Add a missing file sip_profile_copy.php to the dev branch.

This commit is contained in:
Mark Crane
2012-06-04 14:58:40 +00:00
commit af103e9c41
1240 changed files with 164946 additions and 0 deletions
+356
View File
@@ -0,0 +1,356 @@
<?php
//application details
$apps[$x]['name'] = "User Manager";
$apps[$x]['uuid'] = '112124b3-95c2-5352-7e9d-d14c0b88f207';
$apps[$x]['category'] = 'Core';
$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'] = 'Add, edit, delete, and search for users.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Login';
$apps[$x]['menu'][0]['uuid'] = 'c85bf816-b88d-40fa-8634-11b456928afa';
$apps[$x]['menu'][0]['parent_uuid'] = '';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/login.php';
$apps[$x]['menu'][0]['groups'][] = 'public';
$apps[$x]['menu'][0]['order'] = '99';
$apps[$x]['menu'][1]['title']['en'] = 'Logout';
$apps[$x]['menu'][1]['uuid'] = '0d29e9f4-0c9b-9d8d-cd2d-454899dc9bc4';
$apps[$x]['menu'][1]['parent_uuid'] = '02194288-6d56-6d3e-0b1a-d53a2bc10788';
$apps[$x]['menu'][1]['category'] = 'internal';
$apps[$x]['menu'][1]['path'] = '/logout.php';
$apps[$x]['menu'][1]['groups'][] = 'user';
$apps[$x]['menu'][1]['groups'][] = 'admin';
$apps[$x]['menu'][1]['groups'][] = 'superadmin';
$apps[$x]['menu'][2]['title']['en'] = 'User Manager';
$apps[$x]['menu'][2]['uuid'] = '0d57cc1e-1874-47b9-7ddd-fe1f57cec99b';
$apps[$x]['menu'][2]['parent_uuid'] = 'bc96d773-ee57-0cdd-c3ac-2d91aba61b55';
$apps[$x]['menu'][2]['category'] = 'internal';
$apps[$x]['menu'][2]['path'] = '/core/users/index.php';
$apps[$x]['menu'][2]['groups'][] = 'admin';
$apps[$x]['menu'][2]['groups'][] = 'superadmin';
$apps[$x]['menu'][3]['title']['en'] = 'Group Manager';
$apps[$x]['menu'][3]['uuid'] = '3b4acc6d-827b-f537-bf21-0093d94ffec7';
$apps[$x]['menu'][3]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
$apps[$x]['menu'][3]['category'] = 'internal';
$apps[$x]['menu'][3]['path'] = '/core/users/grouplist.php';
$apps[$x]['menu'][3]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'user_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'user_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'user_edit';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'user_delete';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'group_view';
$apps[$x]['permissions'][4]['groups'][] = 'admin';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
$apps[$x]['permissions'][5]['name'] = 'group_add';
$apps[$x]['permissions'][5]['groups'][] = 'admin';
$apps[$x]['permissions'][5]['groups'][] = 'superadmin';
$apps[$x]['permissions'][6]['name'] = 'group_edit';
$apps[$x]['permissions'][6]['groups'][] = 'admin';
$apps[$x]['permissions'][6]['groups'][] = 'superadmin';
$apps[$x]['permissions'][7]['name'] = 'group_delete';
$apps[$x]['permissions'][7]['groups'][] = 'admin';
$apps[$x]['permissions'][7]['groups'][] = 'superadmin';
$apps[$x]['permissions'][8]['name'] = 'group_member_view';
$apps[$x]['permissions'][8]['groups'][] = 'admin';
$apps[$x]['permissions'][8]['groups'][] = 'superadmin';
$apps[$x]['permissions'][9]['name'] = 'group_member_add';
$apps[$x]['permissions'][9]['groups'][] = 'admin';
$apps[$x]['permissions'][9]['groups'][] = 'superadmin';
$apps[$x]['permissions'][10]['name'] = 'group_member_delete';
$apps[$x]['permissions'][10]['groups'][] = 'admin';
$apps[$x]['permissions'][10]['groups'][] = 'superadmin';
$apps[$x]['permissions'][11]['name'] = 'group_permissions';
$apps[$x]['permissions'][11]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_users';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'username';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'password';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'salt';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
//$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_contacts';
//$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'contact_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_email';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'useremail';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_status';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'userstatus';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_time_zone';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'usertimezone';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_add_user';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'useradduser';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'user_add_date';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'useradddate';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_groups';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'group_name';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'groupid';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'group_description';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'groupdesc';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 2; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_group_users';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'group_name';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'groupid';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
//$z++;
//$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
//$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
//$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
//$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
//$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'username';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 3; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_group_permissions';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_permission_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'group_permission_name';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'permission_name';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'permission_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
//$apps[$x]['db'][$y]['fields'][$z]['name'] = 'group_uuid';
//$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
//$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
//$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
//$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
//$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$y = 4; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_user_settings';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_category';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the category.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_subcategory';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the subcategory.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the name.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_value';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the value.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_setting_description';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>
+169
View File
@@ -0,0 +1,169 @@
<?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>
*/
//if the are no groups add the default groups
$sql = "SELECT * FROM v_groups ";
$sql .= "WHERE domain_uuid = '$domain_uuid' ";
$sub_result = $db->query($sql)->fetch();
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$sub_result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
if (count($sub_result) == 0) {
$x = 0;
$tmp[$x]['group_name'] = 'superadmin';
$tmp[$x]['group_description'] = 'Super Administrator Group';
$x++;
$tmp[$x]['group_name'] = 'admin';
$tmp[$x]['group_description'] = 'Administrator Group';
$x++;
$tmp[$x]['group_name'] = 'user';
$tmp[$x]['group_description'] = 'User Group';
$x++;
$tmp[$x]['group_name'] = 'public';
$tmp[$x]['group_description'] = 'Public Group';
$x++;
$tmp[$x]['group_name'] = 'agent';
$tmp[$x]['group_description'] = 'Call Center Agent Group';
foreach($tmp as $row) {
if (strlen($row['group_name']) > 0) {
$sql = "insert into v_groups ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "group_uuid, ";
$sql .= "group_name, ";
$sql .= "group_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'".$row['group_name']."', ";
$sql .= "'".$row['group_description']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
}
}
}
unset($prep_statement, $sub_result);
//if there are no permissions listed in v_group_permissions then set the default permissions
$sql = "select count(*) as count from v_group_permissions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement);
if ($sub_result['count'] > 0) {
if ($display_type == "text") {
echo " Group Permissions: no change\n";
}
}
else {
if ($display_type == "text") {
echo " Group Permissions: added\n";
}
//no permissions found add the defaults
$db->beginTransaction();
foreach($apps as $app) {
foreach ($app['permissions'] as $sub_row) {
foreach ($sub_row['groups'] as $group) {
//add the record
$sql = "insert into v_group_permissions ";
$sql .= "(";
$sql .= "group_permission_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "permission_name, ";
$sql .= "group_name ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$domain_uuid', ";
$sql .= "'".$sub_row['name']."', ";
$sql .= "'".$group."' ";
$sql .= ")";
$db->exec($sql);
unset($sql);
}
}
}
$db->commit();
}
//find rows that have a null user_uuid and set the correct user_uuid
$sql = "select * from v_group_users ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and user_uuid is null; ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result as $row) {
if (strlen($row['username']) > 0) {
//get the user_uuid
$sql = "select user_uuid from v_users ";
$sql .= "where username = '".$row['username']."' ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement_sub);
$user_uuid = $sub_result['user_uuid'];
//set the user uuid
$sql = "update v_group_users set ";
$sql .= "user_uuid = '".$user_uuid."' ";
$sql .= "where username = '".$row['username']."'; ";
$db->exec($sql);
unset($sql);
}
else {
//get the number of users
$sql = "select count(*) as num_rows from v_users ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement_sub);
$num_rows = $sub_result['num_rows'];
if ($num_rows == 1) {
//get the user_uuid
$sql = "select user_uuid from v_users ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
unset ($prep_statement_sub);
$user_uuid = $sub_result['user_uuid'];
//set the user uuid
$sql = "update v_group_users set ";
$sql .= "user_uuid = '".$user_uuid."' ";
$db->exec($sql);
unset($sql);
}
}
}
}
?>
+275
View File
@@ -0,0 +1,275 @@
<?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>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('group_permissions') || if_group("superadmin")) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get the list of installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$x=0;
foreach ($config_list as &$config_path) {
include($config_path);
$x++;
}
//if there are no permissions listed in v_group_permissions then set the default permissions
$sql = "";
$sql .= "select count(*) as count from v_group_permissions ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$group_permission_count = $row["count"];
break; //limit to 1 row
}
unset ($prep_statement);
if ($group_permission_count == 0) {
//no permissions found add the defaults
foreach($apps as $app) {
foreach ($app['permissions'] as $row) {
foreach ($row['groups'] as $group) {
//add the record
$sql = "insert into v_group_permissions ";
$sql .= "(";
$sql .= "group_permission_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "permission_name, ";
$sql .= "group_name ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$domain_uuid', ";
$sql .= "'".$row['name']."', ";
$sql .= "'".$group."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
}
}
}
//get the http values and set them as php variables
$group_name = $_REQUEST['group_name'];
//get the permissions assigned to this group
$sql = "";
$sql .= " select * from v_group_permissions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and group_name = '$group_name' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$permission_name = $row["permission_name"];
$permissions_db[$permission_name] = "true";
}
//show the db checklist
//echo "<pre>";
//print_r($permissions_db);
//echo "</pre>";
//list all the permissions in the database
foreach($apps as $app) {
foreach ($app['permissions'] as $row) {
if ($permissions_db[$row['name']] == "true") {
$permissions_db_checklist[$row['name']] = "true";
}
else {
$permissions_db_checklist[$row['name']] = "false";
}
}
}
//show the db checklist
//echo "<pre>";
//print_r($permissions_db_checklist);
//echo "</pre>";
//process the http post
if (count($_POST)>0) {
foreach($_POST['permissions_form'] as $permission) {
$permissions_form[$permission] = "true";
}
//list all the permissions
foreach($apps as $app) {
foreach ($app['permissions'] as $row) {
if ($permissions_form[$row['name']] == "true") {
$permissions_form_checklist[$row['name']] = "true";
}
else {
$permissions_form_checklist[$row['name']] = "false";
}
}
}
//show the form db checklist
//echo "<pre>";
//print_r($permissions_form_checklist);
//echo "</pre>";
//list all the permissions
foreach($apps as $app) {
foreach ($app['permissions'] as $row) {
$permission = $row['name'];
if ($permissions_db_checklist[$permission] == "true" && $permissions_form_checklist[$permission] == "true") {
//matched do nothing
}
if ($permissions_db_checklist[$permission] == "false" && $permissions_form_checklist[$permission] == "false") {
//matched do nothing
}
if ($permissions_db_checklist[$permission] == "true" && $permissions_form_checklist[$permission] == "false") {
//delete the record
$sql = "delete from v_group_permissions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and group_name = '$group_name' ";
$sql .= "and permission_name = '$permission' ";
$db->exec(check_sql($sql));
unset($sql);
//set the permission to false in the permissions_db_checklist
$permissions_db_checklist[$permission] = "false";
}
if ($permissions_db_checklist[$permission] == "false" && $permissions_form_checklist[$permission] == "true") {
//add the record
$sql = "insert into v_group_permissions ";
$sql .= "(";
$sql .= "group_permission_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "permission_name, ";
$sql .= "group_name ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$domain_uuid', ";
$sql .= "'$permission', ";
$sql .= "'$group_name' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//set the permission to true in the permissions_db_checklist
$permissions_db_checklist[$permission] = "true";
}
}
}
}
//show the content
echo "<form method='post' name='frm' action=''>\n";
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br>";
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>Group Permission List for $group_name</b></td>\n";
echo "<td width='50%' align=\"right\">\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='grouplist.php'\" value='Back'> ";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align=\"left\" colspan='2'>\n";
echo " Assign permissions to groups.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "</tr></table>\n";
echo "<br />\n";
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='left'>\n";
//list all the permissions
foreach($apps as $app) {
$app_name = $app['name'];
$description = $app['description']['en'];
echo "<strong>".$app_name."</strong><br />\n";
echo "".$description."<br /><br />";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo "<th>Permissions</th>\n";
echo "<th>Description</th>\n";
echo "<tr>\n";
foreach ($app['permissions'] as $row) {
echo "<tr >\n";
echo " <td valign='top' style='width:250px' nowrap='nowrap' class='".$row_style[$c]."'>\n";
if ($permissions_db_checklist[$row['name']] == "true") {
echo " <input type='checkbox' name='permissions_form[]' checked='checked' value='".$row['name']."'>\n";
}
else {
echo " <input type='checkbox' name='permissions_form[]' value='".$row['name']."'>\n";
}
echo " &nbsp; ".$row['name']."\n";
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>\n";
echo " &nbsp; ".$row['description']."\n";
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
}
echo "<tr>\n";
echo " <td colspan='3' align='right'>\n";
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br />\n";
} //end foreach
unset($sql, $result, $row_count);
echo "</div>";
echo "<br><br>";
echo "<br><br>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<form>\n";
echo "<br><br>";
//show the footer
require_once "includes/footer.php";
?>
+134
View File
@@ -0,0 +1,134 @@
<?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";
if (permission_exists('group_add')) {
//access allowed
}
else {
echo "access denied";
return;
}
//get the http values and set them as variables
$path = check_str($_GET["path"]);
$msg = check_str($_GET["msg"]);
$group_name = check_str($_POST["group_name"]);
$group_description = check_str($_POST["group_description"]);
if (strlen($group_name) > 0) {
$sql_insert = "insert into v_groups ";
$sql_insert .= "(";
$sql_insert .= "domain_uuid, ";
$sql_insert .= "group_uuid, ";
$sql_insert .= "group_name, ";
$sql_insert .= "group_description ";
$sql_insert .= ")";
$sql_insert .= "values ";
$sql_insert .= "(";
$sql_insert .= "'$domain_uuid', ";
$sql_insert .= "'".uuid()."', ";
$sql_insert .= "'$group_name', ";
$sql_insert .= "'$group_description' ";
$sql_insert .= ")";
if (!$db->exec($sql_insert)) {
//echo $db->errorCode() . "<br>";
$info = $db->errorInfo();
print_r($info);
// $info[0] == $db->errorCode() unified error code
// $info[1] is the driver specific error code
// $info[2] is the driver specific error string
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=grouplist.php\">\n";
echo "<div align='center'>\n";
echo "Group Added\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
}
//include the header
include "includes/header.php";
//show the content
echo "<br><br>";
echo "<div align='center'>";
echo "<table width='100%' cellpadding='6' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left'>\n";
echo " Please choose a group name. ";
echo " </td>\n";
echo " <td align='right'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='grouplist.php'\" value='Back'> ";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br>";
echo "<form name='login' METHOD=\"POST\" action=\"groupadd.php\">\n";
echo "<table width='100%' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncellreq'>\n";
echo "Group Name:\n";
echo "</td>\n";
echo "<td width='70%' align='left' class='vtable'>\n";
echo " <input type=\"text\" class='formfld' name=\"group_name\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq'>\n";
echo "Description:\n";
echo "</td>\n";
echo "<td align='left' class='vtable'>\n";
echo "<textarea name='group_description' class='formfld'></textarea>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "</td>\n";
echo "<td align=\"right\">\n";
echo " <input type=\"hidden\" name=\"path\" value=\"$path\">\n";
echo " <input type=\"submit\" class='btn' value=\"Save\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>";
echo "</div>";
echo "<br><br>";
echo "<br><br>";
//include the footer
include "includes/footer.php";
?>
+56
View File
@@ -0,0 +1,56 @@
<?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";
if (permission_exists('group_delete') || if_group("superadmin")) {
//access allowed
}
else {
echo "access denied";
return;
}
//get the http value and set as a variable
$id = check_str($_GET["id"]);
//delete the group
$sqldelete = "delete from v_groups ";
$sqldelete .= "where domain_uuid = '$domain_uuid' ";
$sqldelete .= "and group_uuid = '$id' ";
if (!$db->exec($sqldelete)) {
//echo $db->errorCode() . "<br>";
$info = $db->errorInfo();
print_r($info);
// $info[0] == $db->errorCode() unified error code
// $info[1] is the driver specific error code
// $info[2] is the driver specific error string
}
//redirect the user
header("Location: grouplist.php");
?>
+137
View File
@@ -0,0 +1,137 @@
<?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";
//check the permissions
require_once "includes/checkauth.php";
if (if_group("admin") || if_group("superadmin")) {
//access allowed
}
else {
echo "access denied";
return;
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div class='' style='padding:0px;'>\n";
echo "<table width='100%'>";
echo "<td>";
echo "<table width='100%' border='0'><tr>";
echo "<td width='50%'><b>Group List</b></td>";
echo "<td width='50%' align='right'>";
if (permission_exists('user_view')) {
echo " <input type='button' class='btn' onclick=\"window.location='index.php'\" value='User Manager'>";
}
echo "</td>\n";
echo "</tr></table>";
$sql = "SELECT * FROM v_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
$strlist = "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
$strlist .= "<tr class='border'>\n";
$strlist .= " <th align=\"left\" nowrap> &nbsp; Group Name &nbsp; </th>\n";
$strlist .= " <th align=\"left\" nowrap> &nbsp; Group Description &nbsp; </th>\n";
$strlist .= " <th align=\"center\" nowrap>&nbsp;</th>\n";
$strlist .= " <td width='22px' align=\"right\" nowrap>\n";
if (permission_exists('group_add')) {
$strlist .= " <a href='groupadd.php' alt='add'>$v_link_label_add</a>\n";
}
$strlist .= " </td>\n";
$strlist .= "</tr>\n";
$count = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$group_name = $row["group_name"];
$group_uuid = $row["group_uuid"];
$group_description = $row["group_description"];
if (strlen($group_name) == 0) { $group_name = "&nbsp;"; }
if (strlen($group_description) == 0) { $group_description = "&nbsp;"; }
$group_description = wordwrap($group_description, 50, "<br />\n");
if (!if_group("superadmin") && $group_name == "superadmin") {
//hide the superadmin group from non superadmin's
}
else {
$strlist .= "<tr>";
$strlist .= "<td class='".$row_style[$c]."' align=\"left\" class='' nowrap> &nbsp; $group_name &nbsp; </td>\n";
$strlist .= "<td class='".$row_style[$c]."' align=\"left\" class='' nowrap> &nbsp; $group_description &nbsp; </td>\n";
$strlist .= "<td class='".$row_style[$c]."' align=\"center\" nowrap>\n";
if (permission_exists('group_add') || if_group("superadmin")) {
$strlist .= "&nbsp;<a class='' href='group_permissions.php?group_name=$group_name' title='Group Permissions'>Permissions</a>&nbsp;&nbsp;";
}
if (permission_exists('group_member_view') || if_group("superadmin")) {
$strlist .= "&nbsp;<a class='' href='groupmembers.php?group_name=$group_name' title='Group Members'>Members</a>&nbsp;";
}
$strlist .= "</td>\n";
$strlist .= "<td align=\"right\" nowrap>\n";
$strlist .= "<a href='groupdelete.php?id=$group_uuid' onclick=\"return confirm('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
$strlist .= "</td>\n";
$strlist .= "</tr>\n";
}
if ($c==0) { $c=1; } else { $c=0; }
$count++;
}
$strlist .= "<tr>\n";
$strlist .= "<td colspan='4' align='right' height='20'>\n";
if (permission_exists('group_add')) {
$strlist .= " <a href='groupadd.php' alt='add'>$v_link_label_add</a>\n";
}
$strlist .= "</td>\n";
$strlist .= "</tr>\n";
$strlist .= "</table>\n";
if ($count > 0) {
echo $strlist;
}
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo "</div>";
//show the footer
require_once "includes/footer.php";
?>
+80
View File
@@ -0,0 +1,80 @@
<?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";
if (permission_exists('group_member_add') || if_group("superadmin")) {
//access allowed
}
else {
echo "access denied";
return;
}
//requires a superadmin to add a user to the superadmin group
if (!if_group("superadmin") && $_GET["group_name"] == "superadmin") {
echo "access denied";
return;
}
//get the http values and set them as variables
$group_name = check_str($_POST["group_name"]);
$user_uuid = check_str($_POST["user_uuid"]);
if (strlen($user_uuid) > 0 && strlen($group_name) > 0) {
$sql_insert = "insert into v_group_users ";
$sql_insert .= "(";
$sql_insert .= "group_user_uuid, ";
$sql_insert .= "domain_uuid, ";
$sql_insert .= "group_name, ";
$sql_insert .= "user_uuid ";
$sql_insert .= ")";
$sql_insert .= "values ";
$sql_insert .= "(";
$sql_insert .= "'".uuid()."', ";
$sql_insert .= "'$domain_uuid', ";
$sql_insert .= "'$group_name', ";
$sql_insert .= "'$user_uuid' ";
$sql_insert .= ")";
if (!$db->exec($sql_insert)) {
//echo $db->errorCode() . "<br>";
$info = $db->errorInfo();
print_r($info);
// $info[0] == $db->errorCode() unified error code
// $info[1] is the driver specific error code
// $info[2] is the driver specific error string
}
else {
//log the success
//$log_type = 'group'; $log_status='add'; $log_add_user=$_SESSION["username"]; $log_desc= "username: ".$username." added to group: ".$group_name;
//log_add($db, $log_type, $log_status, $log_desc, $log_add_user, $_SERVER["REMOTE_ADDR"]);
}
}
//redirect the user
header("Location: groupmembers.php?group_name=$group_name");
?>
+68
View File
@@ -0,0 +1,68 @@
<?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";
if (permission_exists('group_member_delete') || if_group("superadmin")) {
//access allowed
}
else {
echo "access denied";
return;
}
//requires a superadmin to delete superadmin group
if (!if_group("superadmin") && $_GET["group_name"] == "superadmin") {
echo "access denied";
return;
}
//get the http values and set them as variables
$group_name = check_str($_GET["group_name"]);
$user_uuid = check_str($_GET["user_uuid"]);
//delete the group membership
$sql_delete = "delete from v_group_users ";
$sql_delete .= "where domain_uuid = '$domain_uuid' ";
$sql_delete .= "and user_uuid = '$user_uuid' ";
$sql_delete .= "and group_name = '$group_name' ";
if (!$db->exec($sql_delete)) {
//echo $db->errorCode() . "<br>";
$info = $db->errorInfo();
print_r($info);
// $info[0] == $db->errorCode() unified error code
// $info[1] is the driver specific error code
// $info[2] is the driver specific error string
}
else {
//$log_type = 'group'; $log_status='remove'; $log_add_user=$_SESSION["username"]; $log_desc= "username: ".$username." removed from group: ".$group_name;
//log_add($db, $log_type, $log_status, $log_desc, $log_add_user, $_SERVER["REMOTE_ADDR"]);
}
//redirect the user
header("Location: groupmembers.php?group_name=$group_name");
?>
+166
View File
@@ -0,0 +1,166 @@
<?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";
if (permission_exists('group_members_view') || if_group("superadmin")) {
//access allowed
}
else {
echo "access denied";
return;
}
//requires a superadmin to view members of the superadmin group
if (!if_group("superadmin") && $_GET["group_name"] == "superadmin") {
echo "access denied";
return;
}
//get the http value and set as a variable
$group_name = $_GET["group_name"];
//define the if group members function
function if_group_members($db, $group_name, $user_uuid) {
$sql = "select * from v_group_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and group_name = '$group_name' ";
$sql .= "and user_uuid = '$user_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
if (count($prep_statement->fetchAll(PDO::FETCH_NAMED)) == 0) { return true; } else { return false; }
unset ($sql, $prep_statement);
}
//$exampledatareturned = example("apples", 1);
//include the header
require_once "includes/header.php";
//show the content
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table width='90%' border='0'><tr><td align='left'>\n";
echo "\n";
echo "<table width='100%' cellpadding='6' cellspacing='1'>\n";
echo " <tr>\n";
echo " <td align='left'>\n";
echo " <span class=\"\" height='50'>Member list for <b>$group_name</b></span>";
echo " </td>\n";
echo " <td align='right' nowrap='nowrap'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='grouplist.php'\" value='Back'>";
echo " &nbsp;&nbsp;&nbsp;\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
$sql = "SELECT u.user_uuid, u.username, g.group_user_uuid FROM v_group_users as g, v_users as u ";
$sql .= "where g.user_uuid = u.user_uuid ";
$sql .= "and g.domain_uuid = '$domain_uuid' ";
$sql .= "and g.group_name = '$group_name' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$strlist = "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
$strlist .= "<tr>\n";
$strlist .= " <th align=\"left\" nowrap> &nbsp; Username &nbsp; </th>\n";
$strlist .= " <th align=\"left\" nowrap> &nbsp; &nbsp; </th>\n";
$strlist .= " <td width='22' align=\"right\" nowrap>\n";
$strlist .= " &nbsp;\n";
$strlist .= " </td>\n";
$strlist .= "</tr>\n";
$count = 0;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$group_user_uuid = $row["group_user_uuid"];
$username = $row["username"];
$user_uuid = $row["user_uuid"];
$strlist .= "<tr'>";
$strlist .= "<td align=\"left\" class='".$row_style[$c]."' nowrap> &nbsp; $username &nbsp; </td>\n";
$strlist .= "<td align=\"left\" class='".$row_style[$c]."' nowrap> &nbsp; </td>\n";
$strlist .= "<td align=\"right\" nowrap>\n";
if (permission_exists('group_member_delete')) {
$strlist .= " <a href='groupmemberdelete.php?user_uuid=$user_uuid&group_name=$group_name' onclick=\"return confirm('Do you really want to delete this?')\" alt='delete'>$v_link_label_delete</a>\n";
}
$strlist .= "</td>\n";
$strlist .= "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
$count++;
}
$strlist .= "</table>\n";
echo $strlist;
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<br>";
echo " <div align='center'>";
echo " <form method='post' action='groupmemberadd.php'>";
echo " <table width='250'>";
echo " <tr>";
echo " <td width='60%' align='right'>";
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "order by username ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select name=\"user_uuid\" style='width: 200px;' class='formfld'>\n";
echo "<option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result as $field) {
$username = $field['username'];
if (if_group_members($db, $group_name, $field['user_uuid'])) {
echo "<option value='".$field['user_uuid']."'>".$field['username']."</option>\n";
}
}
echo "</select>";
unset($sql, $result);
echo " </td>";
echo " <td align='right'>";
if (permission_exists('group_member_add')) {
echo " <input type='hidden' name='group_name' value='$group_name'>";
echo " <input type='submit' class='btn' value='Add Member'>";
}
echo " </td>";
echo " </tr>";
echo " </table>";
echo " </form>";
echo " </div>";
echo "<br><br>";
//include the footer
require_once "includes/footer.php";
?>
+57
View File
@@ -0,0 +1,57 @@
<?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";
if (permission_exists('user_view') || if_group("superadmin")) {
//access allowed
}
else {
echo "access denied";
return;
}
//include the header
require_once "includes/header.php";
//show the user list
echo "<div align='center'>";
echo " <table width='100%' border='0'>";
echo " <tr>";
echo " <td align='left' width='100%'>";
require_once "userlist.php";
echo " <br />";
echo " <br />";
echo " <br />";
echo " </td>";
echo " </tr>";
echo " </table>";
echo "</div>";
//include the footer
include "includes/footer.php";
?>
+50
View 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'] );
}
?>
+258
View File
@@ -0,0 +1,258 @@
<?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";
if (if_group("admin") || if_group("superadmin")) {
//access allowed
}
else {
echo "access denied";
return;
}
$username = check_str($_POST["username"]);
$password = check_str($_POST["password"]);
$confirmpassword = check_str($_POST["confirmpassword"]);
$contact_organization = check_str($_POST["contact_organization"]);
$contact_name_given = check_str($_POST["contact_name_given"]);
$contact_name_family = check_str($_POST["contact_name_family"]);
$user_email = check_str($_POST["user_email"]);
if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
$msgerror = '';
//--- begin captcha verification ---------------------
//session_start(); //make sure sessions are started
if (strtolower($_SESSION["captcha"]) != strtolower($_REQUEST["captcha"]) || strlen($_SESSION["captcha"]) == 0) {
//$msgerror .= "Captcha Verification Failed<br>\n";
}
else {
//echo "verified";
}
//--- end captcha verification -----------------------
//username is already used.
if (strlen($username) == 0) {
$msgerror .= "Please provide a Username.<br>\n";
}
else {
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '$username' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
if (count($prep_statement->fetchAll(PDO::FETCH_NAMED)) > 0) {
$msgerror .= "Please choose a different Username.<br>\n";
}
}
if (strlen($password) == 0) { $msgerror .= "Password cannot be blank.<br>\n"; }
if ($password != $confirmpassword) { $msgerror .= "Passwords did not match.<br>\n"; }
//if (strlen($contact_organization) == 0) { $msgerror .= "Please provide a organization name.<br>\n"; }
//if (strlen($contact_name_given) == 0) { $msgerror .= "Please provide a first name.<br>\n"; }
//if (strlen($contact_name_family) == 0) { $msgerror .= "Please provide a last name $user_last_name.<br>\n"; }
if (strlen($user_email) == 0) { $msgerror .= "Please provide an email.<br>\n"; }
if (strlen($msgerror) > 0) {
require_once "includes/header.php";
echo "<div align='center'>";
echo "<table><tr><td>";
echo $msgerror;
echo "</td></tr></table>";
require_once "includes/persistform.php";
echo persistform($_POST);
echo "</div>";
require_once "includes/footer.php";
return;
}
//salt used with the password to create a one way hash
$salt = generate_password('20', '4');
//prepare the uuids
$user_uuid = uuid();
$contact_uuid = uuid();
//add the user
$sql = "insert into v_users ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "user_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "username, ";
$sql .= "password, ";
$sql .= "salt, ";
$sql .= "user_add_date, ";
$sql .= "user_add_user ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$user_uuid', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$username', ";
$sql .= "'".md5($salt.$password)."', ";
$sql .= "'".$salt."', ";
$sql .= "now(), ";
$sql .= "'".$_SESSION["username"]."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//add to contacts
$sql = "insert into v_contacts ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_type, ";
$sql .= "contact_organization, ";
$sql .= "contact_name_given, ";
$sql .= "contact_name_family, ";
$sql .= "contact_nickname, ";
$sql .= "contact_email ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$contact_uuid', ";
$sql .= "'user', ";
$sql .= "'$contact_organization', ";
$sql .= "'$contact_name_given', ";
$sql .= "'$contact_name_family', ";
$sql .= "'$username', ";
$sql .= "'$user_email' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//log the success
//$log_type = 'user'; $log_status='add'; $log_add_user=$_SESSION["username"]; $log_desc= "username: ".$username." user added.";
//log_add($db, $log_type, $log_status, $log_desc, $log_add_user, $_SERVER["REMOTE_ADDR"]);
$group_name = 'user';
$sql = "insert into v_group_users ";
$sql .= "(";
$sql .= "group_user_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "group_name, ";
$sql .= "user_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$domain_uuid', ";
$sql .= "'$group_name', ";
$sql .= "'$user_uuid' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"3;url=index.php\">\n";
echo "<div align='center'>Add Complete</div>";
require_once "includes/footer.php";
return;
}
//show the header
require_once "includes/header.php";
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr>\n";
echo " <td align=\"left\">\n";
echo " <br>";
$tablewidth ='width="100%"';
echo "<form method='post' action=''>";
echo "<div class='borderlight' style='padding:10px;'>\n";
echo "<table border='0' $tablewidth cellpadding='6' cellspacing='0'>";
echo " <tr>\n";
echo " <td width='80%'>\n";
echo " <b>To add a user, please fill out this form completely. All fields are required. </b><br>";
echo " </td>\n";
echo " <td width='20%' align='right'>\n";
echo " <input type='button' class='btn' name='back' alt='back' onclick=\"window.history.back()\" value='Back'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<table border='0' $tablewidth cellpadding='6' cellspacing='0'>";
echo " <tr>";
echo " <td class='vncellreq' width='40%'>Username:</td>";
echo " <td class='vtable' width='60%'><input type='text' class='formfld' autocomplete='off' name='username' value='$username'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Password:</td>";
echo " <td class='vtable'><input type='password' class='formfld' autocomplete='off' name='password' value='$password'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Confirm Password:</td>";
echo " <td class='vtable'><input type='password' class='formfld' autocomplete='off' name='confirmpassword' value='$confirmpassword'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncellreq'>Email:</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='user_email' value='$user_email'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncell'>First Name:</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='contact_name_given' value='$contact_name_given'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncell'>Last Name:</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='contact_name_family' value='$contact_name_family'></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncell'>Company Name:</td>";
echo " <td class='vtable'><input type='text' class='formfld' name='contact_organization' value='$contact_organization'></td>";
echo " </tr>";
echo "</table>";
echo "</div>";
echo "<div class='' style='padding:10px;'>\n";
echo "<table $tablewidth>";
echo " <tr>";
echo " <td colspan='2' align='right'>";
echo " <input type='submit' name='submit' class='btn' value='Create Account'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//show the footer
require_once "includes/footer.php";
?>
+87
View File
@@ -0,0 +1,87 @@
<?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";
if (permission_exists('user_delete')) {
//access allowed
}
else {
echo "access denied";
return;
}
//get the id
$user_uuid = check_str($_GET["id"]);
//get the username from v_users
$sql = "";
$sql .= "select * from v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and user_uuid = '$user_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$username = $row["username"];
break; //limit to 1 row
}
unset ($prep_statement);
//required to be a superadmin to delete a member of the superadmin group
$superadmin_list = superadmin_list($db);
if (if_superadmin($superadmin_list, $_SESSION['user_uuid'])) {
if (!if_group("superadmin")) {
echo "access denied";
return;
}
}
//delete the user
$sql_delete = "delete from v_users ";
$sql_delete .= "where domain_uuid = '$domain_uuid' ";
$sql_delete .= "and user_uuid = '$user_uuid' ";
if (!$db->exec($sql_delete)) {
//echo $db->errorCode() . "<br>";
$info = $db->errorInfo();
print_r($info);
// $info[0] == $db->errorCode() unified error code
// $info[1] is the driver specific error code
// $info[2] is the driver specific error string
}
//delete the groups the user is assigned to
$sql_delete = "delete from v_group_users ";
$sql_delete .= "where domain_uuid = '$domain_uuid' ";
$sql_delete .= "and user_uuid = '$user_uuid' ";
if (!$db->exec($sql_delete)) {
$info = $db->errorInfo();
print_r($info);
}
//redirect the user
header("Location: index.php");
?>
+192
View File
@@ -0,0 +1,192 @@
<?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>
*/
require_once "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists("user_view") || if_group("superadmin")) {
//access granted
}
else {
echo "access denied";
exit;
}
//require_once "includes/header.php";
require_once "includes/paging.php";
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$field_name = $_REQUEST["field_name"];
$field_value = $_REQUEST["field_value"];
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
//page title and description
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<form method='post' action=''>";
echo "<tr>\n";
echo "<td align='left' width='90%' nowrap><b>User Manager</b></td>\n";
echo "<td align='right' nowrap='nowrap'>Search by:&nbsp;</td>";
echo "<td align='left'>\n";
echo " <select name='field_name' style='width:150px' class='frm'>\n";
echo " <option value=''></option>\n";
if ($field_name == "username") {
echo " <option value='username' selected='selected'>Username</option>\n";
}
else {
echo " <option value='username'>Username</option>\n";
}
//if ($field_name == "user_email") {
// echo " <option value='user_email' selected='selected'>Email</option>\n";
//}
//else {
// echo " <option value='user_email'>Email</option>\n";
//}
echo " </select>\n";
echo "</td>\n";
echo "<td align='left' width='3px'>&nbsp;</td>";
echo "<td align='left'><input type='text' class='txt' style='width: 150px' name='field_value' value='$field_value'></td>";
echo "<td align='left' width='60px'><input type='submit' class='btn' name='submit' value='search'></td>";
//echo " <input type='button' class='btn' name='' alt='view' onclick=\"window.location='user_search.php'\" value='advanced'>&nbsp;\n";
echo "</tr>\n";
echo "</form>";
echo "<tr>\n";
echo "<td align='left' colspan='4'>\n";
echo "Add, edit, delete, and search for users. \n";
echo "<br />\n";
echo "<br />\n";
echo "</td>\n";
echo "</tr>\n";
//get the user list from the database
$sql = "";
$sql .= " select * from v_users ";
$sql .= " where domain_uuid = '$domain_uuid' ";
if (strlen($field_name) > 0 && strlen($field_value) > 0) {
$sql .= " and $field_name = '$field_value' ";
}
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 200;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "";
$sql .= " select * from v_users ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
if (strlen($field_name) > 0 && strlen($field_value) > 0) {
$sql .= " and $field_name like '%$field_value%' ";
}
if (strlen($order_by)> 0) {
$sql .= "order by $order_by $order ";
}
else {
$sql .= "order by username ";
}
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
//alternate the row style
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
//show the data
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('username', 'Username', $order_by, $order);
//echo th_order_by('user_email', 'Email', $order_by, $order);
//echo th_order_by('user_template_name', 'Template', $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('user_add')) {
echo " <a href='signup.php' alt='add'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['username']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['user_email']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('user_edit')) {
echo " <a href='usersupdate.php?id=".$row['user_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('user_delete')) {
echo " <a href='userdelete.php?id=".$row['user_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='49' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
if (permission_exists('user_add')) {
echo " <a href='signup.php' alt='add'>$v_link_label_add</a>\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</div>";
echo "<br><br>";
echo "<br><br>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br><br>";
?>
+612
View File
@@ -0,0 +1,612 @@
<?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";
if (permission_exists("user_add") ||
permission_exists("user_edit") ||
permission_exists("user_delete") ||
if_group("superadmin")) {
//access allowed
}
else {
echo "access denied";
return;
}
//get data from the db
if (strlen($_REQUEST["id"])> 0) {
$user_uuid = $_REQUEST["id"];
}
else {
if (strlen($_SESSION["username"]) > 0) {
$username = $_SESSION["username"];
}
}
//get the username from v_users
$sql = "select * from v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and user_uuid = '$user_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$username = $row["username"];
break; //limit to 1 row
}
unset ($prep_statement);
//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, $_SESSION['user_uuid'])) {
if (!if_group("superadmin")) {
echo "access denied";
return;
}
}
//delete the group from the user
if ($_GET["a"] == "delete" && permission_exists("user_delete")) {
//set the variables
$group_name = check_str($_GET["group_name"]);
//delete the group from the users
$sql = "delete from v_group_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and group_name = '$group_name' ";
$sql .= "and user_uuid = '$user_uuid' ";
$db->exec(check_sql($sql));
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=usersupdate.php?id=$user_uuid\">\n";
echo "<div align='center'>Update Complete</div>";
require_once "includes/footer.php";
return;
}
//get the user settings
$sql = "select * from v_user_settings ";
$sql .= "where user_uuid = '".$_SESSION["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") {
$user_uuid = $_REQUEST["id"];
$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"]);
$contact_uuid = check_str($_POST["contact_uuid"]);
$group_member = check_str($_POST["group_member"]);
//if (strlen($password) == 0) { $msg_error .= "Password cannot be blank.<br>\n"; }
//if (strlen($username) == 0) { $msg_error .= "Please provide the username.<br>\n"; }
if ($password != $confirm_password) { $msg_error .= "Passwords did not match.<br>\n"; }
//if (strlen($contact_uuid) == 0) { $msg_error .= "Please provide an email.<br>\n"; }
//if (strlen($user_time_zone) == 0) { $msg_error .= "Please provide an time zone.<br>\n"; }
if ($msg_error) {
require_once "includes/header.php";
echo "<div align='center'>";
echo "<table><tr><td>";
echo $msg_error;
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 .= "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 .= "'".$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));
}
}
}
//assign the user to the group
if (strlen($_REQUEST["group_name"]) > 0) {
$sql_insert = "insert into v_group_users ";
$sql_insert .= "(";
$sql_insert .= "group_user_uuid, ";
$sql_insert .= "domain_uuid, ";
$sql_insert .= "group_name, ";
$sql_insert .= "user_uuid ";
$sql_insert .= ")";
$sql_insert .= "values ";
$sql_insert .= "(";
$sql_insert .= "'".uuid()."', ";
$sql_insert .= "'$domain_uuid', ";
$sql_insert .= "'".$_REQUEST["group_name"]."', ";
$sql_insert .= "'$user_uuid' ";
$sql_insert .= ")";
if ($_REQUEST["group_name"] == "superadmin") {
//only a user in the superadmin group can add other users to that group
if (if_group("superadmin")) {
$db->exec($sql_insert);
}
}
else {
$db->exec($sql_insert);
}
}
//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
// if ($_SESSION["username"] == $username) {
// $_SESSION['domain']['template']['name'] = $user_template_name;
// }
//}
//sql update
$sql = "update v_users set ";
if (if_group("admin") && strlen($_POST["username"])> 0) {
$sql .= "username = '$username', ";
}
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', ";
if (strlen($contact_uuid) == 0) {
$sql .= "contact_uuid = null ";
}
else {
$sql .= "contact_uuid = '$contact_uuid' ";
}
if (strlen($user_uuid)> 0) {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and user_uuid = '$user_uuid' ";
}
else {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '$username' ";
}
$db->exec(check_sql($sql));
//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";
if (if_group("admin")) {
echo "<meta http-equiv=\"refresh\" content=\"2;url=usersupdate.php?id=$user_uuid\">\n";
}
else {
echo "<meta http-equiv=\"refresh\" content=\"2;url=usersupdate.php?id=$user_uuid\">\n";
}
echo "<div align='center'>Update Complete</div>";
require_once "includes/footer.php";
return;
}
else {
$sql = "select * from v_users ";
//allow admin access
if (if_group("admin") || if_group("superadmin")) {
if (strlen($user_uuid)> 0) {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and user_uuid = '$user_uuid' ";
}
else {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '$username' ";
}
}
else {
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and username = '$username' ";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$user_uuid = $row["user_uuid"];
if (if_group("admin")) {
$username = $row["username"];
}
$password = $row["password"];
$contact_uuid = $row["contact_uuid"];
$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 "<br />\n";
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>User Manager</b></td>\n";
echo "<td nowrap='nowrap'>\n";
echo " <input type='submit' name='submit' class='btn' value='Save'>";
echo " <input type='button' class='btn' onclick=\"window.location='index.php'\" value='Back'>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo " Edit user information and group membership. \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'>User Info</th>\n";
echo "</tr>\n";
echo " <tr>";
echo " <td width='30%' class='vncellreq'>Username:</td>";
echo " <td width='70%' class='vtable'>$username</td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncell'>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'>Confirm Password:</td>";
echo " <td class='vtable'><input type='password' autocomplete='off' class='formfld' name='confirm_password' value=\"\"></td>";
echo " </tr>";
echo " <tr>";
echo " <td class='vncell' valign='top'>Groups:</td>";
echo " <td class='vtable'>";
echo "<table width='52%'>\n";
$sql = "SELECT * FROM v_group_users ";
$sql .= "where domain_uuid=:domain_uuid ";
$sql .= "and user_uuid=:user_uuid ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->bindParam(':domain_uuid', $domain_uuid);
$prep_statement->bindParam(':user_uuid', $user_uuid);
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
foreach($result as $field) {
if (strlen($field['group_name']) > 0) {
echo "<tr>\n";
echo " <td class='vtable'>".$field['group_name']."</td>\n";
echo " <td>\n";
if (permission_exists('group_member_delete') || if_group("superadmin")) {
echo " <a href='usersupdate.php?id=".$user_uuid."&domain_uuid=".$domain_uuid."&group_name=".$field['group_name']."&a=delete' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
}
}
echo "</table>\n";
echo "<br />\n";
$sql = "SELECT * FROM v_groups ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo "<select name=\"group_name\" class='frm'>\n";
echo "<option value=\"\"></option>\n";
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach($result as $field) {
if ($field['group_name'] == "superadmin") {
//only show the superadmin group to other users in the superadmin group
if (if_group("superadmin")) {
echo "<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
}
}
else {
echo "<option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
}
}
echo "</select>";
echo "<input type=\"submit\" class='btn' value=\"Add\">\n";
unset($sql, $result);
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'>Additional Info</th>\n";
echo " </tr>\n";
echo " <tr>";
echo " <td width='30%' class='vncell'>Contact:</td>";
echo " <td width='70%' class='vtable'>\n";
$sql = " select contact_uuid, contact_organization, contact_name_given, contact_name_family from v_contacts ";
$sql .= " where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= " order by contact_organization asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
echo "<select name=\"contact_uuid\" id=\"contact_uuid\" class=\"formfld\">\n";
echo "<option value=\"\"></option>\n";
foreach($result as $row) {
$contact_name = '';
if (strlen($row['contact_organization']) > 0) {
$contact_name = $row['contact_organization'];
}
if (strlen($row['contact_name_family']) > 0) {
if (strlen($contact_name) > 0) { $contact_name .= ", "; }
$contact_name .= $row['contact_name_family'];
}
if (strlen($row['contact_name_given']) > 0) {
if (strlen($contact_name) > 0) { $contact_name .= ", "; }
$contact_name .= $row['contact_name_given'];
}
if ($row['contact_uuid'] == $contact_uuid) {
echo "<option value=\"".$row['contact_uuid']."\" selected=\"selected\">".$contact_name."</option>\n";
}
else {
echo "<option value=\"".$row['contact_uuid']."\">".$contact_name."</option>\n";
}
}
unset($sql, $result, $row_count);
echo "</select>\n";
echo "<br />\n";
echo "Assign a contact to this user account.\n";
if (strlen($contact_uuid) > 0) {
echo " <a href=\"/app/contacts/contacts_edit.php?id=$contact_uuid\">View</a>\n";
}
echo " </td>";
echo " </tr>";
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 " Status:\n";
echo " </td>\n";
echo " <td class=\"vtable\">\n";
$cmd = "'".PROJECT_PATH."/app/calls_active/v_calls_exec.php?cmd=callcenter_config+agent+set+status+".$_SESSION['username']."@".$_SESSION['domain_name']."+'+this.value";
echo " <select id='user_status' name='user_status' class='formfld' style='' onchange=\"send_cmd($cmd);\">\n";
echo " <option value=''></option>\n";
if ($user_status == "Available") {
echo " <option value='Available' selected='selected'>Available</option>\n";
}
else {
echo " <option value='Available'>Available</option>\n";
}
if ($user_status == "Available (On Demand)") {
echo " <option value='Available (On Demand)' selected='selected'>Available (On Demand)</option>\n";
}
else {
echo " <option value='Available (On Demand)'>Available (On Demand)</option>\n";
}
if ($user_status == "Logged Out") {
echo " <option value='Logged Out' selected='selected'>Logged Out</option>\n";
}
else {
echo " <option value='Logged Out'>Logged Out</option>\n";
}
if ($user_status == "On Break") {
echo " <option value='On Break' selected='selected'>On Break</option>\n";
}
else {
echo " <option value='On Break'>On Break</option>\n";
}
if ($user_status == "Do Not Disturb") {
echo " <option value='Do Not Disturb' selected='selected'>Do Not Disturb</option>\n";
}
else {
echo " <option value='Do Not Disturb'>Do Not Disturb</option>\n";
}
echo " </select>\n";
echo " <br />\n";
echo " Select a the user 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 " Time Zone: \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 " Select the default time zone.<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='hidden' name='id' value=\"$user_uuid\">";
echo " <input type='hidden' name='username' value=\"$username\">";
echo " <input type='submit' name='submit' class='btn' value='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";
?>