[Fusionforge-commits] r7457 - in trunk/gforge: common/include www/project/stats www/reporting
Roland Mas
lolando at libremir.placard.fr.eu.org
Sun Apr 19 22:29:12 CEST 2009
Author: lolando
Date: 2009-04-19 22:29:11 +0200 (Sun, 19 Apr 2009)
New Revision: 7457
Modified:
trunk/gforge/common/include/utils.php
trunk/gforge/www/project/stats/index.php
trunk/gforge/www/reporting/projectact_graph.php
trunk/gforge/www/reporting/siteact.php
Log:
New util_ensure_value_in_set() function to validate input when it needs to be part of a known set
Modified: trunk/gforge/common/include/utils.php
===================================================================
--- trunk/gforge/common/include/utils.php 2009-04-19 20:09:25 UTC (rev 7456)
+++ trunk/gforge/common/include/utils.php 2009-04-19 20:29:11 UTC (rev 7457)
@@ -972,6 +972,14 @@
}
}
+function util_ensure_value_in_set ($value, $set) {
+ if (in_array ($value, $set)) {
+ return $value ;
+ } else {
+ return $set[0] ;
+ }
+}
+
// Local Variables:
// mode: php
// c-file-style: "bsd"
Modified: trunk/gforge/www/project/stats/index.php
===================================================================
--- trunk/gforge/www/project/stats/index.php 2009-04-19 20:09:25 UTC (rev 7456)
+++ trunk/gforge/www/project/stats/index.php 2009-04-19 20:29:11 UTC (rev 7457)
@@ -40,13 +40,7 @@
site_project_header(array('title'=>_('Project Activity').' '.$group->getPublicName(),'group'=>$group_id,'toptab'=>'home'));
-if (($area != 'tracker')
- && ($area != 'forum')
- && ($area != 'docman')
- && ($area != 'taskman')
- && ($area != 'downloads')) {
- $area = 'tracker' ;
-} ;
+$area = util_ensure_value_in_set ($area, aray ('tracker','forum','docman','taskman','downloads')) ;
if ($SPAN && !is_numeric($SPAN)) { $SPAN = 1; }
if ($start && !is_numeric($start)) { $start = false; }
if ($end && !is_numeric($end)) { $end = false; }
Modified: trunk/gforge/www/reporting/projectact_graph.php
===================================================================
--- trunk/gforge/www/reporting/projectact_graph.php 2009-04-19 20:09:25 UTC (rev 7456)
+++ trunk/gforge/www/reporting/projectact_graph.php 2009-04-19 20:29:11 UTC (rev 7457)
@@ -42,9 +42,7 @@
$SPAN=1;
}
-if (!$area) {
- $area='tracker';
-}
+$area = util_ensure_value_in_set ($area, aray ('tracker','forum','docman','taskman','downloads')) ;
//
// Create Report
Modified: trunk/gforge/www/reporting/siteact.php
===================================================================
--- trunk/gforge/www/reporting/siteact.php 2009-04-19 20:09:25 UTC (rev 7456)
+++ trunk/gforge/www/reporting/siteact.php 2009-04-19 20:29:11 UTC (rev 7457)
@@ -37,15 +37,16 @@
}
$area = getStringFromRequest('area');
-$SPAN = getStringFromRequest('SPAN');
-$start = getStringFromRequest('start');
-$end = getStringFromRequest('end');
+$SPAN = getIntFromRequest('SPAN');
+$start = getIntFromRequest('start');
+$end = getIntFromRequest('end');
if (!$start) {
$z =& $report->getMonthStartArr();
$start = $z[count($z)-1];
}
+$area = util_ensure_value_in_set ($area, aray ('tracker','forum','docman','taskman','downloads')) ;
echo report_header(_('Site-Wide Activity'));
More information about the Fusionforge-commits
mailing list