mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 12:14:12 +00:00 
			
		
		
		
	Can check if a user is the owner of a comment or not.
This commit is contained in:
		@@ -102,6 +102,21 @@ class Comments {
 | 
			
		||||
		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
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user