]> git.mxchange.org Git - friendica.git/blobdiff - mod/notifications.php
Merge pull request #2172 from tobiasd/20151212-frosticons
[friendica.git] / mod / notifications.php
index 44f6dd5675ffeda3610674adfd1ce86b47173837..a267b7c95826921e75504b2a8cb77e5499ad6a8b 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 include_once("include/bbcode.php");
+include_once("include/contact_selectors.php");
+include_once("include/Scrape.php");
 
 function notifications_post(&$a) {
 
@@ -138,7 +140,8 @@ function notifications_content(&$a) {
 
                $r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`,
                                `gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
-                               `gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`
+                               `gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
+                               `gcontact`.`network` AS `gnetwork`
                        FROM `intro`
                                LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
                                LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
@@ -152,6 +155,7 @@ function notifications_content(&$a) {
                        $tpl = get_markup_template("intros.tpl");
 
                        foreach($r as $rr) {
+
                                if($rr['fid']) {
 
                                        $return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
@@ -162,7 +166,7 @@ function notifications_content(&$a) {
                                                '$intro_id' => $rr['intro_id'],
                                                '$madeby' => sprintf( t('suggested by %s'),$rr['name']),
                                                '$contact_id' => $rr['contact-id'],
-                                               '$photo' => ((x($rr,'fphoto')) ? $rr['fphoto'] : "images/person-175.jpg"),
+                                               '$photo' => ((x($rr,'fphoto')) ? proxy_url($rr['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
                                                '$fullname' => $rr['fname'],
                                                '$url' => zrl($rr['furl']),
                                                '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
@@ -206,7 +210,27 @@ function notifications_content(&$a) {
                                        ));
                                }
 
+                               $header = $rr["name"];
+
+                               $ret = probe_url($rr["url"]);
+
+                               if ($rr['gnetwork'] == "")
+                                       $rr['gnetwork'] = $ret["network"];
+
+                               if ($ret["addr"] != "")
+                                       $header .= " <".$ret["addr"].">";
+
+                               $header .= " (".network_to_name($rr['gnetwork'], $rr['url']).")";
+
+                               // Don't show these data until you are connected. Diaspora is doing the same.
+                               if($rr['gnetwork'] === NETWORK_DIASPORA) {
+                                       $rr['glocation'] = "";
+                                       $rr['gabout'] = "";
+                                       $rr['ggender'] = "";
+                               }
+
                                $notif_content .= replace_macros($tpl, array(
+                                       '$header' => htmlentities($header),
                                        '$str_notifytype' => t('Notification type: '),
                                        '$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
                                        '$dfrn_text' => $dfrn_text,
@@ -214,12 +238,11 @@ function notifications_content(&$a) {
                                        '$uid' => $_SESSION['uid'],
                                        '$intro_id' => $rr['intro_id'],
                                        '$contact_id' => $rr['contact-id'],
-                                       '$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo']) : "images/person-175.jpg"),
+                                       '$photo' => ((x($rr,'photo')) ? proxy_url($rr['photo'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
                                        '$fullname' => $rr['name'],
+                                       '$location' => bbcode($rr['glocation'], false, false),
                                        '$location_label' => t('Location:'),
-                                       '$location' => $rr['glocation'],
-                                       '$location_label' => t('Location:'),
-                                       '$about' => proxy_parse_html(bbcode($rr['gabout'], false, false)),
+                                       '$about' => bbcode($rr['gabout'], false, false),
                                        '$about_label' => t('About:'),
                                        '$keywords' => $rr['gkeywords'],
                                        '$keywords_label' => t('Tags:'),
@@ -227,7 +250,9 @@ function notifications_content(&$a) {
                                        '$gender_label' => t('Gender:'),
                                        '$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
                                        '$activity' => array('activity', t('Post a new friend activity'), (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0), t('if applicable')),
-                                       '$url' => zrl($rr['url']),
+                                       '$url' => $rr['url'],
+                                       '$zrl' => zrl($rr['url']),
+                                       '$url_label' => t('Profile URL'),
                                        '$knowyou' => $knowyou,
                                        '$approve' => t('Approve'),
                                        '$note' => $rr['note'],
@@ -278,7 +303,7 @@ function notifications_content(&$a) {
                                                $notif_content .= replace_macros($tpl_item_likes,array(
                                                        //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
-                                                       '$item_image' => $it['author-avatar'],
+                                                       '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
                                                        '$item_text' => sprintf( t("%s liked %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
                                                ));
@@ -288,7 +313,7 @@ function notifications_content(&$a) {
                                                $notif_content .= replace_macros($tpl_item_dislikes,array(
                                                        //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
-                                                       '$item_image' => $it['author-avatar'],
+                                                       '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
                                                        '$item_text' => sprintf( t("%s disliked %s's post"), $it['author-name'], $it['pname']),
                                                        '$item_when' => relative_date($it['created'])
                                                ));
@@ -303,7 +328,7 @@ function notifications_content(&$a) {
                                                $notif_content .= replace_macros($tpl_item_friends,array(
                                                        //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
-                                                       '$item_image' => $it['author-avatar'],
+                                                       '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
                                                        '$item_text' => sprintf( t("%s is now friends with %s"), $it['author-name'], $it['fname']),
                                                        '$item_when' => relative_date($it['created'])
                                                ));
@@ -318,7 +343,7 @@ function notifications_content(&$a) {
                                                $notif_content .= replace_macros($tpl,array(
                                                        //'$item_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$it['parent'],
                                                        '$item_link' => $a->get_baseurl(true).'/display/'.$it['pguid'],
-                                                       '$item_image' => $it['author-avatar'],
+                                                       '$item_image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO),
                                                        '$item_text' => $item_text,
                                                        '$item_when' => relative_date($it['created'])
                                                ));
@@ -351,7 +376,7 @@ function notifications_content(&$a) {
                        foreach ($r as $it) {
                                $notif_content .= replace_macros($not_tpl,array(
                                        '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'],
-                                       '$item_image' => $it['photo'],
+                                       '$item_image' => proxy_url($it['photo'], false, PROXY_SIZE_MICRO),
                                        '$item_text' => strip_tags(bbcode($it['msg'])),
                                        '$item_when' => relative_date($it['date'])
                                ));