mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Move user_settings to the core directory.
This commit is contained in:
51
core/user_settings/app_config.php
Normal file
51
core/user_settings/app_config.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
//application details
|
||||
$apps[$x]['name'] = "Account Settings";
|
||||
$apps[$x]['uuid'] = '3a3337f7-78d1-23e3-0cfd-f14499b8ed97';
|
||||
$apps[$x]['category'] = 'Switch';;
|
||||
$apps[$x]['subcategory'] = '';
|
||||
$apps[$x]['version'] = '';
|
||||
$apps[$x]['license'] = 'Mozilla Public License 1.1';
|
||||
$apps[$x]['url'] = 'http://www.fusionpbx.com';
|
||||
$apps[$x]['description']['en-us'] = 'User account settings can be changed by the user.';
|
||||
$apps[$x]['description']['es-mx'] = '';
|
||||
$apps[$x]['description']['de'] = '';
|
||||
$apps[$x]['description']['de-ch'] = '';
|
||||
$apps[$x]['description']['de-at'] = '';
|
||||
$apps[$x]['description']['fr'] = '';
|
||||
$apps[$x]['description']['fr-ca'] = '';
|
||||
$apps[$x]['description']['fr-ch'] = '';
|
||||
$apps[$x]['description']['pt-pt'] = 'Configurações de conta de utilizador pode ser alterado pelo utilizador.';
|
||||
$apps[$x]['description']['pt-br'] = '';
|
||||
|
||||
//menu details
|
||||
$apps[$x]['menu'][0]['title']['en-us'] = 'Account Settings';
|
||||
$apps[$x]['menu'][0]['title']['es-mx'] = '';
|
||||
$apps[$x]['menu'][0]['title']['de'] = '';
|
||||
$apps[$x]['menu'][0]['title']['de-ch'] = '';
|
||||
$apps[$x]['menu'][0]['title']['de-at'] = '';
|
||||
$apps[$x]['menu'][0]['title']['fr'] = '';
|
||||
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
|
||||
$apps[$x]['menu'][0]['title']['fr-ch'] = '';
|
||||
$apps[$x]['menu'][0]['title']['pt-pt'] = 'Configurações da Conta';
|
||||
$apps[$x]['menu'][0]['title']['pt-br'] = '';
|
||||
$apps[$x]['menu'][0]['uuid'] = '4d532f0b-c206-c39d-ff33-fc67d668fb69';
|
||||
$apps[$x]['menu'][0]['parent_uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
|
||||
$apps[$x]['menu'][0]['category'] = 'internal';
|
||||
$apps[$x]['menu'][0]['path'] = 'user/user_edit.php';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'user';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'admin';
|
||||
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
|
||||
|
||||
//permission details
|
||||
$apps[$x]['permissions'][0]['name'] = 'user_account_settings_view';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
|
||||
|
||||
$apps[$x]['permissions'][1]['name'] = 'user_account_settings_edit';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'user';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'admin';
|
||||
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
|
||||
|
||||
?>
|
||||
95
core/user_settings/app_languages.php
Normal file
95
core/user_settings/app_languages.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
$content_users['title']['en-us'] = 'Account Settings';
|
||||
$content_users['title']['pt-pt'] = 'Configurações de Conta';
|
||||
|
||||
$content_users['description']['en-us'] = 'Edit account information.';
|
||||
$content_users['description']['pt-pt'] = 'Editar informações de conta.';
|
||||
|
||||
$content_users['button-back']['en-us'] = 'Back';
|
||||
$content_users['button-back']['pt-pt'] = 'Voltar';
|
||||
|
||||
$content_users['button-save']['en-us'] = 'Save';
|
||||
$content_users['button-save']['pt-pt'] = 'Guardar';
|
||||
|
||||
$content_users['table-title']['en-us'] = 'User Info';
|
||||
$content_users['table-title']['pt-pt'] = 'Informações de Utilizador';
|
||||
|
||||
$content_users['label-username']['en-us'] = 'Username';
|
||||
$content_users['label-username']['pt-pt'] = 'Nome de Utilizador';
|
||||
|
||||
$content_users['label-password']['en-us'] = 'Password';
|
||||
$content_users['label-password']['pt-pt'] = 'Palavra passe';
|
||||
|
||||
$content_users['label-confirm-password']['en-us'] = 'Confirm Password';
|
||||
$content_users['label-confirm-password']['pt-pt'] = 'Confirme Palavra Chave';
|
||||
|
||||
$content_users['label-extension']['en-us'] = 'Extension';
|
||||
$content_users['label-extension']['pt-pt'] = 'Extensão';
|
||||
|
||||
$content_users['table2-title']['en-us'] = 'Additional Info';
|
||||
$content_users['table2-title']['pt-pt'] = 'Informações Adicionais';
|
||||
|
||||
$content_users['label-status']['en-us'] = 'Status';
|
||||
$content_users['label-status']['pt-pt'] = 'Estado';
|
||||
|
||||
$content_users['description-status']['en-us'] = 'Select a the user status.';
|
||||
$content_users['description-status']['pt-pt'] = 'Selecione um estado para o utilizador.';
|
||||
|
||||
$content_users['check-available-status']['en-us'] = 'Available';
|
||||
$content_users['check-available-status']['pt-pt'] = 'Disponível';
|
||||
|
||||
$content_users['check-available-ondemand-status']['en-us'] = 'Available (On Demand)';
|
||||
$content_users['check-available-ondemand-status']['pt-pt'] = 'Disponível (A pedido)';
|
||||
|
||||
$content_users['check-loggedout-status']['en-us'] = 'Logged Out';
|
||||
$content_users['check-loggedout-status']['pt-pt'] = 'Desligado';
|
||||
|
||||
$content_users['check-onbreak-status']['en-us'] = 'On Break';
|
||||
$content_users['check-onbreak-status']['pt-pt'] = 'Em Pausa';
|
||||
|
||||
$content_users['check-do-not-disturb-status']['en-us'] = 'Do Not Disturb';
|
||||
$content_users['check-do-not-disturb-status']['pt-pt'] = 'Não Perturbar';
|
||||
|
||||
$content_users['label-time']['en-us'] = 'Time Zone';
|
||||
$content_users['label-time']['pt-pt'] = 'Fuso Horário';
|
||||
|
||||
$content_users['description-timezone']['en-us'] = 'Select the default time zone.';
|
||||
$content_users['description-timezone']['pt-pt'] = 'Selecione o fuso horário padrão.';
|
||||
|
||||
$content_users['confirm-password']['en-us'] = 'Passwords did not match.';
|
||||
$content_users['confirm-password']['pt-pt'] = 'As palavras chave não coincidem.';
|
||||
|
||||
$content_users['confirm-update']['en-us'] = 'Update Complete';
|
||||
$content_users['confirm-update']['pt-pt'] = 'Actualização Completa';
|
||||
|
||||
$text['title-user-information']['en-us'] = 'User Information';
|
||||
$text['title-user-information']['pt-pt'] = 'Informação do Utilizador';
|
||||
|
||||
$text['label-username']['en-us'] = 'User Name';
|
||||
$text['label-username']['pt-pt'] = 'Nome do Utilizador';
|
||||
|
||||
$text['label-voicemail']['en-us'] = 'Voicemail';
|
||||
$text['label-voicemail']['pt-pt'] = 'Correio de Voz';
|
||||
|
||||
$text['label-view-messages']['en-us'] = 'View Messages';
|
||||
$text['label-view-messages']['pt-pt'] = 'Ver Mensagens';
|
||||
|
||||
$text['table-extension']['en-us'] = 'Extension';
|
||||
$text['table-extension']['pt-pt'] = 'Extensão';
|
||||
|
||||
$text['table-tools']['en-us'] = 'Tools';
|
||||
$text['table-tools']['pt-pt'] = 'Ferramentas';
|
||||
|
||||
$text['table-description']['en-us'] = 'Description';
|
||||
$text['table-description']['pt-pt'] = 'Descrição';
|
||||
|
||||
$text['label-callforward']['en-us'] = 'Call Forward';
|
||||
$text['label-callforward']['pt-pt'] = 'Encaminhamento de Chamadas';
|
||||
|
||||
$text['label-followme']['en-us'] = 'Follow Me';
|
||||
$text['label-followme']['pt-pt'] = 'Segue-me';
|
||||
|
||||
$text['label-dnd']['en-us'] = 'Do Not Disturb';
|
||||
$text['label-dnd']['pt-pt'] = 'Não Perturbar';
|
||||
?>
|
||||
50
core/user_settings/root.php
Normal file
50
core/user_settings/root.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
// make sure the PATH_SEPARATOR is defined
|
||||
if (!defined("PATH_SEPARATOR")) {
|
||||
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
|
||||
}
|
||||
|
||||
// make sure the document_root is set
|
||||
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
|
||||
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
|
||||
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
|
||||
|
||||
// if the project directory exists then add it to the include path otherwise add the document root to the include path
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
|
||||
}
|
||||
else {
|
||||
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
|
||||
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
|
||||
}
|
||||
|
||||
?>
|
||||
105
core/user_settings/user_dashboard.php
Normal file
105
core/user_settings/user_dashboard.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
if (!file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")){
|
||||
header("Location: ".PROJECT_PATH."/install.php");
|
||||
exit;
|
||||
}
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
require_once "includes/header.php";
|
||||
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
//add multi-lingual support
|
||||
echo "<!--\n";
|
||||
require_once "app_languages.php";
|
||||
echo "-->\n";
|
||||
foreach($text as $key => $value) {
|
||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//information
|
||||
//echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
||||
//echo " <tr>\n";
|
||||
//echo " <td align='left'><b>Information</b><br>\n";
|
||||
//echo " The following links are for convenience access to the user account settings, and voicemail.<br />\n";
|
||||
//echo " </td>\n";
|
||||
//echo " </tr>\n";
|
||||
//echo "</table>\n";
|
||||
//echo "<br />\n";
|
||||
|
||||
//start the user table
|
||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
|
||||
echo "<tr>\n";
|
||||
echo " <th class='th' colspan='2' align='left'>".$text['title-user-settings']." </th>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " ".$text['label-usernname'].": \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"row_style1\">\n";
|
||||
echo " <a href='".PROJECT_PATH."/app/user_settings/user_edit.php'>".$_SESSION["username"]."</a> \n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//voicemail
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/voicemail_messages.php")) {
|
||||
echo "<tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " ".$text['label-voicemail'].": \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"row_style1\">\n";
|
||||
echo " <a href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php'>".$text['label-view-messages']."</a> \n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
//end the table
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<br />\n";
|
||||
|
||||
//call forward, follow me and dnd
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/calls/calls.php")) {
|
||||
if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) {
|
||||
$is_included = "true";
|
||||
require_once "app/calls/calls.php";
|
||||
}
|
||||
}
|
||||
|
||||
//hunt group forward
|
||||
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/hunt_group/v_hunt_group_call_forward.php")) {
|
||||
if (permission_exists('hunt_group_call_forward')) {
|
||||
$is_included = "true";
|
||||
require_once "app/hunt_group/v_hunt_group_call_forward.php";
|
||||
}
|
||||
}
|
||||
|
||||
//show the footer
|
||||
require_once "includes/footer.php";
|
||||
?>
|
||||
420
core/user_settings/user_edit.php
Normal file
420
core/user_settings/user_edit.php
Normal file
@@ -0,0 +1,420 @@
|
||||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "includes/require.php";
|
||||
require_once "includes/checkauth.php";
|
||||
include "app_languages.php";
|
||||
|
||||
if (permission_exists("user_account_settings_view")) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
foreach($content_users as $key => $value) {
|
||||
$content_users[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||
}
|
||||
|
||||
//set the username from v_users
|
||||
$username = $_SESSION["username"];
|
||||
$user_uuid = $_SESSION["user_uuid"];
|
||||
|
||||
//required to be a superadmin to update an account that is a member of the superadmin group
|
||||
$superadmin_list = superadmin_list($db);
|
||||
if (if_superadmin($superadmin_list, $user_uuid)) {
|
||||
if (!if_group("superadmin")) {
|
||||
echo "access denied";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//get the user settings
|
||||
$sql = "select * from v_user_settings ";
|
||||
$sql .= "where user_uuid = '".$user_uuid."' ";
|
||||
$sql .= "and user_setting_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $row) {
|
||||
$name = $row['user_setting_name'];
|
||||
$category = $row['user_setting_category'];
|
||||
$subcategory = $row['user_setting_subcategory'];
|
||||
if (strlen($subcategory) == 0) {
|
||||
//$$category[$name] = $row['domain_setting_value'];
|
||||
$user_settings[$category][$name] = $row['user_setting_value'];
|
||||
}
|
||||
else {
|
||||
$user_settings[$category][$subcategory][$name] = $row['user_setting_value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($_POST)>0 && $_POST["persistform"] != "1") {
|
||||
|
||||
$password = check_str($_POST["password"]);
|
||||
$confirm_password = check_str($_POST["confirm_password"]);
|
||||
$user_status = check_str($_POST["user_status"]);
|
||||
$user_template_name = check_str($_POST["user_template_name"]);
|
||||
$user_time_zone = check_str($_POST["user_time_zone"]);
|
||||
$group_member = check_str($_POST["group_member"]);
|
||||
|
||||
$msg = '';
|
||||
//if (strlen($password) == 0) { $msg .= "Password cannot be blank.<br>\n"; }
|
||||
if ($password != $confirm_password) { $msg .= "".$content_users['confirm-password']."<br>\n"; }
|
||||
//if (strlen($user_time_zone) == 0) { $msg .= "Please provide an time zone.<br>\n"; }
|
||||
|
||||
if (strlen($msg) > 0) {
|
||||
require_once "includes/header.php";
|
||||
echo "<div align='center'>";
|
||||
echo "<table><tr><td>";
|
||||
echo $msg;
|
||||
echo "</td></tr></table>";
|
||||
echo "<br />\n";
|
||||
require_once "includes/persistform.php";
|
||||
echo persistform($_POST);
|
||||
echo "</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
|
||||
//get the number of rows in v_user_settings
|
||||
$sql = "select count(*) as num_rows from v_user_settings ";
|
||||
$sql .= "where user_setting_category = 'domain' ";
|
||||
$sql .= "and user_setting_subcategory = 'time_zone' ";
|
||||
$sql .= "and user_uuid = '".$user_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] == 0) {
|
||||
$user_setting_uuid = uuid();
|
||||
$sql = "insert into v_user_settings ";
|
||||
$sql .= "(";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "user_setting_uuid, ";
|
||||
$sql .= "user_setting_category, ";
|
||||
$sql .= "user_setting_subcategory, ";
|
||||
$sql .= "user_setting_name, ";
|
||||
$sql .= "user_setting_value, ";
|
||||
$sql .= "user_setting_enabled, ";
|
||||
$sql .= "user_uuid ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$_SESSION["domain_uuid"]."', ";
|
||||
$sql .= "'".$user_setting_uuid."', ";
|
||||
$sql .= "'domain', ";
|
||||
$sql .= "'time_zone', ";
|
||||
$sql .= "'name', ";
|
||||
$sql .= "'".$user_time_zone."', ";
|
||||
$sql .= "'true', ";
|
||||
$sql .= "'".$user_uuid."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
}
|
||||
else {
|
||||
if (strlen($user_time_zone) == 0) {
|
||||
$sql = "delete from v_user_settings ";
|
||||
$sql .= "where user_setting_category = 'domain' ";
|
||||
$sql .= "and user_setting_subcategory = 'time_zone' ";
|
||||
$sql .= "and user_uuid = '".$user_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
else {
|
||||
$sql = "update v_user_settings set ";
|
||||
$sql .= "user_setting_value = '".$user_time_zone."', ";
|
||||
$sql .= "user_setting_enabled = 'true' ";
|
||||
$sql .= "where user_setting_category = 'domain' ";
|
||||
$sql .= "and user_setting_subcategory = 'time_zone' ";
|
||||
$sql .= "and user_uuid = '".$user_uuid."' ";
|
||||
$db->exec(check_sql($sql));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if the template has not been assigned by the superadmin
|
||||
//if (strlen($_SESSION['domain']['template']['name']) == 0) {
|
||||
//set the session theme for the active user
|
||||
// $_SESSION['domain']['template']['name'] = $user_template_name;
|
||||
//}
|
||||
|
||||
//sql update
|
||||
$sql = "update v_users set ";
|
||||
if (strlen($password) > 0 && $confirm_password == $password) {
|
||||
//salt used with the password to create a one way hash
|
||||
$salt = generate_password('20', '4');
|
||||
//set the password
|
||||
$sql .= "password = '".md5($salt.$password)."', ";
|
||||
$sql .= "salt = '".$salt."', ";
|
||||
}
|
||||
$sql .= "user_status = '$user_status' ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and user_uuid = '$user_uuid' ";
|
||||
if (permission_exists("user_account_settings_edit")) {
|
||||
$count = $db->exec(check_sql($sql));
|
||||
}
|
||||
|
||||
//if call center app is installed then update the user_status
|
||||
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/call_center')) {
|
||||
//update the user_status
|
||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||
$switch_cmd .= "callcenter_config agent set status ".$username."@".$_SESSION['domain_name']." '".$user_status."'";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
|
||||
//update the user state
|
||||
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
}
|
||||
|
||||
//clear the template so it will rebuild in case the template was changed
|
||||
//$_SESSION["template_content"] = '';
|
||||
|
||||
//redirect the browser
|
||||
require_once "includes/header.php";
|
||||
echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/user/user_edit.php\">\n";
|
||||
echo "<div align='center'>".$content_users['confirm-update']."</div>";
|
||||
require_once "includes/footer.php";
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$sql = "select * from v_users ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and user_uuid = '$user_uuid' ";
|
||||
$sql .= "and user_enabled = 'true' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach ($result as $row) {
|
||||
//$password = $row["password"];
|
||||
$user_status = $row["user_status"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
|
||||
//get the groups the user is a member of
|
||||
//group_members function defined in config.php
|
||||
$group_members = group_members($db, $user_uuid);
|
||||
}
|
||||
|
||||
//include the header
|
||||
require_once "includes/header.php";
|
||||
|
||||
//show the content
|
||||
$table_width ='width="100%"';
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td>\n";
|
||||
|
||||
echo "<table $table_width cellpadding='3' cellspacing='0' border='0'>";
|
||||
echo "<td align='left' width='90%' nowrap><b>".$content_users['title']."</b></td>\n";
|
||||
echo "<td nowrap='nowrap'>\n";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$content_users['button-save']."'>";
|
||||
echo " <input type='button' class='btn' onclick=\"window.location='".PROJECT_PATH."/index2.php'\" value='".$content_users['button-back']."'>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td align='left' colspan='2'>\n";
|
||||
echo " ".$content_users['description']." \n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<br />\n";
|
||||
|
||||
echo "<table $table_width cellpadding='6' cellspacing='0' border='0'>";
|
||||
echo "<tr>\n";
|
||||
echo " <th class='th' colspan='2' align='left'>".$content_users['table-title']."</th>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td width='30%' class='vncellreq'>".$content_users['label-username'].":</td>";
|
||||
echo " <td width='70%' class='vtable'>$username</td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>".$content_users['label-password'].":</td>";
|
||||
echo " <td class='vtable'><input type='password' autocomplete='off' class='formfld' name='password' value=\"\"></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>".$content_users['label-confirm-password'].":</td>";
|
||||
echo " <td class='vtable'><input type='password' autocomplete='off' class='formfld' name='confirm_password' value=\"\"></td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "<br>";
|
||||
echo "<br>";
|
||||
|
||||
echo "<table $table_width cellpadding='6' cellspacing='0'>";
|
||||
echo " <tr>\n";
|
||||
echo " <th class='th' colspan='2' align='left'>".$content_users['table2-title']."</th>\n";
|
||||
echo " </tr>\n";
|
||||
|
||||
if ($_SESSION['user_status_display'] == "false") {
|
||||
//hide the user_status when it is set to false
|
||||
}
|
||||
else {
|
||||
echo " <tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " ".$content_users['label-status'].":\n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"vtable\">\n";
|
||||
echo " <select id='user_status' name='user_status' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
if ($user_status == "Available") {
|
||||
echo " <option value='Available' selected='selected'>".$content_users['check-available-status']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Available'>".$content_users['check-available-status']."</option>\n";
|
||||
}
|
||||
if ($user_status == "Available (On Demand)") {
|
||||
echo " <option value='Available (On Demand)' selected='selected'>".$content_users['check-available-ondemand-status']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Available (On Demand)'>".$content_users['check-available-ondemand-status']."</option>\n";
|
||||
}
|
||||
if ($user_status == "Logged Out") {
|
||||
echo " <option value='Logged Out' selected='selected'>".$content_users['check-loggedout-status']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Logged Out'>".$content_users['check-loggedout-status']."</option>\n";
|
||||
}
|
||||
if ($user_status == "On Break") {
|
||||
echo " <option value='On Break' selected='selected'>".$content_users['check-onbreak-status']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='On Break'>".$content_users['check-onbreak-status']."</option>\n";
|
||||
}
|
||||
if ($user_status == "Do Not Disturb") {
|
||||
echo " <option value='Do Not Disturb' selected='selected'>".$content_users['check-do-not-disturb-status']."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='Do Not Disturb'>".$content_users['check-do-not-disturb-status']."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo " ".$content_users['description-status']."<br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
|
||||
//if the template has not been assigned by the superadmin
|
||||
/*
|
||||
if (strlen($_SESSION['domain']['template']['name']) == 0) {
|
||||
echo " <tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " Template: \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"vtable\">\n";
|
||||
echo " <select id='user_template_name' name='user_template_name' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
|
||||
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
|
||||
while (false !== ($dir_name = readdir($handle))) {
|
||||
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && is_dir($theme_dir.'/'.$dir_name)) {
|
||||
$dir_label = str_replace('_', ' ', $dir_name);
|
||||
$dir_label = str_replace('-', ' ', $dir_label);
|
||||
if ($dir_name == $user_settings['domain']['template']['name']) {
|
||||
echo " <option value='$dir_name' selected='selected'>$dir_label</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='$dir_name'>$dir_label</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo " Select a template to set as the default and then press save.<br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
}
|
||||
*/
|
||||
|
||||
echo " <tr>\n";
|
||||
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
|
||||
echo " ".$content_users['label-time'].": \n";
|
||||
echo " </td>\n";
|
||||
echo " <td class=\"vtable\" align='left'>\n";
|
||||
echo " <select id='user_time_zone' name='user_time_zone' class='formfld' style=''>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
//$list = DateTimeZone::listAbbreviations();
|
||||
$time_zone_identifiers = DateTimeZone::listIdentifiers();
|
||||
$previous_category = '';
|
||||
$x = 0;
|
||||
foreach ($time_zone_identifiers as $key => $row) {
|
||||
$time_zone = explode("/", $row);
|
||||
$category = $time_zone[0];
|
||||
if ($category != $previous_category) {
|
||||
if ($x > 0) {
|
||||
echo " </optgroup>\n";
|
||||
}
|
||||
echo " <optgroup label='".$category."'>\n";
|
||||
}
|
||||
if ($row == $user_settings['domain']['time_zone']['name']) {
|
||||
echo " <option value='".$row."' selected='selected'>".$row."</option>\n";
|
||||
}
|
||||
else {
|
||||
echo " <option value='".$row."'>".$row."</option>\n";
|
||||
}
|
||||
$previous_category = $category;
|
||||
$x++;
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " <br />\n";
|
||||
echo " ".$content_users['description-timezone']."<br />\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>";
|
||||
echo "<br>";
|
||||
|
||||
echo "<div class='' style='padding:10px;'>\n";
|
||||
echo "<table $table_width>";
|
||||
echo " <tr>";
|
||||
echo " <td colspan='2' align='right'>";
|
||||
echo " <input type='submit' name='submit' class='btn' value='".$content_users['button-save']."'>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
|
||||
//include the footer
|
||||
require_once "includes/footer.php";
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user