directory search for pubforums using hubzilla directory servers using redmatrix flag value

This commit is contained in:
redmatrix 2015-11-19 16:44:12 -08:00
parent 350519d429
commit 5805a54097

View file

@ -124,8 +124,6 @@ function dirsearch_content(&$a) {
if($keywords) if($keywords)
$sql_extra .= dir_query_build($joiner,'xprof_keywords',$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 // we only support an age range currently. You must set both agege
// (greater than or equal) and agele (less than or equal) // (greater than or equal) and agele (less than or equal)
@ -173,6 +171,9 @@ function dirsearch_content(&$a) {
if($safe < 0) if($safe < 0)
$safesql = " and ( xchan_censored = 1 OR xchan_selfcensored = 1 ) "; $safesql = " and ( xchan_censored = 1 OR xchan_selfcensored = 1 ) ";
if($forums)
$safesql .= " and xchan_pubforum = " . ((intval($forums)) ? '1 ' : '0 ');
if($limit) if($limit)
$qlimit = " LIMIT $limit "; $qlimit = " LIMIT $limit ";
else { else {
@ -185,7 +186,6 @@ function dirsearch_content(&$a) {
} }
} }
if($sort_order == 'normal') { if($sort_order == 'normal') {
$order = " order by xchan_name asc "; $order = " order by xchan_name asc ";
@ -202,6 +202,7 @@ function dirsearch_content(&$a) {
else else
$order = " order by xchan_name_date desc "; $order = " order by xchan_name_date desc ";
if($sync) { if($sync) {
$spkt = array('transactions' => array()); $spkt = array('transactions' => array());
$r = q("select * from updates where ud_date >= '%s' and ud_guid != '' order by ud_date desc", $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); json_return_and_die($spkt);
} }
else { else {
$r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash $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 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 " $safesql $order $qlimit "
); );
$ret['page'] = $page + 1; $ret['page'] = $page + 1;
$ret['records'] = count($r); $ret['records'] = count($r);
} }
if($r) { if($r) {
$entries = array(); $entries = array();