X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FNotifications%2FPing.php;h=603d6408c7bde7c008f73772441ab63d15fd76e4;hb=0a45bdd3b71ec0f8744abb3830858a91a4bca146;hp=c16dec311c51e84ea3bdd3b7f1e7bcc414956763;hpb=f8b70ef9f016114b33d0607a627b1b2ca650c3ea;p=friendica.git diff --git a/src/Module/Notifications/Ping.php b/src/Module/Notifications/Ping.php index c16dec311c..603d6408c7 100644 --- a/src/Module/Notifications/Ping.php +++ b/src/Module/Notifications/Ping.php @@ -1,6 +1,6 @@ session->getLocalUserId() && $this->session->get('page_flags', '') != User::PAGE_FLAGS_COMMUNITY) { if ($this->pconfig->get($this->session->getLocalUserId(), 'system', 'detailed_notif')) { $notifications = $this->notificationRepo->selectDetailedForUser($this->session->getLocalUserId()); @@ -151,18 +152,18 @@ class Ping extends BaseModule } } - $compute_group_counts = $this->config->get('system','compute_group_counts'); - if ($network_count && $compute_group_counts) { - // Find out how unseen network posts are spread across groups - foreach (Group::countUnseen() as $group_count) { - if ($group_count['count'] > 0) { - $groups_unseen[] = $group_count; + $compute_circle_counts = $this->config->get('system','compute_group_counts') ?? $this->config->get('system','compute_circle_counts'); + if ($network_count && $compute_circle_counts) { + // Find out how unseen network posts are spread across circles + foreach (Circle::countUnseen() as $circle_count) { + if ($circle_count['count'] > 0) { + $circles_unseen[] = $circle_count; } } - foreach (ForumManager::countUnseenItems() as $forum_count) { - if ($forum_count['count'] > 0) { - $forums_unseen[] = $forum_count; + foreach (GroupManager::countUnseenItems() as $group_count) { + if ($group_count['count'] > 0) { + $groups_unseen[] = $group_count; } } } @@ -174,7 +175,7 @@ class Ping extends BaseModule $myurl = $this->session->getMyUrl(); $mail_count = $this->database->count('mail', ["`uid` = ? AND NOT `seen` AND `from-url` != ?", $this->session->getLocalUserId(), $myurl]); - if (intval($this->config->get('config', 'register_policy')) === Register::APPROVE && $this->app->isSiteAdmin()) { + if (intval($this->config->get('config', 'register_policy')) === Register::APPROVE && $this->session->isSiteAdmin()) { $registrations = \Friendica\Model\Register::getPending(); $register_count = count($registrations); } @@ -244,7 +245,7 @@ class Ping extends BaseModule $registration['url'], $this->l10n->t('{0} requested registration'), new \DateTime($registration['created'], new \DateTimeZone('UTC')), - new Uri($this->baseUrl->get(true) . '/moderation/users/pending') + new Uri($this->baseUrl . '/moderation/users/pending') ); } } else { @@ -253,7 +254,7 @@ class Ping extends BaseModule $registrations[0]['url'], $this->l10n->t('{0} and %d others requested registration', count($registrations) - 1), new \DateTime($registrations[0]['created'], new \DateTimeZone('UTC')), - new Uri($this->baseUrl->get(true) . '/moderation/users/pending') + new Uri($this->baseUrl . '/moderation/users/pending') ); } @@ -289,15 +290,15 @@ class Ping extends BaseModule $data['events-today'] = $today_event_count; $data['birthdays'] = $birthday_count; $data['birthdays-today'] = $today_birthday_count; + $data['circles'] = $circles_unseen; $data['groups'] = $groups_unseen; - $data['forums'] = $forums_unseen; $data['notification'] = ($notification_count < 50) ? $notification_count : '49+'; $data['notifications'] = $navNotifications; $data['sysmsgs'] = [ - 'notice' => $this->systemMessages->flushNotices(), - 'info' => $this->systemMessages->flushInfos(), + 'notice' => array_map([Strings::class, 'escapeHtml'], $this->systemMessages->flushNotices()), + 'info' => array_map([Strings::class, 'escapeHtml'], $this->systemMessages->flushInfos()), ]; if (isset($_GET['callback'])) {