]> git.mxchange.org Git - friendica.git/blobdiff - mod/display.php
Merge branch 'fixes/poller-warning' into rhaeder-develop
[friendica.git] / mod / display.php
index 41cad5c6a92c81bd107b84d3a85f4df4500922bc..97261e267d659bc882eede5e00ea313ccc571581 100644 (file)
@@ -158,23 +158,25 @@ function display_fetchauthor($a, $item) {
        $showdetails = ($profiledata["network"] != NETWORK_DIASPORA);
 
        // Fetching further contact data from the contact table
-       $r = q("SELECT `uid`, `network`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
+       $r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
                FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s' AND `rel` IN (%d, %d)",
-               dbesc(normalise_link($profiledata["url"])), intval($item["uid"]), dbesc($item["network"]),
+               dbesc(normalise_link($profiledata["url"])), intval(local_user()), dbesc($item["network"]),
                intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
        if (!count($r))
-               $r = q("SELECT `uid`, `network`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
+               $r = q("SELECT `uid`, `network`, `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`
                        FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `rel` IN (%d, %d)",
-                       dbesc(normalise_link($profiledata["url"])), intval($item["uid"]),
+                       dbesc(normalise_link($profiledata["url"])), intval(local_user()),
                        intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND));
 
        if (count($r)) {
+               $profiledata["name"] = $r[0]["name"];
                $profiledata["photo"] = $r[0]["photo"];
                $profiledata["nickname"] = $r[0]["nick"];
                $profiledata["addr"] = $r[0]["addr"];
                $profiledata["keywords"] = $r[0]["keywords"];
+               $profiledata["network"] = $r[0]["network"];
 
-               if (($r[0]["uid"] != 0) OR $showdetails) {
+               if (local_user() OR $showdetails) {
                        $showdetails = true;
                        $profiledata["address"] = $r[0]["location"];
                        $profiledata["about"] = $r[0]["about"];
@@ -184,17 +186,26 @@ function display_fetchauthor($a, $item) {
 
        // Fetching profile data from global contacts
        if ($profiledata["network"] != NETWORK_FEED) {
-               $r = q("SELECT `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
+               $r = q("SELECT `name`, `photo`, `nick`, `addr`, `location`, `about`, `gender`, `keywords`, `network` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($profiledata["url"])));
                if (count($r)) {
+                       $profiledata["name"] = $r[0]["name"];
                        $profiledata["photo"] = $r[0]["photo"];
                        $profiledata["nickname"] = $r[0]["nick"];
                        $profiledata["addr"] = $r[0]["addr"];
-                       $profiledata["keywords"] = $r[0]["keywords"];
+                       $profiledata["network"] = $r[0]["network"];
+
+                       if ($r[0]["keywords"])
+                               $profiledata["keywords"] = $r[0]["keywords"];
 
                        if ($showdetails) {
-                               $profiledata["address"] = $r[0]["location"];
-                               $profiledata["about"] = $r[0]["about"];
-                               $profiledata["gender"] = $r[0]["gender"];
+                               if ($r[0]["location"])
+                                       $profiledata["address"] = $r[0]["location"];
+
+                               if ($r[0]["about"])
+                                       $profiledata["about"] = $r[0]["about"];
+
+                               if ($r[0]["gender"])
+                                       $profiledata["gender"] = $r[0]["gender"];
                        }
                }
        }
@@ -336,6 +347,8 @@ function display_content(&$a, $update = 0) {
                return;
        }
 
+       // We need the editor here to be able to reshare an item.
+
        if ($is_owner) {
                $x = array(
                        'is_owner' => true,