28 include_once DOL_DOCUMENT_ROOT.
'/website/class/website.class.php';
29 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
37 if (isset($_SERVER[
"HTTP_USER_AGENT"]) && is_object($conf) && empty($conf->browser->name)) {
39 $conf->browser->name = $tmp[
'browsername'];
40 $conf->browser->os = $tmp[
'browseros'];
41 $conf->browser->version = $tmp[
'browserversion'];
42 $conf->browser->layout = $tmp[
'layout'];
45 if ($conf->browser->layout ==
'phone') {
46 $conf->dol_no_mouse_hover = 1;
50 if (!is_object($website)) {
52 $website->fetch(0, $websitekey);
55 if (empty($pageid) && !empty($websitepagefile)) {
56 $pageid = str_replace(array(
'.tpl.php',
'page'), array(
'',
''), basename($websitepagefile));
57 if ($pageid ==
'index.php') {
58 $pageid = $website->fk_default_home;
61 if (!is_object($websitepage)) {
65 if (!is_object($weblangs)) {
68 if (!is_object($pagelangs)) {
71 if (!empty($pageid) && $pageid > 0) {
72 $websitepage->fetch($pageid);
80 if (empty($srclang)) {
81 $srclang = (empty($_COOKIE[
'weblangs-shortcode']) ?
'' : preg_replace(
'/[^a-zA-Z0-9_\-]/',
'', $_COOKIE[
'weblangs-shortcode']));
83 if (empty($srclang)) {
86 if (defined(
'USEDOLIBARRSERVER') && !empty($_GET[
'pageref']) && preg_match(
'/^\/?(\w\w)\//', $_GET[
'pageref'], $reg) && $reg[1] !=
'js') {
90 if (defined(
'USEEXTERNALSERVER') && !empty($_SERVER[
'PHP_SELF']) && preg_match(
'/^\/?(\w\w)\//', $_SERVER[
'PHP_SELF'], $reg) && $reg[1] !=
'js') {
94 if (empty($srclang)) {
97 $weblangs->setDefaultLang($srclang);
99 $pagelangs->setDefaultLang($websitepage->lang ? $websitepage->lang : $weblangs->shortlang);
101 if (!defined(
'USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array(
'menu',
'other')) || empty($websitepage->status) && !defined(
'USEDOLIBARRSERVER'))) {
102 $weblangs->load(
"website");
107 header(
"X-Content-Type-Options: nosniff");
110 if (empty($websitepage->allowed_in_frames) && !
getDolGlobalString(
'WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES')) {
111 header(
"X-Frame-Options: SAMEORIGIN");
115 http_response_code(404);
116 print
'<center><br><br>'.$weblangs->trans(
"YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).
'</center>';
121 if (!defined(
'USEDOLIBARRSERVER') && !defined(
'USEDOLIBARREDITOR')) {
125 header(
"X-Content-Type-Options: nosniff");
128 if (empty($websitepage->allowed_in_frames) && !
getDolGlobalString(
'WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES')) {
129 header(
"X-Frame-Options: SAMEORIGIN");
136 if (!defined(
'WEBSITE_MAIN_SECURITY_FORCECSPRO')) {
149 if (!is_object($hookmanager)) {
150 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
153 $hookmanager->initHooks(array(
"main"));
155 $parameters = array(
'contentsecuritypolicy'=>$contentsecuritypolicy,
'mode'=>
'reportonly');
156 $result = $hookmanager->executeHooks(
'setContentSecurityPolicy', $parameters);
158 $contentsecuritypolicy = $hookmanager->resPrint;
160 $contentsecuritypolicy .= $hookmanager->resPrint;
163 if (!empty($contentsecuritypolicy)) {
164 header(
"Content-Security-Policy-Report-Only: ".$contentsecuritypolicy);
169 if (!defined(
'WEBSITE_MAIN_SECURITY_FORCECSP')) {
182 if (!is_object($hookmanager)) {
183 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
186 $hookmanager->initHooks(array(
"main"));
188 $parameters = array(
'contentsecuritypolicy'=>$contentsecuritypolicy,
'mode'=>
'active');
189 $result = $hookmanager->executeHooks(
'setContentSecurityPolicy', $parameters);
191 $contentsecuritypolicy = $hookmanager->resPrint;
193 $contentsecuritypolicy .= $hookmanager->resPrint;
196 if (!empty($contentsecuritypolicy)) {
197 header(
"Content-Security-Policy: ".$contentsecuritypolicy);
202 if (!defined(
'WEBSITE_MAIN_SECURITY_FORCERP')) {
206 $referrerpolicy =
getDolGlobalString(
'WEBSITE_MAIN_SECURITY_FORCERP',
"strict-origin-when-cross-origin");
208 header(
"Referrer-Policy: ".$referrerpolicy);
212 if (!defined(
'WEBSITE_MAIN_SECURITY_FORCESTS')) {
218 header(
"Strict-Transport-Security: ".$sts);
223 if (!defined(
'WEBSITE_MAIN_SECURITY_FORCEPP')) {
229 header(
"Permissions-Policy: ".$pp);
236 $weblangs->setDefaultLang(
GETPOST(
'l',
'aZ09'));
239 if ($_SERVER[
'PHP_SELF'] != DOL_URL_ROOT.
'/website/index.php') {
242 $sql =
"SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page";
243 $sql .=
" FROM ".MAIN_DB_PREFIX.
"website_page as wp";
244 $sql .=
" WHERE wp.fk_website = ".((int) $website->id);
245 $sql .=
" AND (wp.fk_page = ".((int) $pageid).
" OR wp.rowid = ".((int) $pageid);
246 if (is_object($websitepage) && $websitepage->fk_page > 0) {
247 $sql .=
" OR wp.fk_page = ".((int) $websitepage->fk_page).
" OR wp.rowid = ".((int) $websitepage->fk_page);
250 $sql .=
" AND wp.lang = '".$db->escape(
GETPOST(
'l',
'aZ09')).
"'";
252 $resql = $db->query(
$sql);
254 $obj = $db->fetch_object($resql);
256 $newpageid = $obj->rowid;
257 if ($newpageid != $pageid) {
258 if (defined(
'USEDOLIBARRSERVER')) {
259 header(
"Location: ".DOL_URL_ROOT.
'/public/website/index.php?website='.$websitekey.
'&pageid='.$newpageid.
'&l='.
GETPOST(
'l',
'aZ09'));
262 $newpageref = $obj->pageurl;
263 header(
"Location: ".(($obj->lang && $obj->lang != $website->lang) ?
'/'.$obj->lang.
'/' :
'/').$newpageref.
'.php?l='.
GETPOST(
'l',
'aZ09'));
273 if (!defined(
'USEDOLIBARREDITOR') && empty($website->status)) {
277 header(
"X-Content-Type-Options: nosniff");
280 if (empty($websitepage->allowed_in_frames) && !
getDolGlobalString(
'WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES')) {
281 header(
"X-Frame-Options: SAMEORIGIN");
284 $weblangs->load(
"website");
287 http_response_code(503);
288 print
'<center><br><br>'.$weblangs->trans(
"SorryWebsiteIsCurrentlyOffLine").
'</center>';
294 $prefix = dol_getprefix(
'');
295 $sessionname =
'DOLSESSID_'.$prefix;
298 $_COOKIE[$sessionname] =
'obfuscatedcookie';
299 unset($conf->file->instance_unique_id);
301 unset($dolibarr_main_instance_unique_id);
302 unset($dolibarr_main_db_host);
303 unset($dolibarr_main_db_port);
304 unset($dolibarr_main_db_name);
305 unset($dolibarr_main_db_user);
306 unset($dolibarr_main_db_pass);
307 unset($$dolibarr_main_db_type);
308 unset($dolibarr_main_document_root);
309 unset($dolibarr_main_document_root_alt);
Class to manage translations.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
getBrowserInfo($user_agent)
Return information about user browser.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.