From 547e24b443a44bffa5f2a0fa742f59f60335a89a Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Mon, 4 Dec 2017 16:33:10 -0500 Subject: [PATCH] Review updates based on review. --- src/Network/FKOAuth1.php | 6 ++---- src/Network/FKOAuthDataStore.php | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Network/FKOAuth1.php b/src/Network/FKOAuth1.php index a323f5cd56..768cae7d1b 100644 --- a/src/Network/FKOAuth1.php +++ b/src/Network/FKOAuth1.php @@ -37,11 +37,9 @@ class FKOAuth1 extends OAuthServer { logger("FKOAuth1::loginUser $uid"); $a = get_app(); - $r = dba::select('user', array(), array('uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1), array('limit' => 1)); + $record = dba::select('user', array(), array('uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1), array('limit' => 1)); - if (DBM::is_result($r)) { - $record = $r; - } else { + if (!DBM::is_result($record)) { logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); header('HTTP/1.0 401 Unauthorized'); die('This api requires login'); diff --git a/src/Network/FKOAuthDataStore.php b/src/Network/FKOAuthDataStore.php index 007908b99b..0fcd01fc5c 100644 --- a/src/Network/FKOAuthDataStore.php +++ b/src/Network/FKOAuthDataStore.php @@ -83,9 +83,8 @@ class FKOAuthDataStore extends OAuthDataStore */ public static function lookup_nonce($consumer, $token, $nonce, $timestamp) { - $s = dba::select('tokens', array('id', 'secret'), array('client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp)); - $r = dba::inArray($s); - + $r = dba::select('tokens', ['id', 'secret'], ['client_id' => $consumer->key, 'id' => $nonce, 'expires' => $timestamp], ['limit' => 1]); + if (DBM::is_result($r)) { return new OAuthToken($r[0]['id'], $r[0]['secret']); } -- 2.39.5