mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 00:25:18 +00:00
Can get older messages of a conversation
This commit is contained in:
@ -82,7 +82,7 @@ function postString(string $name, int $minLength = 1) : string {
|
||||
|
||||
/**
|
||||
* Get a boolean given in a $_POST request safely.
|
||||
* This function make a REST_Error if an error occur while
|
||||
* This function makes a REST_Error if an error occurr while
|
||||
* processing the value
|
||||
*
|
||||
* @param string $name The name of the $_POST field
|
||||
@ -97,6 +97,22 @@ function postBool(string $name) : bool {
|
||||
return $_POST[$name] == "true";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an integer given in a $_POST request safely
|
||||
* This function makes a REST_Error in case of error
|
||||
*
|
||||
* @param string $name The name of the $_POST field
|
||||
* @return int The integer
|
||||
*/
|
||||
function postInt(string $name) : int {
|
||||
|
||||
//Check the variable
|
||||
if(!isset($_POST[$name]))
|
||||
Rest_fatal_error(400, "Please add a POST integer named '".$name."' in the request !");
|
||||
|
||||
return (int)$_POST[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Securely transform user given number (mixed) to integer (int)
|
||||
*
|
||||
|
Reference in New Issue
Block a user