break; case "getfiles": $dir = $config["basedir"]; if ($params["folder"]) { $dir = $params["folder"]; } $exts = $config["allowfiletype"]; if ($params["ftype"]) { $exts = $params["ftype"]; } $files = getdirfiles($dir, $exts); $result = array("error" => 0, "files" => $files); break; case "delfiles": if ($params["files"]) { $result = delfiles($params["files"]); } break; case "mkdir": if ($params["name"] && $params["pdir"]) { $path = $_SERVER['DOCUMENT_ROOT']; $path = trim($path, "/"); if (!file_exists($path . $params["pdir"] . "/" . $params["name"])) { $rev = createFolder($path . $params["pdir"] . "/" . $params["name"]); if ($rev) { $result = array("error" => 0); } } else { $result = array("error" => -9); } } else {
function delfiles($del_file) { if (is_dir($del_file)) { $del_folder = scandir($del_file); foreach ($del_folder as $file) { if ($file != '.' and $file != '..') { delfiles($del_file . '/' . $file); } } if (!rmdir($del_file)) { $flag = FALSE; } } else { if (!unlink($del_file)) { $flag = FALSE; } } }
function myfilesDispatch($op) { require_once _base_ . '/lib/lib.urlmanager.php'; $url =& UrlManager::getInstance('myfiles'); $url->setStdQuery('modname=myfiles&op=myfiles'); if (isset($_POST['undo'])) { $op = 'myfiles'; } switch ($op) { case "myfiles": fileList($url); break; case "modfiles": modfiles($url); break; case "savefiles": savefiles($url); break; case "delfiles": delfiles($url); break; } }