]> git.mxchange.org Git - friendica.git/blobdiff - mod/content.php
Enhance the database structure checks when they failed.
[friendica.git] / mod / content.php
index f974eecdd11fe0aecb8e09b5432348a77638b4ee..1e44bf160c508e2e13f6e3078c7fa2d53eaa03a5 100644 (file)
@@ -176,7 +176,7 @@ function content_content(&$a, $update = 0) {
                if($tag) {
                        //$sql_extra = sprintf(" AND `term`.`term` = '%s' AND `term`.`otype` = %d AND `term`.`type` = %d ",
                        //      dbesc(protect_sprintf($search)), intval(TERM_OBJ_POST), intval(TERM_HASHTAG));
-                       //$sql_table = "`term` LEFT JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
+                       //$sql_table = "`term` INNER JOIN `item` ON `item`.`id` = `term`.`oid` AND `item`.`uid` = `term`.`uid` ";
 
                        $sql_extra = "";
                        $sql_table = sprintf("`item` INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
@@ -216,7 +216,7 @@ function content_content(&$a, $update = 0) {
                        `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`, `contact`.`writable`,
                        `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
                        `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
-                       FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+                       FROM $sql_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                        WHERE `item`.`uid` = %d AND `item`.`visible` = 1
                        AND `item`.`deleted` = 0 and `item`.`moderated` = 0
                        $simple_update
@@ -240,7 +240,7 @@ function content_content(&$a, $update = 0) {
                $start = dba_timer();
 
                $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
-                       FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+                       FROM $sql_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                        WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
                        AND `item`.`moderated` = 0 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
                        AND `item`.`parent` = `item`.`id`
@@ -267,7 +267,7 @@ function content_content(&$a, $update = 0) {
                                `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`, `contact`.`writable`,
                                `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
                                `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
-                               FROM $sql_table LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
+                               FROM $sql_table INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
                                WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
                                AND `item`.`moderated` = 0
                                AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
@@ -307,8 +307,8 @@ function content_content(&$a, $update = 0) {
 
 function render_content(&$a, $items, $mode, $update, $preview = false) {
 
-
        require_once('include/bbcode.php');
+       require_once('mod/proxy.php');
 
        $ssl_state = ((local_user()) ? true : false);
 
@@ -361,8 +361,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
        $alike = array();
        $dlike = array();
-       
-       
+
+
        // array with html for each thread (parent+comments)
        $threads = array();
        $threadsid = -1;
@@ -412,7 +412,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                if($sp)
                                        $sparkle = ' sparkle';
                                else
-                                       $profile_link = zrl($profile_link);                                     
+                                       $profile_link = zrl($profile_link);
 
                                $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
                                if(($normalised != 'mailbox') && (x($a->contacts[$normalised])))
@@ -440,7 +440,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                $star = false;
                                $isstarred = "unstarred";
-                               
+
                                $lock = false;
                                $likebuttons = false;
                                $shareable = false;
@@ -463,7 +463,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        $location_e = $location;
                                        $owner_name_e = $owner_name;
                                }
-                               
+
                                //$tmp_item = replace_macros($tpl,array(
                                $tmp_item = array(
                                        'template' => $tpl,
@@ -474,7 +474,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        'name' => $name_e,
                                        'sparkle' => $sparkle,
                                        'lock' => $lock,
-                                       'thumb' => $profile_avatar,
+                                       'thumb' => proxy_url($profile_avatar),
                                        'title' => $title_e,
                                        'body' => $body_e,
                                        'text' => $text_e,
@@ -483,7 +483,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        'indent' => '',
                                        'owner_name' => $owner_name_e,
                                        'owner_url' => $owner_url,
-                                       'owner_photo' => $owner_photo,
+                                       'owner_photo' => proxy_url($owner_photo),
                                        'plink' => get_plink($item),
                                        'edpost' => false,
                                        'isstarred' => $isstarred,
@@ -493,7 +493,8 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        'like' => '',
                                        'dislike' => '',
                                        'comment' => '',
-                                       'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
+                                       //'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state) . '/display/' . $nickname . '/' . $item['id'], 'title'=> t('View in context'))),
+                                       'conv' => (($preview) ? '' : array('href'=> $a->get_baseurl($ssl_state).'/display/'.$item['guid'], 'title'=> t('View in context'))),
                                        'previewing' => $previewing,
                                        'wait' => t('Please wait'),
                                );
@@ -590,7 +591,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        $comments_seen ++;
                                        $comment_lastcollapsed  = false;
                                        $comment_firstcollapsed = false;
-                               }       
+                               }
 
                                $override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false);
                                $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
@@ -782,7 +783,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                if($sp)
                                        $sparkle = ' sparkle';
                                else
-                                       $profile_link = zrl($profile_link);                                     
+                                       $profile_link = zrl($profile_link);
 
                                $normalised = normalise_link((strlen($item['author-link'])) ? $item['author-link'] : $item['url']);
                                if(($normalised != 'mailbox') && (x($a->contacts,$normalised)))
@@ -842,7 +843,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        'comment_lastcollapsed' => $comment_lastcollapsed,
                                        // template to use to render item (wall, walltowall, search)
                                        'template' => $template,
-                                       
+
                                        'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
                                        'tags' => $tags,
                                        'body' => $body_e,
@@ -856,7 +857,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        'profile_url' => $profile_link,
                                        'item_photo_menu' => item_photo_menu($item),
                                        'name' => $name_e,
-                                       'thumb' => $profile_avatar,
+                                       'thumb' => proxy_url($profile_avatar),
                                        'osparkle' => $osparkle,
                                        'sparkle' => $sparkle,
                                        'title' => $title_e,
@@ -866,7 +867,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                        'indent' => $indent,
                                        'shiny' => $shiny,
                                        'owner_url' => $owner_url,
-                                       'owner_photo' => $owner_photo,
+                                       'owner_photo' => proxy_url($owner_photo),
                                        'owner_name' => $owner_name_e,
                                        'plink' => get_plink($item),
                                        'edpost' => $edpost,