aboutsummaryrefslogtreecommitdiffstats
path: root/mod/search.php
diff options
context:
space:
mode:
authorVasudev Kamath <kamathvasudev@gmail.com>2012-04-27 22:43:26 +0530
committerVasudev Kamath <kamathvasudev@gmail.com>2012-04-27 22:43:26 +0530
commit214ec91a3f2c5fec6cced93f669b3a9725f0e40a (patch)
treed05fd4c7e65cc89cf46d8347a2d0e6df135ed864 /mod/search.php
parentf1d84c10458986a0a014f844e784617401764b29 (diff)
parent4b92e3543c9af26e590cfecf561ff7483e66e6c9 (diff)
downloadvolse-hubzilla-214ec91a3f2c5fec6cced93f669b3a9725f0e40a.tar.gz
volse-hubzilla-214ec91a3f2c5fec6cced93f669b3a9725f0e40a.tar.bz2
volse-hubzilla-214ec91a3f2c5fec6cced93f669b3a9725f0e40a.zip
Merge branch 'master' of git://github.com/friendica/friendica
Diffstat (limited to 'mod/search.php')
-rw-r--r--mod/search.php30
1 files changed, 22 insertions, 8 deletions
diff --git a/mod/search.php b/mod/search.php
index 4ca7db9bb..d467764b0 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -87,11 +87,26 @@ function search_content(&$a) {
else
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
+ $tag = false;
+ if(x($_GET,'tag')) {
+ $tag = true;
+ $search = ((x($_GET,'tag')) ? notags(trim(rawurldecode($_GET['tag']))) : '');
+ }
+
+
$o .= search($search,'search-box','/search',((local_user()) ? true : false));
if(! $search)
return $o;
+ if($tag)
+ $sql_extra = sprintf(" AND `item`.`tag` REGEXP '%s' ", dbesc('\\]' . preg_quote($search) . '\\['));
+ else
+ $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(preg_quote($search)));
+
+
+
+
// Here is the way permissions work in the search module...
// Only public posts can be shown
// OR your own posts if you are a logged in member
@@ -103,10 +118,8 @@ function search_content(&$a) {
AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0)
OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) group by `item`.`uri` ",
- intval(local_user()),
- dbesc(preg_quote($search)),
- dbesc('\\]' . preg_quote($search) . '\\[')
+ $sql_extra group by `item`.`uri` ",
+ intval(local_user())
);
if(count($r))
@@ -127,18 +140,19 @@ function search_content(&$a) {
AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND `item`.`private` = 0 AND `user`.`hidewall` = 0 )
OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
- AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )
+ $sql_extra
group by `item`.`uri`
ORDER BY `received` DESC LIMIT %d , %d ",
intval(local_user()),
- dbesc(preg_quote($search)),
- dbesc('\\]' . preg_quote($search) . '\\['),
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
- $o .= '<h2>Search results for: ' . $search . '</h2>';
+ if($tag)
+ $o .= '<h2>Items tagged with: ' . $search . '</h2>';
+ else
+ $o .= '<h2>Search results for: ' . $search . '</h2>';
$o .= conversation($a,$r,'search',false);