mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Made getPostUserDirectory function generic
This commit is contained in:
		@@ -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))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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]))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user