33 if (!defined(
'NOTOKENRENEWAL')) {
34 define(
'NOTOKENRENEWAL', 1);
36 if (!defined(
'NOLOGIN')) {
39 if (!defined(
'NOCSRFCHECK')) {
40 define(
"NOCSRFCHECK", 1);
42 if (!defined(
'NOREQUIREMENU')) {
43 define(
'NOREQUIREMENU',
'1');
45 if (!defined(
'NOREQUIREHTML')) {
46 define(
'NOREQUIREHTML',
'1');
48 if (!defined(
'NOREQUIREAJAX')) {
49 define(
'NOREQUIREAJAX',
'1');
51 if (!defined(
'NOIPCHECK')) {
52 define(
'NOIPCHECK',
'1');
54 if (!defined(
'NOBROWSERNOTIF')) {
55 define(
'NOBROWSERNOTIF',
'1');
75 require
'../../master.inc.php';
76 require_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;
135 if (empty($pageid)) {
137 header($_SERVER[
"SERVER_PROTOCOL"].
" 404 Not Found",
true, 404);
139 $langs->load(
"website");
142 print $langs->trans(
"PreviewOfSiteNotYetAvailable", $websitekey);
145 include DOL_DOCUMENT_ROOT.
'/public/error-404.php';
149 $appli = constant(
'DOL_APPLICATION_TITLE');
150 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
151 $appli = $conf->global->MAIN_APPLICATION_TITLE;
164 global $dolibarr_main_data_root;
166 if ($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).
"/");
182 if (!$accessallowed) {
189 if (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);
201 dol_syslog(
"index.php include $original_file $filename content-type=$type");
202 $original_file_osencoded =
dol_osencode($original_file);
205 if (!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';
218 define(
'USEDOLIBARRSERVER', 1);
219 print
'<!-- Page content '.$original_file.
' rendered with DOLIBARR SERVER : Html with CSS link and html header + Body that was saved into tpl dir -->'.
"\n";
220 include_once $original_file_osencoded;
222 if (is_object($db)) {
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.