Made getPostUserDirectory function generic

This commit is contained in:
Pierre HUBERT 2018-07-14 11:13:29 +02:00
parent 82e8106b71
commit c014dbdd48
2 changed files with 5 additions and 4 deletions

View File

@ -55,7 +55,7 @@ class SettingsController {
//Get and check virtual directory //Get and check virtual directory
$virtualDirectory = postString("virtualDirectory", 0); $virtualDirectory = postString("virtualDirectory", 0);
if($virtualDirectory != ""){ if($virtualDirectory != ""){
$virtualDirectory = getPostUserDirectory("virtualDirectory"); $virtualDirectory = getPostVirtualDirectory("virtualDirectory");
//Check if the directory is available //Check if the directory is available
if(!components()->settings->checkUserDirectoryAvailability($virtualDirectory, userID)) if(!components()->settings->checkUserDirectoryAvailability($virtualDirectory, userID))
@ -104,7 +104,7 @@ class SettingsController {
user_login_required(); user_login_required();
//Get user directory //Get user directory
$userDirectory = getPostUserDirectory("directory"); $userDirectory = getPostVirtualDirectory("directory");
//Check if the directory is available //Check if the directory is available
if(!components()->settings->checkUserDirectoryAvailability($userDirectory, userID)) if(!components()->settings->checkUserDirectoryAvailability($userDirectory, userID))

View File

@ -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 * @param string $name The name of the $_POST Request
* @return string The user virtual directory, safe for saving * @return string The user virtual directory, safe for saving
* @throws RESTException If the directory is missing, or invalid * @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 //Check if the $_POST variable exists or not
if(!isset($_POST[$name])) if(!isset($_POST[$name]))