75require
'../../master.inc.php';
76require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
80$websitekey =
GETPOST(
'website',
'alpha');
82$pageref =
GETPOST(
'pageref',
'alphanohtml') ?
GETPOST(
'pageref',
'alphanohtml') :
'';
89 require_once DOL_DOCUMENT_ROOT.
'/website/class/website.class.php';
90 require_once DOL_DOCUMENT_ROOT.
'/website/class/websitepage.class.php';
93 $object->fetch(0, $websitekey);
95 if (empty($object->id)) {
98 header($_SERVER[
"SERVER_PROTOCOL"].
" 404 Not Found",
true, 404);
100 include DOL_DOCUMENT_ROOT.
'/public/error-404.php';
108 $result = $objectpage->fetch(0, $object->id, $pageref);
110 $pageid = $objectpage->id;
111 } elseif ($result == 0) {
113 $result = $objectpage->fetch(0, $object->id,
null, $pageref);
115 $pageid = $objectpage->id;
119 if ($object->fk_default_home > 0) {
120 $result = $objectpage->fetch($object->fk_default_home);
122 $pageid = $objectpage->id;
126 if (empty($pageid)) {
127 $array = $objectpage->fetchAll($object->id);
128 if (is_array($array) && count($array) > 0) {
129 $firstrep = reset($array);
130 $pageid = $firstrep->id;
137 header($_SERVER[
"SERVER_PROTOCOL"].
" 404 Not Found",
true, 404);
139 $langs->load(
"website");
141 if (!GETPOSTISSET(
'pageref')) {
142 print $langs->trans(
"PreviewOfSiteNotYetAvailable", $websitekey);
145 include DOL_DOCUMENT_ROOT.
'/public/error-404.php';
149$appli = constant(
'DOL_APPLICATION_TITLE');
150if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
151 $appli = $conf->global->MAIN_APPLICATION_TITLE;
164global $dolibarr_main_data_root;
166if ($pageid ==
'css') {
167 header(
'Content-type: text/css');
171 header(
'Cache-Control: no-cache');
172 $original_file = $dolibarr_main_data_root.($conf->entity > 1 ?
'/'.$conf->entity :
'').
'/website/'.$websitekey.
'/styles.css.php';
174 $original_file = $dolibarr_main_data_root.($conf->entity > 1 ?
'/'.$conf->entity :
'').
'/website/'.$websitekey.
'/page'.$pageid.
'.tpl.php';
178$refname = basename(dirname($original_file).
"/");
182if (!$accessallowed) {
189if (preg_match(
'/\.\./', $original_file) || preg_match(
'/[<>|]/', $original_file)) {
190 dol_syslog(
"Refused to deliver file ".$original_file);
191 $file = basename($original_file);
198$filename = basename($original_file);
201dol_syslog(
"index.php include $original_file $filename content-type=$type");
205if (!file_exists($original_file_osencoded)) {
207 header($_SERVER[
"SERVER_PROTOCOL"].
" 404 Not Found",
true, 404);
209 $langs->load(
"website");
210 print $langs->trans(
"RequestedPageHasNoContentYet", $pageid);
212 include DOL_DOCUMENT_ROOT.
'/public/error-404.php';
218define(
'USEDOLIBARRSERVER', 1);
219print
'<!-- Page content '.$original_file.
' rendered with DOLIBARR SERVER : Html with CSS link and html header + Body that was saved into tpl dir -->'.
"\n";
220include_once $original_file_osencoded;
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.