From 380be061f538b4745ba0d2a4c29a2f5b400963c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Dec 2009 00:57:15 +0000 Subject: [PATCH] Code simpler. Smarty setup in conf file is deprecated. --- htdocs/master.inc.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index e702c2a32c6..b1a7a147998 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -417,19 +417,20 @@ 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 constats in conf.php file is no more required. + // 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 (file_exists ($smarty_libs)) + if (@include_once($smarty_libs)) { - require_once($smarty_libs); $smarty = new Smarty(); $smarty->compile_dir = $dolibarr_smarty_compile; $smarty->cache_dir = $dolibarr_smarty_cache; @@ -437,7 +438,7 @@ if (sizeof($conf->need_smarty) > 0 || $conf->global->MAIN_SMARTY) } else { - dol_print_error('',"Library Smarty ".$smarty_libs." not found. Check parameter dolibarr_smarty_libs_dir in conf file."); + dol_print_error('',"Library Smarty ".$smarty_libs." not found."); } }