mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-11 02:12:33 +01:00
Fix: Code to manage view output must be stored or initialized into main and not into master (dedicated to all script included command line scripts).
This commit is contained in:
@@ -201,7 +201,7 @@ if (! defined('NOTOKENRENEWAL'))
|
||||
if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken'];
|
||||
$_SESSION['newtoken'] = $token;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_SECURITY_CSRF)) // Check validity of token, only if not option enabled (this option breaks some features sometimes)
|
||||
if (! empty($conf->global->MAIN_SECURITY_CSRF)) // Check validity of token, only if option enabled (this option breaks some features sometimes)
|
||||
{
|
||||
if (isset($_POST['token']) && isset($_SESSION['token']))
|
||||
{
|
||||
@@ -225,6 +225,29 @@ if (! empty($_SESSION["disablemodules"]))
|
||||
}
|
||||
}
|
||||
|
||||
// Init Smarty
|
||||
// TODO activer smarty par defaut ?
|
||||
if (sizeof($conf->need_smarty) > 0 || $conf->global->MAIN_SMARTY)
|
||||
{
|
||||
// Usage of const in conf.php file can overwrite default dir.
|
||||
if (empty($dolibarr_smarty_libs_dir)) $dolibarr_smarty_libs_dir=DOL_DOCUMENT_ROOT.'/includes/smarty/libs/';
|
||||
if (empty($dolibarr_smarty_compile)) $dolibarr_smarty_compile=DOL_DATA_ROOT.'/smarty/templates/temp';
|
||||
if (empty($dolibarr_smarty_cache)) $dolibarr_smarty_cache=DOL_DATA_ROOT.'/smarty/cache/temp';
|
||||
|
||||
$smarty_libs = $dolibarr_smarty_libs_dir. "Smarty.class.php";
|
||||
if (@include_once($smarty_libs))
|
||||
{
|
||||
$smarty = new Smarty();
|
||||
$smarty->compile_dir = $dolibarr_smarty_compile;
|
||||
$smarty->cache_dir = $dolibarr_smarty_cache;
|
||||
//$smarty->config_dir = '/web/www.domain.com/smarty/configs';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('',"Library Smarty ".$smarty_libs." not found.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Phase authentication / login
|
||||
@@ -355,7 +378,7 @@ if (! isset($_SESSION["dol_login"]))
|
||||
// We show login page
|
||||
include_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php");
|
||||
// TODO activer smarty par defaut ?
|
||||
if ($conf->global->MAIN_SMARTY)
|
||||
if (sizeof($conf->need_smarty) > 0 || $conf->global->MAIN_SMARTY)
|
||||
{
|
||||
dol_loginfunction2($langs,$conf,$mysoc);
|
||||
}
|
||||
|
||||
@@ -417,29 +417,4 @@ if (! defined('MAGPIE_CACHE_DIR')) { define('MAGPIE_CACHE_DIR', $conf->exte
|
||||
|
||||
if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
|
||||
|
||||
|
||||
// If there is at least one module using Smarty
|
||||
// FIXME Smarty is an output framework so it should be required and used only in main.inc.php and not in master.inc.php
|
||||
// TODO activer smarty par defaut ?
|
||||
if (sizeof($conf->need_smarty) > 0 || $conf->global->MAIN_SMARTY)
|
||||
{
|
||||
// Usage of const in conf.php file can overwrite default dir.
|
||||
if (empty($dolibarr_smarty_libs_dir)) $dolibarr_smarty_libs_dir=DOL_DOCUMENT_ROOT.'/includes/smarty/libs/';
|
||||
if (empty($dolibarr_smarty_compile)) $dolibarr_smarty_compile=DOL_DATA_ROOT.'/smarty/templates/temp';
|
||||
if (empty($dolibarr_smarty_cache)) $dolibarr_smarty_cache=DOL_DATA_ROOT.'/smarty/cache/temp';
|
||||
|
||||
$smarty_libs = $dolibarr_smarty_libs_dir. "Smarty.class.php";
|
||||
if (@include_once($smarty_libs))
|
||||
{
|
||||
$smarty = new Smarty();
|
||||
$smarty->compile_dir = $dolibarr_smarty_compile;
|
||||
$smarty->cache_dir = $dolibarr_smarty_cache;
|
||||
//$smarty->config_dir = '/web/www.domain.com/smarty/configs';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('',"Library Smarty ".$smarty_libs." not found.");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user