/* *######################################### * PHPCMS File Manager * Copyright (c) 2004-2006 phpcms.cn * Author: Longbill ( http://www.longbill.cn ) * longbill.cn@gmail.com *######################################### */ include_once "common.php"; $user = check_login(); $root = $user["root"]; if (!$user) { exit3('登陆超时!'); } header("content-type:text/html; charset=gb2312"); $path = dealpath($path); if (!$path) { exit3("没有权限!", 0); } ////////////文件上传////////////// if ($action == "upsave" && $user["upfile"]) { if (substr($path, -1) != "/") { $path .= "/"; } $tt = 0; $error = ''; $tsize = 0; if (!is_writable($path)) { exit3("上传失败:目录 {$path} 不可写!", 0); } foreach ($_FILES as $file) {
exitme("notice(lang.var_error)", "eval"); } if (!$filename) { $filename = basename1($url); } if ($filename != checkfilename($filename)) { exitme("notice(lang.download+lang.fail)", "eval"); } checktype($filename); if (!is_writeable($path)) { exitme("notice(lang.cannot_write)", "eval"); } if (file_exists($path . $filename)) { exitme("notice(lang.alreadyExist+':{$filename}')", "eval"); } $filename = dealpath($path . $filename); if (@copy($url, $filename)) { exitme("notice(lang.download+lang.success+': {$filename} ');reloaddata();", "eval"); } else { exitme("notice(lang.download+lang.fail);", "eval"); } } else { if ($action == "paste") { if ($action1 != "cut" && $action1 != "copy") { exitme("notice(lang.clipboard_empty)", "eval"); } $sfile = urldecode1($_COOKIE["sfile"]); $sdir = urldecode1($_COOKIE["sdir"]); $sfile = explode("|", $sfile); $sdir = explode("|", $sdir); $frompath = $_COOKIE["from"];
} reset($user); $dd = array(); while (list($key, $val) = each($user)) { $dd["{$key}"] = $val ? "" : "none"; } $dd["wait"] = $wait; $dd["paste"] = $user["copy"] || $user["move"] ? "" : "none"; $dd["version"] = $version; $main = deal_temp("temp/{$tempname}/table.htm", $dd); echo deal_temp("temp/{$tempname}/main.htm", array("sitewidth" => $sitewidth, "title" => $title, "logout" => "<a href='login.php?action=logout' target=_top>退出</a>", "main" => $main, "currentpath" => "<font id='currentpath'>当前路径 .</font>", "username" => $user["name"], "footer" => deal_temp("temp/{$tempname}/footer.htm"))); echo "</body></html>"; exit; } else { if ($action == "editfile") { $path = dealpath($_GET["path"]); if (!$path || !$user["viewsorce"]) { header("Content-type:TEXT/HTML;Charset=GB2312"); die("<script>alert('没有权限!');window.close();</script>"); } $ftype = getext($path); $encode = get_encode($path); if ($encode == false) { $encode = $force_encode; } if ($_GET['charset']) { $encode = strtoupper($_GET['charset']); } $selected_gb2312 = $encode == "GB2312" ? "selected" : ""; $selected_utf8 = $encode == "UTF-8" ? "selected" : ""; //if ($encode != "GB2312") die("<script>alert('文本编辑器暂时还不支持 {$encode} 编码的文件!');window.close();</script>");