From 6036b0635dc1996c392ea4b64ef0c15c266d5673 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Tue, 22 Jan 2013 19:58:21 +0000 Subject: [PATCH] Error catching on rename function Test if the rename has taken place and only if it has, call updateFileManagerList etc. If it hasn't set the renamed var to false. If renamed var is false, show the improved error message (gives note on permissions). --- lib/file-control.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/file-control.php b/lib/file-control.php index 0579a50..cb9f14a 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -141,12 +141,19 @@ if ($_GET['action']=="upload") { // If we're due to rename a file/folder... if ($_GET['action']=="rename") { if (!$demoMode && is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) { - rename($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])),$docRoot.$fileLoc."/".$fileName); - // Reload file manager - echo ''; + if(rename($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])),$docRoot.$fileLoc."/".$fileName)) { + // Reload file manager + echo ''; + $renamed=true; + } else { + $renamed=false; + } } else { - echo ""; + $didntRename=false; + } + if (!$renamed) { + echo ""; } echo ''; }