' . $delfile;
$msgs[] = '点此返回 »';
show_msg($msgs);
} else {
write_msg('文件已不存在!');
}
exit;
}
$cfg_if_tpledit = $mymps_mymps['cfg_if_tpledit'] == 0 ? '已关闭' : '已开启';
switch ($part) {
case 'template':
chk_admin_purview('purview_模板管理');
$here = '模板在线管理';
$mulu = 'Mymps模板目录';
$showdir = MYMPS_TPL . '/default';
if ($editfile && $do == 'update') {
if ($mymps_mymps['cfg_if_tpledit'] == '0') {
write_msg('操作失败!系统管理员关闭了在线编辑风格的功能!
您可以修改/dat/config.inc.php来开启它');
}
$content = str_replace('&', '&', trim($content));
$content = str_replace('"', '"', trim($content));
$nowfile = trim($editfile);
if (!is_file($nowfile)) {
write_msg('对不起,该文件不存在!');
}
$norootfile = str_replace(MYMPS_ROOT . '/template', '', $nowfile);
if ($db->getOne('SELECT content FROM `' . $db_mymps . 'template` WHERE filepath LIKE \'' . $norootfile . '\'')) {
$update_sql = $db->query('UPDATE `' . $db_mymps . 'template` SET content = \'' . $content . '\' WHERE filepath = \'' . $norootfile . '\'');
} else {
$db->query('INSERT INTO `' . $db_mymps . 'template` (filepath,content) VALUES (\'' . $norootfile . '\',\'' . $content . '\')');
}
$row = $db->getRow('SELECT filepath,content FROM `' . $db_mymps . 'template` WHERE filepath = \'' . $norootfile . '\'');
if (!$row) {
write_msg('操作失败!');
exit;
}
$create_c = createfile($nowfile, $row[content]);
if ($create_c) {
write_msg('模板文件' . $nowfile . '
修改成功', $url, 'MyMps');
} else {
write_msg('模板文件' . $nowfile . '无法修改
请检查template目录的操作权限!');
}
} else {
if ($editfile && empty($do)) {
$ext = FileExt($editfile);
if ($ext != 'html' && $ext != 'css' && $ext != 'htm' && $ext != 'js') {
write_msg('该文件不能在线编辑!');
}
if (!($edit = file_get_contents($editfile))) {
write_msg('该文件不可读,请检查该文件的操作权限');
}
$path = str_replace('/' . end(explode('/', $editfile)), '', $editfile);
$edit = htmlspecialchars($edit);
$acontent = '';
include mymps_tpl('template_edit');
exit;
}
}
break;
case 'upload':
chk_admin_purview('purview_附件管理');
$here = '系统上传附件管理';
$mulu = '系统附件目录';
$showdir = MYMPS_UPLOAD;
break;
}
$path = trim($path) ? trim($path) : $showdir;
$path2 = explode('/', $path);
$path2 = '/' . end($path2);
$LastPath = str_replace($path2, '', $path);
$con = explode($showdir, $CurrentPath);
include mymps_tpl(CURSCRIPT);
is_object($db) && $db->Close();
$db = $mymps_global = $part = $action = $here = NULL;