Update domain_settings.php
This commit is contained in:
@@ -23,67 +23,69 @@
|
|||||||
Contributor(s):
|
Contributor(s):
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
*/
|
*/
|
||||||
require_once "root.php";
|
//includes
|
||||||
require_once "resources/require.php";
|
require_once "root.php";
|
||||||
require_once "resources/check_auth.php";
|
require_once "resources/require.php";
|
||||||
if (permission_exists('domain_setting_view')) {
|
require_once "resources/check_auth.php";
|
||||||
//access granted
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo "access denied";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//check prmissions
|
||||||
|
if (permission_exists('domain_setting_view')) {
|
||||||
|
//access granted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (sizeof($_REQUEST) > 1) {
|
//toggle enabled
|
||||||
|
if (sizeof($_REQUEST) > 1) {
|
||||||
|
|
||||||
$action = check_str($_REQUEST["action"]);
|
$action = check_str($_REQUEST["action"]);
|
||||||
$domain_uuid = check_str($_REQUEST["domain_id"]);
|
$domain_uuid = check_str($_REQUEST["domain_id"]);
|
||||||
$domain_setting_uuids = $_REQUEST["id"];
|
$domain_setting_uuids = $_REQUEST["id"];
|
||||||
$enabled = check_str($_REQUEST['enabled']);
|
$enabled = check_str($_REQUEST['enabled']);
|
||||||
|
|
||||||
//change enabled value
|
//change enabled value
|
||||||
if ($domain_uuid != '' && sizeof($domain_setting_uuids) == 1 && $enabled != '') {
|
if ($domain_uuid != '' && sizeof($domain_setting_uuids) == 1 && $enabled != '') {
|
||||||
$sql = "update v_domain_settings set ";
|
$sql = "update v_domain_settings set ";
|
||||||
$sql .= "domain_setting_enabled = '".$enabled."' ";
|
$sql .= "domain_setting_enabled = '".$enabled."' ";
|
||||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||||
$sql .= "and domain_setting_uuid = '".$domain_setting_uuids[0]."' ";
|
$sql .= "and domain_setting_uuid = '".$domain_setting_uuids[0]."' ";
|
||||||
//echo $sql."<br><br>";
|
//echo $sql."<br><br>";
|
||||||
$db->exec(check_sql($sql));
|
$db->exec(check_sql($sql));
|
||||||
unset($sql);
|
unset($sql);
|
||||||
|
|
||||||
messages::add($text['message-update']);
|
messages::add($text['message-update']);
|
||||||
header("Location: domain_edit.php?id=".$domain_uuid);
|
header("Location: domain_edit.php?id=".$domain_uuid);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete domain settings
|
//delete domain settings
|
||||||
if ($action == 'delete' && permission_exists('domain_setting_delete')) {
|
if ($action == 'delete' && permission_exists('domain_setting_delete')) {
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
$language = new text;
|
$language = new text;
|
||||||
$text = $language->get();
|
$text = $language->get();
|
||||||
|
|
||||||
if (sizeof($domain_setting_uuids) > 0) {
|
if (sizeof($domain_setting_uuids) > 0) {
|
||||||
foreach ($domain_setting_uuids as $domain_setting_uuid) {
|
foreach ($domain_setting_uuids as $domain_setting_uuid) {
|
||||||
$sql = "delete from v_domain_settings ";
|
$sql = "delete from v_domain_settings ";
|
||||||
$sql .= "where domain_setting_uuid = '".$domain_setting_uuid."' ";
|
$sql .= "where domain_setting_uuid = '".$domain_setting_uuid."' ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
unset ($prep_statement, $sql);
|
unset ($prep_statement, $sql);
|
||||||
|
}
|
||||||
|
// set message
|
||||||
|
$_SESSION["message"] = $text['message-delete'].": ".sizeof($domain_setting_uuids);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// set message
|
||||||
|
messages::add($text['message-delete_failed'], 'negative');
|
||||||
}
|
}
|
||||||
// set message
|
|
||||||
$_SESSION["message"] = $text['message-delete'].": ".sizeof($domain_setting_uuids);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// set message
|
|
||||||
messages::add($text['message-delete_failed'], 'negative');
|
|
||||||
}
|
|
||||||
|
|
||||||
header("Location: domain_edit.php?id=".check_str($_REQUEST["domain_uuid"]));
|
header("Location: domain_edit.php?id=".check_str($_REQUEST["domain_uuid"]));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} //REQUEST
|
|
||||||
|
|
||||||
//include the paging
|
//include the paging
|
||||||
require_once "resources/paging.php";
|
require_once "resources/paging.php";
|
||||||
@@ -315,4 +317,5 @@ if (sizeof($_REQUEST) > 1) {
|
|||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
//require_once "resources/footer.php";
|
//require_once "resources/footer.php";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user