diff options
author | patdenice <patdenice@piwigo.org> | 2008-11-30 12:53:43 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2008-11-30 12:53:43 +0000 |
commit | b66f527601e7e9e5aac4ac19c6109d808f1ef56e (patch) | |
tree | ae88f0d0d7208d87014684ea224cf34452b98c7f /plugins/LocalFilesEditor/functions.inc.php | |
parent | 0111f50e632ed12a6781ff9a23bdfbf99fe856f0 (diff) |
merge -c2914 from trunk to branch 2.0.
- Bug in eval_syntax function in LocalFiles Editor function... Come back to previous function (svn 2588)
git-svn-id: http://piwigo.org/svn/branches/2.0@2915 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | plugins/LocalFilesEditor/functions.inc.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/LocalFilesEditor/functions.inc.php b/plugins/LocalFilesEditor/functions.inc.php index 63162d5d4..97813dce0 100644 --- a/plugins/LocalFilesEditor/functions.inc.php +++ b/plugins/LocalFilesEditor/functions.inc.php @@ -30,9 +30,22 @@ function eval_syntax($code) { $code = str_replace(array('<?php', '?>'), '', $code); - if (!@eval('return true;' . $code)) + if (function_exists('token_get_all')) { - return false; + $b = 0; + foreach (token_get_all($code) as $token) + { + if ('{' == $token) ++$b; + else if ('}' == $token) --$b; + } + if ($b) return false; + else + { + ob_start(); + $eval = eval('if(0){' . $code . '}'); + ob_end_clean(); + if ($eval === false) return false; + } } return '<?php' . $code . '?>'; } |