mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
Updated error codes
This commit is contained in:
parent
d9eeddb131
commit
943f03ee98
@ -67,7 +67,7 @@ class conversationsController{
|
|||||||
|
|
||||||
//Check for parametres
|
//Check for parametres
|
||||||
if(!check_post_parametres(array("name", "follow", "users")))
|
if(!check_post_parametres(array("name", "follow", "users")))
|
||||||
Rest_fatal_error(501, "Please check parametres passed with the request !");
|
Rest_fatal_error(400, "Please check parametres passed with the request !");
|
||||||
|
|
||||||
//Extract parametres
|
//Extract parametres
|
||||||
$conversationName = ($_POST["name"] == "false" ? false : $_POST['name']);
|
$conversationName = ($_POST["name"] == "false" ? false : $_POST['name']);
|
||||||
@ -106,7 +106,7 @@ class conversationsController{
|
|||||||
|
|
||||||
//Check conversation ID was specified
|
//Check conversation ID was specified
|
||||||
if(!isset($_POST["conversationID"]))
|
if(!isset($_POST["conversationID"]))
|
||||||
Rest_fatal_error("501", "Please specify a conversation ID !");
|
Rest_fatal_error(400, "Please specify a conversation ID !");
|
||||||
$conversationID = toInt($_POST["conversationID"]);
|
$conversationID = toInt($_POST["conversationID"]);
|
||||||
|
|
||||||
//Check if the user is a conversation moderator or not
|
//Check if the user is a conversation moderator or not
|
||||||
@ -156,4 +156,19 @@ class conversationsController{
|
|||||||
//Success
|
//Success
|
||||||
return array("success" => "Conversation informations were successfully updated !");
|
return array("success" => "Conversation informations were successfully updated !");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find (create ?) and return private conversation ID
|
||||||
|
*
|
||||||
|
* @url POST /conversations/getPrivate
|
||||||
|
*/
|
||||||
|
public function findPrivate(){
|
||||||
|
|
||||||
|
user_login_required();
|
||||||
|
|
||||||
|
//Check for parametres
|
||||||
|
if(!isset($_POST['user1']) OR !isset($_POST['user2']))
|
||||||
|
Rest_fatal_error(400, "Please check your parametres")
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -36,7 +36,7 @@ class friendsController{
|
|||||||
|
|
||||||
//Check parametres
|
//Check parametres
|
||||||
if(!isset($_POST["friendID"]) OR !isset($_POST['accept']))
|
if(!isset($_POST["friendID"]) OR !isset($_POST['accept']))
|
||||||
Rest_fatal_error(501, "Please check your parametres !");
|
Rest_fatal_error(400, "Please check your parametres !");
|
||||||
|
|
||||||
//Extract informations and process request
|
//Extract informations and process request
|
||||||
$friendID = toInt($_POST['friendID']);
|
$friendID = toInt($_POST['friendID']);
|
||||||
|
@ -18,7 +18,7 @@ class userController
|
|||||||
public function connectUSER(){
|
public function connectUSER(){
|
||||||
//Check variables sent in request
|
//Check variables sent in request
|
||||||
if(!isset($_POST['userMail']) OR !isset($_POST['userPassword']))
|
if(!isset($_POST['userMail']) OR !isset($_POST['userPassword']))
|
||||||
throw new RestException(401, "Missing data !");
|
throw new RestException(400, "Missing data !");
|
||||||
|
|
||||||
//Retrieve database connection
|
//Retrieve database connection
|
||||||
$db = CS::get()->db;;
|
$db = CS::get()->db;;
|
||||||
|
Loading…
Reference in New Issue
Block a user