Changeset 2915 for branches


Ignore:
Timestamp:
Nov 30, 2008, 1:53:43 PM (16 years ago)
Author:
patdenice
Message:

merge -c2914 from trunk to branch 2.0.

  • Bug in eval_syntax function in LocalFiles Editor function... Come back to previous function (svn 2588)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/plugins/LocalFilesEditor/functions.inc.php

    r2788 r2915  
    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.