]> git.mxchange.org Git - friendica.git/blobdiff - mod/notifications.php
Merge pull request #3047 from annando/1612-indexlength
[friendica.git] / mod / notifications.php
index fd7f0c33deb13a109dfce887ffa431bc593fa647..ed15f14177a45d4b2b1d94f530eeb7eb6f87e4ef 100644 (file)
@@ -11,7 +11,7 @@ require_once("include/network.php");
 
 function notifications_post(&$a) {
 
-       if(! local_user()) {
+       if (! local_user()) {
                goaway(z_root());
        }
 
@@ -27,7 +27,7 @@ function notifications_post(&$a) {
                        intval(local_user())
                );
 
-               if(count($r)) {
+               if (dbm::is_result($r)) {
                        $intro_id = $r[0]['id'];
                        $contact_id = $r[0]['contact-id'];
                }
@@ -67,7 +67,7 @@ function notifications_post(&$a) {
 
 function notifications_content(&$a) {
 
-       if(! local_user()) {
+       if (! local_user()) {
                notice( t('Permission denied.') . EOL);
                return;
        }
@@ -95,10 +95,7 @@ function notifications_content(&$a) {
                nav_set_selected('introductions');
                $notif_header = t('Notifications');
 
-               if(($a->argc > 2) && ($a->argv[2] == 'all'))
-                       $all = 1;
-               else
-                       $all = 0;
+               $all = (($a->argc > 2) && ($a->argv[2] == 'all'));
 
                $notifs = $nm->introNotifs($all, $startrec, $perpage);
 
@@ -151,8 +148,8 @@ function notifications_content(&$a) {
 
                // The link to switch between ignored and normal connection requests
                $notif_show_lnk = array(
-                       'href' => ($all === 0 ? 'notifications/intros/all' : 'notifications/intros' ),
-                       'text' => ($all === 0 ? t('Show Ignored Requests') : t('Hide Ignored Requests'))
+                       'href' => (!$all ? 'notifications/intros/all' : 'notifications/intros' ),
+                       'text' => (!$all ? t('Show Ignored Requests') : t('Hide Ignored Requests'))
                );
 
                // Loop through all introduction notifications.This creates an array with the output html for each
@@ -288,8 +285,10 @@ function notifications_content(&$a) {
                                '$item_label' => $it['label'],
                                '$item_link' => $it['link'],
                                '$item_image' => $it['image'],
-                               '$item_text' => $it['text'],
+                               '$item_url' => $it['url'],
+                               '$item_text' => htmlentities($it['text']),
                                '$item_when' => $it['when'],
+                               '$item_ago' => $it['ago'],
                                '$item_seen' => $it['seen'],
                        ));
                }
@@ -308,7 +307,6 @@ function notifications_content(&$a) {
                        $notif_nocontent = sprintf( t('No more %s notifications.'), $notifs['ident']);
        }
 
-
        $o .= replace_macros($notif_tpl, array(
                '$notif_header' => $notif_header,
                '$tabs' => $tabs,