]> git.mxchange.org Git - friendica.git/blobdiff - mod/display.php
Merge pull request #1406 from annando/1502-scrape-last-item
[friendica.git] / mod / display.php
index f2fde578781ae101b7c5215c345139c8ed3f7b8f..f483977cd4f847aebc639bbe93a4f85a499b921d 100644 (file)
@@ -41,6 +41,18 @@ function display_init(&$a) {
                                $itemuid = $r[0]["uid"];
                        }
                }
+
+               // Is it an item with uid=0?
+               if ($nick == "") {
+                       $r = q("SELECT `item`.`id`, `item`.`parent`, `item`.`author-name`,
+                               `item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`body`
+                               FROM `item` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
+                                       AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''
+                                       AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''
+                                       AND `item`.`private` = 0 AND `item`.`uid` = 0
+                                       AND `item`.`guid` = '%s'", $a->argv[1]);
+                               //      AND `item`.`private` = 0 AND `item`.`wall` = 1
+               }
                if (count($r)) {
                        if ($r[0]["id"] != $r[0]["parent"])
                                $r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`
@@ -94,8 +106,8 @@ function display_fetchauthor($a, $item) {
                normalise_link($profiledata["url"]), $item["uid"]);
        if (count($r)) {
                $profiledata["photo"] = proxy_url($r[0]["photo"]);
-               $profiledata["address"] = bbcode($r[0]["location"]);
-               $profiledata["about"] = bbcode($r[0]["about"]);
+               $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
+               $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
                if ($r[0]["nick"] != "")
                        $profiledata["nickname"] = $r[0]["nick"];
        }
@@ -106,9 +118,9 @@ function display_fetchauthor($a, $item) {
                if ($profiledata["photo"] == "")
                        $profiledata["photo"] = proxy_url($r[0]["avatar"]);
                if ($profiledata["address"] == "")
-                       $profiledata["address"] = bbcode($r[0]["location"]);
+                       $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
                if ($profiledata["about"] == "")
-                       $profiledata["about"] = bbcode($r[0]["about"]);
+                       $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
                if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
                        $profiledata["nickname"] = $r[0]["nick"];
        }
@@ -172,8 +184,8 @@ function display_fetchauthor($a, $item) {
                        $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", normalise_link($profiledata["url"]));
                        if (count($r)) {
                                $profiledata["photo"] = proxy_url($r[0]["avatar"]);
-                               $profiledata["address"] = bbcode($r[0]["location"]);
-                               $profiledata["about"] = bbcode($r[0]["about"]);
+                               $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
+                               $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
                                if ($r[0]["nick"] != "")
                                        $profiledata["nickname"] = $r[0]["nick"];
                        }
@@ -252,6 +264,18 @@ function display_content(&$a, $update = 0) {
                                        $nick = $r[0]["nickname"];
                                }
                        }
+                       if ($nick == "") {
+                               $r = q("SELECT `item`.`id` FROM `item`
+                                       WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
+                                               AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''
+                                               AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''
+                                               AND `item`.`private` = 0  AND `item`.`uid` = 0
+                                               AND `item`.`guid` = '%s'", $a->argv[1]);
+                                       //      AND `item`.`private` = 0 AND `item`.`wall` = 1
+                               if (count($r)) {
+                                       $item_id = $r[0]["id"];
+                               }
+                       }
                }
        }