]> git.mxchange.org Git - friendica.git/blobdiff - mod/notifications.php
use /servers instead of /siteinfo for the directory link in invitations
[friendica.git] / mod / notifications.php
index fd7f0c33deb13a109dfce887ffa431bc593fa647..396361e91b5bda012716767d3c2f677a8d2c6e29 100644 (file)
@@ -5,13 +5,15 @@
  * @brief The notifications module
  */
 
+use Friendica\App;
+
 require_once("include/NotificationsManager.php");
 require_once("include/contact_selectors.php");
 require_once("include/network.php");
 
-function notifications_post(&$a) {
+function notifications_post(App $a) {
 
-       if(! local_user()) {
+       if (! local_user()) {
                goaway(z_root());
        }
 
@@ -27,7 +29,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'];
                }
@@ -65,9 +67,9 @@ function notifications_post(&$a) {
        }
 }
 
-function notifications_content(&$a) {
+function notifications_content(App $a) {
 
-       if(! local_user()) {
+       if (! local_user()) {
                notice( t('Permission denied.') . EOL);
                return;
        }
@@ -95,10 +97,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 +150,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
@@ -197,10 +196,14 @@ function notifications_content(&$a) {
                                                if($it['network'] === NETWORK_DFRN) {
                                                        $lbl_knowyou = t('Claims to be known to you: ');
                                                        $knowyou = (($it['knowyou']) ? t('yes') : t('no'));
-                                                       $helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Fan/Admirer" means that you allow to read but you do not want to read theirs. Approve as: ');
+                                                       $helptext = t('Shall your connection be bidirectional or not?');
+                                                       $helptext2 = sprintf(t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.'), $it['name'], $it['name']);
+                                                       $helptext3 = sprintf(t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.'), $it['name']);
                                                } else {
                                                        $knowyou = '';
-                                                       $helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Sharer" means that you allow to read but you do not want to read theirs. Approve as: ');
+                                                       $helptext = t('Shall your connection be bidirectional or not?');
+                                                       $helptext2 = sprintf(t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.'), $it['name'], $it['name']);
+                                                       $helptext3 = sprintf(t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.'), $it['name']);
                                                }
                                        }
 
@@ -208,9 +211,11 @@ function notifications_content(&$a) {
                                                '$intro_id' => $it['intro_id'],
                                                '$friend_selected' => $friend_selected,
                                                '$fan_selected' => $fan_selected,
-                                               '$approve_as' => $helptext,
+                                               '$approve_as1' => $helptext,
+                                               '$approve_as2' => $helptext2,
+                                               '$approve_as3' => $helptext3,
                                                '$as_friend' => t('Friend'),
-                                               '$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Fan/Admirer'))
+                                               '$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Subscriber'))
                                        ));
 
                                        $header = $it["name"];
@@ -220,6 +225,12 @@ function notifications_content(&$a) {
 
                                        $header .= " (".network_to_name($it['network'], $it['url']).")";
 
+                                       if ($it['network'] != NETWORK_DIASPORA) {
+                                               $discard = t('Discard');
+                                       } else {
+                                               $discard = '';
+                                       }
+
                                        $notif_content[] = replace_macros($tpl, array(
                                                '$header' => htmlentities($header),
                                                '$str_notifytype' => t('Notification type: '),
@@ -252,7 +263,7 @@ function notifications_content(&$a) {
                                                '$approve' => t('Approve'),
                                                '$note' => $it['note'],
                                                '$ignore' => t('Ignore'),
-                                               '$discard' => t('Discard'),
+                                               '$discard' => $discard,
 
                                        ));
                                        break;
@@ -288,8 +299,10 @@ function notifications_content(&$a) {
                                '$item_label' => $it['label'],
                                '$item_link' => $it['link'],
                                '$item_image' => $it['image'],
+                               '$item_url' => $it['url'],
                                '$item_text' => $it['text'],
                                '$item_when' => $it['when'],
+                               '$item_ago' => $it['ago'],
                                '$item_seen' => $it['seen'],
                        ));
                }
@@ -308,7 +321,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,