summaryrefslogtreecommitdiffstats
path: root/frontends/php/profile.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-23 07:34:27 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-23 07:34:27 +0000
commit28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (patch)
tree8281ccd48964ee0dd11c5ea689091fa3cef706fb /frontends/php/profile.php
parent495799b2aa61aab23d74d7faa110a0cd09d59bf0 (diff)
downloadzabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.gz
zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.xz
zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.zip
- developed group permission system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3371 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/profile.php')
-rw-r--r--frontends/php/profile.php70
1 files changed, 48 insertions, 22 deletions
diff --git a/frontends/php/profile.php b/frontends/php/profile.php
index aa264b84..09f95944 100644
--- a/frontends/php/profile.php
+++ b/frontends/php/profile.php
@@ -19,55 +19,81 @@
**/
?>
<?php
- include "include/config.inc.php";
- include "include/forms.inc.php";
+ require_once "include/config.inc.php";
+ require_once "include/users.inc.php";
+ require_once "include/forms.inc.php";
$page["title"] = "S_USER_PROFILE";
$page["file"] = "profile.php";
- show_header($page["title"],0,0);
-// insert_confirm_javascript();
-?>
+include_once "include/page_header.php";
+ insert_confirm_javascript();
+?>
<?php
if($USER_DETAILS["alias"]=="guest")
{
- show_table_header("<font color=\"AA0000\">".S_NO_PERMISSIONS."</font>");
- show_page_footer();
- exit;
+ access_deny();
}
?>
+<?php
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ $fields=array(
+ "password1"=> array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&{form}!="update"&&isset({change_password})'),
+ "password2"=> array(T_ZBX_STR, O_OPT, null, null, 'isset({save})&&{form}!="update"&&isset({change_password})'),
+ "lang"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'),
+ "autologout"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,3600),'isset({save})'),
+ "url"=> array(T_ZBX_STR, O_OPT, null, null, 'isset({save})'),
+ "refresh"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,3600),'isset({save})'),
+ "change_password"=> array(T_ZBX_STR, O_OPT, null, null, null),
+/* actions */
+ "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null),
+ "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null),
+/* other */
+ "form"=> array(T_ZBX_STR, O_OPT, P_SYS, null, null),
+ "form_refresh"=>array(T_ZBX_STR, O_OPT, null, null, null)
+ );
+
+ check_fields($fields);
+?>
<?php
- if(isset($_REQUEST["save"]))
+ if(isset($_REQUEST["cancel"]))
{
- if($_REQUEST["password1"]==$_REQUEST["password2"])
+ Redirect('index.php');
+ }
+ elseif(isset($_REQUEST["save"]))
+ {
+ $_REQUEST["password1"] = get_request("password1", null);
+ $_REQUEST["password2"] = get_request("password2", null);
+
+ if(isset($_REQUEST["password1"]) && $_REQUEST["password1"] == "")
{
- $result=update_user_profile($_REQUEST["userid"],$_REQUEST["password1"],$_REQUEST["url"],$_REQUEST["autologout"],$_REQUEST["lang"],$_REQUEST["refresh"]);
+ show_error_message(S_ONLY_FOR_GUEST_ALLOWED_EMPTY_PASSWORD);
+ }
+ elseif($_REQUEST["password1"]==$_REQUEST["password2"])
+ {
+ $result=update_user_profile($USER_DETAILS["userid"],$_REQUEST["password1"],$_REQUEST["url"],$_REQUEST["autologout"],$_REQUEST["lang"],$_REQUEST["refresh"]);
show_messages($result, S_USER_UPDATED, S_CANNOT_UPDATE_USER);
if($result)
- add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_USER,"User ID [".$_REQUEST["userid"]."]");
+ add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_USER,
+ "User alias [".$USER_DETAILS["alias"].
+ "] name [".$USER_DETAILS["name"]."] surname [".
+ $USER_DETAILS["surname"]."] profile id [".$USER_DETAILS["userid"]."]");
}
else
{
show_error_message(S_CANNOT_UPDATE_USER_BOTH_PASSWORDS);
}
}
- if(isset($_REQUEST["save"]))
- {
- unset($_REQUEST["userid"]);
- }
?>
-
<?php
show_table_header(S_USER_PROFILE_BIG." : ".$USER_DETAILS["name"]." ".$USER_DETAILS["surname"]);
echo "<br>";
+ insert_user_form($USER_DETAILS["userid"],1);
?>
-
<?php
- @insert_user_form($USER_DETAILS["userid"],1);
-?>
-<?php
- show_page_footer();
+include_once "include/page_footer.php";
+
?>