allow directory searches to be filtered by (public forums) and/or (! public forums)
This commit is contained in:
parent
746e4860fa
commit
5bb794cc28
@ -567,6 +567,7 @@ function z_readdir($channel_id, $observer_hash, $pathname, $parent_hash = '') {
|
||||
* $arr['deny_cid']
|
||||
* $arr['deny_gid']
|
||||
*/
|
||||
|
||||
function attach_mkdir($channel, $observer_hash, $arr = null) {
|
||||
|
||||
$ret = array('success' => false);
|
||||
|
@ -31,8 +31,9 @@ function directory_content(&$a) {
|
||||
if(x($_REQUEST,'safe'))
|
||||
$safe_mode = (intval($_REQUEST['safe']));
|
||||
|
||||
|
||||
|
||||
$pubforums = null;
|
||||
if(array_key_exists('pubforums',$_REQUEST))
|
||||
$pubforums = intval($_REQUEST['pubforums']);
|
||||
|
||||
$o = '';
|
||||
nav_set_selected('directory');
|
||||
@ -92,6 +93,8 @@ function directory_content(&$a) {
|
||||
$query .= '&keywords=' . urlencode($keywords);
|
||||
if($advanced)
|
||||
$query .= '&query=' . urlencode($advanced);
|
||||
if(! is_null($pubforums))
|
||||
$query .= '&pubforums=' . intval($pubforums);
|
||||
|
||||
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : '');
|
||||
if($sort_order)
|
||||
|
@ -64,6 +64,9 @@ function dirsearch_content(&$a) {
|
||||
$agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 );
|
||||
$agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
|
||||
$kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 );
|
||||
$forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : null);
|
||||
|
||||
|
||||
|
||||
// by default use a safe search
|
||||
$safe = ((x($_REQUEST,'safe'))); // ? intval($_REQUEST['safe']) : 1 );
|
||||
@ -108,6 +111,10 @@ function dirsearch_content(&$a) {
|
||||
if($keywords)
|
||||
$sql_extra .= dir_query_build($joiner,'xprof_keywords',$keywords);
|
||||
|
||||
if(! is_null($forums))
|
||||
$sql_extra .= dir_flag_build($joiner,'xprof_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)
|
||||
|
||||
@ -179,7 +186,6 @@ 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",
|
||||
@ -273,6 +279,11 @@ function dir_query_build($joiner,$field,$s) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function dir_flag_build($joiner,$field,$bit,$s) {
|
||||
return dbesc($joiner) . " ( " . dbesc('xchan_flags') . " & " . intval($bit) . " ) " . ((intval($s)) ? '>' : '=' ) . " 0 ";
|
||||
}
|
||||
|
||||
|
||||
function dir_parse_query($s) {
|
||||
|
||||
$ret = array();
|
||||
|
Reference in New Issue
Block a user