27 include_once DOL_DOCUMENT_ROOT.
'/website/class/website.class.php';
 
   28 include_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
 
   36 if (isset($_SERVER[
"HTTP_USER_AGENT"]) && is_object($conf) && empty($conf->browser->name)) {
 
   38   $conf->browser->name = $tmp[
'browsername'];
 
   39   $conf->browser->os = $tmp[
'browseros'];
 
   40   $conf->browser->version = $tmp[
'browserversion'];
 
   41   $conf->browser->layout = $tmp[
'layout']; 
 
   44   if ($conf->browser->layout == 
'phone') {
 
   45     $conf->dol_no_mouse_hover = 1;
 
   49 if (!is_object($website)) {
 
   51   $website->fetch(0, $websitekey);
 
   54 if (!$pageid && !empty($websitepagefile)) {
 
   55   $pageid = str_replace(array(
'.tpl.php', 
'page'), array(
'', 
''), basename($websitepagefile));
 
   56   if ($pageid == 
'index.php') {
 
   57     $pageid = $website->fk_default_home;
 
   60 if (!is_object($websitepage)) {
 
   64 if (!is_object($weblangs)) {
 
   67 if (!is_object($pagelangs)) {
 
   71   $websitepage->fetch($pageid);
 
   73   $weblangs->setDefaultLang(
GETPOSTISSET(
'lang') ? 
GETPOST(
'lang', 
'aZ09') : (empty($_COOKIE[
'weblangs-shortcode']) ? 
'auto' : preg_replace(
'/[^a-zA-Z0-9_\-]/', 
'', $_COOKIE[
'weblangs-shortcode'])));
 
   74   $pagelangs->setDefaultLang($websitepage->lang ? $websitepage->lang : $weblangs->shortlang);
 
   76   if (!defined(
'USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array(
'menu', 
'other')) || empty($websitepage->status) && !defined(
'USEDOLIBARRSERVER'))) {
 
   77     $weblangs->load(
"website");
 
   82     header(
"X-Content-Type-Options: nosniff");
 
   85     if (empty($websitepage->allowed_in_frames) && empty($conf->global->WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES)) {
 
   86       header(
"X-Frame-Options: SAMEORIGIN");
 
   90     http_response_code(404);
 
   91     print 
'<center><br><br>'.$weblangs->trans(
"YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).
'</center>';
 
   96 if (!defined(
'USEDOLIBARRSERVER') && !defined(
'USEDOLIBARREDITOR')) {
 
  100   header(
"X-Content-Type-Options: nosniff");
 
  103   if (empty($websitepage->allowed_in_frames) && empty($conf->global->WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES)) {
 
  104     header(
"X-Frame-Options: SAMEORIGIN");
 
  111   if (!defined(
'WEBSITE_MAIN_SECURITY_FORCECSP')) {
 
  118     if (!is_object($hookmanager)) {
 
  121     $hookmanager->initHooks(array(
"main"));
 
  123     $parameters = array(
'contentsecuritypolicy'=>$contentsecuritypolicy);
 
  124     $result = $hookmanager->executeHooks(
'setContentSecurityPolicy', $parameters); 
 
  126       $contentsecuritypolicy = $hookmanager->resPrint; 
 
  128       $contentsecuritypolicy .= $hookmanager->resPrint; 
 
  131     if (!empty($contentsecuritypolicy)) {
 
  138       header(
"Content-Security-Policy: ".$contentsecuritypolicy);
 
  143   if (!defined(
'WEBSITE_MAIN_SECURITY_FORCERP')) {
 
  147     $referrerpolicy = 
getDolGlobalString(
'WEBSITE_MAIN_SECURITY_FORCERP', 
"strict-origin-when-cross-origin");
 
  149     header(
"Referrer-Policy: ".$referrerpolicy);
 
  153   if (!defined(
'WEBSITE_MAIN_SECURITY_FORCESTS')) {
 
  159       header(
"Strict-Transport-Security: ".$sts);
 
  164   if (!defined(
'WEBSITE_MAIN_SECURITY_FORCEPP')) {
 
  170       header(
"Permissions-Policy: ".$pp);
 
  177   $weblangs->setDefaultLang(
GETPOST(
'l', 
'aZ09'));
 
  180 if ($_SERVER[
'PHP_SELF'] != DOL_URL_ROOT.
'/website/index.php') {  
 
  183     $sql = 
"SELECT wp.rowid, wp.lang, wp.pageurl, wp.fk_page";
 
  184     $sql .= 
" FROM ".MAIN_DB_PREFIX.
"website_page as wp";
 
  185     $sql .= 
" WHERE wp.fk_website = ".((int) $website->id);
 
  186     $sql .= 
" AND (wp.fk_page = ".((int) $pageid).
" OR wp.rowid  = ".((int) $pageid);
 
  187     if (is_object($websitepage) && $websitepage->fk_page > 0) {
 
  188       $sql .= 
" OR wp.fk_page = ".((int) $websitepage->fk_page).
" OR wp.rowid = ".((int) $websitepage->fk_page);
 
  191     $sql .= 
" AND wp.lang = '".$db->escape(
GETPOST(
'l', 
'aZ09')).
"'";
 
  193     $resql = $db->query($sql);
 
  195       $obj = $db->fetch_object(
$resql);
 
  197         $newpageid = $obj->rowid;
 
  198         if ($newpageid != $pageid) {    
 
  199           if (defined(
'USEDOLIBARRSERVER')) {
 
  200             header(
"Location: ".DOL_URL_ROOT.
'/public/website/index.php?website='.$websitekey.
'&pageid='.$newpageid.
'&l='.
GETPOST(
'l', 
'aZ09'));
 
  203             $newpageref = $obj->pageurl;
 
  204             header(
"Location: ".(($obj->lang && $obj->lang != $website->lang) ? 
'/'.$obj->lang.
'/' : 
'/').$newpageref.
'.php?l='.
GETPOST(
'l', 
'aZ09'));
 
  214 if (!defined(
'USEDOLIBARREDITOR') && empty($website->status)) {
 
  218   header(
"X-Content-Type-Options: nosniff");
 
  221   if (empty($websitepage->allowed_in_frames) && empty($conf->global->WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES)) {
 
  222     header(
"X-Frame-Options: SAMEORIGIN");
 
  225   $weblangs->load(
"website");
 
  228   http_response_code(503);
 
  229   print 
'<center><br><br>'.$weblangs->trans(
"SorryWebsiteIsCurrentlyOffLine").
'</center>';
 
Class to manage translations.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.