mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
Add token check to the Thread::load method
This commit is contained in:
parent
5c7d525871
commit
1613a1052e
@ -222,7 +222,7 @@ Class Thread {
|
|||||||
* @param int $id ID of the thread to load
|
* @param int $id ID of the thread to load
|
||||||
* @return boolean|Thread Returns an object of the Thread class or boolean false on failure
|
* @return boolean|Thread Returns an object of the Thread class or boolean false on failure
|
||||||
*/
|
*/
|
||||||
public static function load($id) {
|
public static function load($id, $last_token = null) {
|
||||||
// Check $id
|
// Check $id
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
return false;
|
return false;
|
||||||
@ -235,6 +235,12 @@ Class Thread {
|
|||||||
if ($thread->id != $id) {
|
if ($thread->id != $id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Check last token
|
||||||
|
if (! is_null($last_token)) {
|
||||||
|
if ($thread->lastToken != $last_token) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return $thread;
|
return $thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user