]> git.mxchange.org Git - friendica.git/blobdiff - mod/dirfind.php
Merge pull request #5776 from annando/fix-contact
[friendica.git] / mod / dirfind.php
index fd31b2cbf1260a3f24f1da704602e67964d171a5..332fe90f6c48cf5af9b0a170fb8e6783b2b2581a 100644 (file)
@@ -44,7 +44,7 @@ function dirfind_content(App $a, $prefix = "") {
 
        $local = Config::get('system','poco_local_search');
 
-       $search = $prefix.notags(trim($_REQUEST['search']));
+       $search = $prefix.notags(trim(defaults($_REQUEST, 'search', '')));
 
        $header = '';
 
@@ -85,6 +85,7 @@ function dirfind_content(App $a, $prefix = "") {
 
                        $contact = Contact::getDetailsByURL($user_data["url"], local_user());
                        $objresult->cid = $contact["cid"];
+                       $objresult->pcid = $contact["zid"];
 
                        $j->results[] = $objresult;
 
@@ -163,6 +164,7 @@ function dirfind_content(App $a, $prefix = "") {
 
                                $objresult = new stdClass();
                                $objresult->cid = $result["cid"];
+                               $objresult->pcid = $result["zid"];
                                $objresult->name = $result["name"];
                                $objresult->addr = $result["addr"];
                                $objresult->url = $result["url"];
@@ -217,10 +219,16 @@ function dirfind_content(App $a, $prefix = "") {
                                } else {
                                        $connlnk = System::baseUrl().'/follow/?url='.(!empty($jj->connect) ? $jj->connect : $jj->url);
                                        $conntxt = L10n::t('Connect');
-                                       $photo_menu = [
-                                               'profile' => [L10n::t("View Profile"), Contact::magicLink($jj->url)],
-                                               'follow' => [L10n::t("Connect/Follow"), $connlnk]
-                                       ];
+
+                                       $contact = DBA::selectFirst('contact', [], ['id' => $jj->pcid]);
+                                       if (DBA::isResult($contact)) {
+                                               $photo_menu = Contact::photoMenu($contact);
+                                       } else {
+                                               $photo_menu = [];
+                                       }
+
+                                       $photo_menu['profile'] = [L10n::t("View Profile"), Contact::magicLink($jj->url)];
+                                       $photo_menu['follow'] = [L10n::t("Connect/Follow"), $connlnk];
                                }
 
                                $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);