mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Update ivr_menu_delete.php
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
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.
|
||||
|
||||
Contributor(s):
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
//get the id
|
||||
if (is_array($_GET)) {
|
||||
$id = check_str($_GET["id"]);
|
||||
$id = $_GET["id"];
|
||||
}
|
||||
|
||||
//delete the ivr menu
|
||||
@@ -51,48 +51,43 @@
|
||||
|
||||
//get the dialplan_uuid
|
||||
$sql = "select * from v_ivr_menus ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
||||
$sql .= "and ivr_menu_uuid = '".$id."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll();
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and ivr_menu_uuid = :ivr_menu_uuid ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['ivr_menu_uuid'] = $id;
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters);
|
||||
if (is_array($result)) {
|
||||
foreach ($result as &$row) {
|
||||
$dialplan_uuid = $row["dialplan_uuid"];
|
||||
$ivr_menu_context = $row["ivr_menu_context"];
|
||||
}
|
||||
unset ($sql,$result,$prep_statement);
|
||||
}
|
||||
unset($sql, $parameters);
|
||||
|
||||
//delete the dialplan
|
||||
$sql = "delete from v_dialplans ";
|
||||
$sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' ";
|
||||
$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
unset ($sql,$prep_statement);
|
||||
//add the dialplan permission
|
||||
$p = new permissions;
|
||||
$p->add('dialplan_delete', 'temp');
|
||||
|
||||
//delete the ivr menu options
|
||||
$sql = "delete from v_ivr_menu_options ";
|
||||
$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);
|
||||
//delete the data
|
||||
$array['dialplans'][]['dialplan_uuid'] = $dialplan_uuid;
|
||||
$array['ivr_menu_options'][]['ivr_menu_uuid'] = $id;
|
||||
$array['ivr_menus'][]['ivr_menu_uuid'] = $id;
|
||||
$database = new database;
|
||||
$database->app_name = 'ivr_menus';
|
||||
$database->app_uuid = 'a5788e9b-58bc-bd1b-df59-fff5d51253ab';
|
||||
$database->delete($array);
|
||||
//$message = $database->message;
|
||||
|
||||
//delete the ivr menu
|
||||
$sql = "delete from v_ivr_menus ";
|
||||
$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);
|
||||
//remove the temporary permission
|
||||
$p->delete('dialplan_delete', 'temp');
|
||||
|
||||
//synchronize the xml config
|
||||
save_dialplan_xml();
|
||||
|
||||
//clear the cache
|
||||
$cache = new cache;
|
||||
$cache->delete("dialplan:".$_SESSION["context"]);
|
||||
$cache->delete("dialplan:".$ivr_menu_context);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
|
||||
Reference in New Issue
Block a user