Skip to content
Snippets Groups Projects
Commit d4e89552 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Code to manage view output must be stored or initialized into main and...

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).
parent ddb2e5c4
No related branches found
No related tags found
No related merge requests found
...@@ -201,7 +201,7 @@ if (! defined('NOTOKENRENEWAL')) ...@@ -201,7 +201,7 @@ if (! defined('NOTOKENRENEWAL'))
if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken']; if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken'];
$_SESSION['newtoken'] = $token; $_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'])) if (isset($_POST['token']) && isset($_SESSION['token']))
{ {
...@@ -225,6 +225,29 @@ if (! empty($_SESSION["disablemodules"])) ...@@ -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 * Phase authentication / login
...@@ -355,7 +378,7 @@ if (! isset($_SESSION["dol_login"])) ...@@ -355,7 +378,7 @@ if (! isset($_SESSION["dol_login"]))
// We show login page // We show login page
include_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php"); include_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php");
// TODO activer smarty par defaut ? // 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); dol_loginfunction2($langs,$conf,$mysoc);
} }
......
...@@ -417,29 +417,4 @@ if (! defined('MAGPIE_CACHE_DIR')) { define('MAGPIE_CACHE_DIR', $conf->exte ...@@ -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 (! 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.");
}
}
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment