mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Get the list of friends of a user.
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Main user class
 | 
			
		||||
 *
 | 
			
		||||
 * @author Pierre HUBER
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
class User{
 | 
			
		||||
@@ -496,6 +496,35 @@ class User{
 | 
			
		||||
		return $result[0]["bloquecommentaire"] == 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Check whether a user allow a public access over its friends list or not
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param int $userID The ID of the user
 | 
			
		||||
	 * @return bool True if the friends list of the user is public / FALSE else
 | 
			
		||||
	 */
 | 
			
		||||
	public function isFriendsListPublic(int $userID) : bool {
 | 
			
		||||
		
 | 
			
		||||
		//Fetch the information in the database
 | 
			
		||||
		$conditions = "WHERE ID = ?";
 | 
			
		||||
		$condValues = array($userID);
 | 
			
		||||
		$fields = array("liste_amis_publique");
 | 
			
		||||
 | 
			
		||||
		//Perform the request
 | 
			
		||||
		$result = CS::get()->db->select(
 | 
			
		||||
			$this->userTable,
 | 
			
		||||
			$conditions,
 | 
			
		||||
			$condValues,
 | 
			
		||||
			$fields
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
		//Check for errors
 | 
			
		||||
		if(count($result) == 0)
 | 
			
		||||
			return FAlSE;
 | 
			
		||||
 | 
			
		||||
		//Return result
 | 
			
		||||
		return $result[0]["liste_amis_publique"] == 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Crypt user password
 | 
			
		||||
	 *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user