]> git.mxchange.org Git - friendica.git/blobdiff - mod/dirfind.php
Merge dirfind into template_rework
[friendica.git] / mod / dirfind.php
index 488e10fa169d5e758f2f9fca4e5b68928b0b7628..9e02a47e2075e98421c526f026440e345ebe3a6b 100644 (file)
@@ -5,6 +5,11 @@ require_once('include/Contact.php');
 
 function dirfind_init(&$a) {
 
+       if(! local_user()) {
+               notice( t('Permission denied.') . EOL );
+               return;
+       }
+
        if(! x($a->page,'aside'))
                $a->page['aside'] = '';
 
@@ -33,10 +38,6 @@ function dirfind_content(&$a, $prefix = "") {
 
        $o = '';
 
-       $o .= replace_macros(get_markup_template("section_title.tpl"),array(
-               '$title' => sprintf( t('People Search - %s'), $search)
-       ));
-
        if($search) {
 
                if ($local) {
@@ -116,7 +117,6 @@ function dirfind_content(&$a, $prefix = "") {
 
                        $id = 0;
 
-                       $tpl = get_markup_template('match.tpl');
                        foreach($j->results as $jj) {
 
                                // If We already know this contact then don't show the "connect" button
@@ -132,22 +132,33 @@ function dirfind_content(&$a, $prefix = "") {
                                } else {
                                        $connlnk = $a->get_baseurl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url);
                                        $conntxt = t('Connect');
-                                       $photo_menu = array(array(t("Connect/Follow"), $connlnk));
+                                       $photo_menu = array(array(t("View Profile"), zrl($jj->url)));
+                                       $photo_menu[] = array(t("Connect/Follow"), $connlnk);
                                }
 
                                $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo);
 
-                               $o .= replace_macros($tpl,array(
-                                       '$url' => zrl($jj->url),
-                                       '$name' => $jj->name,
-                                       '$photo' => proxy_url($jj->photo),
-                                       '$tags' => $jj->tags,
-                                       '$conntxt' => $conntxt,
-                                       '$connlnk' => $connlnk,
-                                       '$photo_menu' => $photo_menu,
-                                       '$id' => ++$id,
-                               ));
+                               $entry = array(
+                                       'url' => zrl($jj->url),
+                                       'name' => htmlentities($jj->name),
+                                       'photo' => proxy_url($jj->photo, false, PROXY_SIZE_THUMB),
+                                       'tags' => $jj->tags,
+                                       'conntxt' => $conntxt,
+                                       'connlnk' => $connlnk,
+                                       'photo_menu' => $photo_menu,
+                                       'id' => ++$id,
+                               );
+                               $entries[] = $entry;
                        }
+
+               $tpl = get_markup_template('match.tpl');
+
+               $o .= replace_macros($tpl,array(
+                       'title' => sprintf( t('People Search - %s'), $search),
+                       '$entries' => $entries,
+                       '$paginate' => paginate($a),
+               ));
+
                }
                else {
                        info( t('No matches') . EOL);
@@ -155,7 +166,5 @@ function dirfind_content(&$a, $prefix = "") {
 
        }
 
-       $o .= '<div class="clear"></div>';
-       $o .= paginate($a);
        return $o;
 }