From 497efaabf0ae9ddc9b5c5a467b99111447a6daae Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sun, 13 Jan 2013 16:10:19 +0000 Subject: [PATCH] Fixing multiple & path issies in delete function Establish a fullPath to begin with and use that Only show relative path in message re not being able to delete --- lib/file-control.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/file-control.php b/lib/file-control.php index 945ef96..e86b1b4 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -138,15 +138,20 @@ if ($_GET['action']=="perms") { if ($_GET['action']=="delete") { $filesArray = explode(";",$file); // May contain more than one file here for ($i=0;$i<=count($filesArray)-1;$i++) { - if (!$demoMode && is_writable($iceRoot.$filesArray[$i])) { - is_dir($iceRoot.$filesArray[$i]) - ? rrmdir($iceRoot.$filesArray[$i]) - : unlink($iceRoot.$filesArray[$i]); + $fullPath = str_replace($docRoot,"",$filesArray[$i]); + $fullPath = str_replace($iceRoot,"",$fullPath); + $fullPath = $docRoot.$iceRoot.$fullPath; + if (!$demoMode && is_writable($fullPath)) { + is_dir($fullPath) + ? rrmdir($fullPath) + : unlink($fullPath); + $fileName = basename($fullPath); + $fileLoc = dirname(str_replace($docRoot,"",$fullPath)); // Reload file manager echo ''; } else { - echo ""; + echo ""; } echo ''; }