35 dol_syslog(
"We regenerate the master.inc.php file");
39 $mastercontent =
'<?php'.
"\n";
40 $mastercontent .=
'// File generated to link to the master file - DO NOT MODIFY - It is just an include'.
"\n";
41 $mastercontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n";
42 $mastercontent .=
" if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1);\n";
43 $mastercontent .=
" require_once '".DOL_DOCUMENT_ROOT.
"/master.inc.php';\n";
44 $mastercontent .=
"}\n";
45 $mastercontent .=
'?>'.
"\n";
46 $result = file_put_contents($filemaster, $mastercontent);
65 dol_syslog(
"dolSavePageAlias We regenerate the alias page filealias=".$filealias.
" and a wrapper into all language subdirectories");
67 $aliascontent =
'<?php'.
"\n";
68 $aliascontent .=
"// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
69 $aliascontent .=
'global $dolibarr_main_data_root;'.
"\n";
70 $aliascontent .=
'if (empty($dolibarr_main_data_root)) $res=include \'./page'.$objectpage->id.
'.tpl.php\'; ';
71 $aliascontent .=
'else $res=include $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.
'.tpl.php\';'.
"\n";
72 $aliascontent .=
'if ($res === false) { http_response_code(500); print \'Failed to make include\'; }'.
"\n";
73 $aliascontent .=
'?>'.
"\n";
74 $result = file_put_contents($filealias, $aliascontent);
75 if ($result ===
false) {
76 dol_syslog(
"Failed to write file ".$filealias, LOG_WARNING);
81 if ($objectpage->lang && in_array($objectpage->lang, explode(
',',
$object->otherlang))) {
82 $dirname = dirname($filealias);
83 $filename = basename($filealias);
84 $filealiassub = $dirname.
'/'.$objectpage->lang.
'/'.$filename;
86 dol_mkdir($dirname.
'/'.$objectpage->lang, DOL_DATA_ROOT);
88 $aliascontent =
'<?php'.
"\n";
89 $aliascontent .=
"// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
90 $aliascontent .=
'global $dolibarr_main_data_root;'.
"\n";
91 $aliascontent .=
'if (empty($dolibarr_main_data_root)) $res=include \'../page'.$objectpage->id.
'.tpl.php\'; ';
92 $aliascontent .=
'else $res=include $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.
'.tpl.php\';'.
"\n";
93 $aliascontent .=
'if ($res === false) { http_response_code(500); print \'Failed to make include\'; }'.
"\n";
94 $aliascontent .=
'?>'.
"\n";
95 $result = file_put_contents($filealiassub, $aliascontent);
96 if ($result ===
false) {
97 dol_syslog(
"Failed to write file ".$filealiassub, LOG_WARNING);
100 } elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(
',',
$object->otherlang))) {
103 $dirname = dirname($filealias);
104 $filename = basename($filealias);
105 foreach (explode(
',',
$object->otherlang) as $sublang) {
107 if (empty(trim($sublang))) {
110 $filealiassub = $dirname.
'/'.$sublang.
'/'.$filename;
112 $aliascontent =
'<?php'.
"\n";
113 $aliascontent .=
"// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
114 $aliascontent .=
'global $dolibarr_main_data_root;'.
"\n";
115 $aliascontent .=
'if (empty($dolibarr_main_data_root)) $res=include \'../page'.$objectpage->id.
'.tpl.php\'; ';
116 $aliascontent .=
'else $res=include $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.
'.tpl.php\';'.
"\n";
117 $aliascontent .=
'if ($res === false) { http_response_code(500); print \'Failed to make include\'; }'.
"\n";
118 $aliascontent .=
'?>'.
"\n";
121 $result = file_put_contents($filealiassub, $aliascontent);
122 if ($result ===
false) {
123 dol_syslog(
"Failed to write file ".$filealiassub, LOG_WARNING);
130 return ($result ?
true :
false);
150 dol_syslog(
"dolSavePageContent We regenerate the tpl page filetpl=".$filetpl);
152 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
166 if ($objectpage->lang) {
167 $shortlangcode = substr($objectpage->lang, 0, 2);
169 if (empty($shortlangcode)) {
171 $shortlangcode = substr(
$object->lang, 0, 2);
174 if (!empty($objectpage->type_container) && in_array($objectpage->type_container, array(
'library',
'service'))) {
175 $originalcontentonly = 1;
179 if (!isset($originalcontentonly)) {
181 $tplcontent .=
"<?php // BEGIN PHP\n";
182 $tplcontent .=
'$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'.
"\n";
183 $tplcontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n";
184 $tplcontent .=
' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'.
"\n";
185 $tplcontent .=
' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'.
"\n";
186 if ($objectpage->disable_waf !=
'all') {
187 if (strpos($objectpage->disable_waf,
'NOSCANAUDIOFORINJECTION') !==
false) {
188 $tplcontent .=
' define(\'NOSCANAUDIOFORINJECTION\', 1);'.
"\n";
190 if (strpos($objectpage->disable_waf,
'NOSCANIFRAMEFORINJECTION') !==
false) {
191 $tplcontent .=
' define(\'NOSCANIFRAMEFORINJECTION\', 1);'.
"\n";
193 if (strpos($objectpage->disable_waf,
'NOSCANOBJECTFORINJECTION') !==
false) {
194 $tplcontent .=
' define(\'NOSCANOBJECTFORINJECTION\', 1);'.
"\n";
196 $tplcontent .=
' require_once DOL_DOCUMENT_ROOT.\'/waf.inc.php\';'.
"\n";
198 $tplcontent .=
"}\n";
199 $tplcontent .=
"require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
200 $tplcontent .=
"require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
201 if (in_array($objectpage->type_container, array(
'page',
'blogpost',
'service'))) {
202 $tplcontent .=
'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).
' - '.$objectpage->pageurl.
'");'.
"\n";
204 $tplcontent .=
"ob_start();\n";
205 $tplcontent .=
"try {\n";
206 $tplcontent .=
"// END PHP ?>\n";
208 $tplcontent .=
"<!DOCTYPE html>\n";
211 $tplcontent .=
'<html'.($objectpage->lang ?
' lang="'.substr($objectpage->lang, 0, 2).
'"' :
'<?php echo $weblangs->shortlang ? \' lang="\'.$weblangs->shortlang.\'"\' : \'\' ?>').
'>'.
"\n";
212 $tplcontent .=
'<head>'.
"\n";
213 $tplcontent .=
'<title>'.dol_string_nohtmltag($objectpage->title, 1,
'UTF-8').
'</title>'.
"\n";
214 $tplcontent .=
'<meta charset="utf-8">'.
"\n";
215 $tplcontent .=
'<meta http-equiv="content-type" content="text/html; charset=utf-8" />'.
"\n";
216 $tplcontent .=
'<meta name="robots" content="'.($objectpage->index ?
'index' :
'noindex').
', '.($objectpage->follow ?
'follow' :
'nofollow').
'" />'.
"\n";
217 $tplcontent .=
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'.
"\n";
218 $tplcontent .=
'<meta name="keywords" content="'.dol_string_nohtmltag($objectpage->keywords, 1,
'UTF-8').
'" />'.
"\n";
219 $tplcontent .=
'<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 1,
'UTF-8').
'" />'.
"\n";
220 $tplcontent .=
'<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 1,
'UTF-8').
'" />'.
"\n";
221 $tplcontent .=
'<meta name="generator" content="'.DOL_APPLICATION_TITLE.
' '.DOL_VERSION.
' (https://www.dolibarr.org)" />'.
"\n";
222 $tplcontent .=
'<meta name="dolibarr:pageid" content="'.((int) $objectpage->id).
'" />'.
"\n";
226 $htmlheader = file_get_contents($htmldeaderindestdir);
227 if (in_array($objectpage->type_container, array(
'page',
'blogpost')) && !preg_match(
'/'.preg_quote(
'rel="icon"',
'/').
'/', $htmlheader)) {
228 $tplcontent .=
'<link rel="icon" type="image/png" href="/favicon.png" />'.
"\n";
231 $listofaltlang =
$object->otherlang;
236 $canonicalurladdidlang =
'';
237 if ($objectpage->lang) {
238 $canonicalurl = (($objectpage->id ==
$object->fk_default_home) ?
'/' : (($shortlangcode != substr(
$object->lang, 0, 2) ?
'/'.$shortlangcode :
'').
'/'.$objectpage->pageurl.
'.php'));
240 $canonicalurl =
'/'.$objectpage->pageurl.
'.php';
242 if (
$object->lang && $listofaltlang) {
244 $canonicalurladdidlang =
'?__SEO_CANONICAL_URL_PARAMS__';
245 $canonicalurladdidlang .=
'&l=__SEO_CANONICAL_LANG__';
248 $canonicalurladdidlang =
'?__SEO_CANONICAL_URL_PARAMS__';
252 $tplcontent .=
'<link rel="canonical" href="<?php echo $website->virtualhost; ?>'.$canonicalurl.$canonicalurladdidlang.
'" />'.
"\n";
255 if ($listofaltlang) {
256 if ($objectpage->lang) {
258 $translationof = $objectpage->fk_page;
259 if ($translationof) {
260 $tmppage =
new WebsitePage($db);
261 $tmppage->fetch($translationof);
262 if ($tmppage->id > 0) {
263 $tmpshortlangcode =
'';
264 if ($tmppage->lang) {
265 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'', $tmppage->lang);
267 if (empty($tmpshortlangcode)) {
268 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'',
$object->lang);
270 if ($tmpshortlangcode != $shortlangcode) {
271 $tplcontent .=
'<link rel="alternate" hreflang="'.$tmpshortlangcode.
'" href="<?php echo $website->virtualhost; ?>'.(
$object->fk_default_home == $tmppage->id ?
'/' : (($tmpshortlangcode != substr(
$object->lang, 0, 2)) ?
'/'.$tmpshortlangcode :
'').
'/'.$tmppage->pageurl.
'.php').
'" />'.
"\n";
277 $sql =
"SELECT rowid as id, lang, pageurl from ".MAIN_DB_PREFIX.
'website_page where fk_page IN ('.$db->sanitize($objectpage->id.($translationof ?
", ".$translationof :
'')).
")";
278 $resql = $db->query($sql);
280 $num_rows = $db->num_rows($resql);
282 while ($obj = $db->fetch_object($resql)) {
283 $tmpshortlangcode =
'';
285 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'', $obj->lang);
287 if ($tmpshortlangcode != $shortlangcode) {
288 $tplcontent .=
'<link rel="alternate" hreflang="'.$tmpshortlangcode.
'" href="<?php echo $website->virtualhost; ?>'.(
$object->fk_default_home == $obj->id ?
'/' : (($tmpshortlangcode != substr(
$object->lang, 0, 2) ?
'/'.$tmpshortlangcode :
'')).
'/'.$obj->pageurl.
'.php').
'" />'.
"\n";
297 $tplcontent .=
'<?php if ($_SERVER["PHP_SELF"] == "'.(($object->fk_default_home == $objectpage->id) ?
'/' : (($shortlangcode != substr(
$object->lang, 0, 2)) ?
'/'.$shortlangcode :
'')).
'/'.$objectpage->pageurl.
'.php") { ?>'.
"\n";
298 $tplcontent .=
'<link rel="alternate" hreflang="'.$shortlangcode.
'" href="<?php echo $website->virtualhost; ?>'.((
$object->fk_default_home == $objectpage->id) ?
'/' : (($shortlangcode != substr(
$object->lang, 0, 2)) ?
'/'.$shortlangcode :
'').
'/'.$objectpage->pageurl.
'.php').
'" />'.
"\n";
300 $tplcontent .=
'<?php } ?>'.
"\n";
302 $canonicalurl =
'/'.$objectpage->pageurl.
'.php';
303 $arrayofaltlang = explode(
',', $listofaltlang);
305 foreach ($arrayofaltlang as $altlang) {
307 $canonicalurladdidlang =
'?__SEO_CANONICAL_URL_PARAMS__';
308 $canonicalurladdidlang .=
'&l='.$altlang;
309 $tplcontent .=
'<link rel="alternate" hreflang="'.$altlang.
'" href="<?php echo $website->virtualhost; ?>'.$canonicalurl.$canonicalurladdidlang.
'" />'.
"\n";
312 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'',
$object->lang);
313 $canonicalurladdidlang =
'?__SEO_CANONICAL_URL_PARAMS__';
314 $canonicalurladdidlang .=
'&l='.$tmpshortlangcode;
315 $tplcontent .=
'<link rel="alternate" hreflang="'.$tmpshortlangcode.
'" href="<?php echo $website->virtualhost; ?>'.$canonicalurl.$canonicalurladdidlang.
'" />'.
"\n";
321 $tplcontent .=
'<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'.
"\n";
324 $tplcontent .=
'<!-- Include HTML header from common file -->'.
"\n";
325 $tplcontent .=
'<?php if (file_exists(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")) include DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html"; ?>'.
"\n";
326 $tplcontent .=
'<!-- Include HTML header from page header block -->'.
"\n";
327 $tplcontent .= preg_replace(
'/<\/?html>/ims',
'', $objectpage->htmlheader).
"\n";
330 $tplcontent .=
'<!-- Include link to common CSS file -->'.
"\n";
331 $tplcontent .=
'<link rel="stylesheet" href="/styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'.
"\n";
334 $tplcontent .=
'<!-- Include link to common JS file -->'.
"\n";
335 $tplcontent .=
'<script nonce="'.getNonce().
'" async src="/javascript.js.php?website=<?php echo $websitekey; ?>"></script>'.
"\n";
336 $tplcontent .=
'</head>'.
"\n";
340 $tplcontent .=
'<!-- File content defined in Dolibarr website module editor -->'.
"\n";
341 $tplcontent .=
'<body id="bodywebsite" class="bodywebsite bodywebpage-'.$objectpage->ref.
'">'.
"\n";
344 if ($objectpage->type_container ==
'setup') {
346 $content .=
'<?php'.
"\n";
347 $content .=
'require_once DOL_DOCUMENT_ROOT.\'/core/class/html.formsetup.class.php\';'.
"\n";
348 $content .=
'$formSetup = new FormSetup($db);'.
"\n";
349 $content .=
'?>'.
"\n";
350 $tplcontent .= $content.
"\n";
353 $tplcontent .= $objectpage->content.
"\n";
356 if ($objectpage->type_container ==
'setup') {
357 $content =
'<div id="websitetemplateconfigpage">'.
"\n";
358 $content .=
'<?php'.
"\n";
359 $content .=
'/*' .
"\n";
360 $content .=
' * Actions' .
"\n";
361 $content .=
' */' .
"\n";
362 $content .=
'$websitetemplateconf = GETPOSTINT(\'websitetemplateconf\');' .
"\n";
363 $content .=
'include DOL_DOCUMENT_ROOT.\'/core/actions_setmoduleoptions.inc.php\';' .
"\n";
364 $content .=
'' .
"\n";
365 $content .=
'/*' .
"\n";
366 $content .=
' * View' .
"\n";
367 $content .=
' */' .
"\n";
368 $content .=
'print load_fiche_titre($langs->trans(\'SetupAndProperties\'), \'\', \'title_setup\');' .
"\n";
369 $content .=
'' .
"\n";
370 $content .=
'if (!empty($message)) {' .
"\n";
371 $content .=
' print $message;' .
"\n";
372 $content .=
'}' .
"\n";
373 $content .=
'' .
"\n";
374 $content .=
'if (!empty($formSetup->items)) {' .
"\n";
375 $content .=
' $html = \'\';' .
"\n";
376 $content .=
'' .
"\n";
377 $content .=
' $html .= \'<form action="config.php" method="POST">\';' .
"\n";
378 $content .=
' // Generate hidden values from $formSetup->formHiddenInputs' .
"\n";
379 $content .=
' if (!empty($formSetup->formHiddenInputs) && is_array($formSetup->formHiddenInputs)) {' .
"\n";
380 $content .=
' foreach ($formSetup->formHiddenInputs as $hiddenKey => $hiddenValue) {' .
"\n";
381 $content .=
' $html .= \'<input type="hidden" name="\' . dol_escape_htmltag($hiddenKey) . \'" value="\' . dol_escape_htmltag($hiddenValue) . \'">\';' .
"\n";
382 $content .=
' }' .
"\n";
383 $content .=
' }' .
"\n";
384 $content .=
'' .
"\n";
385 $content .=
' // Generate output table' .
"\n";
386 $content .=
' $html .= $formSetup->generateTableOutput(true);' .
"\n";
387 $content .=
'' .
"\n";
388 $content .=
' // Submit button' .
"\n";
389 $content .=
' $html .= \'<input type="hidden" name="action" value="preview">\';' .
"\n";
390 $content .=
' $html .= \'<input type="hidden" name="websitetemplateconf" value="1">\';' .
"\n";
391 $content .=
' $html .= \'<br>\';' .
"\n";
392 $content .=
' $html .= \'<div class="form-setup-button-container center">\';' .
"\n";
393 $content .=
' $html .= \'<input class="button button-submit" type="submit" value="\' . $langs->trans("Save") . \'">\';' .
"\n";
394 $content .=
' $html .= \'</div>\';' .
"\n";
395 $content .=
' $html .= \'</form>\';' .
"\n";
396 $content .=
'' .
"\n";
397 $content .=
' print $html;' .
"\n";
398 $content .=
'}' .
"\n";
399 $content .=
'?>' .
"\n";
400 $content .=
'</div>' .
"\n";
401 $tplcontent .= $content.
"\n";
405 $tplcontent .=
'</body>'.
"\n";
406 $tplcontent .=
'</html>'.
"\n";
408 $tplcontent .=
'<?php // BEGIN PHP'.
"\n";
409 $tplcontent .=
'} catch(Exception $e) { print $e->getMessage(); }'.
"\n";
410 $tplcontent .=
'$tmp = ob_get_contents(); ob_end_clean();'.
"\n";
412 $tplcontent .=
"// Now fix the content for SEO or multilanguage\n";
414 if (strpos($objectpage->content,
'$__PAGE__KEYWORDS__') !==
false) {
415 $tplcontent .=
'$tmp = preg_replace("/^<meta name=\"keywords\" content=\".*?\" \/>/ms", "<meta name=\"keywords\" content=\"" . dolPrintHTMLForAttribute($__PAGE__KEYWORDS__ ?? "", 1) . "\" />", $tmp);'.
"\n";
417 if (strpos($objectpage->content,
'$__PAGE__TITLE__') !==
false) {
418 $tplcontent .=
'$tmp = preg_replace("/^<title>.*?<\/title>/ms", "<title>" . dolPrintHTMLForAttribute($__PAGE__TITLE__ ?? "", 1) . "</title>", $tmp);'.
"\n";
419 $tplcontent .=
'$tmp = preg_replace("/^<meta name=\"title\" content=\".*?\" \/>/ms", "<meta name=\"title\" content=\"" . dolPrintHTMLForAttribute($__PAGE__TITLE__ ?? "", 1) . "\" />", $tmp);'.
"\n";
421 if (strpos($objectpage->content,
'$__PAGE__DESC__') !==
false) {
422 $tplcontent .=
'$tmp = preg_replace("/^<meta name=\"description\" content=\".*?\" \/>/ms", "<meta name=\"description\" content=\"" . dolPrintHTMLForAttribute($__PAGE__DESC__ ?? "", 1) . "\" />", $tmp);'.
"\n";
425 if (strpos($objectpage->content,
'define("__SEO_PAGE_LANG__"') !==
false) {
426 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'',
$object->lang);
427 $tplcontent .=
'$tmp = preg_replace("/^<html lang=\"[a-z]+\"/ms", "<html lang=\"" . dolPrintHTMLForAttribute(defined("__SEO_PAGE_LANG__") ? preg_replace(\'/\[_-\].*$/\', "", constant("__SEO_PAGE_LANG__")) : (empty($weblangs->shortlang) ? "'.$tmpshortlangcode.
'" : $weblangs->shortlang), 1) . "\"", $tmp);'.
"\n";
429 if (strpos($objectpage->content,
'define("__SEO_PAGE_KEYWORDS__"') !==
false) {
430 $tplcontent .=
'$tmp = preg_replace("/^<meta name=\"keywords\" content=\".*?\" \/>/ms", "<meta name=\"keywords\" content=\"" . dolPrintHTMLForAttribute(constant("__SEO_PAGE_KEYWORDS__"), 1) . "\" />", $tmp);'.
"\n";
432 if (strpos($objectpage->content,
'define("__SEO_PAGE_TITLE__"') !==
false) {
433 $tplcontent .=
'$tmp = preg_replace("/^<title>.*?<\/title>/ms", "<title>" . dolPrintHTMLForAttribute(constant("__SEO_PAGE_TITLE__"), 1) . "</title>", $tmp);'.
"\n";
434 $tplcontent .=
'$tmp = preg_replace("/^<meta name=\"title\" content=\".*?\" \/>/ms", "<meta name=\"title\" content=\"" . dolPrintHTMLForAttribute(constant("__SEO_PAGE_TITLE__"), 1) . "\" />", $tmp);'.
"\n";
436 if (strpos($objectpage->content,
'define("__SEO_PAGE_DESC__"') !==
false) {
437 $tplcontent .=
'$tmp = preg_replace("/^<meta name=\"description\" content=\".*?\" \/>/ms", "<meta name=\"description\" content=\"" . dolPrintHTMLForAttribute(constant("__SEO_PAGE_DESC__"), 1) . "\" />", $tmp);'.
"\n";
439 if (empty($objectpage->lang)) {
440 $tplcontent .=
'defined("__SEO_CANONICAL_URL_PARAMS__") ? ($tmp = preg_replace("/__SEO_CANONICAL_URL_PARAMS__/", dolPrintHTMLForAttributeUrl(constant("__SEO_CANONICAL_URL_PARAMS__")), $tmp)) : ($tmp = preg_replace("/\?__SEO_CANONICAL_URL_PARAMS__\"/", "\"", preg_replace("/\?__SEO_CANONICAL_URL_PARAMS__&/", "?", $tmp)));'.
"\n";
442 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'',
$object->lang);
443 $tplcontent .=
'$tmp = preg_replace("/__SEO_CANONICAL_LANG__/", (defined("__SEO_PAGE_LANG__") ? preg_replace(\'/\[_-\].*$/\', "", constant("__SEO_PAGE_LANG__")) : (empty($weblangs->shortlang) ? "'.$tmpshortlangcode.
'" : $weblangs->shortlang)), $tmp);'.
"\n";
446 $tplcontent .=
"// Now output the generated page content\n";
447 $tplcontent .=
'dolWebsiteOutput($tmp, "html", '.((int) $objectpage->id).
'); dolWebsiteIncrementCounter('.((int)
$object->id).
', "'.$objectpage->type_container.
'", '.((int) $objectpage->id).
');'.
"\n";
448 $tplcontent .=
"// END PHP ?>\n";
450 $tplcontent .=
"<?php // BEGIN PHP\n";
451 $tplcontent .=
'$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'.
"\n";
452 $tplcontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n";
453 $tplcontent .=
' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'.
"\n";
454 $tplcontent .=
' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'.
"\n";
455 if ($objectpage->disable_waf !=
'all') {
456 if (strpos($objectpage->disable_waf,
'NOSCANAUDIOFORINJECTION') !==
false) {
457 $tplcontent .=
' define(\'NOSCANAUDIOFORINJECTION\', 1);'.
"\n";
459 if (strpos($objectpage->disable_waf,
'NOSCANIFRAMEFORINJECTION') !==
false) {
460 $tplcontent .=
' define(\'NOSCANIFRAMEFORINJECTION\', 1);'.
"\n";
462 if (strpos($objectpage->disable_waf,
'NOSCANOBJECTFORINJECTION') !==
false) {
463 $tplcontent .=
' define(\'NOSCANOBJECTFORINJECTION\', 1);'.
"\n";
465 $tplcontent .=
' require_once DOL_DOCUMENT_ROOT.\'/waf.inc.php\';'.
"\n";
467 $tplcontent .=
"}\n";
468 $tplcontent .=
"require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
469 $tplcontent .=
"require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
470 if (in_array($objectpage->type_container, array(
'page',
'blogpost',
'service'))) {
471 $tplcontent .=
'dol_syslog("--- Prepare content of page '.((int) $objectpage->id).
' - '.$objectpage->pageurl.
'");'.
"\n";
473 $tplcontent .=
"// END PHP ?>\n";
475 $tplcontent .= $objectpage->content;
479 $result = file_put_contents($filetpl, $tplcontent);
508 $indexcontent =
'<?php'.
"\n";
509 $indexcontent .=
"// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
510 $indexcontent .=
'$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'.
"\n";
511 $indexcontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
512 $indexcontent .=
'if (!empty($_GET[\'pageref\']) || !empty($_GET[\'pagealiasalt\']) || !empty($_GET[\'pageid\'])) {'.
"\n";
513 $indexcontent .=
" require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
514 $indexcontent .=
" require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
515 $indexcontent .=
' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'.
"\n";
516 $indexcontent .=
"}\n";
517 $indexcontent .=
"include_once './".basename($filetpl).
"'\n";
518 $indexcontent .=
'// END PHP ?>'.
"\n";
520 $result1 = file_put_contents($fileindex, $indexcontent);
525 $objectpage =
new WebsitePage($db);
526 $objectpage->fetch(
$object->fk_default_home);
529 if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(
',',
$object->otherlang))) {
531 $dirname = dirname($fileindex);
532 foreach (explode(
',',
$object->otherlang) as $sublang) {
534 if (empty(trim($sublang))) {
537 $fileindexsub = $dirname.
'/'.$sublang.
'/index.php';
541 $indexcontent =
'<?php'.
"\n";
542 $indexcontent .=
"// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
543 $indexcontent .=
'$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'.
"\n";
544 $indexcontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once '".$relpath.
"/master.inc.php'; } // Load master if not already loaded\n";
545 $indexcontent .=
'if (!empty($_GET[\'pageref\']) || !empty($_GET[\'pagealiasalt\']) || !empty($_GET[\'pageid\'])) {'.
"\n";
546 $indexcontent .=
" require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
547 $indexcontent .=
" require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
548 $indexcontent .=
' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'.
"\n";
549 $indexcontent .=
"}\n";
550 $indexcontent .=
"include_once '".$relpath.
"/".basename($filetpl).
"'\n";
551 $indexcontent .=
'// END PHP ?>'.
"\n";
552 $result = file_put_contents($fileindexsub, $indexcontent);
553 if ($result ===
false) {
554 dol_syslog(
"Failed to write file ".$fileindexsub, LOG_WARNING);
567 $wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.
'/website/samples/wrapper.php');
569 $result2 = file_put_contents($filewrapper, $wrappercontent);
575 return ($result1 && $result2);
588 global $pathofwebsite;
590 dol_syslog(
"Save html header into ".$filehtmlheader);
593 $result = file_put_contents($filehtmlheader, $htmlheadercontent);
608 global $pathofwebsite;
613 $result = file_put_contents($filecss, $csscontent);
628 global $pathofwebsite;
633 $result = file_put_contents($filejs, $jscontent);
648 global $pathofwebsite;
650 dol_syslog(
"Save robot file into ".$filerobot);
653 $result = file_put_contents($filerobot, $robotcontent);
668 global $pathofwebsite;
670 dol_syslog(
"Save htaccess file into ".$filehtaccess);
673 $result = file_put_contents($filehtaccess, $htaccess);
688 global $pathofwebsite;
690 dol_syslog(
"Save manifest.js.php file into ".$file);
693 $result = file_put_contents($file, $content);
708 global $pathofwebsite;
710 dol_syslog(
"Save README.md file into ".$file);
713 $result = file_put_contents($file, $content);
728 global $pathofwebsite;
733 $result = file_put_contents($file, $content);
748 global $conf, $langs, $form, $user;
752 $dirthemes = array(
'/doctemplates/websites');
755 $arrayoftemplatesfound = array();
757 if (count($dirthemes)) {
760 foreach ($dirthemes as $dir) {
761 $dirtheme = DOL_DATA_ROOT.$dir;
763 if (is_dir($dirtheme)) {
764 $handle = opendir($dirtheme);
765 if (is_resource($handle)) {
766 while (($subdir = readdir($handle)) !==
false) {
768 if (
dol_is_file($dirtheme.
"/".$subdir) && substr($subdir, 0, 1) !=
'.' && substr($subdir, 0, 3) !=
'CVS' && preg_match(
'/\.zip$/i', $subdir)) {
769 $subdirwithoutzip = preg_replace(
'/\.zip$/i',
'', $subdir);
770 $subdirwithoutzipwithoutver = preg_replace(
'/(_exp|_dev)$/i',
'', $subdirwithoutzip);
773 if (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2 && preg_match(
'/_dev$/i', $subdirwithoutzip)) {
776 if (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1 && preg_match(
'/_exp$/i', $subdirwithoutzip)) {
780 $arrayoftemplatesfound[$subdirwithoutzip] = array(
'id' => $subdirwithoutzip);
789 $arrayofsourcetemplates =
dol_dir_list(DOL_DOCUMENT_ROOT.
'/install/doctemplates/websites',
'directories', 0,
'website_.*$');
790 $arrayofsourcetemplatesnotdeployed = array();
791 foreach ($arrayofsourcetemplates as $val) {
793 if (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2 && preg_match(
'/_dev$/i', $val[
'relativename'])) {
796 if (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1 && preg_match(
'/_exp$/i', $val[
'relativename'])) {
800 if (empty($arrayoftemplatesfound[$val[
'relativename']])) {
803 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/websites/'.$val[
'name'];
804 $dest = DOL_DATA_ROOT.
'/doctemplates/websites/'.$val[
'name'];
811 $result = dol_compress_dir($src, $dest.
'.zip',
'zip');
813 dol_syslog(
"Error in compress of dir ".$src, LOG_ERR);
816 $srcfile = DOL_DOCUMENT_ROOT.
'/install/doctemplates/websites/'.preg_replace(
'/(_exp|_dev)$/',
'', $val[
'name']).
'.jpg';
817 $destfile = DOL_DATA_ROOT.
'/doctemplates/websites/'.preg_replace(
'/(_exp|_dev)$/',
'', $val[
'name']).
'.jpg';
821 $arrayofsourcetemplatesnotdeployed[$val[
'relativename']] = $val;
826 if (count($arrayofsourcetemplatesnotdeployed)) {
827 $warningtoshow =
img_picto($langs->trans(
"WarningTemplatesFoundNotDeployedClickRefresh").
': '.implode(
', ', array_keys($arrayofsourcetemplatesnotdeployed)).
'. '.$langs->trans(
"WarningTemplatesFoundNotDeployedClickRefresh2"),
'warning',
'class="valignmiddle paddingright"');
833 print
'<!-- For website template import -->'.
"\n";
834 print
'<table class="noborder centpercent">';
837 print
'<tr class="liste_titre"><th class="titlefield">';
838 print $form->textwithpicto($langs->trans(
"Templates"), $langs->trans(
"ThemeDir").
' : '.implode(
", ", $dirthemes));
840 print
'<a class="valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?website='.urlencode($website->ref).
'&importsite=2" rel="noopener noreferrer external">';
841 print $warningtoshow;
842 print
img_picto($langs->trans(
"Refresh"),
'refresh',
'class="valignmiddle"');
845 print
'<th class="right">';
846 $url =
'https://www.dolistore.com/index.php?cat=84';
847 print
'<a href="'.$url.
'" target="_blank" rel="noopener noreferrer external">';
848 print
img_picto(
'',
'globe',
'class="pictofixedwidth"').$langs->trans(
'DownloadMoreSkins');
852 print
'<tr><td colspan="'.$colspan.
'">';
854 print
'<table class="nobordernopadding centpercent"><tr><td><div class="display-flex">';
856 if (count($dirthemes)) {
858 foreach ($dirthemes as $dir) {
859 $dirtheme = DOL_DATA_ROOT.$dir;
861 if (is_dir($dirtheme)) {
862 $handle = opendir($dirtheme);
863 if (is_resource($handle)) {
864 while (($subdir = readdir($handle)) !==
false) {
866 if (
dol_is_file($dirtheme.
"/".$subdir) && substr($subdir, 0, 1) !=
'.' && substr($subdir, 0, 3) !=
'CVS' && preg_match(
'/\.zip$/i', $subdir)) {
867 $subdirwithoutzip = preg_replace(
'/\.zip$/i',
'', $subdir);
868 $subdirwithoutzipwithoutver = preg_replace(
'/(_exp|_dev)$/i',
'', $subdirwithoutzip);
871 if (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2 && preg_match(
'/_dev$/i', $subdirwithoutzip)) {
874 if (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1 && preg_match(
'/_exp$/i', $subdirwithoutzip)) {
878 $arrayoftemplatesfound[$subdirwithoutzip] = array(
'id' => $subdirwithoutzip);
880 print
'<div class="inline-block center flex-item" style="min-width: 250px; max-width: 400px; margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
882 $templatedir = $dirtheme.
"/".$subdir;
883 $file = $dirtheme.
"/".$subdirwithoutzipwithoutver.
".jpg";
884 $url = DOL_URL_ROOT.
'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzipwithoutver.
".jpg";
886 if (!file_exists($file)) {
887 $url = DOL_URL_ROOT.
'/public/theme/common/nophoto.png';
890 $originalimgfile = basename($file);
891 $entity = $conf->entity;
892 $modulepart =
'doctemplateswebsite';
898 if (!empty($urladvanced)) {
899 $ret .=
'<a class="'.$urladvanced[
'css'].
'" target="'.$urladvanced[
'target'].
'" mime="'.$urladvanced[
'mime'].
'" href="'.$urladvanced[
'url'].
'">';
901 $ret .=
'<a href="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.urlencode($modulepart).
'&entity='.((int) $entity).
'&file='.urlencode($originalimgfile).
'&cache='.((int) $cache).
'">';
904 print
'<img class="img-skinthumb shadow" src="'.$url.
'" border="0" alt="'.$title.
'" title="'.$title.
'" style="margin-bottom: 5px;">';
911 if ($user->hasRight(
'website',
'delete')) {
912 print
' <a href="'.$_SERVER[
"PHP_SELF"].
'?action=deletetemplate&token='.
newToken().
'&website='.urlencode($website->ref).
'&templateuserfile='.urlencode($subdir).
'">'.
img_picto(
'',
'delete').
'</a>';
914 print
'<br><a href="'.$_SERVER[
"PHP_SELF"].
'?action=importsiteconfirm&token='.
newToken().
'&website='.urlencode($website->ref).
'&templateuserfile='.urlencode($subdir).
'" class="button">'.$langs->trans(
"Load").
'</a>';
920 print
'<div class="inline-block center flex-item" style="min-width: 250px; max-width: 400px;margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;"></div>';
921 print
'<div class="inline-block center flex-item" style="min-width: 250px; max-width: 400px;margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;"></div>';
922 print
'<div class="inline-block center flex-item" style="min-width: 250px; max-width: 400px;margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;"></div>';
923 print
'<div class="inline-block center flex-item" style="min-width: 250px; max-width: 400px;margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;"></div>';
924 print
'<div class="inline-block center flex-item" style="min-width: 250px; max-width: 400px;margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;"></div>';
929 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
932 print
'</div></td></tr></table>';
951 global $langs, $user;
955 if (empty($phpfullcodestringold) && empty($phpfullcodestring)) {
960 if ($phpfullcodestringold != $phpfullcodestring) {
961 global $dolibarr_website_allow_custom_php;
962 if (empty($dolibarr_website_allow_custom_php)) {
964 setEventMessages($langs->trans(
"NotAllowedToAddDynamicContentDisabledGlobaly",
'dolibarr_website_allow_custom_php'),
null,
'errors');
966 if (!$error && !$user->hasRight(
'website',
'writephp')) {
968 setEventMessages($langs->trans(
"NotAllowedToAddDynamicContent"),
null,
'errors');
972 $phpfullcodestringnew = $phpfullcodestring;
977 $phpfullcodestring = preg_replace(
'/\$_COOKIE\[/',
'__DOLLARCOOKIE__', $phpfullcodestring);
978 $phpfullcodestring = preg_replace(
'/\$_FILES\[/',
'__DOLLARFILES__', $phpfullcodestring);
979 $phpfullcodestring = preg_replace(
'/\$_SESSION\[/',
'__DOLLARSESSION__', $phpfullcodestring);
980 $forbiddenphpstrings = array(
'$$',
'$_',
'}[');
982 $forbiddenphpstrings = array(
'$$',
'}[');
985 $forbiddenphpstrings = array_merge($forbiddenphpstrings, array(
'_ENV',
'ReflectionFunction'));
987 $forbiddenphpfunctions = array();
989 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"override_function",
"session_id",
"session_create_id",
"session_regenerate_id"));
990 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"get_defined_functions",
"get_defined_vars",
"get_defined_constants",
"get_declared_classes"));
991 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"call_user_func",
"call_user_func_array"));
994 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"exec",
"passthru",
"shell_exec",
"system",
"proc_open",
"popen"));
995 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"dol_eval",
"executeCLI",
"verifCond"));
996 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"eval",
"create_function",
"assert",
"mb_ereg_replace"));
999 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"dol_compress_dir",
"dol_delete_file",
"dol_delete_dir",
"dol_delete_dir_recursive",
"dol_copy",
"archiveOrBackupFile"));
1000 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"fopen",
"file_put_contents",
"flock",
"fputs",
"fputscsv",
"fwrite",
"fpassthru",
"mkdir",
"rmdir",
"symlink",
"touch",
"unlink",
"umask"));
1003 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"dol_decode"));
1004 $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array(
"file",
"fopen",
"file_get_contents",
"fgets",
"fgetscsv",
"fgetss",
"fread"));
1009 $forbiddenphpmethods = array(
'invoke',
'invokeArgs');
1011 foreach ($forbiddenphpstrings as $forbiddenphpstring) {
1012 if (preg_match(
'/'.preg_quote($forbiddenphpstring,
'/').
'/ims', $phpfullcodestring)) {
1014 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpstring),
null,
'errors');
1026 foreach ($forbiddenphpfunctions as $forbiddenphpfunction) {
1027 if (preg_match(
'/\b'.$forbiddenphpfunction.
'\b/ims', $phpfullcodestring)) {
1029 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpfunction),
null,
'errors');
1034 foreach ($forbiddenphpmethods as $forbiddenphpmethod) {
1035 if (preg_match(
'/->'.$forbiddenphpmethod.
'/ims', $phpfullcodestring)) {
1037 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpmethod),
null,
'errors');
1045 $forbiddenphpchars = array();
1047 $forbiddenphpchars = array(
"`");
1049 foreach ($forbiddenphpchars as $forbiddenphpchar) {
1050 if (preg_match(
'/'.$forbiddenphpchar.
'/ims', $phpfullcodestring)) {
1052 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpchar),
null,
'errors');
1060 if (preg_match(
'/\*\/\s*\(/ims', $phpfullcodestring)) {
1062 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction",
"exec/*...*/ ('ls')"),
null,
'errors');
1068 if (preg_match(
'/[}\]]\s*\(/ims', $phpfullcodestring)) {
1070 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction",
']('),
null,
'errors');
1076 if (preg_match(
'/\$[a-z0-9_\-\/\*\"]+\s*\(/ims', $phpfullcodestring)) {
1078 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction",
'$...('),
null,
'errors');
1085 if ($phpfullcodestringold != $phpfullcodestringnew) {
1087 $dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
1088 $allowimportsite =
true;
1089 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1090 if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
1091 $allowimportsite =
false;
1094 if (!$allowimportsite) {
1099 $message = $langs->trans(
'InstallModuleFromWebHasBeenDisabledContactUs');
1102 $message = $langs->trans(
"InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.
'/installmodules.lock');
if(! $sortfield) if(! $sortorder) $object
dol_filemtime($pathoffile)
Return time of a file.
dol_filesize($pathoffile)
Return size of a file.
dol_copy($srcfile, $destfile, $newmask='0', $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
archiveOrBackupFile($srcfile, $max_versions=5, $archivedir='', $suffix="v", $moveorcopy='move')
Manage backup versions for a given file, ensuring only a maximum number of versions are kept.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_is_file($pathoffile)
Return if path is a file.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_sanitizePathName($str, $newstr='_', $unaccent=0, $allowdash=0)
Clean a string to use it as a path name.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param='')
Return URL we can use for advanced preview links.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dolSaveMasterFile($filemaster)
Save content of a page on disk.
dolSaveLicense($file, $content)
Save content of a page on disk.
checkPHPCode(&$phpfullcodestringold, &$phpfullcodestring)
Check that the new string $phpfullcodestring contains only php code (including <php tag)
dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent)
Save content of a page on disk.
dolSaveReadme($file, $content)
Save content of a page on disk.
dolSaveManifestJson($file, $content)
Save content of a page on disk.
dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper, $object=null)
Save content of the index.php and/or the wrapper.php page.
dolSavePageAlias($filealias, $object, $objectpage)
Save an alias page on disk (A page that include the reference page).
dolSaveHtaccessFile($filehtaccess, $htaccess)
Save content of a page on disk.
dolSaveJsFile($filejs, $jscontent)
Save content of a page on disk.
dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, $backupold=0)
Save content of a page on disk (page name is generally ID_of_page.php).
showWebsiteTemplates(Website $website, int $refresh)
Show list of themes.
dolSaveCssFile($filecss, $csscontent)
Save content of a page on disk.
dolSaveRobotFile($filerobot, $robotcontent)
Save content of a page on disk.