Fix include

This commit is contained in:
Laurent Destailleur 2017-07-21 17:55:43 +02:00
parent 6d97deb1c3
commit b9df364fbe

View File

@ -414,7 +414,7 @@ if ($action == 'updatemeta')
$mastercontent = '<?php'."\n"; $mastercontent = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n"; $mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require '".DOL_DOCUMENT_ROOT."/master.inc.php';\n"; $mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
//$mastercontent.= "include_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';"."\n"; //$mastercontent.= "include_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';"."\n";
//$mastercontent.= '$website = new WebSite($db)'."\n"; //$mastercontent.= '$website = new WebSite($db)'."\n";
$mastercontent.= '?>'."\n"; $mastercontent.= '?>'."\n";
@ -433,8 +433,9 @@ if ($action == 'updatemeta')
} }
$aliascontent = '<?php'."\n"; $aliascontent = '<?php'."\n";
$aliascontent.= '// File generated to wrap the page - DO NOT MODIFY - It is just an include'."\n"; $aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n";
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php';\n"; $aliascontent.= 'global $dolibarr_main_data_root;'."\n";
$aliascontent.= 'require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent.= '?>'."\n"; $aliascontent.= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent); $result = file_put_contents($filealias, $aliascontent);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@ -452,7 +453,7 @@ if ($action == 'updatemeta')
$tplcontent =''; $tplcontent ='';
$tplcontent.= "<?php // BEGIN PHP\n"; $tplcontent.= "<?php // BEGIN PHP\n";
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require './master.inc.php'; } // Not already loaded"."\n"; $tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent.= "ob_start();\n"; $tplcontent.= "ob_start();\n";
@ -594,7 +595,7 @@ if (($action == 'updatecontent' || $action == 'createpagefromclone')
$mastercontent = '<?php'."\n"; $mastercontent = '<?php'."\n";
$mastercontent.= '// File generated to link to the master file'."\n"; $mastercontent.= '// File generated to link to the master file'."\n";
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require '".DOL_DOCUMENT_ROOT."/master.inc.php';\n"; $mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require_once '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
$mastercontent.= '?>'."\n"; $mastercontent.= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent); $result = file_put_contents($filemaster, $mastercontent);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@ -612,7 +613,8 @@ if (($action == 'updatecontent' || $action == 'createpagefromclone')
$aliascontent = '<?php'."\n"; $aliascontent = '<?php'."\n";
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n"; $aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n";
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php';\n"; $aliascontent.= 'global $dolibarr_main_data_root;'."\n";
$aliascontent.= 'require $dolibarr_main_data_root.\'/websites/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n";
$aliascontent.= '?>'."\n"; $aliascontent.= '?>'."\n";
$result = file_put_contents($filealias, $aliascontent); $result = file_put_contents($filealias, $aliascontent);
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@ -628,7 +630,7 @@ if (($action == 'updatecontent' || $action == 'createpagefromclone')
$tplcontent =''; $tplcontent ='';
$tplcontent.= "<?php // BEGIN PHP\n"; $tplcontent.= "<?php // BEGIN PHP\n";
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n"; $tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require './master.inc.php'; } // Not already loaded"."\n"; $tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
$tplcontent.= "ob_start();\n"; $tplcontent.= "ob_start();\n";