From c014dbdd48e626a88faeb0882b7f01619228dcd1 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 14 Jul 2018 11:13:29 +0200 Subject: [PATCH] Made getPostUserDirectory function generic --- RestControllers/SettingsController.php | 4 ++-- functions/requests.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/RestControllers/SettingsController.php b/RestControllers/SettingsController.php index 7800ca2..acbe59b 100644 --- a/RestControllers/SettingsController.php +++ b/RestControllers/SettingsController.php @@ -55,7 +55,7 @@ class SettingsController { //Get and check virtual directory $virtualDirectory = postString("virtualDirectory", 0); if($virtualDirectory != ""){ - $virtualDirectory = getPostUserDirectory("virtualDirectory"); + $virtualDirectory = getPostVirtualDirectory("virtualDirectory"); //Check if the directory is available if(!components()->settings->checkUserDirectoryAvailability($virtualDirectory, userID)) @@ -104,7 +104,7 @@ class SettingsController { user_login_required(); //Get user directory - $userDirectory = getPostUserDirectory("directory"); + $userDirectory = getPostVirtualDirectory("directory"); //Check if the directory is available if(!components()->settings->checkUserDirectoryAvailability($userDirectory, userID)) diff --git a/functions/requests.php b/functions/requests.php index fc71da3..ea2b45f 100644 --- a/functions/requests.php +++ b/functions/requests.php @@ -543,13 +543,14 @@ function checkVirtualDirectoryValidity(string $directory) : bool { } /** - * Get a user post directory from a $_POST request and transform it to make it SQL-safe + * Get a user / group post directory from a $_POST + * request and transform it to make it SQL-safe * * @param string $name The name of the $_POST Request * @return string The user virtual directory, safe for saving * @throws RESTException If the directory is missing, or invalid */ -function getPostUserDirectory(string $name) : string { +function getPostVirtualDirectory(string $name) : string { //Check if the $_POST variable exists or not if(!isset($_POST[$name]))