Ejemplo n.º 1
0
Archivo: Sql.php Proyecto: k42b3/psx-ws
 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)));
 }
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
 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));
 }
Ejemplo n.º 4
0
    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');
        }
    }