mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-18 16:18:04 +00:00
First post request
This commit is contained in:
@ -162,12 +162,8 @@ class friendsController{
|
||||
|
||||
user_login_required(); //Login required
|
||||
|
||||
//Check if the a friendID has been specified
|
||||
if(!isset($_POST['friendID']))
|
||||
Rest_fatal_error(400, "Please specify a friend ID !");
|
||||
|
||||
//Get it
|
||||
$friendID = toInt($_POST['friendID']);
|
||||
$friendID = getPostUserID('friendID');
|
||||
|
||||
//Prepare the response
|
||||
$response = array(
|
||||
|
@ -8,5 +8,32 @@
|
||||
*/
|
||||
|
||||
class postsController {
|
||||
|
||||
|
||||
/**
|
||||
* Get user posts
|
||||
*
|
||||
* @url POST /posts/get_user
|
||||
*/
|
||||
public function getUserPosts(){
|
||||
|
||||
//Get user ID
|
||||
$userID = getPostUserID("userID");
|
||||
|
||||
//Check if user is allowed to access informations or not
|
||||
if(!CS::get()->components->user->userAllowed(userID, $userID))
|
||||
Rest_fatal_error(401, "You are not allowed to access this user posts !");
|
||||
|
||||
//Check if there is a startpoint for the posts
|
||||
if(isset($_POST['startFrom'])){
|
||||
$startFrom = toInt($_POST['startFrom']);
|
||||
}
|
||||
else
|
||||
$startFrom = 0; //No start point
|
||||
|
||||
//Get visibility level for the post
|
||||
$visibility_level = CS::get()->components->posts->getUserVisibility(userID, $userID);
|
||||
|
||||
return CS::get()->components->posts->getUserPosts(userID, $userID, $visibility_level, $startFrom);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user