<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
*/
class Delegation extends BaseModule
{
- public static function post(array $parameters = [])
+ protected function post(array $request = [])
{
if (!local_user()) {
return;
$ret = [];
Hook::callAll('home_init', $ret);
- DI::baseUrl()->redirect('profile/' . DI::app()->getLoggedInUserNickname());
- // NOTREACHED
+ notice($this->t('You are now logged in as %s', $user['username']));
+
+ DI::baseUrl()->redirect('network');
}
- public static function content(array $parameters = [])
+ protected function content(array $request = []): string
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
$identities[$key]['selected'] = ($identity['nickname'] === DI::app()->getLoggedInUserNickname());
- $condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], Notification\Type::INTRO, Notification\Type::MAIL];
+ $condition = ["`msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", Notification\Type::INTRO, Notification\Type::MAIL];
$params = ['distinct' => true, 'expression' => 'parent'];
- $notifications = DBA::count('notify', $condition, $params);
+ $notifications = DI::notify()->countForUser($identity['uid'], $condition, $params);
$params = ['distinct' => true, 'expression' => 'convid'];
$notifications += DBA::count('mail', ['uid' => $identity['uid'], 'seen' => false], $params);
- $notifications += DBA::count('intro', ['blocked' => false, 'ignore' => false, 'uid' => $identity['uid']]);
+ $notifications += DI::intro()->countActiveForUser($identity['uid']);
$identities[$key]['notifications'] = $notifications;
}