Exemplo n.º 1
0
 private function rename($dir, $uploadpath)
 {
     if (isset($_POST['plugin_filelistwidget_action_rename'])) {
         $oldpath = $uploadpath . $dir . "/" . $_POST['plugin_filelistwidget_rename_oldname'];
         $newpath = $uploadpath . $dir . "/" . $_POST['plugin_filelistwidget_rename_newname'];
         if (file_exists($oldpath) && !file_exists($newpath)) {
             $imagePathOld = $this->getImagePath($dir, $_POST['plugin_filelistwidget_rename_oldname']);
             $imagePathNew = $this->getImagePath($dir, $_POST['plugin_filelistwidget_rename_newname']);
             if (ImageServer::contains($imagePathOld)) {
                 ImageServer::move($imagePathOld, $imagePathNew);
             }
             rename($oldpath, $newpath);
         }
     }
 }