diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-06-06 10:35:31 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-06-06 10:35:31 +0000 |
| commit | aef82a51d4e5f2aa85d29f882b2c0713545f25f0 (patch) | |
| tree | d72fe9e775405132166c8c4d8b3371bebd600141 /frontends/php/include/triggers.inc.php | |
| parent | 94eb3a3761163d3be70d010a7b7dac125894f909 (diff) | |
| download | zabbix-aef82a51d4e5f2aa85d29f882b2c0713545f25f0.tar.gz zabbix-aef82a51d4e5f2aa85d29f882b2c0713545f25f0.tar.xz zabbix-aef82a51d4e5f2aa85d29f882b2c0713545f25f0.zip | |
- merged from branches/1.4.1 rev. 4239:4240 (Eugene) [fixed 'count' function for trigger expression]
git-svn-id: svn://svn.zabbix.com/trunk@4241 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/triggers.inc.php')
| -rw-r--r-- | frontends/php/include/triggers.inc.php | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php index 858622f1..7bd3ad4f 100644 --- a/frontends/php/include/triggers.inc.php +++ b/frontends/php/include/triggers.inc.php @@ -181,7 +181,7 @@ $allowed_functions['sum'] = 'ticks'; $allowed_functions['last'] = 'float'; $allowed_functions['diff'] = 'float'; - $allowed_functions['count'] = 'float'; + $allowed_functions['count'] = array('float', ''); $allowed_functions['prev'] = 'float'; $allowed_functions['change'] = 'float'; $allowed_functions['abschange'] = 'float'; @@ -240,18 +240,28 @@ return -1; } - if( 'float' == $allowed_functions[$function] - && (validate_float($parameter)!=0) ) - { - error('['.$parameter.'] is not a float'); - return -1; - } + if( !is_array($allowed_functions[$function]) ) + $allowed_functions[$function] = array($allowed_functions[$function]); + + $parameter = split(',', $parameter, count($allowed_functions[$function])); - if( 'ticks' == $allowed_functions[$function] - && (validate_ticks($parameter)!=0) ) + foreach($allowed_functions[$function] as $pid => $params) { - error('['.$parameter.'] is not a float'); - return -1; + if(!isset($parameter[$pid])) continue; + + if( 'float' == $params + && (validate_float($parameter[$pid])!=0) ) + { + error('['.$parameter[$pid].'] is not a float'); + return -1; + } + + if( 'ticks' == $params + && (validate_ticks($parameter[$pid])!=0) ) + { + error('['.$parameter[$pid].'] is not a float'); + return -1; + } } } # Process macros |
