Changeset 2914 for trunk/plugins


Ignore:
Timestamp:
Nov 30, 2008, 1:50:37 PM (15 years ago)
Author:
patdenice
Message:
  • Bug in eval_syntax function in LocalFiles Editor function... Come back to previous function (svn 2588)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/LocalFilesEditor/functions.inc.php

    r2787 r2914  
    3131{
    3232  $code = str_replace(array('<?php', '?>'), '', $code);
    33   if (!@eval('return true;' . $code))
     33  if (function_exists('token_get_all'))
    3434  {
    35     return false;
     35    $b = 0;
     36    foreach (token_get_all($code) as $token)
     37    {
     38      if ('{' == $token) ++$b;
     39      else if ('}' == $token) --$b;
     40    }
     41    if ($b) return false;
     42    else
     43    {
     44      ob_start();
     45      $eval = eval('if(0){' . $code . '}');
     46      ob_end_clean();
     47      if ($eval === false) return false;
     48    }
    3649  }
    3750  return '<?php' . $code . '?>';
Note: See TracChangeset for help on using the changeset viewer.