Improved conversations ID security check

This commit is contained in:
Pierre
2017-12-29 18:03:41 +01:00
parent 50c2848a1b
commit a0373ccdb6
2 changed files with 43 additions and 2 deletions

View File

@ -655,6 +655,21 @@ class conversations {
return $messages;
}
/**
* Check whether a conversation exists or not
*
* @param int $convID The ID of the conversation to check
* @return bool TRUE if it exists / false else
*/
public function exist(int $convID) : bool {
//Perform a request on the database
$tableName = $this->conversationsListTable;
return CS::get()->db->count($tableName, "WHERE ID = ?", array($convID)) > 0;
}
}
//Register component