diff options
author | patdenice <patdenice@piwigo.org> | 2008-09-25 17:46:27 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2008-09-25 17:46:27 +0000 |
commit | 1eb3d18ae24a221037a44d662439d50c74e6fe9f (patch) | |
tree | bad9aae88920126457aeadf09a7a9ec55242977b /plugins/LocalFilesEditor/functions.inc.php | |
parent | fd0b26af453fedf4528eaf4114914a6e5b7bc685 (diff) |
- 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
Diffstat (limited to '')
-rw-r--r-- | plugins/LocalFilesEditor/functions.inc.php | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/plugins/LocalFilesEditor/functions.inc.php b/plugins/LocalFilesEditor/functions.inc.php index b53806bfb..97813dce0 100644 --- a/plugins/LocalFilesEditor/functions.inc.php +++ b/plugins/LocalFilesEditor/functions.inc.php @@ -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; +} + ?>
\ No newline at end of file |