X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fapi.php;h=9d3bae70a7f9e03f61468f5d173ec2d1ff9833df;hb=0fe832ef8aeafa1ddba793a8b084005cf070f1f4;hp=16d18a37ca162785701c041ff0b09d2ef2ce382b;hpb=da60893590a302bf94dfd86f5586f26509160d34;p=friendica.git diff --git a/include/api.php b/include/api.php index 16d18a37ca..9d3bae70a7 100644 --- a/include/api.php +++ b/include/api.php @@ -222,11 +222,11 @@ function api_login(App $a) } else { $user_id = User::authenticate(trim($user), trim($password)); if ($user_id) { - $record = dba::selectOne('user', [], ['uid' => $user_id]); + $record = dba::selectFirst('user', [], ['uid' => $user_id]); } } - if (!$record || !count($record)) { + if (!DBM::is_result($record)) { logger('API_login failure: ' . print_r($_SERVER, true), LOGGER_DEBUG); header('WWW-Authenticate: Basic realm="Friendica"'); //header('HTTP/1.0 401 Unauthorized'); @@ -473,7 +473,7 @@ function api_rss_extra(App $a, $arr, $user_info) */ function api_unique_id_to_nurl($id) { - $r = dba::selectOne('contact', array('nurl'), array('uid' => 0, 'id' => $id)); + $r = dba::selectFirst('contact', array('nurl'), array('uid' => 0, 'id' => $id)); if (DBM::is_result($r)) { return $r["nurl"]; @@ -792,7 +792,7 @@ function api_get_user(App $a, $contact_id = null) // If this is a local user and it uses Frio, we can get its color preferences. if ($ret['self']) { - $theme_info = dba::selectOne('user', ['theme'], ['uid' => $ret['uid']]); + $theme_info = dba::selectFirst('user', ['theme'], ['uid' => $ret['uid']]); if ($theme_info['theme'] === 'frio') { $schema = PConfig::get($ret['uid'], 'frio', 'schema'); if ($schema && ($schema != '---')) { @@ -4870,22 +4870,22 @@ function api_friendica_remoteauth() // traditional DFRN - $r = dba::selectOne('contact', [], ['uid' => api_user(), 'nurl' => $c_url]); + $contact = dba::selectFirst('contact', [], ['uid' => api_user(), 'nurl' => $c_url]); - if (!DBM::is_result($r) || ($r['network'] !== NETWORK_DFRN)) { + if (!DBM::is_result($contact) || ($contact['network'] !== NETWORK_DFRN)) { throw new BadRequestException("Unknown contact"); } - $cid = $r['id']; + $cid = $contact['id']; - $dfrn_id = defaults($r, 'issued-id', $r['dfrn-id']); + $dfrn_id = defaults($contact, 'issued-id', $contact['dfrn-id']); - if ($r['duplex'] && $r['issued-id']) { - $orig_id = $r['issued-id']; + if ($contact['duplex'] && $contact['issued-id']) { + $orig_id = $contact['issued-id']; $dfrn_id = '1:' . $orig_id; } - if ($r['duplex'] && $r['dfrn-id']) { - $orig_id = $r['dfrn-id']; + if ($contact['duplex'] && $contact['dfrn-id']) { + $orig_id = $contact['dfrn-id']; $dfrn_id = '0:' . $orig_id; } @@ -4901,10 +4901,10 @@ function api_friendica_remoteauth() intval(time() + 45) ); - logger($r['name'] . ' ' . $sec, LOGGER_DEBUG); + logger($contact['name'] . ' ' . $sec, LOGGER_DEBUG); $dest = ($url ? '&destination_url=' . $url : ''); goaway( - $r['poll'] . '?dfrn_id=' . $dfrn_id + $contact['poll'] . '?dfrn_id=' . $dfrn_id . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest . $quiet );