From 1613a1052eb086397b9778331f04bf9ee26ea402 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Fri, 21 Sep 2012 15:57:54 +0000 Subject: [PATCH] Add token check to the Thread::load method --- src/messenger/webim/libs/classes/thread.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/messenger/webim/libs/classes/thread.php b/src/messenger/webim/libs/classes/thread.php index 9add6ed9..996b0b16 100644 --- a/src/messenger/webim/libs/classes/thread.php +++ b/src/messenger/webim/libs/classes/thread.php @@ -222,7 +222,7 @@ Class Thread { * @param int $id ID of the thread to load * @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 if (empty($id)) { return false; @@ -235,6 +235,12 @@ Class Thread { if ($thread->id != $id) { return false; } + // Check last token + if (! is_null($last_token)) { + if ($thread->lastToken != $last_token) { + return false; + } + } return $thread; }