From 8ec1af01708beaa06d1680bf359e4d687488cee7 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 13 Feb 2023 15:37:04 +0100 Subject: [PATCH] wip #5725 @0.25 --- app/src/Tools.php | 9 +++++++++ app/tools.php | 1 + 2 files changed, 10 insertions(+) diff --git a/app/src/Tools.php b/app/src/Tools.php index 9e76bae..995bc50 100644 --- a/app/src/Tools.php +++ b/app/src/Tools.php @@ -42,4 +42,13 @@ class Tools { protected static function _args($args, $defaults = []) { return array_merge($defaults, $args); } + + public static function rmdir($args) { + $path = preg_replace('/\/+/', '/', $args['path']); + $componants = count(explode('/', $path)); + if ($componants < 3) { + return; + } + `rm -rf $path`; + } } \ No newline at end of file diff --git a/app/tools.php b/app/tools.php index 93dc285..264eb92 100644 --- a/app/tools.php +++ b/app/tools.php @@ -6,6 +6,7 @@ require_once __DIR__ . "/vendor/autoload.php"; $f = $_POST['function']; if (is_callable([Tools::class, $f])) { + $res=''; try { $res = Tools::$f($_POST); } catch (Exception $e) { -- 2.39.5