diff options
Diffstat (limited to 'frontends/php/include/validate.inc.php')
| -rw-r--r-- | frontends/php/include/validate.inc.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php index 95ba33d9..98ea357d 100644 --- a/frontends/php/include/validate.inc.php +++ b/frontends/php/include/validate.inc.php @@ -29,6 +29,11 @@ define('ZBX_VALID_ERROR', 1); define('ZBX_VALID_WARNING', 2); + function is_hex_color($value) + { + return eregi('[0-9,A-F]{6}', $value); + } + function BETWEEN($min,$max,$var=NULL) { return "({".$var."}>=".$min."&&{".$var."}<=".$max.")&&"; @@ -219,6 +224,20 @@ return ZBX_VALID_WARNING; } } + + if(($type == T_ZBX_CLR) && !is_hex_color($var)) { + $var = 'FFFFFF'; + if($flags&P_SYS) + { + info("Critical error. Field [".$field."] is not color"); + return ZBX_VALID_ERROR; + } + else + { + info("Warning. Field [".$field."] is not color"); + return ZBX_VALID_WARNING; + } + } return ZBX_VALID_OK; } |
