Index: trunk/kernel/parser.php
===================================================================
diff -u -r3576 -r3873
--- trunk/kernel/parser.php (.../parser.php) (revision 3576)
+++ trunk/kernel/parser.php (.../parser.php) (revision 3873)
@@ -3750,6 +3750,26 @@
return $GLOBALS['var_list']['t'] == $t ? true : '';
}
+ function m_ShowSearchError($params)
+ {
+ global $objSession, $objTemplate;
+
+ $error_phrase = $objSession->GetVariable('search_error');
+ if (!$error_phrase) {
+ return '';
+ }
+
+ $template = getArrayValue($params, '_itemtemplate');
+ if (!$template) {
+ $ret = '';
+ }
+
+ $ret = $objTemplate->GetTemplate($template, true);
+ $ret = $ret->source;
+
+ return str_replace('', language($error_phrase), $ret);
+ }
+
/*function m_object($attribs=Array())
{
$element = new clsHtmlTag();
Index: trunk/themes/default/search_results/error.tpl
===================================================================
diff -u -r1981 -r3873
--- trunk/themes/default/search_results/error.tpl (.../error.tpl) (revision 1981)
+++ trunk/themes/default/search_results/error.tpl (.../error.tpl) (revision 3873)
@@ -67,7 +67,7 @@
-
+
Index: trunk/kernel/frontaction.php
===================================================================
diff -u -r3576 -r3873
--- trunk/kernel/frontaction.php (.../frontaction.php) (revision 3576)
+++ trunk/kernel/frontaction.php (.../frontaction.php) (revision 3873)
@@ -948,17 +948,18 @@
$MissingCount = SetMissingDataErrors("m_simplesearch");
$MissingCount++;
- $FormError["m_simplesearch"]["keywords"] = language("lu_keywords_tooshort");
+ setSearchError(lu_keywords_tooshort);
}
}
else
{
- if(strlen($_GET["Error"])>0)
- $var_list["t"] = $_GET["Error"];
-
- $MissingCount = SetMissingDataErrors("m_simplesearch");
- $MissingCount++;
- $FormError["m_simplesearch"]["keywords"] = language("lu_no_keyword");
+ if (strlen($_GET["Error"])>0) {
+ $var_list["t"] = $_GET["Error"];
+ }
+
+ $MissingCount = SetMissingDataErrors("m_simplesearch");
+ $MissingCount++;
+ setSearchError('lu_no_keyword');
}
break;
case "m_adv_search":
@@ -1087,14 +1088,20 @@
else {
$MissingCount = SetMissingDataErrors("m_simplesearch");
$MissingCount++;
- $FormError["m_simplesearch"]["keywords"] = language("lu_keywords_tooshort");
+ setSearchError('lu_keywords_tooshort');
}
}
else {
$MissingCount = SetMissingDataErrors("m_simplesearch");
$MissingCount++;
- $FormError["m_simplesearch"]["keywords"] = language("lu_no_keyword");
+ setSearchError('lu_no_keyword');
}
break;
}
+
+ function setSearchError($error_phrase)
+ {
+ $GLOBALS['FormError']['m_simplesearch']['keywords'] = language($error_phrase);
+ $GLOBALS['objSession']->SetVariable('search_error', $error_phrase);
+ }
?>
Index: trunk/kernel/include/searchitems.php
===================================================================
diff -u -r1566 -r3873
--- trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 1566)
+++ trunk/kernel/include/searchitems.php (.../searchitems.php) (revision 3873)
@@ -673,8 +673,10 @@
$keywords["notallowed"] = array();
$keywords["ignored"] = array();
$min_length = $objConfig->Get('Search_MinKeyword_Length');
- if(!strlen($phrase))
- return trim($keywords);
+ if (!strlen($phrase)) {
+ return $keywords;
+ }
+
$w_array = array();
$phrase=trim($phrase);
//if(count_words($phrase)>1)