Added community search mode
This commit is contained in:
parent
6ab304b564
commit
0a998f99df
2 changed files with 18 additions and 2 deletions
|
@ -16,6 +16,8 @@ function dirfind_init(&$a) {
|
|||
|
||||
function dirfind_content(&$a) {
|
||||
|
||||
$community = false;
|
||||
|
||||
$local = get_config('system','poco_local_search');
|
||||
|
||||
$search = notags(trim($_REQUEST['search']));
|
||||
|
@ -23,6 +25,11 @@ function dirfind_content(&$a) {
|
|||
if(strpos($search,'@') === 0)
|
||||
$search = substr($search,1);
|
||||
|
||||
if(strpos($search,'!') === 0) {
|
||||
$search = substr($search,1);
|
||||
$community = true;
|
||||
}
|
||||
|
||||
$o = '';
|
||||
|
||||
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
|
||||
|
@ -33,12 +40,17 @@ function dirfind_content(&$a) {
|
|||
|
||||
if ($local) {
|
||||
|
||||
if ($community)
|
||||
$extra_sql = " AND `community`";
|
||||
else
|
||||
$extra_sql = "";
|
||||
|
||||
$perpage = 80;
|
||||
$startrec = (($a->pager['page']) * $perpage) - $perpage;
|
||||
|
||||
$count = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `network` IN ('%s', '%s', '%s') AND
|
||||
(`url` REGEXP '%s' OR `name` REGEXP '%s' OR `location` REGEXP '%s' OR
|
||||
`about` REGEXP '%s' OR `keywords` REGEXP '%s')",
|
||||
`about` REGEXP '%s' OR `keywords` REGEXP '%s')".$extra_sql,
|
||||
dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA),
|
||||
dbesc(escape_tags($search)), dbesc(escape_tags($search)), dbesc(escape_tags($search)),
|
||||
dbesc(escape_tags($search)), dbesc(escape_tags($search)));
|
||||
|
@ -49,7 +61,7 @@ function dirfind_content(&$a) {
|
|||
WHERE `gcontact`.`network` IN ('%s', '%s', '%s') AND
|
||||
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`)) AND
|
||||
(`gcontact`.`url` REGEXP '%s' OR `gcontact`.`name` REGEXP '%s' OR `gcontact`.`location` REGEXP '%s' OR
|
||||
`gcontact`.`about` REGEXP '%s' OR `gcontact`.`keywords` REGEXP '%s')
|
||||
`gcontact`.`about` REGEXP '%s' OR `gcontact`.`keywords` REGEXP '%s') $extra_sql
|
||||
GROUP BY `gcontact`.`nurl`
|
||||
ORDER BY `gcontact`.`updated` DESC LIMIT %d, %d",
|
||||
intval(local_user()), dbesc(NETWORK_DFRN), dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA),
|
||||
|
|
|
@ -120,6 +120,10 @@ function search_content(&$a) {
|
|||
require_once('mod/dirfind.php');
|
||||
return dirfind_content($a);
|
||||
}
|
||||
if(strpos($search,'!') === 0) {
|
||||
require_once('mod/dirfind.php');
|
||||
return dirfind_content($a);
|
||||
}
|
||||
|
||||
if(! $search)
|
||||
return $o;
|
||||
|
|
Loading…
Reference in a new issue