Improve dba::selectFirst calls

- Fix remaining $r[0] references
- Rename $r to meaningful names
This commit is contained in:
Hypolite Petovan 2018-01-11 03:26:30 -05:00
parent 465e1d6a5c
commit 5fc4927764
29 changed files with 228 additions and 250 deletions

View file

@ -63,11 +63,10 @@ class FKOAuth1 extends OAuthServer
$a->timezone = $a->user['timezone'];
}
$r = dba::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
if (DBM::is_result($r)) {
$a->contact = $r;
$a->cid = $r['id'];
$contact = dba::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
if (DBM::is_result($contact)) {
$a->contact = $contact;
$a->cid = $contact['id'];
$_SESSION['cid'] = $a->cid;
}

View file

@ -88,10 +88,9 @@ class FKOAuthDataStore extends OAuthDataStore
*/
public function lookup_nonce($consumer, $token, $nonce, $timestamp)
{
$r = dba::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
if (DBM::is_result($r)) {
return new \OAuthToken($r['id'], $r['secret']);
$token = dba::selectFirst('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp]);
if (DBM::is_result($token)) {
return new \OAuthToken($token['id'], $token['secret']);
}
return null;