In smarty templates, this syntax works fine:
{if !hasPerm('directory_private') && other_test() }
... but not this one:
{if (!hasPerm('directory_private') || test1()) && test2()}
... because the regexp which handle hasPerm "function" in smarty does
not support parenthesis.
Fix this bug by explicitly allowing space and open parenthesis before
hasPerm().
================================================================================
================================================================================
+VERSION 1.1.13 XX XX XXXX
+
+Bugs:
+
+ * Allow parenthesis before hasPerm() in templates -IOS
+
+================================================================================
VERSION 1.1.12 08 03 2014
Bugs:
VERSION 1.1.12 08 03 2014
Bugs:
function if_rewrites($source, $smarty)
{
$perms = 'isset($smarty.session.user|smarty:nodefaults) && $smarty.session.user';
function if_rewrites($source, $smarty)
{
$perms = 'isset($smarty.session.user|smarty:nodefaults) && $smarty.session.user';
- return preg_replace(array('/\{(else)?if([^}]*) (\!?)hasPerms?\(([^)]+)\)([^}]*)\}/',
- '/\{(else)?if([^}]*) (\!?)t\(([^)]+)\)([^}]*)\}/'),
- array('{\1if\2 \3(' . $perms . '->checkPerms(\4))\5}',
- '{\1if\2 \3(isset(\4|smarty:nodefaults) && (\4|smarty:nodefaults))\5}'),
+ return preg_replace(array('/\{(else)?if([^}]*)([ \(]\!?)hasPerms?\(([^)]+)\)([^}]*)\}/',
+ '/\{(else)?if([^}]*)([ \(]\!?)t\(([^)]+)\)([^}]*)\}/'),
+ array('{\1if\2\3(' . $perms . '->checkPerms(\4))\5}',
+ '{\1if\2\3(isset(\4|smarty:nodefaults) && (\4|smarty:nodefaults))\5}'),