]> git.mxchange.org Git - friendica.git/commitdiff
Further improvement of the contact menu
authorMichael Vogel <icarus@dabo.de>
Sun, 4 Oct 2015 21:41:13 +0000 (23:41 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 4 Oct 2015 21:41:13 +0000 (23:41 +0200)
include/conversation.php

index 143dd4e424c4043d61249f3acc5f90fe207546ba..0a337405553a3c69acad2b029ef47d18542cf904 100644 (file)
@@ -792,10 +792,16 @@ function best_link_url($item,&$sparkle,$ssl_state = false) {
                        if($a->contacts[$clean_url]['network'] === NETWORK_DFRN) {
                                $best_url = $a->get_baseurl($ssl_state) . '/redir/' . $a->contacts[$clean_url]['id'];
                                $sparkle = true;
-                       }
-                       else
+                       } else
                                $best_url = $a->contacts[$clean_url]['url'];
                }
+       } elseif (local_user()) {
+               $r = q("SELECT `id`, `network` FROM `contact` WHERE `network` = '%s' AND `uid` = %d AND `nurl` = '%s'",
+                       dbesc(NETWORK_DFRN), intval(local_user()), dbesc(normalise_link($clean_url)));
+               if ($r) {
+                       $best_url = $a->get_baseurl($ssl_state).'/redir/'.$r[0]['id'];
+                       $sparkle = true;
+               }
        }
        if(! $best_url) {
                if(strlen($item['author-link']))
@@ -848,13 +854,16 @@ function item_photo_menu($item){
                $profile_link = zrl($profile_link);
                if(local_user() && local_user() == $item['uid'] && link_compare($item['url'],$item['author-link'])) {
                        $cid = $item['contact-id'];
-               }
-               else {
-                       $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' ORDER BY `uid` DESC LIMIT 1",
-                               intval($item['uid']), normalise_link($item['author-link']));
-                       if ($r)
+               } else {
+                       $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' ORDER BY `uid` DESC LIMIT 1",
+                               intval(local_user()), dbesc(normalise_link($item['author-link'])));
+                       if ($r) {
                                $cid = $r[0]["id"];
-                       else
+
+                               if ($r[0]["network"] == NETWORK_DIASPORA)
+                                       $pm_url = $a->get_baseurl($ssl_state) . '/message/new/' . $cid;
+
+                       } else
                                $cid = 0;
                }
        }