summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-03-19 11:01:58 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-03-19 11:01:58 -0400
commitd1b2a9d7087ecc171f941755b4c3a420cd202842 (patch)
tree4e10480273945d9d983c0ab6ec546dfe4764a57e /actions
parent5dc913f58951815fcaa246e675ff7d30ad93f633 (diff)
Somewhat better behaviour with mixed caps in search
Deal somewhat better with mixed caps in people and notice search.
Diffstat (limited to 'actions')
-rw-r--r--actions/groupsearch.php11
-rw-r--r--actions/noticesearch.php2
-rw-r--r--actions/noticesearchrss.php3
-rw-r--r--actions/peoplesearch.php6
4 files changed, 7 insertions, 15 deletions
diff --git a/actions/groupsearch.php b/actions/groupsearch.php
index 9b0026db9..109a53ce1 100644
--- a/actions/groupsearch.php
+++ b/actions/groupsearch.php
@@ -1,9 +1,4 @@
<?php
-
-
-// define('GROUPS_PER_PAGE', 20);
-
-
/**
* Group search action class.
*
@@ -90,15 +85,15 @@ class GroupSearchResults extends GroupList
{
var $terms = null;
var $pattern = null;
-
+
function __construct($user_group, $terms, $action)
{
parent::__construct($user_group, $terms, $action);
- $this->terms = array_map('preg_quote',
+ $this->terms = array_map('preg_quote',
array_map('htmlspecialchars', $terms));
$this->pattern = '/('.implode('|',$terms).')/i';
}
-
+
function highlight($text)
{
return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index 83e59dd9a..eb4a072de 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -103,7 +103,7 @@ class NoticesearchAction extends SearchAction
function showResults($q, $page)
{
$notice = new Notice();
- $q = strtolower($q);
+
$search_engine = $notice->getSearchEngine('identica_notices');
$search_engine->set_sort_mode('chron');
// Ask for an extra to see if there's more.
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index 0f98ed04b..ba5276d06 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -62,9 +62,6 @@ class NoticesearchrssAction extends Rss10Action
$notice = new Notice();
- # lcase it for comparison
- $q = strtolower($q);
-
$search_engine = $notice->getSearchEngine('identica_notices');
$search_engine->set_sort_mode('chron');
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index 14177fcf0..9e515ade1 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -63,13 +63,13 @@ class PeoplesearchAction extends SearchAction
$profile = new Profile();
- # lcase it for comparison
- $q = strtolower($q);
+ // lcase it for comparison
+ // $q = strtolower($q);
$search_engine = $profile->getSearchEngine('identica_people');
$search_engine->set_sort_mode('chron');
- # Ask for an extra to see if there's more.
+ // Ask for an extra to see if there's more.
$search_engine->limit((($page-1)*PROFILES_PER_PAGE), PROFILES_PER_PAGE + 1);
if (false === $search_engine->query($q)) {
$cnt = 0;