diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-21 10:47:01 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-01-21 10:47:01 +0000 |
| commit | acb94184d3be234c51afae80428233c548977b7f (patch) | |
| tree | 28b56548ab2c492427dc60db359ce783ffc5a5fb /frontends/php/include/validate.inc.php | |
| parent | 0cc27d49dd291e679531fa5c197d86d4f192377c (diff) | |
| download | zabbix-acb94184d3be234c51afae80428233c548977b7f.tar.gz zabbix-acb94184d3be234c51afae80428233c548977b7f.tar.xz zabbix-acb94184d3be234c51afae80428233c548977b7f.zip | |
- renamed latestalarms.php and alerts.php (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2553 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/validate.inc.php')
| -rw-r--r-- | frontends/php/include/validate.inc.php | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php index 89090b51..c7800cd6 100644 --- a/frontends/php/include/validate.inc.php +++ b/frontends/php/include/validate.inc.php @@ -71,12 +71,27 @@ { if(!isset($fields[$key])) { -// info("Unset:".$key); + echo "Unset: $key<br>"; unset($_REQUEST[$key]); } } } + function unset_if_zero($fields) + { + foreach($fields as $field => $checks) + { + list($type,$opt,$flags,$validation,$exception)=$checks; + + if(($flags&P_NZERO)&&(isset($_REQUEST[$field]))&&($_REQUEST[$field]==0)) + { + echo "Unset: $field<br>"; + unset($_REQUEST[$field]); + } + } + } + + function unset_action_vars($fields) { foreach($fields as $field => $checks) @@ -126,7 +141,6 @@ if(!isset($_REQUEST[$field])) { $ret = FALSE; - info("Warning. Field [".$field."] is mandatory"); if($flags&P_SYS) { info("Critical error. Field [".$field."] is mandatory"); @@ -134,7 +148,11 @@ $critical = TRUE; break; } - else continue; + else + { + info("Warning. Field [".$field."] is mandatory"); + continue; + } } } @@ -143,7 +161,6 @@ if(isset($_REQUEST[$field])) { $ret = FALSE; - info("Warning. Field [".$field."] must be missing"); if($flags&P_SYS) { info("Critical error. Field [".$field."] must be missing"); @@ -151,7 +168,11 @@ $critical = TRUE; break; } - else continue; + else + { + info("Warning. Field [".$field."] must be missing"); + continue; + } } else continue; } @@ -164,7 +185,6 @@ if( ($type == T_ZBX_INT) && !is_numeric($_REQUEST[$field])) { $ret = FALSE; - info("Warning. Field [".$field."] is not integer"); if($flags&P_SYS) { info("Critical error. Field [".$field."] is not integer"); @@ -172,12 +192,15 @@ $critical = TRUE; break; } - else continue; + else + { + info("Warning. Field [".$field."] is not integer"); + continue; + } } if( ($type == T_ZBX_DBL) && !is_numeric($_REQUEST[$field])) { $ret = FALSE; - info("Warning. Field [".$field."] is not double"); if($flags&P_SYS) { info("Critical error. Field [".$field."] is not double"); @@ -185,7 +208,11 @@ $critical = TRUE; break; } - else continue; + else + { + info("Warning. Field [".$field."] is not double"); + continue; + } } if(($exception==NULL)||($except==TRUE)) @@ -196,7 +223,6 @@ if(!$valid) { $ret = FALSE; - info("Warning. Incorrect value for [".$field."]"); if($flags&P_SYS) { info("Critical error. Incorrect value for [".$field."]"); @@ -204,7 +230,11 @@ $critical = TRUE; break; } - else continue; + else + { + info("Warning. Incorrect value for [".$field."]"); + continue; + } } } @@ -213,6 +243,7 @@ } } unset_not_in_list($fields); + unset_if_zero($fields); if($critical) { show_messages(FALSE, "", "Invalid URL"); |
