]> git.mxchange.org Git - friendica.git/blobdiff - mod/ping.php
Class file relocations
[friendica.git] / mod / ping.php
index 59fa52121411429ae6acff8bb90f8b9743d4badd..00620ddeb5936096a02233fea1992c9fc7661668 100644 (file)
@@ -2,6 +2,8 @@
 
 use Friendica\App;
 use Friendica\Core\System;
+use Friendica\Core\PConfig;
+use Friendica\Database\DBM;
 
 require_once('include/datetime.php');
 require_once('include/bbcode.php');
@@ -129,7 +131,7 @@ function ping_init(App $a)
                        intval(local_user()), intval(local_user())
                );
 
-               if (dbm::is_result($items_unseen)) {
+               if (DBM::is_result($items_unseen)) {
                        $arr = array('items' => $items_unseen);
                        call_hooks('network_ping', $arr);
 
@@ -146,7 +148,7 @@ function ping_init(App $a)
                        if (intval(feature_enabled(local_user(), 'groups'))) {
                                // Find out how unseen network posts are spread across groups
                                $group_counts = groups_count_unseen();
-                               if (dbm::is_result($group_counts)) {
+                               if (DBM::is_result($group_counts)) {
                                        foreach ($group_counts as $group_count) {
                                                if ($group_count['count'] > 0) {
                                                        $groups_unseen[] = $group_count;
@@ -157,7 +159,7 @@ function ping_init(App $a)
 
                        if (intval(feature_enabled(local_user(), 'forumlist_widget'))) {
                                $forum_counts = ForumManager::count_unseen_items();
-                               if (dbm::is_result($forums_counts)) {
+                               if (DBM::is_result($forums_counts)) {
                                        foreach ($forums_counts as $forum_count) {
                                                if ($forum_count['count'] > 0) {
                                                        $forums_unseen[] = $forum_count;
@@ -196,7 +198,7 @@ function ping_init(App $a)
                                FROM `contact` RIGHT JOIN `register` ON `register`.`uid` = `contact`.`uid`
                                WHERE `contact`.`self` = 1");
 
-                       if (dbm::is_result($regs)) {
+                       if (DBM::is_result($regs)) {
                                $register_count = $regs[0]['total'];
                        }
                }
@@ -211,12 +213,12 @@ function ping_init(App $a)
                                dbesc(datetime_convert('UTC', 'UTC', 'now + 7 days')),
                                dbesc(datetime_convert('UTC', 'UTC', 'now'))
                        );
-                       if (dbm::is_result($ev)) {
+                       if (DBM::is_result($ev)) {
                                Cache::set($cachekey, $ev, CACHE_HOUR);
                        }
                }
 
-               if (dbm::is_result($ev)) {
+               if (DBM::is_result($ev)) {
                        $all_events = count($ev);
 
                        if ($all_events) {
@@ -254,7 +256,7 @@ function ping_init(App $a)
                $data['birthdays']        = $birthdays;
                $data['birthdays-today']  = $birthdays_today;
 
-               if (dbm::is_result($notifs)) {
+               if (DBM::is_result($notifs)) {
                        foreach ($notifs as $notif) {
                                if ($notif['seen'] == 0) {
                                        $sysnotify_count ++;
@@ -263,7 +265,7 @@ function ping_init(App $a)
                }
 
                // merge all notification types in one array
-               if (dbm::is_result($intros)) {
+               if (DBM::is_result($intros)) {
                        foreach ($intros as $intro) {
                                $notif = array(
                                        'href'    => System::baseUrl() . '/notifications/intros/' . $intro['id'],
@@ -278,7 +280,7 @@ function ping_init(App $a)
                        }
                }
 
-               if (dbm::is_result($mails)) {
+               if (DBM::is_result($mails)) {
                        foreach ($mails as $mail) {
                                $notif = array(
                                        'href'    => System::baseUrl() . '/message/' . $mail['id'],
@@ -293,7 +295,7 @@ function ping_init(App $a)
                        }
                }
 
-               if (dbm::is_result($regs)) {
+               if (DBM::is_result($regs)) {
                        foreach ($regs as $reg) {
                                $notif = array(
                                        'href'    => System::baseUrl() . '/admin/users/',
@@ -329,7 +331,7 @@ function ping_init(App $a)
                };
                usort($notifs, $sort_function);
 
-               if (dbm::is_result($notifs)) {
+               if (DBM::is_result($notifs)) {
                        // Are the nofications called from the regular process or via the friendica app?
                        $regularnotifications = (intval($_GET['uid']) && intval($_GET['_']));
 
@@ -477,7 +479,12 @@ function ping_get_notifications($uid)
 
                        if ($notification["visible"] && !$notification["spam"] &&
                                !$notification["deleted"] && !is_array($result[$notification["parent"]])) {
-                               $result[$notification["parent"]] = $notification;
+                               // Should we condense the notifications or show them all?
+                               if (PConfig::get(local_user(), 'system', 'detailed_notif')) {
+                                       $result[$notification["id"]] = $notification;
+                               } else {
+                                       $result[$notification["parent"]] = $notification;
+                               }
                        }
                }
        } while ((count($result) < 50) && !$quit);