示例#1
0
文件: class.php 项目: anteknik/arsip
 /**
  * setup file renaming
  *
  * @param string $postoldname original file or directory name
  * @param string $postnewname new file or directory name
  *
  * @return call renameFile();
  */
 public function setRename($postoldname, $postnewname)
 {
     if (GateKeeper::isAccessAllowed() && GateKeeper::isAllowed('rename_enable')) {
         $postthisext = filter_input(INPUT_POST, "thisext", FILTER_SANITIZE_STRING);
         $postthisdir = filter_input(INPUT_POST, "thisdir", FILTER_SANITIZE_STRING);
         if ($postoldname && $postnewname) {
             if ($postthisext) {
                 $oldname = $postthisdir . $postoldname . "." . $postthisext;
                 $newname = $postthisdir . Utils::normalizeStr($postnewname) . "." . $postthisext;
             } else {
                 $oldname = $postthisdir . $postoldname;
                 $newname = $postthisdir . Utils::normalizeStr($postnewname);
             }
             Actions::renameFile($oldname, $newname, $postnewname);
         }
     }
 }