]> git.mxchange.org Git - friendica.git/blobdiff - mod/content.php
Events: Now with guid.
[friendica.git] / mod / content.php
index ab0fe7e4bf2a37a884f4154f297b2ad05d6e4797..49cff74d2d9f4e4eac2ffcce3529f87fafcabc55 100644 (file)
@@ -15,7 +15,7 @@
 // fast - e.g. one or two milliseconds to fetch parent items for the current content,
 // and 10-20 milliseconds to fetch all the child items.
 
-if(! function_exists('content_content')) {
+
 function content_content(&$a, $update = 0) {
 
        require_once('include/conversation.php');
@@ -61,7 +61,7 @@ function content_content(&$a, $update = 0) {
 
        $o = '';
 
-
+       
 
        $contact_id = $a->cid;
 
@@ -100,7 +100,7 @@ function content_content(&$a, $update = 0) {
                        $def_acl = array('allow_cid' => $str);
        }
 
-
+       
        $sql_options  = (($star) ? " and starred = 1 " : '');
        $sql_options .= (($bmark) ? " and bookmark = 1 " : '');
 
@@ -137,7 +137,7 @@ function content_content(&$a, $update = 0) {
        }
        elseif($cid) {
 
-               $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d
+               $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d 
                                AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
                        intval($cid)
                );
@@ -304,9 +304,9 @@ function content_content(&$a, $update = 0) {
        echo json_encode($o);
        killme();
 }
-}
 
-if(! function_exists('render_content')) {
+
+
 function render_content(&$a, $items, $mode, $update, $preview = false) {
 
        require_once('include/bbcode.php');
@@ -373,7 +373,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                if($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
 
-                       // "New Item View" on network page or search page results
+                       // "New Item View" on network page or search page results 
                        // - just loop through the items and format them minimally for display
 
                        //$tpl = get_markup_template('search_item.tpl');
@@ -389,7 +389,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                $sparkle     = '';
 
                                if($mode === 'search' || $mode === 'community') {
-                                       if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE)))
+                                       if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) 
                                                && ($item['id'] != $item['parent']))
                                                continue;
                                        $nickname = $item['nickname'];
@@ -420,7 +420,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
                                        $profile_avatar = $a->contacts[$normalised]['thumb'];
                                else
-                                       $profile_avatar = ((strlen($item['author-avatar'])) ? $a->get_cached_avatar_image($item['author-avatar']) : $item['thumb']);
+                                       $profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']));
 
                                $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
                                call_hooks('render_location',$locate);
@@ -436,7 +436,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                $drop = array(
                                        'dropping' => $dropping,
-                                       'select' => t('Select'),
+                                       'select' => t('Select'), 
                                        'delete' => t('Delete'),
                                );
 
@@ -526,11 +526,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                                $comments[$item['parent']] = 1;
                                        else
                                                $comments[$item['parent']] += 1;
-                               } elseif(! x($comments,$item['parent']))
+                               } elseif(! x($comments,$item['parent'])) 
                                        $comments[$item['parent']] = 0; // avoid notices later on
                        }
 
-                       // map all the like/dislike activities for each parent item
+                       // map all the like/dislike activities for each parent item 
                        // Store these in the $alike and $dlike arrays
 
                        foreach($items as $item) {
@@ -615,16 +615,16 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        $comment_lastcollapsed = true;
                                }
 
-                               $redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ;
+                               $redirect_url = 'redir/' . $item['cid'] ;
 
-                               $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
+                               $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
                                        || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
                                        ? t('Private Message')
                                        : false);
 
 
                                // Top-level wall post not written by the wall owner (wall-to-wall)
-                               // First figure out who owns it.
+                               // First figure out who owns it. 
 
                                $osparkle = '';
 
@@ -651,13 +651,13 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                                if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) {
 
                                                        // The author url doesn't match the owner (typically the contact)
-                                                       // and also doesn't match the contact alias.
-                                                       // The name match is a hack to catch several weird cases where URLs are
+                                                       // and also doesn't match the contact alias. 
+                                                       // The name match is a hack to catch several weird cases where URLs are 
                                                        // all over the park. It can be tricked, but this prevents you from
                                                        // seeing "Bob Smith to Bob Smith via Wall-to-wall" and you know darn
-                                                       // well that it's the same Bob Smith.
+                                                       // well that it's the same Bob Smith. 
 
-                                                       // But it could be somebody else with the same name. It just isn't highly likely.
+                                                       // But it could be somebody else with the same name. It just isn't highly likely. 
 
 
                                                        $owner_url = $item['owner-link'];
@@ -666,7 +666,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                                        $template = $wallwall;
                                                        $commentww = 'ww';
                                                        // If it is our contact, use a friendly redirect link
-                                                       if((link_compare($item['owner-link'],$item['url']))
+                                                       if((link_compare($item['owner-link'],$item['url'])) 
                                                                && ($item['network'] === NETWORK_DFRN)) {
                                                                $owner_url = $redirect_url;
                                                                $osparkle = ' sparkle';
@@ -678,7 +678,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                }
 
                                $likebuttons = '';
-                               $shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false);
+                               $shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false); 
 
                                if($page_writeable) {
 /*                                     if($toplevelpost) {  */
@@ -698,7 +698,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                        if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
                                                $comment = replace_macros($cmnt_tpl,array(
-                                                       '$return_path' => '',
+                                                       '$return_path' => '', 
                                                        '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
                                                        '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
                                                        '$id' => $item['item_id'],
@@ -739,7 +739,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                $drop = array(
                                        'dropping' => $dropping,
-                                       'select' => t('Select'),
+                                       'select' => t('Select'), 
                                        'delete' => t('Delete'),
                                );
 
@@ -791,7 +791,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
                                        $profile_avatar = $a->contacts[$normalised]['thumb'];
                                else
-                                       $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $a->get_cached_avatar_image($thumb));
+                                       $profile_avatar = $a->remove_baseurl(((strlen($item['author-avatar']) && $diff_author) ? $item['author-avatar'] : $thumb));
 
                                $like    = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
                                $dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
@@ -805,9 +805,9 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                $shiny = "";
                                if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
-                                       $shiny = 'shiny';
+                                       $shiny = 'shiny'; 
 
-                               //
+                               // 
                                localize_item($item);
 
 
@@ -897,5 +897,5 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
 
        return $threads;
-}
+
 }