public function isTokenValid($token) { $tokenAuth = $this->find('first', array('conditions' => array('Token.token' => $token))); if ($tokenAuth) { $expiryDate = $tokenAuth['Token']['token_expiry_date']; if (CakeTime::gmt($expiryDate) < CakeTime::gmt()) { return false; } else { return $tokenAuth['Token']; } } else { return false; } }
/** * Returns gmt as a UNIX timestamp. * * @param int|string|DateTime $string UNIX timestamp, strtotime() valid string or DateTime object * * @return int UNIX timestamp * @see CakeTime::gmt() * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#formatting */ public function gmt($string = NULL) { return $this->_engine->gmt($string); }