mirror of
				https://github.com/Mibew/design.git
				synced 2025-11-04 04:15:14 +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
 | 
			
		||||
	 * @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;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user