[pLog-svn] r6473 - plog/branches/lifetype-1.2/class/action

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Sat May 24 15:14:31 EDT 2008


Author: jondaley
Date: 2008-05-24 15:14:31 -0400 (Sat, 24 May 2008)
New Revision: 6473

Modified:
   plog/branches/lifetype-1.2/class/action/searchaction.class.php
Log:
allow html in the search terms, and then filter it out later.
Also check for a null search (after filtering), since that doesn't make sense.
removed unused $request var



Modified: plog/branches/lifetype-1.2/class/action/searchaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/searchaction.class.php	2008-05-24 19:12:40 UTC (rev 6472)
+++ plog/branches/lifetype-1.2/class/action/searchaction.class.php	2008-05-24 19:14:31 UTC (rev 6473)
@@ -22,8 +22,8 @@
         {
             $this->BlogAction( $actionInfo, $request );
 			
-			// data validatdion
-			$this->registerFieldValidator( "searchTerms", new StringValidator());
+			// data validation
+			$this->registerFieldValidator( "searchTerms", new StringValidator( true ));
 			$this->setValidationErrorView( new ErrorView( $this->_blogInfo, "error_incorrect_search_terms" ));
         }
 		
@@ -31,7 +31,13 @@
         {
 			// get the search terms that have already been validated...
             $this->_searchTerms = $this->_request->getFilteredValue( "searchTerms", new HtmlFilter());
-		
+
+            if(trim($this->_searchTerms) == ""){
+                $this->_view = new ErrorView( $this->_blogInfo, "error_incorrect_search_terms" );
+                $this->setCommonData();
+                return false;
+            }
+            
 			// check if the search feature is disabled in this site...
 			$config =& Config::getConfig();
 			if( !$config->getValue( "search_engine_enabled" )) {
@@ -74,12 +80,11 @@
                 
                 return true;
             }
-            
+
             // if only one search result, we can see it straight away 
             if( count($searchResults) == 1 && $numSearchResults == 1 ) {
 				// only one search result, we can redirect the view via the URL,
 				// so that the right permalink appears in the address bar
-                $request = HttpVars::getRequest();
                 $searchResult = array_pop( $searchResults );
                 $article = $searchResult->getResult();
 				$url = $this->_blogInfo->getBlogRequestGenerator();



More information about the pLog-svn mailing list