aboutsummaryrefslogtreecommitdiffstats
path: root/mod/search.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/search.php')
-rw-r--r--mod/search.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/mod/search.php b/mod/search.php
index 2a8bf1484..819100204 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -96,12 +96,16 @@ function search_content(&$a) {
// Only public wall posts can be shown
// OR your own posts if you are a logged in member
- $s_bool = "AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )";
- $s_regx = "AND `item`.`body` REGEXP '%s' ";
+ $escaped_search = str_replace(array('[',']'),array('\\[','\\]'),$search);
+
+// $s_bool = sprintf("AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )", dbesc($search));
+ $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )",
+ dbesc($escaped_search), dbesc('\\]' . $escaped_search . '\\['));
+
+// if(mb_strlen($search) >= 3)
+// $search_alg = $s_bool;
+// else
- if(mb_strlen($search) >= 3)
- $search_alg = $s_bool;
- else
$search_alg = $s_regx;
$r = q("SELECT COUNT(*) AS `total`
@@ -111,8 +115,7 @@ function search_content(&$a) {
OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$search_alg ",
- intval(local_user()),
- dbesc($search)
+ intval(local_user())
);
if(count($r))
@@ -137,7 +140,6 @@ function search_content(&$a) {
$search_alg
ORDER BY `received` DESC LIMIT %d , %d ",
intval(local_user()),
- dbesc($search),
intval($a->pager['start']),
intval($a->pager['itemspage'])