Merge branch 'master' of https://github.com/fusionpbx/fusionpbx
This commit is contained in:
@@ -67,12 +67,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check for all required data
|
//check for all required data
|
||||||
//if (strlen($default_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
|
if (strlen($default_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
|
||||||
//if (strlen($default_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
|
if (strlen($default_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
|
||||||
//if (strlen($default_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
|
if (strlen($default_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
|
||||||
//if (strlen($default_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
|
//if (strlen($default_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
|
||||||
//if (strlen($default_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
if (strlen($default_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
||||||
//if (strlen($default_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
if (strlen($default_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
||||||
//if (strlen($default_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
//if (strlen($default_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
||||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
require_once "resources/header.php";
|
require_once "resources/header.php";
|
||||||
@@ -223,11 +223,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td align='left' colspan='2'>\n";
|
echo "<td align='left' colspan='2'>\n";
|
||||||
if ($action == "add") {
|
if ($action == "add") {
|
||||||
echo $text['description-default_setting-add']."<br /><br />\n";
|
echo $text['description-default_setting-add'];
|
||||||
}
|
}
|
||||||
if ($action == "update") {
|
if ($action == "update") {
|
||||||
echo $text['description-default_setting-edit']."<br /><br />\n";
|
echo $text['description-default_setting-edit'];
|
||||||
}
|
}
|
||||||
|
echo "<br /><br />\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
@@ -247,7 +248,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " ".$text['label-subcategory']."\n";
|
echo " ".$text['label-subcategory']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo " <input class='formfld' type='text' name='default_setting_subcategory' id='default_setting_subcategory' maxlength='255' value=\"$default_setting_subcategory\">\n";
|
echo " <input class='formfld lowercase' type='text' name='default_setting_subcategory' id='default_setting_subcategory' maxlength='255' value=\"$default_setting_subcategory\">\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-subcategory']."\n";
|
echo $text['description-subcategory']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
@@ -258,7 +259,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " ".$text['label-type']."\n";
|
echo " ".$text['label-type']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo " <input class='formfld' type='text' name='default_setting_name' maxlength='255' value=\"$default_setting_name\">\n";
|
echo " <input class='formfld lowercase' type='text' name='default_setting_name' id='default_setting_name' maxlength='255' value=\"$default_setting_name\">\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-type']."\n";
|
echo $text['description-type']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
@@ -514,40 +515,42 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo $text['description-value']."\n";
|
echo $text['description-value']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
if ($name == "array" || $name == '') {
|
echo "<div id='tr_order' ".(($default_setting_name != 'array') ? "style='display: none;'" : null).">\n";
|
||||||
echo "<tr>\n";
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='30%'>\n";
|
|
||||||
echo " ".$text['label-order']."\n";
|
|
||||||
echo "</td>\n";
|
|
||||||
echo "<td class='vtable' align='left'>\n";
|
|
||||||
echo " <select name='default_setting_order' class='formfld'>\n";
|
|
||||||
$i=0;
|
|
||||||
while($i<=999) {
|
|
||||||
$selected = ($i == $default_setting_order) ? "selected" : null;
|
|
||||||
if (strlen($i) == 1) {
|
|
||||||
echo " <option value='00$i' ".$selected.">00$i</option>\n";
|
|
||||||
}
|
|
||||||
if (strlen($i) == 2) {
|
|
||||||
echo " <option value='0$i' ".$selected.">0$i</option>\n";
|
|
||||||
}
|
|
||||||
if (strlen($i) == 3) {
|
|
||||||
echo " <option value='$i' ".$selected.">$i</option>\n";
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
echo " </select>\n";
|
|
||||||
echo " <br />\n";
|
|
||||||
echo $text['description-order']."\n";
|
|
||||||
echo "</td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-order']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||||
|
echo " <select name='default_setting_order' class='formfld'>\n";
|
||||||
|
$i=0;
|
||||||
|
while($i<=999) {
|
||||||
|
$selected = ($i == $default_setting_order) ? "selected" : null;
|
||||||
|
if (strlen($i) == 1) {
|
||||||
|
echo " <option value='00$i' ".$selected.">00$i</option>\n";
|
||||||
|
}
|
||||||
|
if (strlen($i) == 2) {
|
||||||
|
echo " <option value='0$i' ".$selected.">0$i</option>\n";
|
||||||
|
}
|
||||||
|
if (strlen($i) == 3) {
|
||||||
|
echo " <option value='$i' ".$selected.">$i</option>\n";
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
echo " </select>\n";
|
||||||
|
echo " <br />\n";
|
||||||
|
echo $text['description-order']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
echo "</div>\n";
|
||||||
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||||
echo " ".$text['label-enabled']."\n";
|
echo " ".$text['label-enabled']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||||
echo " <select class='formfld' name='default_setting_enabled'>\n";
|
echo " <select class='formfld' name='default_setting_enabled'>\n";
|
||||||
if ($default_setting_enabled == "true") {
|
if ($default_setting_enabled == "true") {
|
||||||
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||||
@@ -601,12 +604,18 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " $(window).keypress(function(event){\n";
|
echo " $(window).keypress(function(event){\n";
|
||||||
echo " if (event.which == 13) { submit_form(); }\n";
|
echo " if (event.which == 13) { submit_form(); }\n";
|
||||||
echo " });\n";
|
echo " });\n";
|
||||||
// convert password fields to
|
//hide/convert password fields then submit form
|
||||||
echo " function submit_form() {\n";
|
echo " function submit_form() {\n";
|
||||||
echo " $('input:password').css('visibility','hidden');\n";
|
echo " $('input:password').css('visibility','hidden');\n";
|
||||||
echo " $('input:password').attr({type:'text'});\n";
|
echo " $('input:password').attr({type:'text'});\n";
|
||||||
echo " $('form#frm').submit();\n";
|
echo " $('form#frm').submit();\n";
|
||||||
echo " }\n";
|
echo " }\n";
|
||||||
|
//define lowercase class
|
||||||
|
echo " $('.lowercase').blur(function(){ this.value = this.value.toLowerCase(); });";
|
||||||
|
//show order if array
|
||||||
|
echo " $('#default_setting_name').keyup(function(){ \n";
|
||||||
|
echo " (this.value.toLowerCase() == 'array') ? $('#tr_order').slideDown('fast') : $('#tr_order').slideUp('fast');\n";
|
||||||
|
echo " });\n";
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "domain_edit";
|
$apps[$x]['permissions'][$y]['name'] = "domain_edit";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "domain_delete";
|
$apps[$x]['permissions'][$y]['name'] = "domain_delete";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
@@ -38,18 +39,23 @@
|
|||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "domain_setting_view";
|
$apps[$x]['permissions'][$y]['name'] = "domain_setting_view";
|
||||||
$apps[$x]['permissions'][$y]['menu']['uuid'] = "4fa7e90b-6d6c-12d4-712f-62857402b801";
|
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "domain_setting_add";
|
$apps[$x]['permissions'][$y]['name'] = "domain_setting_add";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "domain_setting_edit";
|
$apps[$x]['permissions'][$y]['name'] = "domain_setting_edit";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "domain_setting_delete";
|
$apps[$x]['permissions'][$y]['name'] = "domain_setting_delete";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$y++;
|
$y++;
|
||||||
|
$apps[$x]['permissions'][$y]['name'] = "domain_setting_category_edit";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
|
|
||||||
//schema details
|
//schema details
|
||||||
$y = 0; //table array index
|
$y = 0; //table array index
|
||||||
|
|||||||
@@ -15,4 +15,19 @@ $apps[$x]['menu'][0]['category'] = "internal";
|
|||||||
$apps[$x]['menu'][0]['path'] = "/core/domain_settings/domains.php";
|
$apps[$x]['menu'][0]['path'] = "/core/domain_settings/domains.php";
|
||||||
$apps[$x]['menu'][0]['groups'][] = "superadmin";
|
$apps[$x]['menu'][0]['groups'][] = "superadmin";
|
||||||
|
|
||||||
|
$apps[$x]['menu'][1]['title']['en-us'] = "Domain Settings";
|
||||||
|
$apps[$x]['menu'][1]['title']['es-cl'] = "Configuraciones de Dominio";
|
||||||
|
$apps[$x]['menu'][1]['title']['fr-fr'] = "Paramètres du Domaine";
|
||||||
|
$apps[$x]['menu'][1]['title']['pt-pt'] = "Definições do Domínio";
|
||||||
|
$apps[$x]['menu'][1]['title']['pt-br'] = "Configurações do Dominio";
|
||||||
|
$apps[$x]['menu'][1]['title']['pl'] = "Ustawienia Domen";
|
||||||
|
$apps[$x]['menu'][1]['title']['sv-se'] = "Domän Inställning";
|
||||||
|
$apps[$x]['menu'][1]['title']['uk'] = "Налаштування доменів";
|
||||||
|
$apps[$x]['menu'][1]['title']['de-at'] = "Domain Einstellungen";
|
||||||
|
$apps[$x]['menu'][1]['uuid'] = "0869ac79-4af3-498f-af65-69662280d74e";
|
||||||
|
$apps[$x]['menu'][1]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f";
|
||||||
|
$apps[$x]['menu'][1]['category'] = "internal";
|
||||||
|
$apps[$x]['menu'][1]['path'] = "/core/domain_settings/domain_edit.php";
|
||||||
|
$apps[$x]['menu'][1]['groups'][] = "admin";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -40,12 +40,19 @@ else {
|
|||||||
$text = $language->get();
|
$text = $language->get();
|
||||||
|
|
||||||
//action add or update
|
//action add or update
|
||||||
if (isset($_REQUEST["id"])) {
|
if (!permission_exists('domain_add') || (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/") && !permission_exists('domain_parent') && permission_exists('domain_descendants'))) {
|
||||||
|
//admin editing own domain/settings
|
||||||
|
$domain_uuid = $_SESSION['domain_uuid'];
|
||||||
$action = "update";
|
$action = "update";
|
||||||
$domain_uuid = check_str($_REQUEST["id"]);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$action = "add";
|
if (isset($_REQUEST["id"])) {
|
||||||
|
$action = "update";
|
||||||
|
$domain_uuid = check_str($_REQUEST["id"]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$action = "add";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//get http post variables and set them to php variables
|
//get http post variables and set them to php variables
|
||||||
@@ -573,17 +580,23 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
//redirect the browser
|
//redirect the browser
|
||||||
if ($action == "update") {
|
if ($action == "update") {
|
||||||
$_SESSION["message"] = $text['message-update'];
|
$_SESSION["message"] = $text['message-update'];
|
||||||
|
if (!permission_exists('domain_add')) { //admin, updating own domain
|
||||||
|
header("Location: domain_edit.php");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
header("Location: domains.php"); //superadmin
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($action == "add") {
|
if ($action == "add") {
|
||||||
$_SESSION["message"] = $text['message-add'];
|
$_SESSION["message"] = $text['message-add'];
|
||||||
|
header("Location: domains.php");
|
||||||
}
|
}
|
||||||
header("Location: domains.php");
|
|
||||||
return;
|
return;
|
||||||
} //if ($_POST["persistformvar"] != "true")
|
} //if ($_POST["persistformvar"] != "true")
|
||||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||||
|
|
||||||
//pre-populate the form
|
//pre-populate the form (admin won't have domain_add permissions, but domain_uuid will already be set above)
|
||||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
if ((count($_GET) > 0 || (!permission_exists('domain_add') && $domain_uuid != '')) && $_POST["persistformvar"] != "true") {
|
||||||
$sql = "select * from v_domains ";
|
$sql = "select * from v_domains ";
|
||||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
@@ -619,7 +632,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
echo "</b></td>\n";
|
echo "</b></td>\n";
|
||||||
echo "<td width='70%' align='right' valign='top'>\n";
|
echo "<td width='70%' align='right' valign='top'>\n";
|
||||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='domains.php'\" value='".$text['button-back']."'>\n";
|
if (permission_exists('domain_add')) { //only for superadmin, not admin editing their own domain
|
||||||
|
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='domains.php'\" value='".$text['button-back']."'>\n";
|
||||||
|
}
|
||||||
if (permission_exists('domain_export')) {
|
if (permission_exists('domain_export')) {
|
||||||
echo " <input type='button' class='btn' name='' alt='".$text['button-export']."' onclick=\"window.location='".PROJECT_PATH."/app/domain_export/index.php?id=".$domain_uuid."'\" value='".$text['button-export']."'>\n";
|
echo " <input type='button' class='btn' name='' alt='".$text['button-export']."' onclick=\"window.location='".PROJECT_PATH."/app/domain_export/index.php?id=".$domain_uuid."'\" value='".$text['button-export']."'>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,25 @@ else {
|
|||||||
$language = new text;
|
$language = new text;
|
||||||
$text = $language->get();
|
$text = $language->get();
|
||||||
|
|
||||||
|
//retrieve allowed setting categories
|
||||||
|
if (!permission_exists('domain_setting_category_edit')) {
|
||||||
|
if (is_array($_SESSION['settings']) && sizeof($_SESSION['settings']) > 0) {
|
||||||
|
foreach ($_SESSION['groups'] as $index => $group) {
|
||||||
|
$group_name = $group['group_name'];
|
||||||
|
if (is_array($_SESSION['settings'][$group_name]) && sizeof($_SESSION['settings'][$group_name]) > 0) {
|
||||||
|
foreach ($_SESSION['settings'][$group_name] as $category) {
|
||||||
|
$categories[] = strtolower($category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_array($categories) && sizeof($categories) > 0) {
|
||||||
|
$allowed_categories = array_unique($categories);
|
||||||
|
sort($allowed_categories, SORT_NATURAL);
|
||||||
|
}
|
||||||
|
unset($group, $group_name, $index, $category, $categories);
|
||||||
|
}
|
||||||
|
|
||||||
//action add or update
|
//action add or update
|
||||||
if (isset($_REQUEST["id"])) {
|
if (isset($_REQUEST["id"])) {
|
||||||
$action = "update";
|
$action = "update";
|
||||||
@@ -71,12 +90,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check for all required data
|
//check for all required data
|
||||||
//if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
|
if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
|
||||||
//if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
|
if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
|
||||||
//if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
|
if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
|
||||||
//if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
|
//if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
|
||||||
//if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
||||||
//if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
||||||
//if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
//if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
||||||
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
require_once "resources/header.php";
|
require_once "resources/header.php";
|
||||||
@@ -358,7 +377,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo $text['description-domain_setting-edit'];
|
echo $text['description-domain_setting-edit'];
|
||||||
}
|
}
|
||||||
if ($action == "add") {
|
if ($action == "add") {
|
||||||
echo $text['header-domain_setting-add'];
|
echo $text['description-domain_setting-add'];
|
||||||
}
|
}
|
||||||
echo "<br /><br />\n";
|
echo "<br /><br />\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
@@ -369,18 +388,31 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " ".$text['label-category']."\n";
|
echo " ".$text['label-category']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo " <input class='formfld' type='text' name='domain_setting_category' maxlength='255' value=\"$domain_setting_category\">\n";
|
if (permission_exists('domain_setting_category_edit')) {
|
||||||
|
echo " <input type='text' class='formfld' name='domain_setting_category' id='domain_setting_category' maxlength='255' value=\"".$domain_setting_category."\">\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <select class='formfld' name='domain_setting_category' id='domain_setting_category' onchange=\"$('#domain_setting_subcategory').focus();\">\n";
|
||||||
|
echo " <option value=''></option>\n";
|
||||||
|
if (is_array($allowed_categories) && sizeof($allowed_categories) > 0) {
|
||||||
|
foreach ($allowed_categories as $category) {
|
||||||
|
$selected = ($domain_setting_category == $category) ? 'selected' : null;
|
||||||
|
echo " <option value='".$category."' ".$selected.">".ucwords(str_replace('_',' ',$category))."</option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo " </select>";
|
||||||
|
}
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-category']."\n";
|
echo $text['description-category']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
echo " ".$text['label-subcategory']."\n";
|
echo " ".$text['label-subcategory']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo " <input class='formfld' type='text' name='domain_setting_subcategory' maxlength='255' value=\"$domain_setting_subcategory\">\n";
|
echo " <input class='formfld lowercase' type='text' name='domain_setting_subcategory' id='domain_setting_subcategory' maxlength='255' value=\"$domain_setting_subcategory\">\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-subcategory']."\n";
|
echo $text['description-subcategory']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
@@ -391,7 +423,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " ".$text['label-type']."\n";
|
echo " ".$text['label-type']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo " <input class='formfld' type='text' name='domain_setting_name' maxlength='255' value=\"$domain_setting_name\">\n";
|
echo " <input class='formfld lowercase' type='text' name='domain_setting_name' id='domain_setting_name' maxlength='255' value=\"$domain_setting_name\">\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-type']."\n";
|
echo $text['description-type']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
@@ -424,7 +456,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
unset ($sub_prep_statement);
|
unset ($sub_prep_statement);
|
||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
} elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
|
}
|
||||||
|
elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
|
||||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||||
echo " <option value=''></option>\n";
|
echo " <option value=''></option>\n";
|
||||||
//add all the themes to the list
|
//add all the themes to the list
|
||||||
@@ -445,7 +478,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
} elseif ($category == "domain" && $subcategory == "language" && $name == "code" ) {
|
}
|
||||||
|
elseif ($category == "domain" && $subcategory == "language" && $name == "code" ) {
|
||||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||||
echo " <option value=''></option>\n";
|
echo " <option value=''></option>\n";
|
||||||
foreach ($_SESSION['app']['languages'] as $key => $value) {
|
foreach ($_SESSION['app']['languages'] as $key => $value) {
|
||||||
@@ -457,7 +491,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
} elseif ($category == "domain" && $subcategory == "time_zone" && $name == "name" ) {
|
}
|
||||||
|
elseif ($category == "domain" && $subcategory == "time_zone" && $name == "name" ) {
|
||||||
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
echo " <select id='domain_setting_value' name='domain_setting_value' class='formfld' style=''>\n";
|
||||||
echo " <option value=''></option>\n";
|
echo " <option value=''></option>\n";
|
||||||
//$list = DateTimeZone::listAbbreviations();
|
//$list = DateTimeZone::listAbbreviations();
|
||||||
@@ -541,12 +576,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " <option value='fine' ".(($row['default_setting_value'] == 'fine') ? 'selected' : null).">".$text['label-fine']."</option>";
|
echo " <option value='fine' ".(($row['default_setting_value'] == 'fine') ? 'selected' : null).">".$text['label-fine']."</option>";
|
||||||
echo " <option value='superfine' ".(($row['default_setting_value'] == 'superfine') ? 'selected' : null).">".$text['label-superfine']."</option>";
|
echo " <option value='superfine' ".(($row['default_setting_value'] == 'superfine') ? 'selected' : null).">".$text['label-superfine']."</option>";
|
||||||
echo " </select>";
|
echo " </select>";
|
||||||
} elseif ($category == "theme" && $subcategory == "domain_visible" && $name == "text" ) {
|
}
|
||||||
|
elseif ($category == "theme" && $subcategory == "domain_visible" && $name == "text" ) {
|
||||||
echo " <select class='formfld' name='default_setting_value'>\n";
|
echo " <select class='formfld' name='default_setting_value'>\n";
|
||||||
echo " <option value='false' ".(($row['default_setting_value'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
echo " <option value='false' ".(($row['default_setting_value'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||||
echo " <option value='true' ".(($row['default_setting_value'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
echo " <option value='true' ".(($row['default_setting_value'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
} elseif ($category == "theme" && $subcategory == "cache" && $name == "boolean" ) {
|
}
|
||||||
|
elseif ($category == "theme" && $subcategory == "cache" && $name == "boolean" ) {
|
||||||
echo " <select class='formfld' name='default_setting_value'>\n";
|
echo " <select class='formfld' name='default_setting_value'>\n";
|
||||||
echo " <option value='true' ".(($row['default_setting_value'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
echo " <option value='true' ".(($row['default_setting_value'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||||
echo " <option value='false' ".(($row['default_setting_value'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
echo " <option value='false' ".(($row['default_setting_value'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||||
@@ -559,40 +596,44 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo $text['description-value']."\n";
|
echo $text['description-value']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
|
||||||
if ($name == "array" || $name == '') {
|
echo "<div id='tr_order' ".(($domain_setting_name != 'array') ? "style='display: none;'" : null).">\n";
|
||||||
echo "<tr>\n";
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap' width='30%'>\n";
|
|
||||||
echo " ".$text['label-order']."\n";
|
|
||||||
echo "</td>\n";
|
|
||||||
echo "<td class='vtable' align='left'>\n";
|
|
||||||
echo " <select name='domain_setting_order' class='formfld'>\n";
|
|
||||||
$i=0;
|
|
||||||
while($i<=999) {
|
|
||||||
$selected = ($i == $domain_setting_order) ? "selected" : null;
|
|
||||||
if (strlen($i) == 1) {
|
|
||||||
echo " <option value='00$i' ".$selected.">00$i</option>\n";
|
|
||||||
}
|
|
||||||
if (strlen($i) == 2) {
|
|
||||||
echo " <option value='0$i' ".$selected.">0$i</option>\n";
|
|
||||||
}
|
|
||||||
if (strlen($i) == 3) {
|
|
||||||
echo " <option value='$i' ".$selected.">$i</option>\n";
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
echo " </select>\n";
|
|
||||||
echo " <br />\n";
|
|
||||||
echo $text['description-order']."\n";
|
|
||||||
echo "</td>\n";
|
|
||||||
echo "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
|
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-order']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||||
|
echo " <select name='domain_setting_order' class='formfld'>\n";
|
||||||
|
$i=0;
|
||||||
|
while($i<=999) {
|
||||||
|
$selected = ($i == $domain_setting_order) ? "selected" : null;
|
||||||
|
if (strlen($i) == 1) {
|
||||||
|
echo " <option value='00$i' ".$selected.">00$i</option>\n";
|
||||||
|
}
|
||||||
|
if (strlen($i) == 2) {
|
||||||
|
echo " <option value='0$i' ".$selected.">0$i</option>\n";
|
||||||
|
}
|
||||||
|
if (strlen($i) == 3) {
|
||||||
|
echo " <option value='$i' ".$selected.">$i</option>\n";
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
echo " </select>\n";
|
||||||
|
echo " <br />\n";
|
||||||
|
echo $text['description-order']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
echo "</div>\n";
|
||||||
|
|
||||||
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||||
echo " ".$text['label-enabled']."\n";
|
echo " ".$text['label-enabled']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||||
echo " <select class='formfld' name='domain_setting_enabled'>\n";
|
echo " <select class='formfld' name='domain_setting_enabled'>\n";
|
||||||
if ($domain_setting_enabled == "true") {
|
if ($domain_setting_enabled == "true") {
|
||||||
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||||
@@ -642,12 +683,18 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " $(window).keypress(function(event){\n";
|
echo " $(window).keypress(function(event){\n";
|
||||||
echo " if (event.which == 13) { submit_form(); }\n";
|
echo " if (event.which == 13) { submit_form(); }\n";
|
||||||
echo " });\n";
|
echo " });\n";
|
||||||
// convert password fields to
|
//hide/convert password fields then submit form
|
||||||
echo " function submit_form() {\n";
|
echo " function submit_form() {\n";
|
||||||
echo " $('input:password').css('visibility','hidden');\n";
|
echo " $('input:password').css('visibility','hidden');\n";
|
||||||
echo " $('input:password').attr({type:'text'});\n";
|
echo " $('input:password').attr({type:'text'});\n";
|
||||||
echo " $('form#frm').submit();\n";
|
echo " $('form#frm').submit();\n";
|
||||||
echo " }\n";
|
echo " }\n";
|
||||||
|
//define lowercase class
|
||||||
|
echo " $('.lowercase').blur(function(){ this.value = this.value.toLowerCase(); });";
|
||||||
|
//show order if array
|
||||||
|
echo " $('#domain_setting_name').keyup(function(){ \n";
|
||||||
|
echo " (this.value.toLowerCase() == 'array') ? $('#tr_order').slideDown('fast') : $('#tr_order').slideUp('fast');\n";
|
||||||
|
echo " });\n";
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
|
|||||||
@@ -255,16 +255,7 @@ if (sizeof($_REQUEST) > 1) {
|
|||||||
} //end if results
|
} //end if results
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
if (
|
echo "<td colspan='20' align='left'>\n";
|
||||||
(permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) ||
|
|
||||||
permission_exists("domain_delete")
|
|
||||||
) {
|
|
||||||
$colspan = 7;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$colspan = 6;
|
|
||||||
}
|
|
||||||
echo "<td colspan='".$colspan."' align='left'>\n";
|
|
||||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||||
echo " <tr>\n";
|
echo " <tr>\n";
|
||||||
echo " <td width='33.3%' nowrap> </td>\n";
|
echo " <td width='33.3%' nowrap> </td>\n";
|
||||||
@@ -274,7 +265,7 @@ if (sizeof($_REQUEST) > 1) {
|
|||||||
echo "<a href='domain_setting_edit.php?domain_uuid=".check_str($_GET['id'])."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
echo "<a href='domain_setting_edit.php?domain_uuid=".check_str($_GET['id'])."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||||
}
|
}
|
||||||
if (permission_exists('domain_setting_delete') && $result_count > 0) {
|
if (permission_exists('domain_setting_delete') && $result_count > 0) {
|
||||||
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('action').value = 'delete'; document.getElementById('domain_frm').submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('action').value = 'delete'; document.getElementById('domain_frm').submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " </tr>\n";
|
echo " </tr>\n";
|
||||||
|
|||||||
@@ -26,13 +26,20 @@
|
|||||||
require_once "root.php";
|
require_once "root.php";
|
||||||
require_once "resources/require.php";
|
require_once "resources/require.php";
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/check_auth.php";
|
||||||
if (permission_exists('domain_view')) {
|
|
||||||
//access granted
|
//redirect admin to app instead
|
||||||
}
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/") && !permission_exists('domain_parent') && permission_exists('domain_descendants')) {
|
||||||
else {
|
header("Location: ".PROJECT_PATH."/app/domains/domains.php");
|
||||||
echo "access denied";
|
}
|
||||||
exit;
|
|
||||||
}
|
//check permission
|
||||||
|
if (permission_exists('domain_view')) {
|
||||||
|
//access granted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
$language = new text;
|
$language = new text;
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ $apps[$x]['menu'][5]['category'] = "internal";
|
|||||||
$apps[$x]['menu'][5]['path'] = "";
|
$apps[$x]['menu'][5]['path'] = "";
|
||||||
$apps[$x]['menu'][5]['order'] = "30";
|
$apps[$x]['menu'][5]['order'] = "30";
|
||||||
$apps[$x]['menu'][5]['groups'][] = "superadmin";
|
$apps[$x]['menu'][5]['groups'][] = "superadmin";
|
||||||
|
$apps[$x]['menu'][5]['groups'][] = "admin";
|
||||||
|
|
||||||
$apps[$x]['menu'][6]['title']['en-us'] = "Login";
|
$apps[$x]['menu'][6]['title']['en-us'] = "Login";
|
||||||
$apps[$x]['menu'][6]['title']['es-cl'] = "Ingresar";
|
$apps[$x]['menu'][6]['title']['es-cl'] = "Ingresar";
|
||||||
|
|||||||
@@ -110,25 +110,23 @@
|
|||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "user_setting_view";
|
$apps[$x]['permissions'][$y]['name'] = "user_setting_view";
|
||||||
$apps[$x]['permissions'][$y]['menu']['uuid'] = "0d57cc1e-1874-47b9-7ddd-fe1f57cec99b";
|
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "user";
|
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "user_setting_add";
|
$apps[$x]['permissions'][$y]['name'] = "user_setting_add";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "user";
|
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "user_setting_edit";
|
$apps[$x]['permissions'][$y]['name'] = "user_setting_edit";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "user";
|
|
||||||
$y++;
|
$y++;
|
||||||
$apps[$x]['permissions'][$y]['name'] = "user_setting_delete";
|
$apps[$x]['permissions'][$y]['name'] = "user_setting_delete";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
$apps[$x]['permissions'][$y]['groups'][] = "admin";
|
||||||
$apps[$x]['permissions'][$y]['groups'][] = "user";
|
$y++;
|
||||||
|
$apps[$x]['permissions'][$y]['name'] = "user_setting_category_edit";
|
||||||
|
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
|
||||||
|
|
||||||
//schema details
|
//schema details
|
||||||
$y = 0; //table array index
|
$y = 0; //table array index
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$text['title-user_setting-edit']['en-us'] = "User Setting";
|
||||||
|
$text['title-user_setting-edit']['es-cl'] = "Configuración de Usuario";
|
||||||
|
$text['title-user_setting-edit']['pt-pt'] = "Definição do Utilizador";
|
||||||
|
$text['title-user_setting-edit']['fr-fr'] = "Cadre de l'utilisateur";
|
||||||
|
|
||||||
|
$text['title-user_setting-add']['en-us'] = "User Setting Add";
|
||||||
|
$text['title-user_setting-add']['es-cl'] = "Ajuste del usuario Agregar";
|
||||||
|
$text['title-user_setting-add']['pt-pt'] = "Usuário setting Adicionar";
|
||||||
|
$text['title-user_setting-add']['fr-fr'] = "Cadre utilisateur Ajouter";
|
||||||
|
|
||||||
$text['title-user_manager']['en-us'] = "User Manager";
|
$text['title-user_manager']['en-us'] = "User Manager";
|
||||||
$text['title-user_manager']['es-cl'] = "Administración de Usuarios";
|
$text['title-user_manager']['es-cl'] = "Administración de Usuarios";
|
||||||
$text['title-user_manager']['pt-pt'] = "Gestão de Utilizadores";
|
$text['title-user_manager']['pt-pt'] = "Gestão de Utilizadores";
|
||||||
@@ -572,6 +582,16 @@ $text['label-additional_info']['ro'] = "";
|
|||||||
$text['label-additional_info']['de-at'] = "Zusätzliche Information";
|
$text['label-additional_info']['de-at'] = "Zusätzliche Information";
|
||||||
$text['label-additional_info']['he'] = "מידע נוסף";
|
$text['label-additional_info']['he'] = "מידע נוסף";
|
||||||
|
|
||||||
|
$text['header-user_setting-edit']['en-us'] = "User Setting";
|
||||||
|
$text['header-user_setting-edit']['es-cl'] = "Configuración de Usuario";
|
||||||
|
$text['header-user_setting-edit']['pt-pt'] = "Definição do Utilizador";
|
||||||
|
$text['header-user_setting-edit']['fr-fr'] = "Cadre de l'utilisateur";
|
||||||
|
|
||||||
|
$text['header-user_setting-add']['en-us'] = "User Setting Add";
|
||||||
|
$text['header-user_setting-add']['es-cl'] = "Ajuste del usuario Agregar";
|
||||||
|
$text['header-user_setting-add']['pt-pt'] = "Usuário setting Adicionar";
|
||||||
|
$text['header-user_setting-add']['fr-fr'] = "Cadre utilisateur Ajouter";
|
||||||
|
|
||||||
$text['header-user_manager']['en-us'] = "Users";
|
$text['header-user_manager']['en-us'] = "Users";
|
||||||
$text['header-user_manager']['es-cl'] = "Administración de Usuario";
|
$text['header-user_manager']['es-cl'] = "Administración de Usuario";
|
||||||
$text['header-user_manager']['pt-pt'] = "Gestão de Utilizadores";
|
$text['header-user_manager']['pt-pt'] = "Gestão de Utilizadores";
|
||||||
@@ -660,6 +680,16 @@ $text['header-group_add']['ro'] = "";
|
|||||||
$text['header-group_add']['de-at'] = "Gruppe hinzufügen";
|
$text['header-group_add']['de-at'] = "Gruppe hinzufügen";
|
||||||
$text['header-group_add']['he'] = "הוסף קבוצה";
|
$text['header-group_add']['he'] = "הוסף קבוצה";
|
||||||
|
|
||||||
|
$text['description-user_setting-edit']['en-us'] = "Edit a setting for this user.";
|
||||||
|
$text['description-user_setting-edit']['es-cl'] = "Editar un escenario de este usuario.";
|
||||||
|
$text['description-user_setting-edit']['pt-pt'] = "Editar uma configuração para este usuário.";
|
||||||
|
$text['description-user_setting-edit']['fr-fr'] = "Modifier un réglage pour cet utilisateur.";
|
||||||
|
|
||||||
|
$text['description-user_setting-add']['en-us'] = "Add a setting for this user.";
|
||||||
|
$text['description-user_setting-add']['es-cl'] = "Añadir un entorno para este usuario.";
|
||||||
|
$text['description-user_setting-add']['pt-pt'] = "Adicionar uma definição para esse usuário.";
|
||||||
|
$text['description-user_setting-add']['fr-fr'] = "Ajouter un cadre pour cet utilisateur.";
|
||||||
|
|
||||||
$text['description-user_manager']['en-us'] = "Add, edit, delete, and search users. ";
|
$text['description-user_manager']['en-us'] = "Add, edit, delete, and search users. ";
|
||||||
$text['description-user_manager']['es-cl'] = "Agregar, Editar, Eliminar y Buscar Usuarios. ";
|
$text['description-user_manager']['es-cl'] = "Agregar, Editar, Eliminar y Buscar Usuarios. ";
|
||||||
$text['description-user_manager']['pt-pt'] = "Adicionar, editar, remover e pesquisar utilizadores. ";
|
$text['description-user_manager']['pt-pt'] = "Adicionar, editar, remover e pesquisar utilizadores. ";
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?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 "resources/require.php";
|
||||||
|
require_once "resources/check_auth.php";
|
||||||
|
if (permission_exists('user_setting_delete')) {
|
||||||
|
//access granted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//add multi-lingual support
|
||||||
|
$language = new text;
|
||||||
|
$text = $language->get();
|
||||||
|
|
||||||
|
//get the variables
|
||||||
|
if (count($_GET)>0) {
|
||||||
|
$id = check_str($_GET["id"]);
|
||||||
|
$user_uuid = check_str($_GET["user_uuid"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete the record
|
||||||
|
if (strlen($id) > 0) {
|
||||||
|
//delete user_setting
|
||||||
|
$sql = "delete from v_user_settings ";
|
||||||
|
$sql .= "where user_uuid = '$user_uuid' ";
|
||||||
|
$sql .= "and user_setting_uuid = '$id' ";
|
||||||
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$prep_statement->execute();
|
||||||
|
unset($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
//redirect the user
|
||||||
|
$_SESSION["message"] = $text['message-delete'];
|
||||||
|
header("Location: usersupdate.php?id=".$user_uuid);
|
||||||
|
return;
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,704 @@
|
|||||||
|
<?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-2015
|
||||||
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
*/
|
||||||
|
require_once "root.php";
|
||||||
|
require_once "resources/require.php";
|
||||||
|
require_once "resources/check_auth.php";
|
||||||
|
if (permission_exists('user_setting_add') || permission_exists('user_setting_edit')) {
|
||||||
|
//access granted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//add multi-lingual support
|
||||||
|
$language = new text;
|
||||||
|
$text = $language->get();
|
||||||
|
|
||||||
|
//retrieve allowed setting categories
|
||||||
|
if (!permission_exists('user_setting_category_edit')) {
|
||||||
|
if (is_array($_SESSION['settings']) && sizeof($_SESSION['settings']) > 0) {
|
||||||
|
foreach ($_SESSION['groups'] as $index => $group) {
|
||||||
|
$group_name = $group['group_name'];
|
||||||
|
if (is_array($_SESSION['settings'][$group_name]) && sizeof($_SESSION['settings'][$group_name]) > 0) {
|
||||||
|
foreach ($_SESSION['settings'][$group_name] as $category) {
|
||||||
|
$categories[] = strtolower($category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_array($categories) && sizeof($categories) > 0) {
|
||||||
|
$allowed_categories = array_unique($categories);
|
||||||
|
sort($allowed_categories, SORT_NATURAL);
|
||||||
|
}
|
||||||
|
unset($group, $group_name, $index, $category, $categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
//action add or update
|
||||||
|
if (isset($_REQUEST["id"])) {
|
||||||
|
$action = "update";
|
||||||
|
$user_setting_uuid = check_str($_REQUEST["id"]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$action = "add";
|
||||||
|
}
|
||||||
|
|
||||||
|
//set the user_uuid
|
||||||
|
if (strlen($_GET["user_uuid"]) > 0) {
|
||||||
|
$user_uuid = check_str($_GET["user_uuid"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//get http post variables and set them to php variables
|
||||||
|
if (count($_REQUEST) > 0) {
|
||||||
|
$user_setting_category = strtolower(check_str($_REQUEST["user_setting_category"]));
|
||||||
|
$user_setting_subcategory = strtolower(check_str($_POST["user_setting_subcategory"]));
|
||||||
|
$user_setting_name = strtolower(check_str($_POST["user_setting_name"]));
|
||||||
|
$user_setting_value = check_str($_POST["user_setting_value"]);
|
||||||
|
$user_setting_order = check_str($_POST["user_setting_order"]);
|
||||||
|
$user_setting_enabled = strtolower(check_str($_POST["user_setting_enabled"]));
|
||||||
|
$user_setting_description = check_str($_POST["user_setting_description"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
|
|
||||||
|
$msg = '';
|
||||||
|
if ($action == "update") {
|
||||||
|
$user_setting_uuid = check_str($_POST["user_setting_uuid"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//check for all required data
|
||||||
|
if (strlen($user_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
|
||||||
|
if (strlen($user_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
|
||||||
|
if (strlen($user_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
|
||||||
|
//if (strlen($user_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
|
||||||
|
if (strlen($user_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
|
||||||
|
if (strlen($user_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
|
||||||
|
//if (strlen($user_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
|
||||||
|
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
||||||
|
require_once "resources/header.php";
|
||||||
|
require_once "resources/persist_form_var.php";
|
||||||
|
echo "<div align='center'>\n";
|
||||||
|
echo "<table><tr><td>\n";
|
||||||
|
echo $msg."<br />";
|
||||||
|
echo "</td></tr></table>\n";
|
||||||
|
persistformvar($_POST);
|
||||||
|
echo "</div>\n";
|
||||||
|
require_once "resources/footer.php";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//add or update the database
|
||||||
|
if ($_POST["persistformvar"] != "true") {
|
||||||
|
// fix null
|
||||||
|
$user_setting_order = ($user_setting_order != '') ? $user_setting_order : 'null';
|
||||||
|
|
||||||
|
//update switch timezone variables
|
||||||
|
if ($user_setting_category == "domain" && $user_setting_subcategory == "time_zone" && $user_setting_name == "name" ) {
|
||||||
|
//get the dialplan_uuid
|
||||||
|
$sql = "select * from v_dialplans ";
|
||||||
|
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||||
|
$sql .= "and app_uuid = '9f356fe7-8cf8-4c14-8fe2-6daf89304458' ";
|
||||||
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$prep_statement->execute();
|
||||||
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$dialplan_uuid = $row["dialplan_uuid"];
|
||||||
|
}
|
||||||
|
unset ($prep_statement);
|
||||||
|
|
||||||
|
//get the action
|
||||||
|
$sql = "select * from v_dialplan_details ";
|
||||||
|
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||||
|
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
|
||||||
|
$sql .= "and dialplan_detail_tag = 'action' ";
|
||||||
|
$sql .= "and dialplan_detail_type = 'set' ";
|
||||||
|
$sql .= "and dialplan_detail_data like 'timezone=%' ";
|
||||||
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$prep_statement->execute();
|
||||||
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
$detail_action = "add";
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$dialplan_detail_uuid = $row["dialplan_detail_uuid"];
|
||||||
|
$detail_action = "update";
|
||||||
|
}
|
||||||
|
unset ($prep_statement);
|
||||||
|
|
||||||
|
//update the timezone
|
||||||
|
if ($detail_action == "update") {
|
||||||
|
$sql = "update v_dialplan_details ";
|
||||||
|
$sql .= "set dialplan_detail_data = 'timezone=".$user_setting_value."' ";
|
||||||
|
$sql .= "where dialplan_detail_uuid = '".$dialplan_detail_uuid."' ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$dialplan_detail_uuid = uuid();
|
||||||
|
$dialplan_detail_group = 0;
|
||||||
|
$sql = "insert into v_dialplan_details ";
|
||||||
|
$sql .= "(";
|
||||||
|
$sql .= "domain_uuid, ";
|
||||||
|
$sql .= "dialplan_detail_uuid, ";
|
||||||
|
$sql .= "dialplan_uuid, ";
|
||||||
|
$sql .= "dialplan_detail_tag, ";
|
||||||
|
$sql .= "dialplan_detail_type, ";
|
||||||
|
$sql .= "dialplan_detail_data, ";
|
||||||
|
$sql .= "dialplan_detail_inline, ";
|
||||||
|
$sql .= "dialplan_detail_group ";
|
||||||
|
$sql .= ") ";
|
||||||
|
$sql .= "values ";
|
||||||
|
$sql .= "(";
|
||||||
|
$sql .= "'".$domain_uuid."', ";
|
||||||
|
$sql .= "'".$dialplan_detail_uuid."', ";
|
||||||
|
$sql .= "'".$dialplan_uuid."', ";
|
||||||
|
$sql .= "'action', ";
|
||||||
|
$sql .= "'set', ";
|
||||||
|
$sql .= "'timezone=".$user_setting_value."', ";
|
||||||
|
$sql .= "'true', ";
|
||||||
|
$sql .= "'".$dialplan_detail_group."' ";
|
||||||
|
$sql .= "); ";
|
||||||
|
}
|
||||||
|
$db->query($sql);
|
||||||
|
unset($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
//add the user setting
|
||||||
|
if ($action == "add" && permission_exists('user_setting_add')) {
|
||||||
|
$sql = "insert into v_user_settings ";
|
||||||
|
$sql .= "(";
|
||||||
|
$sql .= "user_uuid, ";
|
||||||
|
$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_order, ";
|
||||||
|
$sql .= "user_setting_enabled, ";
|
||||||
|
$sql .= "user_setting_description ";
|
||||||
|
$sql .= ")";
|
||||||
|
$sql .= "values ";
|
||||||
|
$sql .= "(";
|
||||||
|
$sql .= "'$user_uuid', ";
|
||||||
|
$sql .= "'$domain_uuid', ";
|
||||||
|
$sql .= "'".uuid()."', ";
|
||||||
|
$sql .= "'$user_setting_category', ";
|
||||||
|
$sql .= "'$user_setting_subcategory', ";
|
||||||
|
$sql .= "'$user_setting_name', ";
|
||||||
|
$sql .= "'$user_setting_value', ";
|
||||||
|
$sql .= "$user_setting_order, ";
|
||||||
|
$sql .= "'$user_setting_enabled', ";
|
||||||
|
$sql .= "'$user_setting_description' ";
|
||||||
|
$sql .= ")";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
} //if ($action == "add")
|
||||||
|
|
||||||
|
//update the user setting
|
||||||
|
if ($action == "update" && permission_exists('user_setting_edit')) {
|
||||||
|
$sql = "update v_user_settings set ";
|
||||||
|
$sql .= "user_setting_category = '$user_setting_category', ";
|
||||||
|
$sql .= "user_setting_subcategory = '$user_setting_subcategory', ";
|
||||||
|
$sql .= "user_setting_name = '$user_setting_name', ";
|
||||||
|
$sql .= "user_setting_value = '$user_setting_value', ";
|
||||||
|
$sql .= "user_setting_order = $user_setting_order, ";
|
||||||
|
$sql .= "user_setting_enabled = '$user_setting_enabled', ";
|
||||||
|
$sql .= "user_setting_description = '$user_setting_description' ";
|
||||||
|
$sql .= "where user_uuid = '$user_uuid' ";
|
||||||
|
$sql .= "and user_setting_uuid = '$user_setting_uuid'";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
} //if ($action == "update")
|
||||||
|
|
||||||
|
//update time zone
|
||||||
|
if ($user_setting_category == "domain" && $user_setting_subcategory == "time_zone" && $user_setting_name == "name" && strlen($user_setting_value) > 0 ) {
|
||||||
|
$sql = "select * from v_dialplans ";
|
||||||
|
$sql .= "where app_uuid = '34dd307b-fffe-4ead-990c-3d070e288126' ";
|
||||||
|
$sql .= "and domain_uuid = '".$_SESSION["domain_uuid"]."' ";
|
||||||
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$prep_statement->execute();
|
||||||
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
$time_zone_found = false;
|
||||||
|
foreach ($result as &$row) {
|
||||||
|
//get the dialplan_uuid
|
||||||
|
$dialplan_uuid = $row["dialplan_uuid"];
|
||||||
|
|
||||||
|
//get the dialplan details
|
||||||
|
$sql = "select * from v_dialplan_details ";
|
||||||
|
$sql .= "where dialplan_uuid = '".$dialplan_uuid."' ";
|
||||||
|
$sql .= "and domain_uuid = '".$_SESSION["domain_uuid"]."' ";
|
||||||
|
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$sub_prep_statement->execute();
|
||||||
|
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
foreach ($sub_result as $field) {
|
||||||
|
$dialplan_detail_uuid = $field["dialplan_detail_uuid"];
|
||||||
|
$dialplan_detail_tag = $field["dialplan_detail_tag"]; //action //condition
|
||||||
|
$dialplan_detail_type = $field["dialplan_detail_type"]; //set
|
||||||
|
$dialplan_detail_data = $field["dialplan_detail_data"];
|
||||||
|
$dialplan_detail_group = $field["dialplan_detail_group"];
|
||||||
|
if ($dialplan_detail_tag == "action" && $dialplan_detail_type == "set") {
|
||||||
|
$data_array = explode("=", $dialplan_detail_data);
|
||||||
|
if ($data_array[0] == "timezone") {
|
||||||
|
$time_zone_found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//add the time zone
|
||||||
|
if (!$time_zone_found) {
|
||||||
|
//$dialplan_detail_uuid = uuid();
|
||||||
|
$dialplan_detail_uuid = "eb3b3a4e-88ea-4306-b2a8-9f52d3c95f2f";
|
||||||
|
$sql = "insert into v_dialplan_details ";
|
||||||
|
$sql .= "(";
|
||||||
|
$sql .= "domain_uuid, ";
|
||||||
|
$sql .= "dialplan_uuid, ";
|
||||||
|
$sql .= "dialplan_detail_uuid, ";
|
||||||
|
$sql .= "dialplan_detail_tag, ";
|
||||||
|
$sql .= "dialplan_detail_type, ";
|
||||||
|
$sql .= "dialplan_detail_data, ";
|
||||||
|
$sql .= "dialplan_detail_group, ";
|
||||||
|
$sql .= "dialplan_detail_order ";
|
||||||
|
$sql .= ") ";
|
||||||
|
$sql .= "values ";
|
||||||
|
$sql .= "(";
|
||||||
|
$sql .= "'".$_SESSION["domain_uuid"]."', "; //8cfd9525-6ccf-4c2c-813a-bca5809067cd
|
||||||
|
$sql .= "'$dialplan_uuid', "; //807b4aa6-4478-4663-a661-779397c1d542
|
||||||
|
$sql .= "'$dialplan_detail_uuid', ";
|
||||||
|
$sql .= "'action', ";
|
||||||
|
$sql .= "'set', ";
|
||||||
|
$sql .= "'timezone=$user_setting_value', ";
|
||||||
|
if (strlen($dialplan_detail_group) > 0) {
|
||||||
|
$sql .= "'$dialplan_detail_group', ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= "null, ";
|
||||||
|
}
|
||||||
|
$sql .= "'15' ";
|
||||||
|
$sql .= ")";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
//update the time zone
|
||||||
|
if ($time_zone_found) {
|
||||||
|
$sql = "update v_dialplan_details set ";
|
||||||
|
$sql .= "dialplan_detail_data = 'timezone=".$user_setting_value."' ";
|
||||||
|
$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
|
||||||
|
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
|
||||||
|
$sql .= "and dialplan_detail_uuid = '$dialplan_detail_uuid' ";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//redirect the browser
|
||||||
|
if ($action == "update") {
|
||||||
|
$_SESSION["message"] = $text['message-update'];
|
||||||
|
}
|
||||||
|
if ($action == "add") {
|
||||||
|
$_SESSION["message"] = $text['message-add'];
|
||||||
|
}
|
||||||
|
header("Location: usersupdate.php?id=".$user_uuid);
|
||||||
|
return;
|
||||||
|
} //if ($_POST["persistformvar"] != "true")
|
||||||
|
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||||
|
|
||||||
|
//pre-populate the form
|
||||||
|
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||||
|
$user_setting_uuid = check_str($_GET["id"]);
|
||||||
|
$sql = "select * from v_user_settings ";
|
||||||
|
$sql .= "where user_uuid = '$user_uuid' ";
|
||||||
|
$sql .= "and user_setting_uuid = '$user_setting_uuid' ";
|
||||||
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$prep_statement->execute();
|
||||||
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
foreach ($result as &$row) {
|
||||||
|
$user_setting_category = $row["user_setting_category"];
|
||||||
|
$user_setting_subcategory = $row["user_setting_subcategory"];
|
||||||
|
$user_setting_name = $row["user_setting_name"];
|
||||||
|
$user_setting_value = $row["user_setting_value"];
|
||||||
|
$user_setting_order = $row["user_setting_order"];
|
||||||
|
$user_setting_enabled = $row["user_setting_enabled"];
|
||||||
|
$user_setting_description = $row["user_setting_description"];
|
||||||
|
break; //limit to 1 row
|
||||||
|
}
|
||||||
|
unset ($prep_statement);
|
||||||
|
}
|
||||||
|
|
||||||
|
//show the header
|
||||||
|
require_once "resources/header.php";
|
||||||
|
if ($action == "update") {
|
||||||
|
$document['title'] = $text['title-user_setting-edit'];
|
||||||
|
}
|
||||||
|
elseif ($action == "add") {
|
||||||
|
$document['title'] = $text['title-user_setting-add'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//show the content
|
||||||
|
echo "<form name='frm' id='frm' method='post' action=''>\n";
|
||||||
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td align='left' valign='top' width='30%' nowrap='nowrap'><b>";
|
||||||
|
if ($action == "update") {
|
||||||
|
echo $text['header-user_setting-edit'];
|
||||||
|
}
|
||||||
|
if ($action == "add") {
|
||||||
|
echo $text['header-user_setting-add'];
|
||||||
|
}
|
||||||
|
echo "</b></td>\n";
|
||||||
|
echo "<td width='70%' align='right' valign='top'>";
|
||||||
|
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='usersupdate.php?id=$user_uuid'\" value='".$text['button-back']."'>";
|
||||||
|
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td align='left' colspan='2'>\n";
|
||||||
|
if ($action == "update") {
|
||||||
|
echo $text['description-user_setting-edit'];
|
||||||
|
}
|
||||||
|
if ($action == "add") {
|
||||||
|
echo $text['description-user_setting-add'];
|
||||||
|
}
|
||||||
|
echo "<br /><br />\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-category']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
if (permission_exists('user_setting_category_edit')) {
|
||||||
|
echo " <input type='text' class='formfld' name='user_setting_category' id='user_setting_category' maxlength='255' value=\"".$user_setting_category."\">\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <select class='formfld' name='user_setting_category' id='user_setting_category' onchange=\"$('#user_setting_subcategory').focus();\">\n";
|
||||||
|
echo " <option value=''></option>\n";
|
||||||
|
if (is_array($allowed_categories) && sizeof($allowed_categories) > 0) {
|
||||||
|
foreach ($allowed_categories as $category) {
|
||||||
|
$selected = ($domain_setting_category == $category) ? 'selected' : null;
|
||||||
|
echo " <option value='".$category."' ".$selected.">".ucwords(str_replace('_',' ',$category))."</option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo " </select>";
|
||||||
|
}
|
||||||
|
echo "<br />\n";
|
||||||
|
echo $text['description-category']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-subcategory']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
echo " <input class='formfld lowercase' type='text' name='user_setting_subcategory' id='user_setting_subcategory' maxlength='255' value=\"$user_setting_subcategory\">\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo $text['description-subcategory']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-type']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
echo " <input class='formfld lowercase' type='text' name='user_setting_name' id='user_setting_name' maxlength='255' value=\"$user_setting_name\">\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo $text['description-type']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-value']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
$category = $row['user_setting_category'];
|
||||||
|
$subcategory = $row['user_setting_subcategory'];
|
||||||
|
$name = $row['user_setting_name'];
|
||||||
|
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||||
|
echo " <select id='user_setting_value' name='user_setting_value' class='formfld' style=''>\n";
|
||||||
|
echo " <option value=''></option>\n";
|
||||||
|
$sql = "";
|
||||||
|
$sql .= "select * from v_menus ";
|
||||||
|
$sql .= "order by menu_language, menu_name asc ";
|
||||||
|
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$sub_prep_statement->execute();
|
||||||
|
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
foreach ($sub_result as $sub_row) {
|
||||||
|
if (strtolower($row['user_setting_value']) == strtolower($sub_row["menu_uuid"])) {
|
||||||
|
echo " <option value='".strtolower($sub_row["menu_uuid"])."' selected='selected'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <option value='".strtolower($sub_row["menu_uuid"])."'>".$sub_row["menu_language"]." - ".$sub_row["menu_name"]."</option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset ($sub_prep_statement);
|
||||||
|
echo " </select>\n";
|
||||||
|
}
|
||||||
|
elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
|
||||||
|
echo " <select id='user_setting_value' name='user_setting_value' class='formfld' style=''>\n";
|
||||||
|
echo " <option value=''></option>\n";
|
||||||
|
//add all the themes to the list
|
||||||
|
$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" && $dir_name != ".git" && is_dir($theme_dir.'/'.$dir_name)) {
|
||||||
|
$dir_label = str_replace('_', ' ', $dir_name);
|
||||||
|
$dir_label = str_replace('-', ' ', $dir_label);
|
||||||
|
if ($dir_name == $row['user_setting_value']) {
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
elseif ($category == "domain" && $subcategory == "language" && $name == "code" ) {
|
||||||
|
echo " <select id='user_setting_value' name='user_setting_value' class='formfld' style=''>\n";
|
||||||
|
echo " <option value=''></option>\n";
|
||||||
|
foreach ($_SESSION['app']['languages'] as $key => $value) {
|
||||||
|
if ($row['default_setting_value'] == $key) {
|
||||||
|
echo " <option value='$value' selected='selected'>$value</option>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <option value='$value'>$value</option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo " </select>\n";
|
||||||
|
}
|
||||||
|
elseif ($category == "domain" && $subcategory == "time_zone" && $name == "name" ) {
|
||||||
|
echo " <select id='user_setting_value' name='user_setting_value' 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 => $val) {
|
||||||
|
$time_zone = explode("/", $val);
|
||||||
|
$category = $time_zone[0];
|
||||||
|
if ($category != $previous_category) {
|
||||||
|
if ($x > 0) {
|
||||||
|
echo " </optgroup>\n";
|
||||||
|
}
|
||||||
|
echo " <optgroup label='".$category."'>\n";
|
||||||
|
}
|
||||||
|
if (strlen($val) > 0) {
|
||||||
|
$time_zone_offset = get_time_zone_offset($val)/3600;
|
||||||
|
$time_zone_offset_hours = floor($time_zone_offset);
|
||||||
|
$time_zone_offset_minutes = ($time_zone_offset - $time_zone_offset_hours) * 60;
|
||||||
|
$time_zone_offset_minutes = number_pad($time_zone_offset_minutes, 2);
|
||||||
|
if ($time_zone_offset > 0) {
|
||||||
|
$time_zone_offset_hours = number_pad($time_zone_offset_hours, 2);
|
||||||
|
$time_zone_offset_hours = "+".$time_zone_offset_hours;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$time_zone_offset_hours = str_replace("-", "", $time_zone_offset_hours);
|
||||||
|
$time_zone_offset_hours = "-".number_pad($time_zone_offset_hours, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($val == $row['user_setting_value']) {
|
||||||
|
echo " <option value='".$val."' selected='selected'>(UTC ".$time_zone_offset_hours.":".$time_zone_offset_minutes.") ".$val."</option>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <option value='".$val."'>(UTC ".$time_zone_offset_hours.":".$time_zone_offset_minutes.") ".$val."</option>\n";
|
||||||
|
}
|
||||||
|
$previous_category = $category;
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
echo " </select>\n";
|
||||||
|
}
|
||||||
|
elseif ($subcategory == 'password' || substr_count($subcategory, '_password') > 0 || $category == "login" && $subcategory == "password_reset_key" && $name == "text") {
|
||||||
|
echo " <input class='formfld' type='password' name='user_setting_value' maxlength='255' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" value=\"".$row['user_setting_value']."\">\n";
|
||||||
|
}
|
||||||
|
elseif (
|
||||||
|
$category == "theme" && $subcategory == "background_color" && $name == "array" ||
|
||||||
|
$category == "theme" && $subcategory == "login_shadow_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "login_background_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "domain_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "domain_shadow_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "domain_background_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "footer_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "footer_background_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "message_default_background_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "message_default_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "message_negative_background_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "message_negative_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "message_alert_background_color" && $name == "text" ||
|
||||||
|
$category == "theme" && $subcategory == "message_alert_color" && $name == "text"
|
||||||
|
) {
|
||||||
|
echo " <style>";
|
||||||
|
echo " DIV.rui-colorpicker { width: 253px; }";
|
||||||
|
echo " DIV.rui-colorpicker DIV.controls { width: 61px; }";
|
||||||
|
echo " DIV.rui-colorpicker DIV.controls DIV.preview { width: 55px; }";
|
||||||
|
echo " DIV.rui-colorpicker DIV.controls INPUT.display { width: 61px; text-align: center; font-family: courier; }";
|
||||||
|
echo " DIV.rui-colorpicker DIV.controls DIV.rgb-display { width: 50px; }";
|
||||||
|
echo " DIV.rui-colorpicker DIV.controls DIV.rgb-display DIV INPUT { width: 30px; }";
|
||||||
|
echo " </style>";
|
||||||
|
echo " <input class='formfld' id='user_setting_value' name='user_setting_value' data-colorpcker=\"{format: 'hex'}\" value=\"".$row['user_setting_value']."\">\n";
|
||||||
|
echo " <script type='text/javascript'>new Colorpicker().assignTo('user_setting_value');</script>";
|
||||||
|
}
|
||||||
|
elseif ($category == "fax" && $subcategory == "page_size" && $name == "text" ) {
|
||||||
|
echo " <select id='default_setting_value' name='default_setting_value' class='formfld' style=''>\n";
|
||||||
|
echo " <option value='letter' ".(($row['default_setting_value'] == 'letter') ? 'selected' : null).">Letter</option>";
|
||||||
|
echo " <option value='legal' ".(($row['default_setting_value'] == 'legal') ? 'selected' : null).">Legal</option>";
|
||||||
|
echo " <option value='a4' ".(($row['default_setting_value'] == 'a4') ? 'selected' : null).">A4</option>";
|
||||||
|
echo " </select>";
|
||||||
|
}
|
||||||
|
elseif ($category == "fax" && $subcategory == "resolution" && $name == "text" ) {
|
||||||
|
echo " <select id='default_setting_value' name='default_setting_value' class='formfld' style=''>\n";
|
||||||
|
echo " <option value='normal' ".(($row['default_setting_value'] == 'normal') ? 'selected' : null).">".$text['label-normal']."</option>";
|
||||||
|
echo " <option value='fine' ".(($row['default_setting_value'] == 'fine') ? 'selected' : null).">".$text['label-fine']."</option>";
|
||||||
|
echo " <option value='superfine' ".(($row['default_setting_value'] == 'superfine') ? 'selected' : null).">".$text['label-superfine']."</option>";
|
||||||
|
echo " </select>";
|
||||||
|
}
|
||||||
|
elseif ($category == "theme" && $subcategory == "domain_visible" && $name == "text" ) {
|
||||||
|
echo " <select class='formfld' name='default_setting_value'>\n";
|
||||||
|
echo " <option value='false' ".(($row['default_setting_value'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||||
|
echo " <option value='true' ".(($row['default_setting_value'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||||
|
echo " </select>\n";
|
||||||
|
}
|
||||||
|
elseif ($category == "theme" && $subcategory == "cache" && $name == "boolean" ) {
|
||||||
|
echo " <select class='formfld' name='default_setting_value'>\n";
|
||||||
|
echo " <option value='true' ".(($row['default_setting_value'] == "true") ? "selected='selected'" : null).">".$text['label-true']."</option>\n";
|
||||||
|
echo " <option value='false' ".(($row['default_setting_value'] == "false") ? "selected='selected'" : null).">".$text['label-false']."</option>\n";
|
||||||
|
echo " </select>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <input class='formfld' type='text' name='user_setting_value' maxlength='255' value=\"".$row['user_setting_value']."\">\n";
|
||||||
|
}
|
||||||
|
echo "<br />\n";
|
||||||
|
echo $text['description-value']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
|
||||||
|
echo "<div id='tr_order' ".(($user_setting_name != 'array') ? "style='display: none;'" : null).">\n";
|
||||||
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-order']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||||
|
echo " <select name='user_setting_order' class='formfld'>\n";
|
||||||
|
$i=0;
|
||||||
|
while($i<=999) {
|
||||||
|
$selected = ($i == $user_setting_order) ? "selected" : null;
|
||||||
|
if (strlen($i) == 1) {
|
||||||
|
echo " <option value='00$i' ".$selected.">00$i</option>\n";
|
||||||
|
}
|
||||||
|
if (strlen($i) == 2) {
|
||||||
|
echo " <option value='0$i' ".$selected.">0$i</option>\n";
|
||||||
|
}
|
||||||
|
if (strlen($i) == 3) {
|
||||||
|
echo " <option value='$i' ".$selected.">$i</option>\n";
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
echo " </select>\n";
|
||||||
|
echo " <br />\n";
|
||||||
|
echo $text['description-order']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
echo "</div>\n";
|
||||||
|
|
||||||
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap>\n";
|
||||||
|
echo " ".$text['label-enabled']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||||
|
echo " <select class='formfld' name='user_setting_enabled'>\n";
|
||||||
|
if ($user_setting_enabled == "true") {
|
||||||
|
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <option value='true'>".$text['label-true']."</option>\n";
|
||||||
|
}
|
||||||
|
if ($user_setting_enabled == "false") {
|
||||||
|
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <option value='false'>".$text['label-false']."</option>\n";
|
||||||
|
}
|
||||||
|
echo " </select>\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo $text['description-setting_enabled']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||||
|
echo " ".$text['label-description']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td class='vtable' align='left'>\n";
|
||||||
|
echo " <input class='formfld' type='text' name='user_setting_description' maxlength='255' value=\"".$user_setting_description."\">\n";
|
||||||
|
echo "<br />\n";
|
||||||
|
echo $text['description-description']."\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo " <tr>\n";
|
||||||
|
echo " <td colspan='2' align='right'>\n";
|
||||||
|
echo " <input type='hidden' name='user_uuid' value='$user_uuid'>\n";
|
||||||
|
if ($action == "update") {
|
||||||
|
echo " <input type='hidden' name='user_setting_uuid' value='$user_setting_uuid'>\n";
|
||||||
|
}
|
||||||
|
echo " <br />";
|
||||||
|
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick='submit_form();'>\n";
|
||||||
|
echo " </td>\n";
|
||||||
|
echo " </tr>";
|
||||||
|
echo "</table>";
|
||||||
|
echo "<br />";
|
||||||
|
echo "</form>";
|
||||||
|
|
||||||
|
echo "<script>\n";
|
||||||
|
//capture enter key to submit form
|
||||||
|
echo " $(window).keypress(function(event){\n";
|
||||||
|
echo " if (event.which == 13) { submit_form(); }\n";
|
||||||
|
echo " });\n";
|
||||||
|
//hide/convert password fields then submit form
|
||||||
|
echo " function submit_form() {\n";
|
||||||
|
echo " $('input:password').css('visibility','hidden');\n";
|
||||||
|
echo " $('input:password').attr({type:'text'});\n";
|
||||||
|
echo " $('form#frm').submit();\n";
|
||||||
|
echo " }\n";
|
||||||
|
//define lowercase class
|
||||||
|
echo " $('.lowercase').blur(function(){ this.value = this.value.toLowerCase(); });";
|
||||||
|
//show order if array
|
||||||
|
echo " $('#user_setting_name').keyup(function(){ \n";
|
||||||
|
echo " (this.value.toLowerCase() == 'array') ? $('#tr_order').slideDown('fast') : $('#tr_order').slideUp('fast');\n";
|
||||||
|
echo " });\n";
|
||||||
|
echo "</script>\n";
|
||||||
|
|
||||||
|
//include the footer
|
||||||
|
require_once "resources/footer.php";
|
||||||
|
?>
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
<?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-2015
|
||||||
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
*/
|
||||||
|
require_once "root.php";
|
||||||
|
require_once "resources/require.php";
|
||||||
|
require_once "resources/check_auth.php";
|
||||||
|
if (permission_exists('user_setting_view')) {
|
||||||
|
//access granted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (sizeof($_REQUEST) > 1) {
|
||||||
|
|
||||||
|
$action = check_str($_REQUEST["action"]);
|
||||||
|
$user_uuid = check_str($_REQUEST["user_id"]);
|
||||||
|
$user_setting_uuids = $_REQUEST["id"];
|
||||||
|
$enabled = check_str($_REQUEST['enabled']);
|
||||||
|
|
||||||
|
//change enabled value
|
||||||
|
if ($user_uuid != '' && sizeof($user_setting_uuids) == 1 && $enabled != '') {
|
||||||
|
$sql = "update v_user_settings set ";
|
||||||
|
$sql .= "user_setting_enabled = '".$enabled."' ";
|
||||||
|
$sql .= "where user_uuid = '".$user_uuid."' ";
|
||||||
|
$sql .= "and user_setting_uuid = '".$user_setting_uuids[0]."' ";
|
||||||
|
//echo $sql."<br><br>";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
|
$_SESSION["message"] = $text['message-update'];
|
||||||
|
header("Location: usersupdate.php?id=".$user_uuid);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete user settings
|
||||||
|
if ($action == 'delete' && permission_exists('user_setting_delete')) {
|
||||||
|
//add multi-lingual support
|
||||||
|
$language = new text;
|
||||||
|
$text = $language->get();
|
||||||
|
|
||||||
|
if (sizeof($user_setting_uuids) > 0) {
|
||||||
|
foreach ($user_setting_uuids as $user_setting_uuid) {
|
||||||
|
$sql = "delete from v_user_settings ";
|
||||||
|
$sql .= "where user_setting_uuid = '".$user_setting_uuid."' ";
|
||||||
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$prep_statement->execute();
|
||||||
|
unset ($prep_statement, $sql);
|
||||||
|
}
|
||||||
|
// set message
|
||||||
|
$_SESSION["message"] = $text['message-delete'].": ".sizeof($user_setting_uuids);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// set message
|
||||||
|
$_SESSION["message"] = $text['message-delete_failed'];
|
||||||
|
$_SESSION["message_mood"] = "negative";
|
||||||
|
}
|
||||||
|
|
||||||
|
header("Location: usersupdate.php?id=".check_str($_REQUEST["user_uuid"]));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
} //REQUEST
|
||||||
|
|
||||||
|
//include the paging
|
||||||
|
require_once "resources/paging.php";
|
||||||
|
|
||||||
|
//get the variables
|
||||||
|
$order_by = check_str($_GET["order_by"]);
|
||||||
|
$order = check_str($_GET["order"]);
|
||||||
|
|
||||||
|
//show the content
|
||||||
|
echo "<form name='user_frm' id='user_frm' method='GET' action='user_settings.php'>";
|
||||||
|
echo "<input type='hidden' name='action' id='action' value=''>";
|
||||||
|
echo "<input type='hidden' name='user_uuid' value='".$user_uuid."'>";
|
||||||
|
|
||||||
|
//prepare to page the results
|
||||||
|
$sql = "select count(*) as num_rows from v_user_settings ";
|
||||||
|
$sql .= "where user_uuid = '$user_uuid' ";
|
||||||
|
$prep_statement = $db->prepare($sql);
|
||||||
|
if ($prep_statement) {
|
||||||
|
$prep_statement->execute();
|
||||||
|
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||||
|
if ($row['num_rows'] > 0) {
|
||||||
|
$num_rows = $row['num_rows'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$num_rows = '0';
|
||||||
|
}
|
||||||
|
unset ($prep_statement, $sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
//prepare to page the results
|
||||||
|
$rows_per_page = 200;
|
||||||
|
$param = "";
|
||||||
|
$page = $_GET['page'];
|
||||||
|
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
||||||
|
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||||
|
$offset = $rows_per_page * $page;
|
||||||
|
|
||||||
|
//get the list
|
||||||
|
$sql = "select * from v_user_settings ";
|
||||||
|
$sql .= "where user_uuid = '$user_uuid' ";
|
||||||
|
$sql .= "and (user_setting_category <> 'domain' and user_setting_subcategory <> 'language') ";
|
||||||
|
$sql .= "and (user_setting_category <> 'domain' and user_setting_subcategory <> 'time_zone') ";
|
||||||
|
if (strlen($order_by) == 0) {
|
||||||
|
$sql .= "order by user_setting_category, user_setting_subcategory, user_setting_order asc ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= "order by $order_by $order ";
|
||||||
|
}
|
||||||
|
$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);
|
||||||
|
|
||||||
|
$c = 0;
|
||||||
|
$row_style["0"] = "row_style0";
|
||||||
|
$row_style["1"] = "row_style1";
|
||||||
|
|
||||||
|
//show the content
|
||||||
|
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
|
|
||||||
|
if ($result_count > 0) {
|
||||||
|
$previous_category = '';
|
||||||
|
foreach($result as $row) {
|
||||||
|
if ($previous_category != $row['user_setting_category']) {
|
||||||
|
$c = 0;
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo " <td colspan='7' align='left'>\n";
|
||||||
|
if ($previous_category != '') {
|
||||||
|
echo " <br /><br />\n";
|
||||||
|
}
|
||||||
|
echo " <b>\n";
|
||||||
|
if (strtolower($row['user_setting_category']) == "cdr") {
|
||||||
|
echo " CDR";
|
||||||
|
}
|
||||||
|
elseif (strtolower($row['user_setting_category']) == "ldap") {
|
||||||
|
echo " LDAP";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " ".ucfirst($row['user_setting_category']);
|
||||||
|
}
|
||||||
|
echo " </b>\n";
|
||||||
|
echo " </td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
if ((permission_exists("domain_select")
|
||||||
|
&& permission_exists("user_setting_add")
|
||||||
|
&& count($_SESSION['domains']) > 1) ||
|
||||||
|
permission_exists('user_setting_delete')) {
|
||||||
|
echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' onchange=\"(this.checked) ? check('all','".strtolower($row['user_setting_category'])."') : check('none','".strtolower($row['user_setting_category'])."');\"></th>";
|
||||||
|
}
|
||||||
|
echo "<th>".$text['label-subcategory']."</th>";
|
||||||
|
echo "<th>".$text['label-type']."</th>";
|
||||||
|
echo "<th>".$text['label-value']."</th>";
|
||||||
|
echo "<th style='text-align: center;'>".$text['label-enabled']."</th>";
|
||||||
|
echo "<th>".$text['label-description']."</th>";
|
||||||
|
echo "<td class='list_control_icons'>";
|
||||||
|
if (permission_exists('user_setting_add')) {
|
||||||
|
echo "<a href='user_setting_edit.php?user_setting_category=".urlencode($row['user_setting_category'])."&user_uuid=".check_str($_GET['id'])."' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
||||||
|
}
|
||||||
|
if (permission_exists('user_setting_delete')) {
|
||||||
|
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('action').value = 'delete'; document.forms.user_frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||||
|
}
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
}
|
||||||
|
$tr_link = (permission_exists('user_setting_edit')) ? " href='user_setting_edit.php?user_uuid=".$row['user_uuid']."&id=".$row['user_setting_uuid']."'" : null;
|
||||||
|
echo "<tr ".$tr_link.">\n";
|
||||||
|
if (
|
||||||
|
(permission_exists("domain_select") && permission_exists("user_setting_add") && count($_SESSION['domains']) > 1) ||
|
||||||
|
permission_exists("user_setting_delete")
|
||||||
|
) {
|
||||||
|
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; padding: 3px 0px 0px 0px;'><input type='checkbox' name='id[]' id='checkbox_".$row['user_setting_uuid']."' value='".$row['user_setting_uuid']."'></td>\n";
|
||||||
|
$subcat_ids[strtolower($row['user_setting_category'])][] = 'checkbox_'.$row['user_setting_uuid'];
|
||||||
|
}
|
||||||
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||||
|
if (permission_exists('user_setting_edit')) {
|
||||||
|
echo "<a href='user_setting_edit.php?user_uuid=".$row['user_uuid']."&id=".$row['user_setting_uuid']."'>".$row['user_setting_subcategory']."</a>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo $row['user_setting_subcategory'];
|
||||||
|
}
|
||||||
|
echo " </td>\n";
|
||||||
|
echo " <td valign='top' class='".$row_style[$c]."'>".$row['user_setting_name']." </td>\n";
|
||||||
|
echo " <td valign='top' class='".$row_style[$c]."' style='width: 30%; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;'>\n";
|
||||||
|
|
||||||
|
$category = $row['user_setting_category'];
|
||||||
|
$subcategory = $row['user_setting_subcategory'];
|
||||||
|
$name = $row['user_setting_name'];
|
||||||
|
if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) {
|
||||||
|
$sql = "select * from v_menus ";
|
||||||
|
$sql .= "where menu_uuid = '".$row['user_setting_value']."' ";
|
||||||
|
$sub_prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$sub_prep_statement->execute();
|
||||||
|
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
unset ($prep_statement, $sql);
|
||||||
|
foreach ($sub_result as &$sub_row) {
|
||||||
|
echo $sub_row["menu_language"]." - ".$sub_row["menu_name"]."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
|
||||||
|
echo " ".ucwords($row['user_setting_value']);
|
||||||
|
}
|
||||||
|
else if ($subcategory == 'password' || substr_count($subcategory, '_password') > 0 || $category == "login" && $subcategory == "password_reset_key" && $name == "text") {
|
||||||
|
echo " ".str_repeat('*', strlen($row['user_setting_value']));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " ".htmlspecialchars($row['user_setting_value']);
|
||||||
|
}
|
||||||
|
echo " \n";
|
||||||
|
echo " </td>\n";
|
||||||
|
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center;'>\n";
|
||||||
|
echo " <a href='?user_id=".$row['user_uuid']."&id[]=".$row['user_setting_uuid']."&enabled=".(($row['user_setting_enabled'] == 'true') ? 'false' : 'true')."'>".ucwords($row['user_setting_enabled'])."</a>\n";
|
||||||
|
echo " </td>\n";
|
||||||
|
echo " <td valign='top' class='row_stylebg'>".$row['user_setting_description']." </td>\n";
|
||||||
|
echo " <td class='list_control_icons'>";
|
||||||
|
if (permission_exists('user_setting_edit')) {
|
||||||
|
echo "<a href='user_setting_edit.php?user_uuid=".$row['user_uuid']."&id=".$row['user_setting_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||||
|
}
|
||||||
|
if (permission_exists('user_setting_delete')) {
|
||||||
|
echo "<a href='user_settings.php?user_uuid=".$row['user_uuid']."&id[]=".$row['user_setting_uuid']."&action=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||||
|
}
|
||||||
|
echo " </td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
$previous_category = $row['user_setting_category'];
|
||||||
|
if ($c==0) { $c=1; } else { $c=0; }
|
||||||
|
} //end foreach
|
||||||
|
unset($sql, $result, $row_count);
|
||||||
|
} //end if results
|
||||||
|
|
||||||
|
echo "<tr>\n";
|
||||||
|
echo "<td colspan='20' align='left'>\n";
|
||||||
|
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||||
|
echo " <tr>\n";
|
||||||
|
echo " <td width='33.3%' nowrap> </td>\n";
|
||||||
|
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||||
|
echo " <td class='list_control_icons'>";
|
||||||
|
if (permission_exists('user_setting_add')) {
|
||||||
|
echo "<a href='user_setting_edit.php?user_uuid=".check_str($_GET['id'])."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||||
|
}
|
||||||
|
if (permission_exists('user_setting_delete') && $result_count > 0) {
|
||||||
|
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('action').value = 'delete'; document.getElementById('user_frm').submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||||
|
}
|
||||||
|
echo " </td>\n";
|
||||||
|
echo " </tr>\n";
|
||||||
|
echo " </table>\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo "</table>";
|
||||||
|
echo "</form>";
|
||||||
|
|
||||||
|
echo "<br /><br />";
|
||||||
|
|
||||||
|
// check or uncheck all category checkboxes
|
||||||
|
if (sizeof($subcat_ids) > 0) {
|
||||||
|
echo "<script>\n";
|
||||||
|
echo " function check(what, category) {\n";
|
||||||
|
foreach ($subcat_ids as $user_setting_category => $checkbox_ids) {
|
||||||
|
echo "if (category == '".$user_setting_category."') {\n";
|
||||||
|
foreach ($checkbox_ids as $index => $checkbox_id) {
|
||||||
|
echo "document.getElementById('".$checkbox_id."').checked = (what == 'all') ? true : false;\n";
|
||||||
|
}
|
||||||
|
echo "}\n";
|
||||||
|
}
|
||||||
|
echo " }\n";
|
||||||
|
echo "</script>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -765,6 +765,10 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
|
|||||||
echo " }\n";
|
echo " }\n";
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
|
|
||||||
|
if (permission_exists('user_setting_view')) {
|
||||||
|
require "user_settings.php";
|
||||||
|
}
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user