]> git.mxchange.org Git - friendica.git/blobdiff - mod/notifications.php
Merge pull request #4208 from annando/thr-parent
[friendica.git] / mod / notifications.php
index 47e4cd03405f867f2560f5588f3fd4fa3ac5b840..e2de81e6c7f24a7f49dfe41602298fbe7c1d0b10 100644 (file)
@@ -1,18 +1,20 @@
 <?php
-
 /**
  * @file mod/notifications.php
  * @brief The notifications module
  */
+use Friendica\App;
+use Friendica\Content\ContactSelector;
+use Friendica\Core\NotificationsManager;
+use Friendica\Core\System;
+use Friendica\Database\DBM;
 
-require_once("include/NotificationsManager.php");
-require_once("include/contact_selectors.php");
-require_once("include/network.php");
+require_once "include/network.php";
 
-function notifications_post(App &$a) {
+function notifications_post(App $a) {
 
        if (! local_user()) {
-               goaway(z_root());
+               goaway(System::baseUrl());
        }
 
        $request_id = (($a->argc > 1) ? $a->argv[1] : 0);
@@ -27,7 +29,7 @@ function notifications_post(App &$a) {
                        intval(local_user())
                );
 
-               if (dbm::is_result($r)) {
+               if (DBM::is_result($r)) {
                        $intro_id = $r[0]['id'];
                        $contact_id = $r[0]['contact-id'];
                }
@@ -65,7 +67,7 @@ function notifications_post(App &$a) {
        }
 }
 
-function notifications_content(App &$a) {
+function notifications_content(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -194,10 +196,14 @@ function notifications_content(App &$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']);
                                                }
                                        }
 
@@ -205,9 +211,11 @@ function notifications_content(App &$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"];
@@ -215,7 +223,13 @@ function notifications_content(App &$a) {
                                        if ($it["addr"] != "")
                                                $header .= " <".$it["addr"].">";
 
-                                       $header .= " (".network_to_name($it['network'], $it['url']).")";
+                                       $header .= " (".ContactSelector::networkToName($it['network'], $it['url']).")";
+
+                                       if ($it['network'] != NETWORK_DIASPORA) {
+                                               $discard = t('Discard');
+                                       } else {
+                                               $discard = '';
+                                       }
 
                                        $notif_content[] = replace_macros($tpl, array(
                                                '$header' => htmlentities($header),
@@ -244,12 +258,12 @@ function notifications_content(App &$a) {
                                                '$addr' => $it['addr'],
                                                '$lbl_knowyou' => $lbl_knowyou,
                                                '$lbl_network' => t('Network:'),
-                                               '$network' => network_to_name($it['network'], $it['url']),
+                                               '$network' => ContactSelector::networkToName($it['network'], $it['url']),
                                                '$knowyou' => $knowyou,
                                                '$approve' => t('Approve'),
                                                '$note' => $it['note'],
                                                '$ignore' => t('Ignore'),
-                                               '$discard' => t('Discard'),
+                                               '$discard' => $discard,
 
                                        ));
                                        break;
@@ -286,7 +300,7 @@ function notifications_content(App &$a) {
                                '$item_link' => $it['link'],
                                '$item_image' => $it['image'],
                                '$item_url' => $it['url'],
-                               '$item_text' => htmlentities($it['text']),
+                               '$item_text' => $it['text'],
                                '$item_when' => $it['when'],
                                '$item_ago' => $it['ago'],
                                '$item_seen' => $it['seen'],