]> git.mxchange.org Git - friendica.git/blobdiff - mod/directory.php
Merge branch 'master' of git://github.com/friendika/friendika
[friendica.git] / mod / directory.php
index 49aac657ce45e9f0cf50f2afea49ef7f876345d7..b0cee76cb72330e59ae8e537dd24b72de0e2dcee 100644 (file)
@@ -39,14 +39,16 @@ function directory_content(&$a) {
                $search = dbesc($search);
        $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, `user`.`nickname`, `locality`,`region`,`country-name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
 
+       $publish = ((get_config('system','publish_all')) ? '' : " AND `publish` = 1 " );
 
-       $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ");
+
+       $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ");
        if(count($r))
                $a->set_pager_total($r[0]['total']);
 
 
 
-       $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `publish` = 1 AND `user`.`blocked` = 0 $sql_extra ORDER BY `name` ASC LIMIT %d , %d ",
+       $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`, `user`.`timezone` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra ORDER BY `name` ASC LIMIT %d , %d ",
                intval($a->pager['start']),
                intval($a->pager['itemspage'])
        );
@@ -83,7 +85,7 @@ function directory_content(&$a) {
                        if(strlen($rr['gender']))
                                $details .= '<br />Gender: ' . $rr['gender'];
 
-                       $o .= replace_macros($tpl,array(
+                       $entry = replace_macros($tpl,array(
                                '$id' => $rr['id'],
                                '$profile-link' => $profile_link,
                                '$photo' => $rr[$photo],
@@ -94,7 +96,14 @@ function directory_content(&$a) {
 
                        ));
 
+                       $arr = array('contact' => $rr, 'entry' => $entry);
+
+                       call_hooks('directory_item', $arr);
+
+                       $o .= $entry;
+
                }
+
                $o .= "<div class=\"directory-end\" ></div>\r\n";
                $o .= paginate($a);