22 include dirname(dirname(__DIR__)) .
'/header.php';
25 $xoops->disableErrorReporting();
31 include_once
$xoops->path(
'modules/system/functions.php');
32 $xoops->loadLocale(
'system');
34 if (isset($_REQUEST[
"op"])) {
35 $op = $_REQUEST[
"op"];
42 case "tpls_display_folder":
43 $_REQUEST[
'dir'] = urldecode($_REQUEST[
'dir']);
49 echo
"<ul class=\"jqueryFileTree\" style=\"display: none;\">";
55 $file_no_valid = array(
'.svn',
'icons',
'img',
'images',
'language',
'locale');
57 if (!in_array($file, $file_no_valid)) {
58 echo
"<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlentities($_REQUEST[
'dir'] . $file) .
"/\">" . htmlentities($file) .
"</a></li>";
63 foreach (
$files as $file) {
64 if (
XoopsLoad::fileExists(
$root . $_REQUEST[
'dir'] . $file) && $file !=
'.' && $file !=
'..' && !is_dir(
$root . $_REQUEST[
'dir'] . $file) && $file !=
'index.html') {
65 $ext = preg_replace(
'/^.*\./',
'', $file);
67 $extensions = array(
'.tpl',
'.html',
'.htm',
'.css');
68 $extension_verif = strrchr($file,
'.');
70 if (in_array($extension_verif, $extensions)) {
71 echo
"<li class=\"file ext_$ext\"><a href=\"#\" onclick=\"tpls_edit_file('" . htmlentities($_REQUEST[
'dir'] . $file) .
"', '" . htmlentities($_REQUEST[
'dir']) .
"', '" . htmlentities($file) .
"', '" .
$ext .
"');\" rel=\"tpls_edit_file('" . htmlentities($_REQUEST[
'dir'] . $file) .
"', '" . htmlentities($_REQUEST[
'dir']) .
"', '" . htmlentities($file) .
"', '" .
$ext .
"');\">" . htmlentities($file) .
"</a></li>";
82 case 'tpls_edit_file':
83 $path_file = realpath(\
XoopsBaseConfig::get(
'root-path') .
'/themes' . trim($_REQUEST[
'path_file']));
84 $path_file = str_replace(
'\\',
'/', $path_file);
88 $restore =
'<button class="ui-corner-all tooltip" type="button" onclick="tpls_restore(\'' . $path_file .
'\')
" value="' . XoopsLocale::A_RESTORE . '" title="' . XoopsLocale::A_RESTORE . '">
89 <img src="' . system_AdminIcons('revert.png
') . '" alt="' . XoopsLocale::A_RESTORE . '" />
95 $file = XoopsFile::getHandler('file', $path_file);
96 $content = $file->read();
97 if (empty($content)) {
98 echo SystemLocale::EMPTY_FILE;
100 $ext = preg_replace('/^.*\./', '', $_REQUEST['path_file']);
102 echo '<form name="back
" action="admin.php?fct=tplsets&op=tpls_save
" method="POST
">
106 <div class="xo-btn-actions
">
107 <div class="xo-buttons
">
108 <button class="ui-corner-all tooltip
" type="submit
" value="' . XoopsLocale::A_SAVE . '" title="' . XoopsLocale::A_SAVE . '">
109 <img src="' . system_AdminIcons('save.png
') . '" alt="' . XoopsLocale::A_SAVE . '" />
112 <button class="ui-corner-all tooltip
" type="button
" onclick="$(\
'#display_contenu\').hide();$(\'#display_form\').fadeIn(\'fast\');" title="' .
XoopsLocale::A_CANCEL .
'">
115 <div class="clear"></div>
121 <td><textarea id="code_mirror" name="templates" rows=24 cols=110>' .
$content .
'</textarea></td>
124 echo
'<input type="hidden" name="path_file" value="' . $path_file .
'"><input type="hidden" name="file" value="' . trim($_REQUEST[
'file']) .
'"><input type="hidden" name="ext" value="' .
$ext .
'"></form>';
129 $extensions = array(
'.tpl',
'.html',
'.htm',
'.css');
132 $valid_dir = stristr(realpath($_REQUEST[
'path_file']), realpath(\
XoopsBaseConfig::get(
'root-path') .
'/themes'));
134 $old_file = $_REQUEST[
'path_file'] .
'.back';
135 $new_file = $_REQUEST[
'path_file'];
137 $extension_verif = strrchr($new_file,
'.');
139 if (unlink($new_file)) {
140 if (rename($old_file, $new_file)) {
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
const E_NO_ACCESS_PERMISSION