X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplpage.php;h=258a8c3c474ef2deedc0be1436a765af3347c527;hb=a2efe30f0470b8150e70189e6f8d9d7d8601ea87;hp=63ece95d1ca64b1b8cd74a6a57d3e8c01c7137d7;hpb=988a0ceddebb96949ca74e62129d9b3dbe2450c3;p=platal.git diff --git a/classes/plpage.php b/classes/plpage.php index 63ece95..258a8c3 100644 --- a/classes/plpage.php +++ b/classes/plpage.php @@ -494,13 +494,11 @@ function core_include($source, &$smarty) function if_rewrites($source, &$smarty) { - $perms = 'isset($smarty.session.perms|smarty:nodefaults) && $smarty.session.perms|smarty:nodefaults && $smarty.session.perms'; - return preg_replace(array('/\{if([^}]*) (\!?)hasPerms\(([^)]+)\)([^}]*)\}/', - '/\{if([^}]*) (\!?)hasPerm\(([^)]+)\)([^}]*)\}/', - '/\{if([^}]*) (\!?)t\(([^)]+)\)([^}]*)\}/'), - array('{if\1 \2(' . $perms . '->hasFlagCombination(\3))\4}', - '{if\1 \2(' . $perms . '->hasFlag(\3))\4}', - '{if\1 \2(isset(\3|smarty:nodefaults) && (\3|smarty:nodefaults))\4}'), + $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}'), $source); }