mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-27 15:59:29 +00:00
Can check if a user is the owner of a comment or not.
This commit is contained in:
parent
249c85c1db
commit
37b3893849
@ -102,6 +102,21 @@ class Comments {
|
|||||||
return isset($commentInfos["postID"]) ? $commentInfos["postID"] : 0;
|
return isset($commentInfos["postID"]) ? $commentInfos["postID"] : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a user is the owner of a comment or not
|
||||||
|
*
|
||||||
|
* @param int $userID The ID of the user to check
|
||||||
|
* @param int $commentID The ID of the comment to check
|
||||||
|
* @return bool TRUE if the user is the owner of the post / FALSE else
|
||||||
|
*/
|
||||||
|
public function is_owner(int $userID, int $commentID) : bool {
|
||||||
|
return CS::get()->db->count(
|
||||||
|
$this::COMMENTS_TABLE,
|
||||||
|
"WHERE ID = ? AND ID_personne = ?",
|
||||||
|
array($commentID, $userID)
|
||||||
|
) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a comment informations
|
* Parse a comment informations
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user