mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-12-25 13:08:58 +00:00
Made getPostUserDirectory function generic
This commit is contained in:
parent
82e8106b71
commit
c014dbdd48
@ -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))
|
||||
|
@ -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]))
|
||||
|
Loading…
Reference in New Issue
Block a user