...based on revision 940.
1. trunk-conf.patch
* Some debugging code got left in conf.php from adding input filtering
in revision 905. This patch removes that code.
2. trunk-float.patch
* Change clean_float() to an is_numeric() call rather than a regular
expression. Equivalent behavior with small performance gain.
* Remove clean_number() function from functions.php.
* Change all calls to clean_number() to use clean_float().
This remove the dependency on the ctype extension.
3. 30-beta-float.patch
* Add the clean_float() function, which was not present in this branch.
Identical to clean_float() in trunk.
* Change all clean_number() calls to clean_float() calls.
* Remove clean_number() function from functions.php.
Index: graph.php
===================================================================
--- graph.php (revision 940)
+++ graph.php (working copy)
@@ -19,17 +19,17 @@
$self = isset($_GET["me"]) ?
escapeshellcmd( clean_string( rawurldecode($_GET["me"] ) ) ) : NULL;
$max = isset($_GET["x"]) ?
- clean_number( rawurldecode($_GET["x"] ) ) : NULL;
+ clean_float( rawurldecode($_GET["x"] ) ) : NULL;
$min = isset($_GET["n"]) ?
- clean_number( rawurldecode($_GET["n"] ) ) : NULL;
+ clean_float( rawurldecode($_GET["n"] ) ) : NULL;
$value = isset($_GET["v"]) ?
- clean_number( rawurldecode( $_GET["v"] ) ) : NULL;
+ clean_float( rawurldecode( $_GET["v"] ) ) : NULL;
$load_color = isset($_GET["l"]) && is_valid_hex_color( rawurldecode( $_GET[
'l' ] ) ) ?
escapeshellcmd( rawurldecode( $_GET["l"] ) ) : NULL;
$vlabel = isset($_GET["vl"]) ?
escapeshellcmd( clean_string( rawurldecode( $_GET["vl"] ) ) ) : NULL;
$sourcetime = isset($_GET["st"]) ?
- clean_number( $_GET["st"] ) : NULL;
+ clean_float( $_GET["st"] ) : NULL;
# RFM - Define these variables to avoid "Undefined variable" errors being
# reported in ssl_error_log.
Index: functions.php
===================================================================
--- functions.php (revision 940)
+++ functions.php (working copy)
@@ -421,14 +421,10 @@
}
#-------------------------------------------------------------------------------
-# If arg is entirely numeric, return it. Otherwise, return null.
-function clean_number( $digit )
+# If arg is a valid floating point number, return it. Otherwise, return null.
+function clean_float( $value )
{
- $return_value = null;
- if( ctype_digit( $digit ) ) {
- $return_value = $digit;
- }
- return $return_value;
+ return is_numeric( $value ) ? $value : null;
}
#-------------------------------------------------------------------------------
Index: get_context.php
===================================================================
--- get_context.php (revision 940)
+++ get_context.php (working copy)
@@ -18,22 +18,22 @@
$sort = isset($_GET["s"]) ?
escapeshellcmd( clean_string( rawurldecode($_GET["s"]) ) ) : NULL;
$controlroom = isset($_GET["cr"]) ?
- clean_number( rawurldecode($_GET["cr"]) ) : NULL;
+ clean_float( rawurldecode($_GET["cr"]) ) : NULL;
$hostcols = isset($_GET["hc"]) ?
- clean_number( $_GET["hc"] ) : NULL;
+ clean_float( $_GET["hc"] ) : NULL;
# Flag, whether or not to show a list of hosts
$showhosts = isset($_GET["sh"]) ? 1 : NULL;
# The 'p' variable specifies the verbosity level in the physical view.
$physical = isset($_GET["p"]) ?
- clean_number( $_GET["p"] ) : NULL;
+ clean_float( $_GET["p"] ) : NULL;
$tree = isset($_GET["t"]) ?
escapeshellcmd($_GET["t"] ) : NULL;
# A custom range value for job graphs, in -sec.
$jobrange = isset($_GET["jr"]) ?
- clean_number( $_GET["jr"] ) : NULL;
+ clean_float( $_GET["jr"] ) : NULL;
# A red vertical line for various events. Value specifies the event time.
$jobstart = isset($_GET["js"]) ?
- clean_number( $_GET["js"] ) : NULL;
+ clean_float( $_GET["js"] ) : NULL;
# The direction we are travelling in the grid tree
$gridwalk = isset($_GET["gw"]) ?
escapeshellcmd( clean_string( $_GET["gw"] ) ) : NULL;
Index: conf.php
===================================================================
--- conf.php (revision 940)
+++ conf.php (working copy)
@@ -5,11 +5,6 @@
#
include_once "./version.php";
-$get = print_r( $_GET, 1 );
-$fp = fopen( '/tmp/ganglia_vars.txt', 'a+' );
-fwrite( $fp, $_SERVER[ 'PHP_SELF'] . "\n" . $get . "\n\n" );
-fclose( $fp );
-
#
# The name of the directory in "./templates" which contains the
# templates that you want to use. Templates are like a skin for the
Index: graph.php
===================================================================
--- graph.php (revision 940)
+++ graph.php (working copy)
@@ -19,9 +19,9 @@
$self = isset($_GET["me"]) ?
escapeshellcmd( clean_string( rawurldecode($_GET["me"] ) ) ) : NULL;
$max = isset($_GET["x"]) ?
- clean_number( rawurldecode($_GET["x"] ) ) : NULL;
+ clean_float( rawurldecode($_GET["x"] ) ) : NULL;
$min = isset($_GET["n"]) ?
- clean_number( rawurldecode($_GET["n"] ) ) : NULL;
+ clean_float( rawurldecode($_GET["n"] ) ) : NULL;
$value = isset($_GET["v"]) ?
clean_float( rawurldecode( $_GET["v"] ) ) : NULL;
$load_color = isset($_GET["l"]) && is_valid_hex_color( rawurldecode( $_GET[
'l' ] ) ) ?
@@ -29,7 +29,7 @@
$vlabel = isset($_GET["vl"]) ?
escapeshellcmd( clean_string( rawurldecode( $_GET["vl"] ) ) ) : NULL;
$sourcetime = isset($_GET["st"]) ?
- clean_number( $_GET["st"] ) : NULL;
+ clean_float( $_GET["st"] ) : NULL;
$summary = isset($_GET["su"]) ? 1 : 0;
$debug = isset( $_GET[ 'debug' ] ) ? 1 : 0;
Index: functions.php
===================================================================
--- functions.php (revision 940)
+++ functions.php (working copy)
@@ -421,25 +421,13 @@
}
#-------------------------------------------------------------------------------
-# If arg is entirely numeric, return it. Otherwise, return null.
-function clean_number( $digit )
+# If arg is a valid floating point number, return it. Otherwise, return null.
+function clean_float( $value )
{
- $return_value = null;
- if( ctype_digit( $digit ) ) {
- $return_value = $digit;
- }
- return $return_value;
+ return is_numeric( $value ) ? $value : null;
}
#-------------------------------------------------------------------------------
-# If arg is a valid floating point number, return it. Otherwise, return null.
-function clean_float( $value ) {
- return preg_match('/^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/', $value) ?
- $value :
- null;
-}
-
-#-------------------------------------------------------------------------------
# Return true if string is a 3 or 6 character hex color. Return false
otherwise.
function is_valid_hex_color( $string )
{
Index: get_context.php
===================================================================
--- get_context.php (revision 940)
+++ get_context.php (working copy)
@@ -20,22 +20,22 @@
$sort = isset($_GET["s"]) ?
escapeshellcmd( clean_string( rawurldecode($_GET["s"]) ) ) : NULL;
$controlroom = isset($_GET["cr"]) ?
- clean_number( rawurldecode($_GET["cr"]) ) : NULL;
+ clean_float( rawurldecode($_GET["cr"]) ) : NULL;
$hostcols = isset($_GET["hc"]) ?
- clean_number( $_GET["hc"] ) : NULL;
+ clean_float( $_GET["hc"] ) : NULL;
# Flag, whether or not to show a list of hosts
$showhosts = isset($_GET["sh"]) ? 1 : NULL;
# The 'p' variable specifies the verbosity level in the physical view.
$physical = isset($_GET["p"]) ?
- clean_number( $_GET["p"] ) : NULL;
+ clean_float( $_GET["p"] ) : NULL;
$tree = isset($_GET["t"]) ?
escapeshellcmd($_GET["t"] ) : NULL;
# A custom range value for job graphs, in -sec.
$jobrange = isset($_GET["jr"]) ?
- clean_number( $_GET["jr"] ) : NULL;
+ clean_float( $_GET["jr"] ) : NULL;
# A red vertical line for various events. Value specifies the event time.
$jobstart = isset($_GET["js"]) ?
- clean_number( $_GET["js"] ) : NULL;
+ clean_float( $_GET["js"] ) : NULL;
# The direction we are travelling in the grid tree
$gridwalk = isset($_GET["gw"]) ?
escapeshellcmd( clean_string( $_GET["gw"] ) ) : NULL;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers