From 0da9371c4df8140e813f43d98d8eb8251b33ff6a Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 11 Dec 2013 06:20:20 +0000 Subject: [PATCH] Move event added If we're due to move a file and it's writable, rename it to new location Call move event once done to update file list Show message if we failed or clear server message if all is OK --- lib/file-control.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/file-control.php b/lib/file-control.php index 9e331c2..3b5ca5f 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -191,6 +191,23 @@ if ($_GET['action']=="rename") { echo 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; } +// If we're due to move a file/folder... +if ($_GET['action']=="move") { + $moved=false; + if (!$demoMode && is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) { + if(rename($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])),$docRoot.$fileLoc."/".$fileName)) { + // Reload file manager + echo 'top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'move\',\''.$fileLoc.'\',\''.$fileName.'\',\'\',\''.str_replace($iceRoot,"",strClean($_GET['oldFileName'])).'\');'; + echo 'action="move";'; + $moved=true; + } + } + if (!$moved) { + echo "action='nothing'; top.ICEcoder.message('Sorry, cannot move\\n".strClean($_GET['oldFileName'])."\\n\\nMaybe public write permissions needed on this or parent folder?');"; + } + echo 'top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);'; +} + // If we're due to replace text in a file... if ($_GET['action']=="replaceText") { if (!$demoMode && is_writable(str_replace("|","/",strClean($_GET['fileRef'])))) {