Update user_edit.php

This commit is contained in:
FusionPBX 2019-09-11 02:34:25 -06:00 committed by GitHub
parent 451c3fe048
commit 6f4fd7bc28
1 changed files with 51 additions and 79 deletions

View File

@ -98,7 +98,7 @@
//redirect the user
message::add($text['message-update']);
header("Location: user_edit.php?id=".$user_uuid);
header("Location: user_edit.php?id=".urlencode($user_uuid));
exit;
}
@ -144,10 +144,8 @@
if ($username == '') {
message::add($text['message-required'].$text['label-username'], 'negative', 7500);
}
if (
(permission_exists('user_edit') && $action == 'edit' && $username != $username_old && $username != '') ||
(permission_exists('user_add') && $action == 'add' && $username != '')
) {
if ((permission_exists('user_edit') && $action == 'edit' && $username != $username_old && $username != '') ||
(permission_exists('user_add') && $action == 'add' && $username != '')) {
$sql = "select count(*) from v_users where username = :username ";
if ($_SESSION["users"]["unique"]["text"] != "global") {
$sql .= "and domain_uuid = :domain_uuid ";
@ -206,7 +204,6 @@
//return if error
if (message::count() != 0) {
$_SESSION['tmp'][$_SERVER['PHP_SELF']]['user'] = $_POST;
header("Location: user_edit.php".(permission_exists('user_edit') && $action != 'add' ? "?id=".urlencode($user_uuid) : null));
exit;
}
@ -541,35 +538,11 @@
else {
message::add($text['message-add'],'positive');
}
header("Location: user_edit.php?id=".$user_uuid);
header("Location: user_edit.php?id=".urldecode($user_uuid));
exit;
}
//populate the form with values from session variable
if (is_array($_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']) && sizeof($_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']) != 0) {
$domain_uuid = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']["domain_uuid"];
$username = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']["username"];
$password = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']["password"];
$password_confirm = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']["password_confirm"];
$api_key = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']["api_key"];
$user_enabled = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']["user_enabled"];
$contact_uuid = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']["contact_uuid"];
$user_status = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']["user_status"];
$password_confirm = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['password_confirm'];
$user_settings['domain']['language']['code'] = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['user_language'];
$user_settings['domain']['time_zone']['name'] = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['user_time_zone'];
$user_email = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['user_email'];
$contact_name_given = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['contact_name_given'];
$contact_name_family = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['contact_name_family'];
$contact_organization = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['contact_organization'];
$group_uuid_name = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['group_uuid_name'];
$user_settings["message"]["key"]["text"] = $_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']['message_key'];
$unsaved = true;
unset($_SESSION['tmp'][$_SERVER['PHP_SELF']]['user']);
}
else {
//populate the form with values from db
//populate the form with values from db
if ($action == 'edit') {
$sql = "select * from v_users where user_uuid = :user_uuid ";
if (!permission_exists('user_all')) {
@ -619,7 +592,6 @@
}
unset($sql, $parameters, $result, $row);
}
}
//include the header
require_once "resources/header.php";