コード例 #1
0
ファイル: action.rename.php プロジェクト: RTR-ITF/usse-cms
    $params["fmerror"] = "nofilesselected";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
//echo count($selall);
if (count($selall) > 1) {
    //echo "hi";die();
    $params["fmerror"] = "morethanonefiledirselected";
    $this->Redirect($id, "defaultadmin", $returnid, $params);
}
$config = cmsms()->GetConfig();
$oldname = $this->decodefilename($selall[0]);
$newname = $oldname;
//for initial input box
if (isset($params["newname"])) {
    $newname = $params["newname"];
    if (!filemanager_utils::is_valid_filename($newname)) {
        echo $this->ShowErrors($this->Lang("invaliddestname"));
    } else {
        $cwd = filemanager_utils::get_cwd();
        $fullnewname = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), trim($params['newname']));
        if (file_exists($fullnewname)) {
            echo $this->ShowErrors($this->Lang("namealreadyexists"));
            //fallthrough
        } else {
            $fulloldname = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), $oldname);
            if (@rename($fulloldname, $fullnewname)) {
                $thumboldname = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), 'thumb_' . $oldname);
                $thumbnewname = filemanager_utils::join_path(filemanager_utils::get_full_cwd(), 'thumb_' . trim($params['newname']));
                if (file_exists($thumboldname)) {
                    @rename($thumboldname, $thumbnewname);
                }
コード例 #2
0
<?php

if (!cmsms()) {
    exit;
}
if (!$this->CheckPermission("Modify Files") && !$this->AdvancedAccessAllowed()) {
    exit;
}
if (!isset($params["newdirname"]) || !isset($params["path"])) {
    $this->Redirect($id, 'defaultadmin');
}
if ($this->IntruderCheck($params["path"])) {
    $this->Redirect($id, 'defaultadmin', $returnid, array("fmerror" => "fileoutsideuploads"));
}
$params["newdirname"] = trim($params["newdirname"]);
if (!filemanager_utils::is_valid_filename($params['newdirname'])) {
    $this->Redirect($id, 'defaultadmin', $returnid, array("fmerror" => "invalidnewdir"));
}
$config =& $gCms->GetConfig();
$newdir = $this->Slash($params["path"], $params["newdirname"]);
$newdir = $this->Slash($config["root_path"], $newdir);
//echo $newdir; die();
if (is_dir($newdir)) {
    $this->Redirect($id, 'defaultadmin', $returnid, array("fmerror" => "direxists"));
}
$message = "";
$error = "";
if (mkdir($newdir)) {
    $message = "newdirsuccess";
    // put mention into the admin log
    $this->Audit(0, "File Manager", "Created new directory: " . $params["newdirname"]);