40 $mastercontent =
'<?php'.
"\n";
41 $mastercontent .=
'// File generated to link to the master file - DO NOT MODIFY - It is just an include'.
"\n";
42 $mastercontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n";
43 $mastercontent .=
" if (! defined('USEEXTERNALSERVER')) define('USEEXTERNALSERVER', 1);\n";
44 $mastercontent .=
" require_once '".DOL_DOCUMENT_ROOT.
"/master.inc.php';\n";
45 $mastercontent .=
"}\n";
46 $mastercontent .=
'?>'.
"\n";
47 $result = file_put_contents($filemaster, $mastercontent);
48 if (!empty($conf->global->MAIN_UMASK)) {
49 @chmod($filemaster, octdec($conf->global->MAIN_UMASK));
70 dol_syslog(
"dolSavePageAlias We regenerate the alias page filealias=".$filealias);
72 $aliascontent =
'<?php'.
"\n";
73 $aliascontent .=
"// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
74 $aliascontent .=
'global $dolibarr_main_data_root;'.
"\n";
75 $aliascontent .=
'if (empty($dolibarr_main_data_root)) require \'./page'.$objectpage->id.
'.tpl.php\'; ';
76 $aliascontent .=
'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.
'.tpl.php\';'.
"\n";
77 $aliascontent .=
'?>'.
"\n";
78 $result = file_put_contents($filealias, $aliascontent);
79 if ($result ===
false) {
80 dol_syslog(
"Failed to write file ".$filealias, LOG_WARNING);
82 if (!empty($conf->global->MAIN_UMASK)) {
83 @chmod($filealias, octdec($conf->global->MAIN_UMASK));
87 if ($objectpage->lang && in_array($objectpage->lang, explode(
',', $object->otherlang))) {
88 $dirname = dirname($filealias);
89 $filename = basename($filealias);
90 $filealiassub = $dirname.
'/'.$objectpage->lang.
'/'.$filename;
92 $aliascontent =
'<?php'.
"\n";
93 $aliascontent .=
"// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
94 $aliascontent .=
'global $dolibarr_main_data_root;'.
"\n";
95 $aliascontent .=
'if (empty($dolibarr_main_data_root)) require \'../page'.$objectpage->id.
'.tpl.php\'; ';
96 $aliascontent .=
'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.
'.tpl.php\';'.
"\n";
97 $aliascontent .=
'?>'.
"\n";
98 $result = file_put_contents($filealiassub, $aliascontent);
99 if ($result ===
false) {
100 dol_syslog(
"Failed to write file ".$filealiassub, LOG_WARNING);
102 if (!empty($conf->global->MAIN_UMASK)) {
103 @chmod($filealiassub, octdec($conf->global->MAIN_UMASK));
105 } elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(
',', $object->otherlang))) {
107 if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR) && !empty($object->otherlang)) {
108 $dirname = dirname($filealias);
109 $filename = basename($filealias);
110 foreach (explode(
',', $object->otherlang) as $sublang) {
112 if (empty(trim($sublang)))
continue;
113 $filealiassub = $dirname.
'/'.$sublang.
'/'.$filename;
115 $aliascontent =
'<?php'.
"\n";
116 $aliascontent .=
"// File generated to wrap the alias page - DO NOT MODIFY - It is just a wrapper to real page\n";
117 $aliascontent .=
'global $dolibarr_main_data_root;'.
"\n";
118 $aliascontent .=
'if (empty($dolibarr_main_data_root)) require \'../page'.$objectpage->id.
'.tpl.php\'; ';
119 $aliascontent .=
'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.
'.tpl.php\';'.
"\n";
120 $aliascontent .=
'?>'.
"\n";
121 $result = file_put_contents($filealiassub, $aliascontent);
122 if ($result ===
false) {
123 dol_syslog(
"Failed to write file ".$filealiassub, LOG_WARNING);
125 if (!empty($conf->global->MAIN_UMASK)) {
126 @chmod($filealiassub, octdec($conf->global->MAIN_UMASK));
132 return ($result ?
true:
false);
152 dol_syslog(
"dolSavePageContent We regenerate the tpl page filetpl=".$filetpl);
154 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
159 $result =
dol_move($filetpl, $filetpl.
'.old', 0, 1, 0, 0);
169 if ($objectpage->lang) {
170 $shortlangcode = substr($objectpage->lang, 0, 2);
172 if (empty($shortlangcode)) {
173 $shortlangcode = substr($object->lang, 0, 2);
177 $tplcontent .=
"<?php // BEGIN PHP\n";
178 $tplcontent .=
'$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'.
"\n";
179 $tplcontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n";
180 $tplcontent .=
' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'.
"\n";
181 $tplcontent .=
' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'.
"\n";
182 $tplcontent .=
"} // Not already loaded\n";
183 $tplcontent .=
"require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
184 $tplcontent .=
"require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
185 $tplcontent .=
"ob_start();\n";
186 $tplcontent .=
"// END PHP ?>\n";
187 if (!empty($conf->global->WEBSITE_FORCE_DOCTYPE_HTML5)) {
188 $tplcontent .=
"<!DOCTYPE html>\n";
190 $tplcontent .=
'<html'.($shortlangcode ?
' lang="'.$shortlangcode.
'"' :
'').
'>'.
"\n";
191 $tplcontent .=
'<head>'.
"\n";
192 $tplcontent .=
'<title>'.dol_string_nohtmltag($objectpage->title, 0,
'UTF-8').
'</title>'.
"\n";
193 $tplcontent .=
'<meta charset="utf-8">'.
"\n";
194 $tplcontent .=
'<meta http-equiv="content-type" content="text/html; charset=utf-8" />'.
"\n";
195 $tplcontent .=
'<meta name="robots" content="index, follow" />'.
"\n";
196 $tplcontent .=
'<meta name="viewport" content="width=device-width, initial-scale=1.0">'.
"\n";
197 $tplcontent .=
'<meta name="keywords" content="'.dol_string_nohtmltag($objectpage->keywords).
'" />'.
"\n";
198 $tplcontent .=
'<meta name="title" content="'.dol_string_nohtmltag($objectpage->title, 0,
'UTF-8').
'" />'.
"\n";
199 $tplcontent .=
'<meta name="description" content="'.dol_string_nohtmltag($objectpage->description, 0,
'UTF-8').
'" />'.
"\n";
200 $tplcontent .=
'<meta name="generator" content="'.DOL_APPLICATION_TITLE.
' '.DOL_VERSION.
' (https://www.dolibarr.org)" />'.
"\n";
201 $tplcontent .=
'<meta name="dolibarr:pageid" content="'.dol_string_nohtmltag($objectpage->id).
'" />'.
"\n";
203 if ($object->virtualhost) {
204 $tplcontent .=
'<link rel="canonical" href="'.(($objectpage->id == $object->fk_default_home) ?
'/' : (($shortlangcode != substr($object->lang, 0, 2) ?
'/'.$shortlangcode :
'').
'/'.$objectpage->pageurl.
'.php')).
'" />'.
"\n";
207 if ($object->isMultiLang()) {
209 $translationof = $objectpage->fk_page;
210 if ($translationof) {
212 $tmppage->fetch($translationof);
213 if ($tmppage->id > 0) {
214 $tmpshortlangcode =
'';
215 if ($tmppage->lang) {
216 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'', $tmppage->lang);
218 if (empty($tmpshortlangcode)) {
219 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'', $object->lang);
221 if ($tmpshortlangcode != $shortlangcode) {
222 $tplcontent .=
'<link rel="alternate" hreflang="'.$tmpshortlangcode.
'" href="'.($object->fk_default_home == $tmppage->id ?
'/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ?
'/'.$tmpshortlangcode :
'').
'/'.$tmppage->pageurl.
'.php').
'" />'.
"\n";
228 $sql =
"SELECT rowid as id, lang, pageurl from ".MAIN_DB_PREFIX.
'website_page where fk_page IN ('.$db->sanitize($objectpage->id.($translationof ?
", ".$translationof :
'')).
")";
229 $resql = $db->query($sql);
231 $num_rows = $db->num_rows(
$resql);
233 while ($obj = $db->fetch_object(
$resql)) {
234 $tmpshortlangcode =
'';
236 $tmpshortlangcode = preg_replace(
'/[_-].*$/',
'', $obj->lang);
238 if ($tmpshortlangcode != $shortlangcode) {
239 $tplcontent .=
'<link rel="alternate" hreflang="'.$tmpshortlangcode.
'" href="'.($object->fk_default_home == $obj->id ?
'/' : (($tmpshortlangcode != substr($object->lang, 0, 2) ?
'/'.$tmpshortlangcode :
'')).
'/'.$obj->pageurl.
'.php').
'" />'.
"\n";
248 $tplcontent .=
'<?php if ($_SERVER["PHP_SELF"] == "'.(($object->fk_default_home == $objectpage->id) ?
'/' : (($shortlangcode != substr($object->lang, 0, 2)) ?
'/'.$shortlangcode :
'')).
'/'.$objectpage->pageurl.
'.php") { ?>'.
"\n";
249 $tplcontent .=
'<link rel="alternate" hreflang="'.$shortlangcode.
'" href="'.(($object->fk_default_home == $objectpage->id) ?
'/' : (($shortlangcode != substr($object->lang, 0, 2)) ?
'/'.$shortlangcode :
'').
'/'.$objectpage->pageurl.
'.php').
'" />'.
"\n";
251 $tplcontent .=
'<?php } ?>'.
"\n";
254 $tplcontent .=
'<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'.
"\n";
255 $tplcontent .=
'<!-- Include link to CSS file -->'.
"\n";
257 $tplcontent .=
'<link rel="stylesheet" href="/styles.css.php?website=<?php echo $websitekey; ?>" type="text/css" />'.
"\n";
258 $tplcontent .=
'<!-- Include link to JS file -->'.
"\n";
259 $tplcontent .=
'<script async src="/javascript.js.php"></script>'.
"\n";
261 $tplcontent .=
'<!-- Include HTML header from common file -->'.
"\n";
262 $tplcontent .=
'<?php if (file_exists(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")) include DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html"; ?>'.
"\n";
263 $tplcontent .=
'<!-- Include HTML header from page header block -->'.
"\n";
264 $tplcontent .= preg_replace(
'/<\/?html>/ims',
'', $objectpage->htmlheader).
"\n";
265 $tplcontent .=
'</head>'.
"\n";
267 $tplcontent .=
'<!-- File generated by Dolibarr website module editor -->'.
"\n";
268 $tplcontent .=
'<body id="bodywebsite" class="bodywebsite bodywebpage-'.$objectpage->ref.
'">'.
"\n";
269 $tplcontent .= $objectpage->content.
"\n";
270 $tplcontent .=
'</body>'.
"\n";
271 $tplcontent .=
'</html>'.
"\n";
273 $tplcontent .=
'<?php // BEGIN PHP'.
"\n";
274 $tplcontent .=
'$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp, "html", '.$objectpage->id.
');'.
"\n";
275 $tplcontent .=
"// END PHP ?>\n";
278 $result = file_put_contents($filetpl, $tplcontent);
279 if (!empty($conf->global->MAIN_UMASK)) {
280 @chmod($filetpl, octdec($conf->global->MAIN_UMASK));
297 function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper, $object =
null)
308 $indexcontent =
'<?php'.
"\n";
309 $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";
310 $indexcontent .=
'$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'.
"\n";
311 $indexcontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
312 $indexcontent .=
'if (!empty($_GET[\'pageref\']) || !empty($_GET[\'pagealiasalt\']) || !empty($_GET[\'pageid\'])) {'.
"\n";
313 $indexcontent .=
" require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
314 $indexcontent .=
" require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
315 $indexcontent .=
' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'.
"\n";
316 $indexcontent .=
"}\n";
317 $indexcontent .=
"include_once './".basename($filetpl).
"'\n";
318 $indexcontent .=
'// END PHP ?>'.
"\n";
320 $result1 = file_put_contents($fileindex, $indexcontent);
321 if (!empty($conf->global->MAIN_UMASK)) {
322 @chmod($fileindex, octdec($conf->global->MAIN_UMASK));
325 if (is_object($object) && $object->fk_default_home > 0) {
327 $objectpage->fetch($object->fk_default_home);
330 if (empty($objectpage->lang) || !in_array($objectpage->lang, explode(
',', $object->otherlang))) {
331 if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR) && is_object($object) && !empty($object->otherlang)) {
332 $dirname = dirname($fileindex);
333 foreach (explode(
',', $object->otherlang) as $sublang) {
335 if (empty(trim($sublang)))
continue;
336 $fileindexsub = $dirname.
'/'.$sublang.
'/index.php';
340 $indexcontent =
'<?php'.
"\n";
341 $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";
342 $indexcontent .=
'$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'.
"\n";
343 $indexcontent .=
"if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once '".$relpath.
"/master.inc.php'; } // Load master if not already loaded\n";
344 $indexcontent .=
'if (!empty($_GET[\'pageref\']) || !empty($_GET[\'pagealiasalt\']) || !empty($_GET[\'pageid\'])) {'.
"\n";
345 $indexcontent .=
" require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
346 $indexcontent .=
" require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
347 $indexcontent .=
' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'.
"\n";
348 $indexcontent .=
"}\n";
349 $indexcontent .=
"include_once '".$relpath.
"/".basename($filetpl).
"'\n";
350 $indexcontent .=
'// END PHP ?>'.
"\n";
351 $result = file_put_contents($fileindexsub, $indexcontent);
352 if ($result ===
false) {
353 dol_syslog(
"Failed to write file ".$fileindexsub, LOG_WARNING);
355 if (!empty($conf->global->MAIN_UMASK)) {
356 @chmod($fileindexsub, octdec($conf->global->MAIN_UMASK));
368 $wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.
'/website/samples/wrapper.php');
370 $result2 = file_put_contents($filewrapper, $wrappercontent);
371 if (!empty($conf->global->MAIN_UMASK)) {
372 @chmod($filewrapper, octdec($conf->global->MAIN_UMASK));
378 return ($result1 && $result2);
391 global $conf, $pathofwebsite;
393 dol_syslog(
"Save html header into ".$filehtmlheader);
396 $result = file_put_contents($filehtmlheader, $htmlheadercontent);
397 if (!empty($conf->global->MAIN_UMASK)) {
398 @chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
413 global $conf, $pathofwebsite;
418 $result = file_put_contents($filecss, $csscontent);
419 if (!empty($conf->global->MAIN_UMASK)) {
420 @chmod($filecss, octdec($conf->global->MAIN_UMASK));
435 global $conf, $pathofwebsite;
440 $result = file_put_contents($filejs, $jscontent);
441 if (!empty($conf->global->MAIN_UMASK)) {
442 @chmod($filejs, octdec($conf->global->MAIN_UMASK));
457 global $conf, $pathofwebsite;
459 dol_syslog(
"Save robot file into ".$filerobot);
462 $result = file_put_contents($filerobot, $robotcontent);
463 if (!empty($conf->global->MAIN_UMASK)) {
464 @chmod($filerobot, octdec($conf->global->MAIN_UMASK));
479 global $conf, $pathofwebsite;
481 dol_syslog(
"Save htaccess file into ".$filehtaccess);
484 $result = file_put_contents($filehtaccess, $htaccess);
485 if (!empty($conf->global->MAIN_UMASK)) {
486 @chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
501 global $conf, $pathofwebsite;
503 dol_syslog(
"Save manifest.js.php file into ".$file);
506 $result = file_put_contents($file, $content);
507 if (!empty($conf->global->MAIN_UMASK)) {
508 @chmod($file, octdec($conf->global->MAIN_UMASK));
523 global $conf, $pathofwebsite;
525 dol_syslog(
"Save README.md file into ".$file);
528 $result = file_put_contents($file, $content);
529 if (!empty($conf->global->MAIN_UMASK)) {
530 @chmod($file, octdec($conf->global->MAIN_UMASK));
545 global $conf, $pathofwebsite;
550 $result = file_put_contents($file, $content);
551 if (!empty($conf->global->MAIN_UMASK)) {
552 @chmod($file, octdec($conf->global->MAIN_UMASK));
566 global $conf, $langs, $db,
$form, $user;
568 $dirthemes = array(
'/doctemplates/websites');
569 if (!empty($conf->modules_parts[
'websitetemplates'])) {
570 foreach ($conf->modules_parts[
'websitetemplates'] as $reldir) {
571 $dirthemes = array_merge($dirthemes, (array) ($reldir.
'doctemplates/websites'));
574 $dirthemes = array_unique($dirthemes);
579 print
'<!-- For website template import -->'.
"\n";
580 print
'<table class="noborder centpercent">';
583 print
'<tr class="liste_titre"><th class="titlefield">';
584 print
$form->textwithpicto($langs->trans(
"Templates"), $langs->trans(
"ThemeDir").
' : '.join(
", ", $dirthemes));
586 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?website='.urlencode($website->ref).
'&importsite=1" target="_blank" rel="noopener noreferrer external">';
590 print
'<th class="right">';
591 $url =
'https://www.dolistore.com/43-web-site-templates';
592 print
'<a href="'.$url.
'" target="_blank" rel="noopener noreferrer external">';
593 print
img_picto(
'',
'globe',
'class="pictofixedwidth"').$langs->trans(
'DownloadMoreSkins');
597 print
'<tr><td colspan="'.$colspan.
'">';
599 print
'<table class="nobordernopadding centpercent"><tr><td><div class="center">';
601 if (count($dirthemes)) {
603 foreach ($dirthemes as $dir) {
605 $dirtheme = DOL_DATA_ROOT.$dir;
606 if (is_dir($dirtheme)) {
607 $handle = opendir($dirtheme);
608 if (is_resource($handle)) {
609 while (($subdir = readdir($handle)) !==
false) {
610 if (is_file($dirtheme.
"/".$subdir) && substr($subdir, 0, 1) <>
'.' && substr($subdir, 0, 3) <>
'CVS' && preg_match(
'/\.zip$/i', $subdir)) {
611 $subdirwithoutzip = preg_replace(
'/\.zip$/i',
'', $subdir);
614 if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match(
'/_dev$/i', $subdir)) {
617 if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match(
'/_exp$/i', $subdir)) {
621 print
'<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
623 $templatedir = $dirtheme.
"/".$subdir;
624 $file = $dirtheme.
"/".$subdirwithoutzip.
".jpg";
625 $url = DOL_URL_ROOT.
'/viewimage.php?modulepart=doctemplateswebsite&file='.$subdirwithoutzip.
".jpg";
627 if (!file_exists($file)) {
628 $url = DOL_URL_ROOT.
'/public/theme/common/nophoto.png';
631 $originalfile = basename($file);
632 $entity = $conf->entity;
633 $modulepart =
'doctemplateswebsite';
639 if (!empty($urladvanced)) {
640 $ret .=
'<a class="'.$urladvanced[
'css'].
'" target="'.$urladvanced[
'target'].
'" mime="'.$urladvanced[
'mime'].
'" href="'.$urladvanced[
'url'].
'">';
642 $ret .=
'<a href="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.urlencode($modulepart).
'&entity='.((int) $entity).
'&file='.urlencode($originalfile).
'&cache='.((int) $cache).
'">';
645 print
'<img class="img-skinthumb shadow" src="'.$url.
'" border="0" alt="'.$title.
'" title="'.$title.
'" style="margin-bottom: 5px;">';
652 if ($user->hasRight(
'website',
'delete')) {
653 print
' <a href="'.$_SERVER[
"PHP_SELF"].
'?action=deletetemplate&token='.
newToken().
'&website='.urlencode($website->ref).
'&templateuserfile='.urlencode($subdir).
'">'.
img_picto(
'',
'delete').
'</a>';
655 print
'<br><a href="'.$_SERVER[
"PHP_SELF"].
'?action=importsiteconfirm&token='.
newToken().
'&website='.urlencode($website->ref).
'&templateuserfile='.urlencode($subdir).
'" class="button">'.$langs->trans(
"Load").
'</a>';
665 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
668 print
'</div></td></tr></table>';
684 global $conf, $langs, $user;
688 if (empty($phpfullcodestringold) && empty($phpfullcodestring)) {
693 $forbiddenphpcommands = array();
694 if (empty($conf->global->WEBSITE_PHP_ALLOW_EXEC)) {
695 $forbiddenphpcommands = array(
"exec",
"passthru",
"shell_exec",
"system",
"proc_open",
"popen",
"eval",
"dol_eval",
"executeCLI");
697 if (empty($conf->global->WEBSITE_PHP_ALLOW_WRITE)) {
698 $forbiddenphpcommands = array_merge($forbiddenphpcommands, array(
"fopen",
"file_put_contents",
"fputs",
"fputscsv",
"fwrite",
"fpassthru",
"unlink",
"mkdir",
"rmdir",
"symlink",
"touch",
"umask"));
700 foreach ($forbiddenphpcommands as $forbiddenphpcommand) {
701 if (preg_match(
'/'.$forbiddenphpcommand.
'\s*\(/ms', $phpfullcodestring)) {
703 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpcommand),
null,
'errors');
708 $forbiddenphpchars = array();
709 if (empty($conf->global->WEBSITE_PHP_ALLOW_DANGEROUS_CHARS)) {
710 $forbiddenphpchars = array(
"`");
712 foreach ($forbiddenphpchars as $forbiddenphpchar) {
713 if (preg_match(
'/'.$forbiddenphpchar.
'/ms', $phpfullcodestring)) {
715 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpchar),
null,
'errors');
720 if (preg_match(
'/\$[a-z0-9_]+\(/ims', $phpfullcodestring)) {
722 setEventMessages($langs->trans(
"DynamicPHPCodeContainsAForbiddenInstruction",
'$...('),
null,
'errors');
725 if ($phpfullcodestringold != $phpfullcodestring) {
726 if (!$error && empty($user->rights->website->writephp)) {
728 setEventMessages($langs->trans(
"NotAllowedToAddDynamicContent"),
null,
'errors');
731 $dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
732 $allowimportsite =
true;
733 if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
734 $allowimportsite =
false;
737 if (!$allowimportsite) {
742 $message = $langs->trans(
'InstallModuleFromWebHasBeenDisabledContactUs');
745 $message = $langs->trans(
"InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.
'/installmodules.lock');
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_filemtime($pathoffile)
Return time of a file.
dol_filesize($pathoffile)
Return size of a file.
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_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=1)
Move a file into another name.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return 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)
checkPHPCode($phpfullcodestringold, $phpfullcodestring)
checkPHPCode
dolSaveMasterFile($filemaster)
Save content of a page on disk.
showWebsiteTemplates(Website $website)
Show list of themes.
dolSaveLicense($file, $content)
Save content of a page on disk.
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).
dolSaveCssFile($filecss, $csscontent)
Save content of a page on disk.
dolSaveRobotFile($filerobot, $robotcontent)
Save content of a page on disk.