From 5805a540973e6110f148d5be7b68c102382a4e12 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 19 Nov 2015 16:44:12 -0800 Subject: directory search for pubforums using hubzilla directory servers using redmatrix flag value --- mod/dirsearch.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 937564a79..548acbd08 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -124,8 +124,6 @@ function dirsearch_content(&$a) { if($keywords) $sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords); - if($forums) - $safesql .= dir_flag_build(' AND ','xchan_flags',XCHAN_FLAGS_PUBFORUM, $forums); // we only support an age range currently. You must set both agege // (greater than or equal) and agele (less than or equal) @@ -173,6 +171,9 @@ function dirsearch_content(&$a) { if($safe < 0) $safesql = " and ( xchan_censored = 1 OR xchan_selfcensored = 1 ) "; + if($forums) + $safesql .= " and xchan_pubforum = " . ((intval($forums)) ? '1 ' : '0 '); + if($limit) $qlimit = " LIMIT $limit "; else { @@ -185,7 +186,6 @@ function dirsearch_content(&$a) { } } - if($sort_order == 'normal') { $order = " order by xchan_name asc "; @@ -202,6 +202,7 @@ function dirsearch_content(&$a) { else $order = " order by xchan_name_date desc "; + if($sync) { $spkt = array('transactions' => array()); $r = q("select * from updates where ud_date >= '%s' and ud_guid != '' order by ud_date desc", @@ -245,15 +246,20 @@ function dirsearch_content(&$a) { json_return_and_die($spkt); } else { + $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 xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 $safesql $order $qlimit " ); + + + $ret['page'] = $page + 1; $ret['records'] = count($r); } + if($r) { $entries = array(); -- cgit v1.2.3