]> git.mxchange.org Git - friendica.git/blobdiff - mod/network.php
show creative commons coverage on registration page
[friendica.git] / mod / network.php
index 5958a5905052d588b1e417222c38ee010be590c8..43c55b8e3f4dee124e16a27e94aec165be6fa430 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");
 
@@ -34,10 +38,11 @@ function network_content(&$a, $update = 0) {
        
                $a->page['htmlhead'] .= replace_macros($tpl, array(
                        '$baseurl' => $a->get_baseurl(),
-                       '$geotag' => $geotag
+                       '$geotag' => $geotag,
+                       '$nickname' => $a->user['nickname']
                ));
 
-               require_once('view/acl_selectors.php');
+               require_once('include/acl_selectors.php');
 
                $tpl = load_view_file("view/jot.tpl");
                
@@ -140,32 +145,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,18 +156,22 @@ 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']) 
-                               || strlen($item['deny_cid']) || strlen($item['deny_gid']))
+
+                       $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
+                               || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
                                ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
                                : '<div class="wall-item-lock"></div>');
 
+
                        // Top-level wall post not written by the wall owner (wall-to-wall)
                        // First figure out who owns it. 
 
@@ -255,15 +242,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 +264,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>' : '');
@@ -286,6 +276,12 @@ function network_content(&$a, $update = 0) {
                                        $location = '<span class="smalltext">' . $coord . '</span>';
                        }
 
+                       $indent = (($item['parent'] != $item['item_id']) ? ' comment' : '');
+
+                       if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
+                               $indent .= ' shiny'; 
+
+
                        // Build the HTML
 
                        $o .= replace_macros($template,array(
@@ -296,11 +292,11 @@ function network_content(&$a, $update = 0) {
                                '$osparkle' => $osparkle,
                                '$sparkle' => $sparkle,
                                '$title' => $item['title'],
-                               '$body' => bbcode($item['body']),
+                               '$body' => smilies(bbcode($item['body'])),
                                '$ago' => relative_date($item['created']),
                                '$lock' => $lock,
                                '$location' => $location,
-                               '$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''),
+                               '$indent' => $indent,
                                '$owner_url' => $owner_url,
                                '$owner_photo' => $owner_photo,
                                '$owner_name' => $owner_name,