Update ivr_menu_delete.php

This commit is contained in:
FusionPBX
2019-05-07 19:21:49 -06:00
committed by GitHub
parent f0c76245d0
commit 34cdfc2ed6
+25 -30
View File
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2018 Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -43,7 +43,7 @@
//get the id //get the id
if (is_array($_GET)) { if (is_array($_GET)) {
$id = check_str($_GET["id"]); $id = $_GET["id"];
} }
//delete the ivr menu //delete the ivr menu
@@ -51,48 +51,43 @@
//get the dialplan_uuid //get the dialplan_uuid
$sql = "select * from v_ivr_menus "; $sql = "select * from v_ivr_menus ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and ivr_menu_uuid = '".$id."' "; $sql .= "and ivr_menu_uuid = :ivr_menu_uuid ";
$prep_statement = $db->prepare(check_sql($sql)); $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$prep_statement->execute(); $parameters['ivr_menu_uuid'] = $id;
$result = $prep_statement->fetchAll(); $database = new database;
$result = $database->select($sql, $parameters);
if (is_array($result)) { if (is_array($result)) {
foreach ($result as &$row) { foreach ($result as &$row) {
$dialplan_uuid = $row["dialplan_uuid"]; $dialplan_uuid = $row["dialplan_uuid"];
$ivr_menu_context = $row["ivr_menu_context"];
} }
unset ($sql,$result,$prep_statement);
} }
unset($sql, $parameters);
//delete the dialplan //add the dialplan permission
$sql = "delete from v_dialplans "; $p = new permissions;
$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' "; $p->add('dialplan_delete', 'temp');
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset ($sql,$prep_statement);
//delete the ivr menu options //delete the data
$sql = "delete from v_ivr_menu_options "; $array['dialplans'][]['dialplan_uuid'] = $dialplan_uuid;
$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' "; $array['ivr_menu_options'][]['ivr_menu_uuid'] = $id;
$sql .= "and ivr_menu_uuid = '".$id."' "; $array['ivr_menus'][]['ivr_menu_uuid'] = $id;
$prep_statement = $db->prepare(check_sql($sql)); $database = new database;
$prep_statement->execute(); $database->app_name = 'ivr_menus';
unset ($sql,$prep_statement); $database->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab';
$database->delete($array);
//$message = $database->message;
//delete the ivr menu //remove the temporary permission
$sql = "delete from v_ivr_menus "; $p->delete('dialplan_delete', 'temp');
$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
$sql .= "and ivr_menu_uuid = '".$id."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset ($sql,$prep_statement);
//synchronize the xml config //synchronize the xml config
save_dialplan_xml(); save_dialplan_xml();
//clear the cache //clear the cache
$cache = new cache; $cache = new cache;
$cache->delete("dialplan:".$_SESSION["context"]); $cache->delete("dialplan:".$ivr_menu_context);
} }
//redirect the user //redirect the user