[pLog-svn] r6481 - plog/branches/lifetype-1.2/class/summary/action
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Sat May 24 15:38:36 EDT 2008
Author: jondaley
Date: 2008-05-24 15:38:36 -0400 (Sat, 24 May 2008)
New Revision: 6481
Modified:
plog/branches/lifetype-1.2/class/summary/action/summarysearchaction.class.php
Log:
copied search action validation fixes from regular searches. Check if search engine is turned on before doing search.
Modified: plog/branches/lifetype-1.2/class/summary/action/summarysearchaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/action/summarysearchaction.class.php 2008-05-24 19:19:22 UTC (rev 6480)
+++ plog/branches/lifetype-1.2/class/summary/action/summarysearchaction.class.php 2008-05-24 19:38:36 UTC (rev 6481)
@@ -4,7 +4,6 @@
lt_include( PLOG_CLASS_PATH."class/summary/dao/summarystatsconstants.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
- lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
class SummarySearchAction extends SummaryAction
{
@@ -16,7 +15,7 @@
$this->SummaryAction( $actionInfo, $request );
// validation stuff
- $this->registerFieldValidator( "searchTerms", new StringValidator());
+ $this->registerFieldValidator( "searchTerms", new StringValidator( true ));
$this->registerFieldValidator( "searchType", new IntegerValidator());
$view = new SummaryView( "summaryerror" );
@@ -29,14 +28,29 @@
*/
function perform()
{
+ lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/searchengine.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
- $tf = new Textfilter();
- $this->_searchTerms = $tf->filterAllHTML( $this->_request->getValue( "searchTerms" ));
+ $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;
+ }
$this->_searchType = $this->_request->getValue( "searchType" );
-
+
+ // check if the search feature is disabled in this site...
+ $config =& Config::getConfig();
+ if( !$config->getValue( "search_engine_enabled" )) {
+ $this->_view = new ErrorView( $this->_blogInfo, "error_search_engine_disabled" );
+ $this->setCommonData();
+
+ return false;
+ }
+
$search = new SearchEngine();
// number of items per page
More information about the pLog-svn
mailing list