summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/validate.inc.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-01-24 11:53:06 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-01-24 11:53:06 +0000
commit2b8703fbe10a01e92ba737d233faffc3727341a4 (patch)
treefb2a98a5b00863c133b7c18a0eed2f40d570474b /frontends/php/include/validate.inc.php
parentfe41bf62d79f697b051e75aa4b65889ac133d5e0 (diff)
downloadzabbix-2b8703fbe10a01e92ba737d233faffc3727341a4.tar.gz
zabbix-2b8703fbe10a01e92ba737d233faffc3727341a4.tar.xz
zabbix-2b8703fbe10a01e92ba737d233faffc3727341a4.zip
- [DEV-102] added support of UTF8 for GUI (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5275 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/validate.inc.php')
-rw-r--r--frontends/php/include/validate.inc.php28
1 files changed, 18 insertions, 10 deletions
diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php
index 740974d0..2b4875b2 100644
--- a/frontends/php/include/validate.inc.php
+++ b/frontends/php/include/validate.inc.php
@@ -68,7 +68,7 @@
}
function KEY_PARAM($var=NULL)
{
- return 'ereg(\'^([0-9a-zA-Z\_\.[.-.]\$ ]+)$\',{'.$var.'})&&';
+ return 'ereg(\'^([0-9a-zA-Z\_\.[.'.ZBX_EREG_SPACE_SYMB.'.]\$ ]+)$\',{'.$var.'})&&';
}
function validate_ipv4($str,&$arr)
{
@@ -209,7 +209,7 @@
{
/*
// If an unset variable used in expression, return FALSE
- if(strstr($expression,'{'.$f.'}')&&!isset($_REQUEST[$f]))
+ if(zbx_strstr($expression,'{'.$f.'}')&&!isset($_REQUEST[$f]))
{
//SDI("Variable [$f] is not set. $expression is FALSE");
//info("Variable [$f] is not set. $expression is FALSE");
@@ -233,13 +233,13 @@
{
//SDI("$field - expression: ".$expression);
- if(strstr($expression,"{}") && !isset($_REQUEST[$field]))
+ if(zbx_strstr($expression,"{}") && !isset($_REQUEST[$field]))
return FALSE;
- if(strstr($expression,"{}") && !is_array($_REQUEST[$field]))
+ if(zbx_strstr($expression,"{}") && !is_array($_REQUEST[$field]))
$expression = str_replace("{}",'$_REQUEST["'.$field.'"]',$expression);
- if(strstr($expression,"{}") && is_array($_REQUEST[$field]))
+ if(zbx_strstr($expression,"{}") && is_array($_REQUEST[$field]))
{
foreach($_REQUEST[$field] as $key => $val)
{
@@ -412,12 +412,20 @@
return ZBX_VALID_WARNING;
}
}
-
- if($type == T_ZBX_STR){
-// XSS
-// $var=str_replace('<','&lt;',$var);
+//*
+ if(($type == T_ZBX_STR) && !defined('ZBX_ALLOW_UNICODE') && (strlen($var) != zbx_strlen($var))){
+ if($flags&P_SYS)
+ {
+ info("Critical error. Field [".$field."] contains Multibyte chars");
+ return ZBX_VALID_ERROR;
+ }
+ else
+ {
+ info("Warning. Field [".$field."] - multibyte chars are restricted");
+ return ZBX_VALID_ERROR;
+ }
}
-
+//*/
if(($type == T_ZBX_CLR) && !is_hex_color($var)) {
$var = 'FFFFFF';
if($flags&P_SYS)