From 6e7612d3ecc9ea175822465f604fe685f51a38d5 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 23 Apr 2014 08:22:44 +0100 Subject: [PATCH] Inform user they can't delete the root Stops the root accidentally being deleted --- lib/file-control.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/file-control.php b/lib/file-control.php index 7e7c6f9..ba5538f 100644 --- a/lib/file-control.php +++ b/lib/file-control.php @@ -256,7 +256,10 @@ if ($_GET['action']=="delete") { $fullPath = str_replace($docRoot,"",$filesArray[$i]); $fullPath = str_replace($iceRoot,"",$fullPath); $fullPath = $docRoot.$iceRoot.$fullPath; - if (!$demoMode && is_writable($fullPath)) { + + if (rtrim($fullPath,"/") == rtrim($docRoot,"/")) { + echo "top.ICEcoder.message('Sorry can\\'t delete the root level');"; + } else if (!$demoMode && is_writable($fullPath)) { is_dir($fullPath) ? rrmdir($fullPath) : unlink($fullPath);