]> git.mxchange.org Git - friendica-addons.git/commitdiff
Replaced deprecated functionalities
authorMichael <heluecht@pirati.ca>
Sun, 7 Nov 2021 14:01:30 +0000 (14:01 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 7 Nov 2021 14:01:30 +0000 (14:01 +0000)
nitter/nitter.php
windowsphonepush/windowsphonepush.php

index 49808a126974622055611d0d43fe6bbb1908e9d1..e7cbb1af050e244bb6cbf98bcc14876a60ab7eb2 100644 (file)
  */
 
 use Friendica\App;
-use Friendica\Core\Addon;
+use Friendica\Core\Hook;
 use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function nitter_install()
 {
-       Addon::registerHook ('prepare_body_final', 'addon/nitter/nitter.php', 'nitter_render');
+       Hook::register('prepare_body_final', 'addon/nitter/nitter.php', 'nitter_render');
 }
 
 /* Handle the send data from the admin settings
index 4201db661b6f88dd7f23e1e157addf3c8694c30b..e5295cc391518fda6bb9d19af9ce4b14ff6a7fa9 100644 (file)
@@ -440,11 +440,16 @@ function windowsphonepush_login(App $a)
                throw new UnauthorizedException('This api requires login');
        }
 
-       $user_id = User::authenticate($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
+       try {
+               $user_id = User::getIdFromPasswordAuthentication($_SERVER['PHP_AUTH_USER'], trim($_SERVER['PHP_AUTH_PW']));
+               if ($user_id) {
+                       $record = DBA::selectFirst('user', [], ['uid' => $user_id]);
+               }
+       } catch (Exception $ex) {
+               $record = [];
+       }
 
-       if ($user_id) {
-               $record = DBA::selectFirst('user', [], ['uid' => $user_id]);
-       } else {
+       if (empty($record)) {
                Logger::info('API_login failure: ' . print_r($_SERVER, true));
                header('WWW-Authenticate: Basic realm="Friendica"');
                throw new UnauthorizedException('This api requires login');