]> git.mxchange.org Git - friendica.git/blobdiff - src/Network/FKOAuth1.php
Ignore code blocks when extracting tags
[friendica.git] / src / Network / FKOAuth1.php
index b9d1a65396a31eeff75f488216dfa8436f27678d..33fdf0ac22732b48002be5bdb5e73642bf711320 100644 (file)
@@ -4,11 +4,11 @@
  */
 namespace Friendica\Network;
 
-use Friendica\Core\Addon;
+use Friendica\Core\Hook;
+use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
-use Friendica\Database\DBM;
 use Friendica\Util\DateTimeFormat;
 use OAuthServer;
 use OAuthSignatureMethod_HMAC_SHA1;
@@ -32,15 +32,16 @@ class FKOAuth1 extends OAuthServer
        /**
         * @param string $uid user id
         * @return void
+        * @throws HTTPException\InternalServerErrorException
         */
        public function loginUser($uid)
        {
-               logger("FKOAuth1::loginUser $uid");
-               $a = get_app();
+               Logger::log("FKOAuth1::loginUser $uid");
+               $a = \get_app();
                $record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
 
-               if (!DBM::is_result($record)) {
-                       logger('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), LOGGER_DEBUG);
+               if (!DBA::isResult($record)) {
+                       Logger::log('FKOAuth1::loginUser failure: ' . print_r($_SERVER, true), Logger::DEBUG);
                        header('HTTP/1.0 401 Unauthorized');
                        die('This api requires login');
                }
@@ -61,7 +62,7 @@ class FKOAuth1 extends OAuthServer
                }
 
                $contact = DBA::selectFirst('contact', [], ['uid' => $_SESSION['uid'], 'self' => 1]);
-               if (DBM::is_result($contact)) {
+               if (DBA::isResult($contact)) {
                        $a->contact = $contact;
                        $a->cid = $contact['id'];
                        $_SESSION['cid'] = $a->cid;
@@ -69,6 +70,6 @@ class FKOAuth1 extends OAuthServer
 
                DBA::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]);
 
-               Addon::callHooks('logged_in', $a->user);
+               Hook::callAll('logged_in', $a->user);
        }
 }