76require 
'../../master.inc.php';
 
   77require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
   81$websitekey = 
GETPOST(
'website', 
'alpha');
 
   83$pageref = 
GETPOST(
'pageref', 
'alphanohtml') ? 
GETPOST(
'pageref', 
'alphanohtml') : 
'';
 
   86if (preg_match(
'/^(\w\w)\/(.*)$/', $pageref, $reg)) {
 
   95  require_once DOL_DOCUMENT_ROOT.
'/website/class/website.class.php';
 
   96  require_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
 
  102    if (empty($pageid)) {
 
  104      header($_SERVER[
"SERVER_PROTOCOL"].
" 404 Not Found", 
true, 404);
 
  106      include DOL_DOCUMENT_ROOT.
'/public/error-404.php';
 
  115    $result = $objectpage->fetch(0, 
$object->id, $pageref);
 
  117      $pageid = $objectpage->id;
 
  118    } elseif ($result == 0) {
 
  121      $result = $objectpage->fetch(0, 
$object->id, 
null, $pageref);
 
  123        $pageid = $objectpage->id;
 
  127    if (
$object->fk_default_home > 0) {
 
  128      $result = $objectpage->fetch(
$object->fk_default_home);
 
  130        $pageid = $objectpage->id;
 
  134    if (empty($pageid)) {
 
  135      $array = $objectpage->fetchAll(
$object->id); 
 
  136      if (is_array($array) && count($array) > 0) {
 
  137        $firstrep = reset($array);
 
  138        $pageid = $firstrep->id;
 
  145  header($_SERVER[
"SERVER_PROTOCOL"].
" 404 Not Found", 
true, 404);
 
  147  $langs->load(
"website");
 
  149  if (!GETPOSTISSET(
'pageref')) {
 
  150    print $langs->trans(
"PreviewOfSiteNotYetAvailable", $websitekey);
 
  153  include DOL_DOCUMENT_ROOT.
'/public/error-404.php';
 
  156if (empty($pageref)) {
 
  158  $result = $objectpage->fetch($pageid);
 
  160    $pageref = $objectpage->ref;
 
  163if (preg_match(
'/^_(library|service)_page_/', $pageref)) {
 
  164  $originalcontentonly = 1;
 
  167$appli = constant(
'DOL_APPLICATION_TITLE');
 
  182global $dolibarr_main_data_root;
 
  184if ($pageid == 
'css') {   
 
  185  header(
'Content-type: text/css');
 
  189  header(
'Cache-Control: no-cache');
 
  190  $original_file = $dolibarr_main_data_root.($conf->entity > 1 ? 
'/'.$conf->entity : 
'').
'/website/'.$websitekey.
'/styles.css.php';
 
  192  $original_file = $dolibarr_main_data_root.($conf->entity > 1 ? 
'/'.$conf->entity : 
'').
'/website/'.$websitekey.
'/page'.$pageid.
'.tpl.php';
 
  196$refname = basename(dirname($original_file).
"/");
 
  200if (!$accessallowed) {
 
  207if (preg_match(
'/\.\./', $original_file) || preg_match(
'/[<>|]/', $original_file)) {
 
  208  dol_syslog(
"Refused to deliver file ".$original_file);
 
  209  $file = basename($original_file); 
 
  216$filename = basename($original_file);
 
  219dol_syslog(
"index.php include $original_file $filename content-type=$type");
 
  223if (!file_exists($original_file_osencoded)) {
 
  225  header($_SERVER[
"SERVER_PROTOCOL"].
" 404 Not Found", 
true, 404);
 
  227  $langs->load(
"website");
 
  228  print $langs->trans(
"RequestedPageHasNoContentYet", $pageid);
 
  230  include DOL_DOCUMENT_ROOT.
'/public/error-404.php';
 
  236define(
'USEDOLIBARRSERVER', 1);
 
  237if (!isset($originalcontentonly)) {
 
  238  print 
'<!-- Page content '.$original_file.
' rendered with DOLIBARR SERVER : Html with CSS link and html header + Body that was saved into tpl dir -->'.
"\n";
 
  240include_once $original_file_osencoded; 
 
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.