diff options
author | friendica <redmatrix@redmatrix.me> | 2015-04-07 13:51:51 -0700 |
---|---|---|
committer | friendica <redmatrix@redmatrix.me> | 2015-04-07 13:51:51 -0700 |
commit | 558246257c4cbc91b55884b3d6252e41858b9955 (patch) | |
tree | 57135caf33564c1dba45d0ae6ea8b57f1c49dfaf /mod | |
parent | 5bc7c0e7988765998d44f005a9e7121848888660 (diff) | |
download | volse-hubzilla-558246257c4cbc91b55884b3d6252e41858b9955.tar.gz volse-hubzilla-558246257c4cbc91b55884b3d6252e41858b9955.tar.bz2 volse-hubzilla-558246257c4cbc91b55884b3d6252e41858b9955.zip |
separate the hub query since it changes the logic default and cannot easily be grouped
Diffstat (limited to 'mod')
-rw-r--r-- | mod/dirsearch.php | 11 |
1 files changed, 7 insertions, 4 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); } |