[xoops-cvslog 3203] CVS update: xoops2jp/html/modules/base/forms

Back to archive index

Minahito minah****@users*****
2006年 5月 28日 (日) 14:03:36 JST


Index: xoops2jp/html/modules/base/forms/SearchShowallbyuserForm.class.php
diff -u xoops2jp/html/modules/base/forms/SearchShowallbyuserForm.class.php:1.1.2.1 xoops2jp/html/modules/base/forms/SearchShowallbyuserForm.class.php:1.1.2.2
--- xoops2jp/html/modules/base/forms/SearchShowallbyuserForm.class.php:1.1.2.1	Sat May 27 22:06:39 2006
+++ xoops2jp/html/modules/base/forms/SearchShowallbyuserForm.class.php	Sun May 28 14:03:36 2006
@@ -9,7 +9,7 @@
 
 class Legacy_SearchShowallbyuserForm extends Legacy_SearchShowallForm
 {
-	function prepare()
+	function prepare($keywordMin)
 	{
 		parent::prepare();
 		
Index: xoops2jp/html/modules/base/forms/SearchResultsForm.class.php
diff -u xoops2jp/html/modules/base/forms/SearchResultsForm.class.php:1.1.2.1 xoops2jp/html/modules/base/forms/SearchResultsForm.class.php:1.1.2.2
--- xoops2jp/html/modules/base/forms/SearchResultsForm.class.php:1.1.2.1	Sat May 27 22:06:39 2006
+++ xoops2jp/html/modules/base/forms/SearchResultsForm.class.php	Sun May 28 14:03:36 2006
@@ -8,9 +8,17 @@
 class Legacy_SearchResultsForm extends XCube_ActionForm
 {
 	var $mQueries = array();
+	var $_mKeywordMin = 0;
 	
+	function Legacy_SearchResultsForm($keywordMin)
+	{
+		parent::XCube_ActionForm();
+		$this->_mKeywordMin = intval($keywordMin);
+	}
+		
 	function prepare()
 	{
+		
 		//
 		// Set form properties
 		//
@@ -32,15 +40,35 @@
 	{
 		parent::fetch();
 		
-		$separator = '/[\s,]+/';
-		if (defined('_MD_BASE_FORMAT_SEARCH_SEPARATOR')) {
-			$separator = _MD_BASE_FORMAT_SEARCH_SEPARATOR;
-		}
+		$t_queries = array();
 		
-		$tmpArr = preg_split($separator, $this->get('query'));
 		$myts =& MyTextSanitizer::getInstance();
-		foreach ($tmpArr as $tmp) {
-			$this->mQueries[] = $myts->addSlashes($tmp);
+		if ($this->get('andor') == 'exact' && strlen($this->get('query')) >= $this->_mKeywordMin) {
+			$this->mQueries[] = $myts->addSlashes($this->get('query'));
+		}
+		else {
+			$separator = '/[\s,]+/';
+			if (defined('_MD_BASE_FORMAT_SEARCH_SEPARATOR')) {
+				$separator = _MD_BASE_FORMAT_SEARCH_SEPARATOR;
+			}
+		
+			$tmpArr = preg_split($separator, $this->get('query'));
+			foreach ($tmpArr as $tmp) {
+				if (strlen($tmp) >= $this->_mKeywordMin) {
+					$this->mQueries[] = $myts->addSlashes($tmp);
+				}
+			}
+		}
+		
+		$this->set('query', implode(" ", $this->mQueries));
+	}
+	
+	function validate()
+	{
+		parent::validate();
+		
+		if (!count($this->mQueries)) {
+			$this->addErrorMessage(_MD_BASE_ERROR_SEARCH_QUERY_REQUIRED);
 		}
 	}
 	


xoops-cvslog メーリングリストの案内
Back to archive index