mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-26 21:15:21 +02:00
change conditional enclosements in template engine
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8739 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@ -515,11 +515,64 @@ class template_compile
|
||||
}
|
||||
$token = "sizeof($varref)";
|
||||
}
|
||||
else if (!empty($token))
|
||||
{
|
||||
$token = '(' . $token . ')';
|
||||
/**
|
||||
* If we need to really secure the usage, or force specific types on specific operations... the following would be the code
|
||||
|
||||
if (!isset($tokens[$i - 1]))
|
||||
{
|
||||
unset($tokens[$i]);
|
||||
break;
|
||||
}
|
||||
|
||||
$prev_token = trim($tokens[$i - 1]);
|
||||
|
||||
switch ($prev_token)
|
||||
{
|
||||
// Integer
|
||||
case '<':
|
||||
case '>':
|
||||
case '<=':
|
||||
case '>=':
|
||||
case '%':
|
||||
$token = ( ((double) $token) != 0) ? (double) $token : (int) $token;
|
||||
break;
|
||||
|
||||
case '==':
|
||||
case '!=':
|
||||
$int_token = (((double) $token) != 0) ? (double) $token : (int) $token;
|
||||
if ($int_token && $int_token == $token)
|
||||
{
|
||||
$token = $int_token;
|
||||
break;
|
||||
}
|
||||
|
||||
// It is a string...
|
||||
$token = '(' . $token . ')';
|
||||
break;
|
||||
|
||||
case '!':
|
||||
case '||':
|
||||
case '&&':
|
||||
default:
|
||||
unset($tokens[$i]);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If there are no valid tokens left or only control/compare characters left, we do skip this statement
|
||||
if (!sizeof($tokens) || str_replace(array(' ', '=', '!', '<', '>', '&', '|', '%', '(', ')'), '', implode('', $tokens)) == '')
|
||||
{
|
||||
$tokens = array('false');
|
||||
}
|
||||
return (($elseif) ? '} else if (' : 'if (') . (implode(' ', $tokens) . ') { ');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user