]> git.mxchange.org Git - friendica.git/blobdiff - mod/display.php
Merge pull request #2135 from rabuzarus/doxygen
[friendica.git] / mod / display.php
index be5dd7cae38a2e56ac7a2db29812f6669cdb61f1..6b345e6302d1640d572a44c34ca5b099623091cf 100644 (file)
@@ -97,43 +97,10 @@ function display_fetchauthor($a, $item) {
        $profiledata["nickname"] = $item["author-name"];
        $profiledata["name"] = $item["author-name"];
        $profiledata["picdate"] = "";
-       $profiledata["photo"] = proxy_url($item["author-avatar"]);
+       $profiledata["photo"] = proxy_url($item["author-avatar"], false, PROXY_SIZE_SMALL);
        $profiledata["url"] = $item["author-link"];
        $profiledata["network"] = $item["network"];
 
-       // Fetching further contact data from the contact table
-       $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s'",
-               dbesc(normalise_link($profiledata["url"])), intval($item["uid"]), dbesc($item["network"]));
-
-       if (!count($r))
-               $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
-                       dbesc(normalise_link($profiledata["url"])), intval($item["uid"]));
-
-       if (!count($r))
-               $r = q("SELECT `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
-                       dbesc(normalise_link($profiledata["url"])));
-
-       if (count($r)) {
-               $profiledata["photo"] = proxy_url($r[0]["photo"]);
-               $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"];
-       }
-
-       // Fetching profile data from unique contacts
-       $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"])));
-       if (count($r)) {
-               if ($profiledata["photo"] == "")
-                       $profiledata["photo"] = proxy_url($r[0]["avatar"]);
-               if ($profiledata["address"] == "")
-                       $profiledata["address"] = proxy_parse_html(bbcode($r[0]["location"]));
-               if ($profiledata["about"] == "")
-                       $profiledata["about"] = proxy_parse_html(bbcode($r[0]["about"]));
-               if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
-                       $profiledata["nickname"] = $r[0]["nick"];
-       }
-
        // Check for a repeated message
        $skip = false;
        $body = trim($item["body"]);
@@ -187,28 +154,49 @@ function display_fetchauthor($a, $item) {
 
                $profiledata["address"] = "";
                $profiledata["about"] = "";
+       }
 
-               // Fetching profile data from unique contacts
-               if ($profiledata["url"] != "") {
-                       $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"])));
-                       if (count($r)) {
-                               $profiledata["photo"] = proxy_url($r[0]["avatar"]);
-                               $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"];
-                       }
+       // Fetching further contact data from the contact table
+       $r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s'",
+               dbesc(normalise_link($profiledata["url"])), intval($item["uid"]), dbesc($item["network"]));
+
+       if (!count($r))
+               $r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
+                       dbesc(normalise_link($profiledata["url"])), intval($item["uid"]));
+
+       if (!count($r))
+               $r = q("SELECT `uid`, `network`, `photo`, `nick`, `location`, `about` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
+                       dbesc(normalise_link($profiledata["url"])));
+
+       if (count($r)) {
+               if ((($r[0]["uid"] != local_user()) OR !local_user()) AND ($profiledata["network"] == NETWORK_DIASPORA)) {
+                       $r[0]["location"] = "";
+                       $r[0]["about"] = "";
                }
+
+               $profiledata["photo"] = proxy_url($r[0]["photo"], false, PROXY_SIZE_SMALL);
+               $profiledata["address"] = bbcode($r[0]["location"]);
+               $profiledata["about"] = bbcode($r[0]["about"]);
+               if ($r[0]["nick"] != "")
+                       $profiledata["nickname"] = $r[0]["nick"];
+       }
+
+       // Fetching profile data from unique contacts
+       $r = q("SELECT `avatar`, `nick`, `location`, `about` FROM `unique_contacts` WHERE `url` = '%s'", dbesc(normalise_link($profiledata["url"])));
+       if (count($r)) {
+               if ($profiledata["photo"] == "")
+                       $profiledata["photo"] = proxy_url($r[0]["avatar"], false, PROXY_SIZE_SMALL);
+               if (($profiledata["address"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA))
+                       $profiledata["address"] = bbcode($r[0]["location"]);
+               if (($profiledata["about"] == "") AND ($profiledata["network"] != NETWORK_DIASPORA))
+                       $profiledata["about"] = bbcode($r[0]["about"]);
+               if (($profiledata["nickname"] == "") AND ($r[0]["nick"] != ""))
+                       $profiledata["nickname"] = $r[0]["nick"];
        }
 
        if (local_user()) {
                if (in_array($profiledata["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
                        $profiledata["remoteconnect"] = $a->get_baseurl()."/follow?url=".urlencode($profiledata["url"]);
-               //if ($profiledata["network"] == NETWORK_DFRN) {
-               //      $connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"])."&addr=".bin2hex($a->get_baseurl()."/profile/".$a->user["nickname"]);
-               //      $profiledata["remoteconnect"] = $connect;
-               //} elseif ($profiledata["network"] == NETWORK_DIASPORA)
-               //      $profiledata["remoteconnect"] = $a->get_baseurl()."/contacts?add=".GetProfileUsername($profiledata["url"], "", true);
        } elseif ($profiledata["network"] == NETWORK_DFRN) {
                $connect = str_replace("/profile/", "/dfrn_request/", $profiledata["url"]);
                $profiledata["remoteconnect"] = $connect;