Example #1
0
 public function getInfo()
 {
     if (!$this->theOneIsSet) {
         $remoteTableName = DbObject::_getTableName($this->remoteClassName);
         $sql = "select * from {$remoteTableName} where {$this->remoteFieldName} = :id:int";
         $row = SqlFetchRow($sql, array('id' => $this->dbObject->getField($this->localFieldName)));
         if ($row) {
             $this->theOne = new $this->remoteClassName($row);
         }
         $this->theOneIsSet = 1;
     }
     return $this->theOne;
 }
Example #2
0
 public static function auth($username, $password)
 {
     $userInfo = SqlFetchRow("SELECT id, password from person where username = :username", array('username' => $username));
     if (!$userInfo) {
         return false;
     }
     $parts = explode('$', $userInfo['password']);
     assert($parts[0] == 'sha1');
     $salt = $parts[1];
     if (self::hashPassword($password, $salt) !== $userInfo['password']) {
         return false;
     }
     return $userInfo['id'];
 }
Example #3
0
 public function getInfo($username)
 {
     return SqlFetchRow('select ' . $this->info['username'] . ' as username, ' . $this->info['password'] . ' as password, ' . $this->info['nonce'] . ' as nonce, ' . $this->info['password_type'] . ' as password_type from ' . $this->info['table'] . ' where ' . $this->info['username'] . ' = :username', array('username' => $username));
 }