summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-19 15:04:05 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-19 15:04:05 +0000
commit190d0cf7ac2cbc5b71637d4b07c712c0f5c4f4a3 (patch)
treeb8e00bf40f55fdacc47acf74bf0dd5830b898989 /frontends/php
parent57c41aefe08e7a3c0356b1f30cb19cbe429ca2b8 (diff)
downloadzabbix-190d0cf7ac2cbc5b71637d4b07c712c0f5c4f4a3.tar.gz
zabbix-190d0cf7ac2cbc5b71637d4b07c712c0f5c4f4a3.tar.xz
zabbix-190d0cf7ac2cbc5b71637d4b07c712c0f5c4f4a3.zip
Frontend improvements.
git-svn-id: svn://svn.zabbix.com/trunk@2545 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/config.php22
-rw-r--r--frontends/php/include/validate.inc.php25
-rw-r--r--frontends/php/users.php26
3 files changed, 50 insertions, 23 deletions
diff --git a/frontends/php/config.php b/frontends/php/config.php
index c5652d7d..e919e554 100644
--- a/frontends/php/config.php
+++ b/frontends/php/config.php
@@ -44,24 +44,6 @@
?>
<?php
- function BETWEEN($min,$max)
- {
- return "({}>=$min&&{}<=$max)&&";
- }
-
- function GT($value)
- {
- return "({}>=$value)&&";
- }
-
- function IN($array)
- {
- return "in_array({},array($array))&&";
- }
-
- define("NOT_EMPTY","({}!='')&&");
-
-// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
"config"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1,3,4,5"), NULL),
@@ -93,9 +75,7 @@
$_REQUEST["config"]=@iif(isset($_REQUEST["config"]),$_REQUEST["config"],get_profile("web.config.config",0));
update_profile("web.config.config",$_REQUEST["config"]);
- if(check_fields($fields)!=TRUE)
- {
- }
+ check_fields($fields);
if(isset($_REQUEST["save"])&&isset($_REQUEST["config"])&&(in_array($_REQUEST["config"],array(0,5))))
{
diff --git a/frontends/php/include/validate.inc.php b/frontends/php/include/validate.inc.php
index 04ebac59..89090b51 100644
--- a/frontends/php/include/validate.inc.php
+++ b/frontends/php/include/validate.inc.php
@@ -19,6 +19,24 @@
**/
?>
<?php
+ function BETWEEN($min,$max)
+ {
+ return "({}>=$min&&{}<=$max)&&";
+ }
+
+ function GT($value)
+ {
+ return "({}>=$value)&&";
+ }
+
+ function IN($array)
+ {
+ return "in_array({},array($array))&&";
+ }
+
+ define("NOT_EMPTY","({}!='')&&");
+
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
function calc_exp($fields,$field,$expression)
{
global $_REQUEST;
@@ -67,7 +85,7 @@
if(($flags&P_ACT)&&(isset($_REQUEST[$field])))
{
- info("Unset:".$field);
+// info("Unset:".$field);
unset($_REQUEST[$field]);
}
}
@@ -189,6 +207,10 @@
else continue;
}
}
+
+ if(isset($_REQUEST[$field])&&!get_magic_quotes_gpc()) {
+ $_REQUEST[$field]=addslashes($_REQUEST[$field]);
+ }
}
unset_not_in_list($fields);
if($critical)
@@ -199,7 +221,6 @@
}
if(!$ret)
{
- info("zzz");
unset_action_vars($fields);
}
show_messages();
diff --git a/frontends/php/users.php b/frontends/php/users.php
index d3366920..95bc5e08 100644
--- a/frontends/php/users.php
+++ b/frontends/php/users.php
@@ -42,6 +42,32 @@
<?php
update_profile("web.menu.config.last",$page["file"]);
?>
+
+<?php
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ $fields=array(
+ "alias"=> array(T_ZBX_STR, O_NO, NULL, NOT_EMPTY, '({config}==0)&&isset({save})'),
+ "name"=> array(T_ZBX_STR, O_NO, NULL, NOT_EMPTY, '({config}==0)&&(isset({save}))'),
+ "surname"=> array(T_ZBX_STR, O_NO, NULL, NOT_EMPTY, '({config}==0)&&(isset({save}))'),
+ "password1"=> array(T_ZBX_STR, O_NO, NULL, NULL, '({config}==0)&&(isset({save}))'),
+ "password2"=> array(T_ZBX_STR, O_NO, NULL, NULL, '({config}==0)&&(isset({save}))'),
+ "lang"=> array(T_ZBX_STR, O_NO, NULL, NOT_EMPTY, '({config}==0)&&(isset({save}))'),
+ "autologout"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,3600),'({config}==0)&&(isset({save}))'),
+ "url"=> array(T_ZBX_STR, O_NO, NULL, NULL, '({config}==0)&&(isset({save}))'),
+ "refresh"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,3600),'({config}==0)&&(isset({save}))'),
+
+ "userid"=> array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0,65535), NULL),
+
+ "config"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1,3,4,5"), NULL),
+ "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
+ "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
+ "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
+ "form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL)
+ );
+
+ check_fields($fields);
+?>
+
<?php
if(isset($_REQUEST["save"])&&($_REQUEST["config"]==0))
{