From d2120b9b6157c6bdcf4b5b852253fdf6e75ea862 Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Fri, 21 Jan 2022 14:53:19 +0100 Subject: [PATCH] Don't delete parent directories --- includes/functions/deleteDirectory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/functions/deleteDirectory.php b/includes/functions/deleteDirectory.php index d7635daa..4f643318 100644 --- a/includes/functions/deleteDirectory.php +++ b/includes/functions/deleteDirectory.php @@ -9,6 +9,10 @@ function delete_directory(string $directoryToDelete) { foreach (scandir($directoryToDelete) as $filename) { + if (in_array($filename, array('.', '..'))) { + continue; + } + $filepath = $directoryToDelete . '/' . $filename; if (is_file($filepath)) {