diff --git a/public_html/includes/class/class.LSsession.php b/public_html/includes/class/class.LSsession.php index d7580493..525a8374 100644 --- a/public_html/includes/class/class.LSsession.php +++ b/public_html/includes/class/class.LSsession.php @@ -149,7 +149,19 @@ class LSsession { } } - $GLOBALS['Smarty'] -> register_function('getFData','smarty_getFData'); + if (method_exists($GLOBALS['Smarty'],'register_function')) { + define('SMARTY3',False); + $GLOBALS['Smarty'] -> register_function('getFData','smarty_getFData'); + $GLOBALS['Smarty'] -> register_function('tr','smarty_tr'); + } + elseif (method_exists($GLOBALS['Smarty'],'registerPlugin')) { + define('SMARTY3',True); + $GLOBALS['Smarty'] -> registerPlugin("function","getFData", "smarty_getFData"); + $GLOBALS['Smarty'] -> registerPlugin("function","tr", "smarty_tr"); + } + else { + die("Smarty : Can't register getFData fonction"); + } $GLOBALS['Smarty'] -> assign('LS_CSS_DIR',LS_CSS_DIR); $GLOBALS['Smarty'] -> assign('LS_IMAGES_DIR',LS_IMAGES_DIR); diff --git a/public_html/includes/functions.php b/public_html/includes/functions.php index af34595a..0e2e7b74 100644 --- a/public_html/includes/functions.php +++ b/public_html/includes/functions.php @@ -456,21 +456,9 @@ function LSdebugDefined() { return _($msg); } - function tr($msg,$key=null) { - if (is_array($msg)) { - echo __($msg[$key]); - } - else { - $val = $GLOBALS['Smarty']->get_template_vars($msg); - if (!$val) - $val=$msg; - if (is_array($val)) { - echo __($val[$key]); - } - else { - echo __($val); - } - } + function smarty_tr($params) { + extract($params); + echo __($msg); } /** diff --git a/public_html/templates/default/LSform.tpl b/public_html/templates/default/LSform.tpl index cafdad40..805ff15b 100644 --- a/public_html/templates/default/LSform.tpl +++ b/public_html/templates/default/LSform.tpl @@ -4,7 +4,7 @@