mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-09 10:13:00 +02:00
- Move get_extents function to include/functions.inc.php.
- Change all plugins version to 2.0. - LocalFiles Editor can now edit and create template extension. - Editarea (for LocalFiles Editor) go to version 0.7.2.2 (chrome compatible) - Editarea activation is now saved in database with AJAX. git-svn-id: http://piwigo.org/svn/trunk@2588 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -29,22 +29,25 @@
|
||||
*/
|
||||
function eval_syntax($code)
|
||||
{
|
||||
$code = str_replace(array('<?php', '?>'), '', $code);
|
||||
$code = str_replace(array('<?php', '?>'), '', $code);
|
||||
if (function_exists('token_get_all'))
|
||||
{
|
||||
$b = 0;
|
||||
foreach (token_get_all($code) as $token)
|
||||
{
|
||||
if ('{' == $token) ++$b;
|
||||
else if ('}' == $token) --$b;
|
||||
{
|
||||
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;
|
||||
else return '<?php' . $code . '?>';
|
||||
{
|
||||
ob_start();
|
||||
$eval = eval('if(0){' . $code . '}');
|
||||
ob_end_clean();
|
||||
if ($eval === false) return false;
|
||||
}
|
||||
}
|
||||
return '<?php' . $code . '?>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,4 +70,45 @@ function editarea_quote($value)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns bak file for restore
|
||||
* @param string
|
||||
*/
|
||||
function get_bak_file($file)
|
||||
{
|
||||
if (get_extension($file) == 'php')
|
||||
{
|
||||
return substr_replace($file, '.bak', strrpos($file , '.'), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $file . '.bak';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns dirs and subdirs
|
||||
* retun array
|
||||
* @param string
|
||||
*/
|
||||
function get_rec_dirs($path='')
|
||||
{
|
||||
$options = array();
|
||||
if (is_dir($path))
|
||||
{
|
||||
$fh = opendir($path);
|
||||
while ($file = readdir($fh))
|
||||
{
|
||||
$pathfile = $path . '/' . $file;
|
||||
if ($file != '.' and $file != '..' and $file != '.svn' and is_dir($pathfile))
|
||||
{
|
||||
$options[$pathfile] = str_replace(array('./', '/'), array('', ' / '), $pathfile);
|
||||
$options = array_merge($options, get_rec_dirs($pathfile));
|
||||
}
|
||||
}
|
||||
closedir($fh);
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user