mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 00:25:18 +00:00
Can get the posts of a group and returns them to the API
This commit is contained in:
@ -102,15 +102,19 @@ function postBool(string $name) : bool {
|
||||
* This function makes a REST_Error in case of error
|
||||
*
|
||||
* @param string $name The name of the $_POST field
|
||||
* @param string $default The default value (null = none)
|
||||
* @return int The integer
|
||||
*/
|
||||
function postInt(string $name) : int {
|
||||
function postInt(string $name, string $default = null) : int {
|
||||
|
||||
//Check the variable
|
||||
if(!isset($_POST[$name]))
|
||||
if(!isset($_POST[$name]) && $default == null)
|
||||
Rest_fatal_error(400, "Please add a POST integer named '".$name."' in the request !");
|
||||
|
||||
return (int)$_POST[$name];
|
||||
if(isset($_POST[$name]))
|
||||
return (int)$_POST[$name];
|
||||
else
|
||||
return (int) $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user