diff options
author | Mario <mario@mariovavti.com> | 2023-05-04 09:28:05 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-05-04 09:28:05 +0000 |
commit | dfa43b48566ebdc758a46de0090cfcc9617471b1 (patch) | |
tree | e42fbcd6100e1cea35b6cee3614f5ff5940569e5 /Zotlabs/Module/Dirsearch.php | |
parent | a24a1ca6d79cf48ae18352a9df9e94bc6c4c7431 (diff) | |
parent | 2d4b35fbc99062d52c6c32cacd158ceda661bb31 (diff) | |
download | volse-hubzilla-dfa43b48566ebdc758a46de0090cfcc9617471b1.tar.gz volse-hubzilla-dfa43b48566ebdc758a46de0090cfcc9617471b1.tar.bz2 volse-hubzilla-dfa43b48566ebdc758a46de0090cfcc9617471b1.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Module/Dirsearch.php')
-rw-r--r-- | Zotlabs/Module/Dirsearch.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php index acf1b64e4..7380a551e 100644 --- a/Zotlabs/Module/Dirsearch.php +++ b/Zotlabs/Module/Dirsearch.php @@ -40,6 +40,8 @@ class Dirsearch extends Controller { } $sql_extra = ''; + $keywords_query = ''; + $hub_query = ''; $tables = array('name','address','locale','region','postcode','country','gender','marital','sexual','keywords'); @@ -98,10 +100,10 @@ class Dirsearch extends Controller { $hub = \App::get_hostname(); } - if($hub) + 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'] : ''); @@ -127,9 +129,12 @@ class Dirsearch extends Controller { $sql_extra .= $this->dir_query_build($joiner,'xprof_marital',$marital); if($sexual) $sql_extra .= $this->dir_query_build($joiner,'xprof_sexual',$sexual); - if($keywords) - $sql_extra .= $this->dir_query_build($joiner,'xprof_keywords',$keywords); + if($keywords) { + $keywords_arr = explode(',', $keywords); + stringify_array_elms($keywords_arr, true); + $keywords_query = " AND xchan_hash IN (SELECT xtag_hash FROM xtag WHERE xtag_term IN (" . protect_sprintf(implode(',', $keywords_arr)) . ")) "; + } // we only support an age range currently. You must set both agege // (greater than or equal) and agele (less than or equal) @@ -265,7 +270,7 @@ class Dirsearch extends Controller { xprof.xprof_hometown as hometown, xprof.xprof_keywords as keywords from xchan left join xprof on xchan_hash = xprof_hash left join hubloc on (hubloc_id_url = xchan_url and hubloc_hash = xchan_hash) - where hubloc_primary = 1 and hubloc_updated > %s - INTERVAL %s and ( $logic $sql_extra ) $hub_query and xchan_network = 'zot6' and xchan_system = 0 and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 + where hubloc_primary = 1 and hubloc_updated > %s - INTERVAL %s and ( $logic $sql_extra ) $hub_query $keywords_query and xchan_network = 'zot6' and xchan_system = 0 and xchan_hidden = 0 and xchan_orphan = 0 and xchan_deleted = 0 $safesql $order $qlimit", db_utcnow(), db_quoteinterval('30 DAY') |