diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-05-14 12:30:14 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-05-14 12:30:14 +0000 |
| commit | 77ddebaf537a1c9d5a98e6ba7cbefce50b64d27f (patch) | |
| tree | 7bb757f88228440455f58990b3cc71c2d3e123cc /frontends/php/include/validate.inc.php | |
| parent | 90f1044ad520c79987196bdeb408877bc571bbd4 (diff) | |
| download | zabbix-77ddebaf537a1c9d5a98e6ba7cbefce50b64d27f.tar.gz zabbix-77ddebaf537a1c9d5a98e6ba7cbefce50b64d27f.tar.xz zabbix-77ddebaf537a1c9d5a98e6ba7cbefce50b64d27f.zip | |
- added http status code configuration for web monitoring (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@4130 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/validate.inc.php')
| -rw-r--r-- | frontends/php/include/validate.inc.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php index 07ef0752..997e7f76 100644 --- a/frontends/php/include/validate.inc.php +++ b/frontends/php/include/validate.inc.php @@ -28,6 +28,19 @@ define('ZBX_VALID_ERROR', 1); define('ZBX_VALID_WARNING', 2); + function is_int_range($value) + { + if( !empty($value) ) foreach(explode(',',$value) as $int_range) + { + $int_range = explode('-', $int_range); + if(count($int_range) > 2) return false; + foreach($int_range as $int_val) + if( !is_numeric($int_val) ) + return false; + } + return true; + } + function is_hex_color($value) { return eregi('^[0-9,A-F]{6}$', $value); @@ -258,6 +271,24 @@ $err |= check_type($field, $flags, $p, T_ZBX_INT); return $err; } + + if($type == T_ZBX_INT_RANGE) + { + if( !is_int_range($var) ) + { + if($flags&P_SYS) + { + info("Critical error. Field [".$field."] is not integer range"); + return ZBX_VALID_ERROR; + } + else + { + info("Warning. Field [".$field."] is not integer range"); + return ZBX_VALID_WARNING; + } + } + return ZBX_VALID_OK; + } if(($type == T_ZBX_INT) && !is_numeric($var)) { if($flags&P_SYS) |
