aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2014-09-26 20:17:15 +0000
committerrvelices <rv-github@modusoptimus.com>2014-09-26 20:17:15 +0000
commit946a1c7017564ee2b3d8b3851dd44a865af4e693 (patch)
tree1f7e1ebeb4f43f81ef602b1368caa0bc0ab75ecf
parent4f41b2e9ae31d1394122f597a7ff55e189baf0f5 (diff)
bug 3148: quick search Merged -r29804 from trunk to branch 2.7
git-svn-id: http://piwigo.org/svn/branches/2.7@29805 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/functions_search.inc.php14
-rw-r--r--index.php2
2 files changed, 10 insertions, 6 deletions
diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php
index 4f971cacb..688a043de 100644
--- a/include/functions_search.inc.php
+++ b/include/functions_search.inc.php
@@ -384,9 +384,9 @@ class QNumericRangeScope extends QSearchScope
function get_sql($field, $token)
{
$clauses = array();
- if ($token->scope_data['range'][0]!=='')
+ if ($token->scope_data['range'][0]!='')
$clauses[] = $field.' >'.($token->scope_data['strict'][0]?'':'=').$token->scope_data['range'][0].' ';
- if ($token->scope_data['range'][1]!=='')
+ if ($token->scope_data['range'][1]!='')
$clauses[] = $field.' <'.($token->scope_data['strict'][1]?'':'=').$token->scope_data['range'][1].' ';
if (empty($clauses))
@@ -458,9 +458,9 @@ class QDateRangeScope extends QSearchScope
function get_sql($field, $token)
{
$clauses = array();
- if ($token->scope_data[0]!=='')
+ if ($token->scope_data[0]!='')
$clauses[] = $field.' >= \'' . $token->scope_data[0].'\'';
- if ($token->scope_data[1]!=='')
+ if ($token->scope_data[1]!='')
$clauses[] = $field.' <= \'' . $token->scope_data[1].'\'';
if (empty($clauses))
@@ -1081,7 +1081,7 @@ function qsearch_eval(QMultiToken $expr, QResults $qsr, &$qualifies, &$ignored_t
{
$crt_ids = $qsr->iids[$crt->idx] = array_unique( array_merge($qsr->images_iids[$crt->idx], $qsr->tag_iids[$crt->idx]) );
$crt_qualifies = count($crt_ids)>0 || count($qsr->tag_ids[$crt->idx])>0;
- $crt_ignored_terms = $crt_qualifies ? array() : array($crt->term);
+ $crt_ignored_terms = $crt_qualifies ? array() : array((string)$crt);
}
else
$crt_ids = qsearch_eval($crt, $qsr, $crt_qualifies, $crt_ignored_terms);
@@ -1172,6 +1172,8 @@ function get_quick_search_results_no_cache($q, $options)
'qs' => array('q'=>$q),
);
+ $q = trigger_change('qsearch_pre', $q);
+
$scopes = array();
$scopes[] = new QSearchScope('tag', array('tags'));
$scopes[] = new QSearchScope('photo', array('photos'));
@@ -1247,6 +1249,8 @@ function get_quick_search_results_no_cache($q, $options)
$debug[] = 'before perms '.count($ids);
$search_results['qs']['matching_tags'] = $qsr->all_tags;
+ $search_results = trigger_change('qsearch_results', $search_results, $expression, $qsr);
+
global $template;
if (empty($ids))
diff --git a/index.php b/index.php
index 53c2b906d..1f524ed17 100644
--- a/index.php
+++ b/index.php
@@ -245,7 +245,7 @@ if ( empty($page['is_external']) or !$page['is_external'] )
}
elseif (!empty($page['qsearch_details']['unmatched_terms']))
{
- $template->assign( 'no_search_results', $page['qsearch_details']['unmatched_terms']);
+ $template->assign( 'no_search_results', array_map($page['qsearch_details']['unmatched_terms'], 'htmlspecialchars'));
}
}