]> git.mxchange.org Git - friendica.git/blobdiff - mod/network.php
use sha1 keys for friends as well
[friendica.git] / mod / network.php
index 97a82a705c8a5ae12d5a1cec873ab1590f38f04c..6e781f4fa3df418a53b08afb9a2a5011b7bfc9b2 100644 (file)
@@ -3,6 +3,8 @@
 
 function network_init(&$a) {
        require_once('include/group.php');
+       if(! x($a->page,'aside'))
+               $a->page['aside'] = '';
        $a->page['aside'] .= group_side('network','network');
 }
 
@@ -10,7 +12,9 @@ function network_init(&$a) {
 function network_content(&$a, $update = 0) {
 
        if(! local_user())
-               return;
+               return '';
+
+       $o = '';
 
        require_once("include/bbcode.php");
 
@@ -37,7 +41,7 @@ function network_content(&$a, $update = 0) {
                        '$geotag' => $geotag
                ));
 
-               require_once('view/acl_selectors.php');
+               require_once('include/acl_selectors.php');
 
                $tpl = load_view_file("view/jot.tpl");
                
@@ -140,32 +144,10 @@ function network_content(&$a, $update = 0) {
        $dlike = array();
        
        if(count($r)) {
-               foreach($r as $item) {
-
-                       $sparkle = '';
 
-                       if(($item['verb'] == ACTIVITY_LIKE) && ($item['id'] != $item['parent'])) {
-                               $url = $item['url'];
-                               if(($item['network'] === 'dfrn') && (! $item['self'])) { 
-                                       $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
-                                       $sparkle = ' class="sparkle"';
-                               }
-                               if(! is_array($alike[$item['parent'] . '-l']))
-                                       $alike[$item['parent'] . '-l'] = array();
-                               $alike[$item['parent']] ++;
-                               $alike[$item['parent'] . '-l'][] = '<a href="'. $url . '"' . $sparkle . '>' . $item['name'] . '</a>';
-                       }
-                       if(($item['verb'] == ACTIVITY_DISLIKE) && ($item['id'] != $item['parent'])) {
-                               $url = $item['url'];
-                               if(($item['network'] === 'dfrn') && (! $item['self'])) { 
-                                       $url = $a->get_baseurl() . '/redir/' . $item['contact-id'];
-                                       $sparkle = ' class="sparkle"';
-                               }
-                               if(! is_array($dlike[$item['parent'] . '-l']))
-                                       $dlike[$item['parent'] . '-l'] = array();
-                               $dlike[$item['parent']] ++;
-                               $dlike[$item['parent'] . '-l'][] = '<a href="'. $url . '"' . $sparkle . '>' . $item['name'] . '</a>';
-                       }
+               foreach($r as $item) {
+                       like_puller($a,$item,$alike,'like');
+                       like_puller($a,$item,$dlike,'dislike');
                }
 
                foreach($r as $item) {
@@ -173,11 +155,13 @@ function network_content(&$a, $update = 0) {
                        $comment = '';
                        $template = $tpl;
                        $commentww = '';
+                       $owner_url = $owner_photo = $owner_name = '';
 
                        $profile_url = $item['url'];
+
                        $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
 
-                       if((($item['verb'] == ACTIVITY_LIKE) || ($item['verb'] == ACTIVITY_DISLIKE)) && ($item['id'] != $item['parent'])) 
+                       if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent']))
                                continue;
 
                        $lock = (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
@@ -200,7 +184,7 @@ function network_content(&$a, $update = 0) {
                                        $template = $wallwall;
                                        $commentww = 'ww';      
                                }
-                               if($item['type'] === 'remote' && ($item['owner-link'] != $item['author-link'])) {
+                               if(($item['type'] === 'remote') && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) {
                                        // Could be anybody. 
                                        $owner_url = $item['owner-link'];
                                        $owner_photo = $item['owner-avatar'];
@@ -255,15 +239,18 @@ function network_content(&$a, $update = 0) {
 
                        // Post was remotely authored.
 
-                       $profile_name = ((strlen($item['author-name'])) ? $item['author-name'] : $item['name']);
-                       $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $thumb);
+                       $diff_author = (($item['url'] !== $item['author-link']) ? true : false);
+
+                       $profile_name   = (((strlen($item['author-name']))   && $diff_author) ? $item['author-name']   : $item['name']);
+                       $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
+
 
                        $profile_link = $profile_url;
 
                        // Can we use our special contact URL for this author? 
 
                        if(strlen($item['author-link'])) {
-                               if($item['author-link'] == $item['url'] && (! $item['self'])) {
+                               if($item['author-link'] == $item['url'] && ($item['network'] === 'dfrn') && (! $item['self'])) {
                                        $profile_link = $redirect_url;
                                        $sparkle = ' sparkle';
                                }
@@ -274,8 +261,8 @@ function network_content(&$a, $update = 0) {
                        }
 
 
-                       $like    = (($alike[$item['id']]) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
-                       $dislike = (($dlike[$item['id']]) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
+                       $like    = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
+                       $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
 
                        $location = (($item['location']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
                        $coord = (($item['coord']) ? '<a target="map" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');