From: Michael Date: Sun, 7 Nov 2021 14:01:30 +0000 (+0000) Subject: Replaced deprecated functionalities X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=25b267c6dae4810298ceda4786b59e0cff22a849;p=friendica-addons.git Replaced deprecated functionalities --- diff --git a/nitter/nitter.php b/nitter/nitter.php index 49808a12..e7cbb1af 100644 --- a/nitter/nitter.php +++ b/nitter/nitter.php @@ -24,13 +24,13 @@ */ 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 diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php index 4201db66..e5295cc3 100644 --- a/windowsphonepush/windowsphonepush.php +++ b/windowsphonepush/windowsphonepush.php @@ -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');