Alexander Nicolaysen Sørnes : db_filter_ui: Restrict number of active filters
Chris Morgan
cmorgan at winehq.org
Tue Jun 17 18:28:29 CDT 2008
Module: appdb
Branch: master
Commit: 250296e23774ddd1da7afc92f3eaa094bfafaea7
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=250296e23774ddd1da7afc92f3eaa094bfafaea7
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Wed Jun 18 00:33:19 2008 +0200
db_filter_ui: Restrict number of active filters
---
include/db_filter_ui.php | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/db_filter_ui.php b/include/db_filter_ui.php
index 61a6d93..a2644ce 100644
--- a/include/db_filter_ui.php
+++ b/include/db_filter_ui.php
@@ -15,6 +15,8 @@ define('FILTER_VALUES_ENUM', 2);
define('FILTER_VALUES_BOOL', 3);
define('FILTER_VALUES_OPTION', 4);
+define('MAX_FILTERS', 50);
+
/* Info describing an available filter: what column it applies to,
and what comparison options are available */
class FilterInfo
@@ -436,10 +438,18 @@ class FilterInterface
The given TableFilterSet defines available options */
public function readInput($aClean)
{
+ $iCount = 0; // We set a maximum for how many filters a user can add,
+ // otherwise we may get a too long SQL query
+
foreach($this->getFilterInfo() as $oOption)
{
foreach($this->readInputForColumn($aClean, $oOption) as $oNewFilter)
+ {
+ $iCount ++;
$this->AddFilterObject($oNewFilter);
+ if($iCount > MAX_FILTERS)
+ break;
+ }
}
}
More information about the wine-cvs
mailing list