Destination Select - Dynamic: Clear session array on add/toggle/delete of a destination type record.

This commit is contained in:
fusionate 2020-11-30 14:15:57 -07:00
parent f6334ad9d0
commit c67c8cd4c2
30 changed files with 215 additions and 9 deletions

View File

@ -124,6 +124,11 @@
$database->save($array);
$message = $database->message;
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//redirect the user
if (isset($action)) {
if ($action == "add") {

View File

@ -106,6 +106,11 @@ if (!class_exists('bridges')) {
$database->delete($array);
unset($array);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
}
@ -174,6 +179,11 @@ if (!class_exists('bridges')) {
$database->save($array);
unset($array);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -379,6 +379,11 @@
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//redirect the user
if (isset($action)) {
if ($action == "add") {

View File

@ -369,6 +369,11 @@
$cache->delete("dialplan:".$_SESSION["domain_name"]);
remove_config_from_cache('configuration:callcenter.conf');
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//synchronize configuration
save_call_center_xml();

View File

@ -255,6 +255,11 @@
$cache = new cache;
$cache->delete("dialplan:".$call_flow_context);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//redirect the user
if (isset($action)) {
if ($action == "add") {

View File

@ -158,6 +158,11 @@ if (!class_exists('call_flows')) {
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
}
@ -250,6 +255,11 @@ if (!class_exists('call_flows')) {
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -185,6 +185,11 @@
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//redirect the user
if (isset($action)) {
if ($action == "add") {

View File

@ -375,6 +375,11 @@ if (!class_exists('conference_centers')) {
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//apply settings reminder
$_SESSION["reload_xml"] = true;
@ -606,6 +611,11 @@ if (!class_exists('conference_centers')) {
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);

View File

@ -243,6 +243,11 @@
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//redirect the browser
header("Location: conferences.php");
exit;

View File

@ -143,6 +143,11 @@ if (!class_exists('conferences')) {
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
@ -229,6 +234,11 @@ if (!class_exists('conferences')) {
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -457,13 +457,12 @@ if (!class_exists('destinations')) {
//get the destinations
$destination = new destinations;
if (!isset($_SESSION['destinations'][$destination_type])) {
unset($_SESSION['destinations'][$destination_type]);
$_SESSION['destinations'][$destination_type] = $destination->get($destination_type);
if (!isset($_SESSION['destinations']['array'][$destination_type])) {
$_SESSION['destinations']['array'][$destination_type] = $destination->get($destination_type);
}
//get the destination label
foreach($_SESSION['destinations'][$destination_type] as $key => $value) {
foreach($_SESSION['destinations']['array'][$destination_type] as $key => $value) {
foreach($value as $k => $row) {
if ($destination_value == $row['destination']) {
$destination_key = $key;
@ -479,7 +478,7 @@ if (!class_exists('destinations')) {
//build the destination select list in html
$response .= " <select class='formfld' style='".$select_style."' onchange=\"get_destinations('".$destination_id."', '".$destination_type."', this.value);\">\n";
$response .= " <option value=''></option>\n";
foreach($_SESSION['destinations'][$destination_type] as $key => $value) {
foreach($_SESSION['destinations']['array'][$destination_type] as $key => $value) {
if (permission_exists($destination->singular($key)."_destinations")) {
//determine if selected
$selected = ($key == $destination_key) ? "selected='selected'" : '';
@ -499,7 +498,7 @@ if (!class_exists('destinations')) {
}
$response .= " </select>\n";
$response .= " <select id='".$destination_id."' name='".$destination_name."' class='formfld' style='".$select_style."'>\n";
foreach($_SESSION['destinations'][$destination_type] as $key => $value) {
foreach($_SESSION['destinations']['array'][$destination_type] as $key => $value) {
if ($key == $destination_key) {
foreach($value as $k => $row) {
$selected = ($row['destination'] == $destination_value) ? "selected='selected'" : '';

View File

@ -272,6 +272,11 @@
}
$cache->delete("dialplan:".$dialplan_context);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set the message
if ($action == "add") {
message::add($text['message-add']);

View File

@ -118,6 +118,10 @@
$database->app_uuid = '742714e5-8cdf-32fd-462c-cbe7e3d655db';
$database->save($array);
unset($array);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//revoke temporary permissions
$p->delete('dialplan_add', 'temp');
}
@ -1054,6 +1058,11 @@
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete'].': '.@sizeof($array[$this->table]));
@ -1257,6 +1266,11 @@
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -625,6 +625,12 @@
if (permission_exists('number_alias') && strlen($number_alias) > 0) {
$cache->delete("directory:".$number_alias."@".$user_context);
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
}
//set the message and redirect

View File

@ -683,6 +683,11 @@ if (!class_exists('extension')) {
$this->xml();
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
@ -787,6 +792,11 @@ if (!class_exists('extension')) {
}
unset($extensions);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);

View File

@ -356,6 +356,12 @@
//revoke temp permissions
$p->delete('fax_add', 'temp');
$p->delete('fax_edit', 'temp');
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
}
//get the dialplan_uuid

View File

@ -348,6 +348,11 @@ if (!class_exists('fax')) {
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
}

View File

@ -425,6 +425,12 @@
foreach ($parent_uuids as $x => $row) {
$cache->delete("configuration:ivr.conf:".$row['ivr_menu_parent_uuid']);
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set the add message
if ($action == "add" && permission_exists('ivr_menu_add')) {
message::add($text['message-add']);

View File

@ -170,6 +170,11 @@ if (!class_exists('ivr_menu')) {
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
}
@ -329,6 +334,11 @@ if (!class_exists('ivr_menu')) {
$cache->delete("configuration:ivr.conf:".$ivr_menu_uuid);
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -174,6 +174,11 @@
$cache = new cache;
$cache->delete("languages:".$phrase_language.".".$phrase_uuid);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//send a redirect
message::add($text['message-add']);
header("Location: phrase_edit.php?id=".$phrase_uuid);
@ -240,6 +245,11 @@
$cache = new cache;
$cache->delete("languages:".$phrase_language.".".$phrase_uuid);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//send a redirect
message::add($text['message-update']);
header("Location: phrase_edit.php?id=".$phrase_uuid);

View File

@ -54,21 +54,21 @@
if (permission_exists('phrase_add')) {
$obj = new phrases;
$obj->copy($phrases);
save_phrases_xml();
//save_phrases_xml();
}
break;
case 'toggle':
if (permission_exists('phrase_edit')) {
$obj = new phrases;
$obj->toggle($phrases);
save_phrases_xml();
//save_phrases_xml();
}
break;
case 'delete':
if (permission_exists('phrase_delete')) {
$obj = new phrases;
$obj->delete($phrases);
save_phrases_xml();
//save_phrases_xml();
}
break;
}

View File

@ -152,6 +152,11 @@ if (!class_exists('phrases')) {
$cache->delete("languages:".$phrase_language);
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
}
@ -302,6 +307,11 @@ if (!class_exists('phrases')) {
$cache->delete("languages:".$phrase_language);
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -128,6 +128,11 @@
//move the uploaded files
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/'.$recording_filename);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set the message
message::add($text['message-uploaded'].": ".htmlentities($recording_filename));

View File

@ -151,6 +151,11 @@ if (!class_exists('switch_recordings')) {
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
}

View File

@ -166,6 +166,11 @@ if (!class_exists('ring_groups')) {
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
}
@ -335,6 +340,11 @@ if (!class_exists('ring_groups')) {
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -435,6 +435,11 @@
$cache = new cache;
$cache->delete("dialplan:".$ring_group_context);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set the message
if ($action == "add") {
//save the message to a session variable

View File

@ -123,6 +123,11 @@
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete'].': '.@sizeof($array[$this->table]));
@ -210,6 +215,11 @@
}
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -503,6 +503,11 @@
$cache = new cache;
$cache->delete("dialplan:".$_SESSION["domain_name"]);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set the message
if ($action == "add") {
message::add($text['message-add']);

View File

@ -364,6 +364,11 @@
$p->delete('voicemail_destination_delete', 'temp');
$p->delete('voicemail_greeting_delete', 'temp');
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-delete']);
}
@ -544,6 +549,11 @@
$database->save($array);
unset($array);
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
message::add($text['message-toggle']);
}

View File

@ -244,6 +244,11 @@
$obj->voicemail_destinations_delete($voicemail_destinations_delete);
}
//clear the destinations session array
if (isset($_SESSION['destinations']['array'])) {
unset($_SESSION['destinations']['array']);
}
//set message
if ($action == "add" && permission_exists('voicemail_add')) {
message::add($text['message-add']);