public function save($opEndpoint, Association $assoc) { $now = new DateTime(); $this->sql->insert($this->table, array('opEndpoint' => $opEndpoint, 'assocHandle' => $assoc->getAssocHandle(), 'assocType' => $assoc->getAssocType(), 'sessionType' => $assoc->getSessionType(), 'secret' => $assoc->getSecret(), 'expires' => $assoc->getExpire(), 'date' => $now->format(DateTime::SQL))); }
public function save($opEndpoint, Association $assoc) { $key = md5($opEndpoint); $this->container[$key] = array('opEndpoint' => $opEndpoint, 'assocHandle' => $assoc->getAssocHandle(), 'assocType' => $assoc->getAssocType(), 'sessionType' => $assoc->getSessionType(), 'secret' => $assoc->getSecret(), 'expires' => $assoc->getExpire()); }
public function save($opEndpoint, Association $assoc) { $data = unserialize(FileObject::getContents($this->file)); $key = md5($opEndpoint); $data[$key] = array('opEndpoint' => $opEndpoint, 'assocHandle' => $assoc->getAssocHandle(), 'assocType' => $assoc->getAssocType(), 'sessionType' => $assoc->getSessionType(), 'secret' => $assoc->getSecret(), 'expires' => $assoc->getExpire()); FileObject::putContents($this->file, serialize($data)); }
public function onAsocciation(Association $assoc) { $sql = <<<SQL SELECT \t`assoc`.`id`, \t`assoc`.`assocHandle`, \t`assoc`.`expires`, \t`assoc`.`date` FROM \t{$this->registry['table.openid_assoc']} `assoc` WHERE \t`assoc`.`assocHandle` = ? SQL; $row = $this->sql->getRow($sql, array($assoc->getAssocHandle())); if (empty($row)) { $date = new DateTime('NOW', $this->registry['core.default_timezone']); $this->sql->insert($this->registry['table.openid_assoc'], array('assocHandle' => $assoc->getAssocHandle(), 'assocType' => $assoc->getAssocType(), 'sessionType' => $assoc->getSessionType(), 'secret' => $assoc->getSecret(), 'expires' => self::EXPIRE, 'date' => $date->format(DateTime::SQL))); return self::EXPIRE; } else { throw new Exception('Association already exists'); } }