From 558246257c4cbc91b55884b3d6252e41858b9955 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 7 Apr 2015 13:51:51 -0700 Subject: separate the hub query since it changes the logic default and cannot easily be grouped --- mod/dirsearch.php | 11 +++++++---- version.inc | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mod/dirsearch.php b/mod/dirsearch.php index c741d31a3..d997020b2 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -91,6 +91,12 @@ function dirsearch_content(&$a) { else $sync = false; + + if($hub) + $hub_query = " and xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') "; + else + $hub_query = ''; + $sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : ''); $joiner = ' OR '; @@ -99,8 +105,6 @@ function dirsearch_content(&$a) { if($name) $sql_extra .= dir_query_build($joiner,'xchan_name',$name); - if($hub) - $sql_extra .= " and xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') "; if($address) $sql_extra .= dir_query_build($joiner,'xchan_addr',$address); if($city) @@ -248,13 +252,12 @@ function dirsearch_content(&$a) { } else { - $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) and xchan_network = 'zot' and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 $safesql $order $qlimit ", + $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where ( $logic $sql_extra ) $hub_query and xchan_network = 'zot' and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 and not ( xchan_flags & %d )>0 $safesql $order $qlimit ", intval(XCHAN_FLAGS_HIDDEN), intval(XCHAN_FLAGS_ORPHAN), intval(XCHAN_FLAGS_DELETED) ); - $ret['page'] = $page + 1; $ret['records'] = count($r); } diff --git a/version.inc b/version.inc index 18bf58d83..6f0b1c05c 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-04-06.994 +2015-04-07.995 -- cgit v1.2.3