diff --git a/app/call_block/call_block_delete.php b/app/call_block/call_block_delete.php index 51d734b785..8eee612c93 100644 --- a/app/call_block/call_block_delete.php +++ b/app/call_block/call_block_delete.php @@ -49,41 +49,37 @@ else { //delete the extension if (strlen($id)>0) { + //read the call_block_number + $sql = " select c.call_block_number, d.domain_name from v_call_block as c "; + $sql .= "JOIN v_domains as d ON c.domain_uuid=d.domain_uuid "; + $sql .= "where c.domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and c.call_block_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(); + $result_count = count($result); + if ($result_count > 0) { + $call_block_number = $result[0]["call_block_number"]; + $domain_name = $result[0]["domain_name"]; -//read the call_block_number - $sql = " select c.call_block_number, d.domain_name from v_call_block as c "; - $sql .= "JOIN v_domains as d ON c.domain_uuid=d.domain_uuid "; - $sql .= "where c.domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and c.call_block_uuid = '$id' "; - - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(); - $result_count = count($result); - if ($result_count > 0) { - $call_block_number = $result[0]["call_block_number"]; - $domain_name = $result[0]["domain_name"]; - -//delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete app:call_block:".$domain_name.":".$call_block_number; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } - } - unset ($prep_statement, $sql); + //clear the cache + $cache = new cache; + $cache->delete("app:call_block:".$domain_name.":".$call_block_number); + } + unset ($prep_statement, $sql); - $sql = "delete from v_call_block "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and call_block_uuid = '$id' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($prep_statement, $sql); + //delete the call block + $sql = "delete from v_call_block "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and call_block_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); } - - $_SESSION["message"] = $text['label-delete-complete']; - header("Location: call_block.php"); - return; + //redirect the browser + $_SESSION["message"] = $text['label-delete-complete']; + header("Location: call_block.php"); + return; ?> \ No newline at end of file diff --git a/app/call_block/call_block_edit.php b/app/call_block/call_block_edit.php index d54372a236..0aec8763c1 100644 --- a/app/call_block/call_block_edit.php +++ b/app/call_block/call_block_edit.php @@ -13,11 +13,11 @@ for the specific language governing rights and limitations under the License. - The Original Code is FusionPBX + The Original Code is FusionPBX The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -158,7 +158,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { return; } //if ($action == "add") - if ($action == "update") { + if ($action == "update") { $sql = " select c.call_block_number, d.domain_name from v_call_block as c "; $sql .= "JOIN v_domains as d ON c.domain_uuid=d.domain_uuid "; $sql .= "where c.domain_uuid = '".$_SESSION['domain_uuid']."' "; @@ -172,12 +172,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $call_block_number = $result[0]["call_block_number"]; $domain_name = $result[0]["domain_name"]; -//delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete app:call_block:".$domain_name.":".$call_block_number; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("app:call_block:".$domain_name.":".$call_block_number); } unset ($prep_statement, $sql); diff --git a/app/call_center/call_center_queue_delete.php b/app/call_center/call_center_queue_delete.php index 51600437c1..41039759d4 100644 --- a/app/call_center/call_center_queue_delete.php +++ b/app/call_center/call_center_queue_delete.php @@ -85,6 +85,10 @@ if (strlen($id) > 0) { $db->query($sql); unset($sql); + //clear the cache + $cache = new cache; + $cache->delete("memcache delete dialplan:".$_SESSION["context"]); + //syncrhonize configuration save_dialplan_xml(); @@ -92,8 +96,8 @@ if (strlen($id) > 0) { $_SESSION["reload_xml"] = true; } - -$_SESSION["message"] = $text['message-delete']; -header("Location: call_center_queues.php"); -return; +//redirect the browser + $_SESSION["message"] = $text['message-delete']; + header("Location: call_center_queues.php"); + return; ?> \ No newline at end of file diff --git a/app/call_center/call_center_queue_edit.php b/app/call_center/call_center_queue_edit.php index 89d0bb66b4..110bb3c532 100644 --- a/app/call_center/call_center_queue_edit.php +++ b/app/call_center/call_center_queue_edit.php @@ -283,12 +283,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //syncrhonize the configuration save_call_center_xml(); - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("memcache delete dialplan:".$_SESSION["context"]); $_SESSION["message"] = $text['message-update']; } //if ($action == "update") diff --git a/app/call_flows/call_flow_edit.php b/app/call_flows/call_flow_edit.php index cde3d9d01b..7ce09f98ac 100644 --- a/app/call_flows/call_flow_edit.php +++ b/app/call_flows/call_flow_edit.php @@ -342,12 +342,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //apply settings reminder $_SESSION["reload_xml"] = true; - //delete the cache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$call_flow_context; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("memcache delete dialplan:".$call_flow_context); //set the message if ($action == "add") { diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index 0fb7d6f681..4e2d7f77fc 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -372,12 +372,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $db->exec(check_sql($sql)); unset($sql); - //delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("memcache delete directory:".$extension."@".$_SESSION['domain_name']); //redirect the user $_SESSION["message"] = $text['confirm-update']; diff --git a/app/conference_centers/conference_center_delete.php b/app/conference_centers/conference_center_delete.php index 41c7faf005..000a41e072 100644 --- a/app/conference_centers/conference_center_delete.php +++ b/app/conference_centers/conference_center_delete.php @@ -78,12 +78,9 @@ if (strlen($id)>0) { $db->query($sql); unset($sql); - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); //syncrhonize configuration save_dialplan_xml(); diff --git a/app/conference_centers/conference_center_edit.php b/app/conference_centers/conference_center_edit.php index b425e73105..3eee468708 100644 --- a/app/conference_centers/conference_center_edit.php +++ b/app/conference_centers/conference_center_edit.php @@ -259,12 +259,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "and dialplan_uuid = '$dialplan_uuid' "; $db->query($sql); - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']); //save the xml save_dialplan_xml(); diff --git a/app/conferences/conference_delete.php b/app/conferences/conference_delete.php index 4cee427c60..52227583b5 100644 --- a/app/conferences/conference_delete.php +++ b/app/conferences/conference_delete.php @@ -84,18 +84,15 @@ if (strlen($id)>0) { //apply settings reminder $_SESSION["reload_xml"] = true; - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); } - -$_SESSION["message"] = $text['confirm-delete']; -header("Location: conferences.php"); -return; +//redirect the browser + $_SESSION["message"] = $text['confirm-delete']; + header("Location: conferences.php"); + return; ?> \ No newline at end of file diff --git a/app/conferences/conference_edit.php b/app/conferences/conference_edit.php index 03faeecc36..19c3dd698d 100644 --- a/app/conferences/conference_edit.php +++ b/app/conferences/conference_edit.php @@ -279,15 +279,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //apply settings reminder $_SESSION["reload_xml"] = true; - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); - header("Location: conferences.php"); - return; + //redirect the browser + header("Location: conferences.php"); + return; } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) diff --git a/app/destinations/destination_delete.php b/app/destinations/destination_delete.php index 56e4c7d5a9..48262ecd59 100644 --- a/app/destinations/destination_delete.php +++ b/app/destinations/destination_delete.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -93,12 +93,9 @@ else { //synchronize the xml config save_dialplan_xml(); -//clear memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$destination_context; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } +//clear the cache + $cache = new cache; + $cache->delete("dialplan:".$destination_context); //redirect the user $_SESSION["message"] = $text['message-delete']; diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 53fa47cfb8..bf42b2914f 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2013-2014 + Portions created by the Initial Developer are Copyright (C) 2013-2015 the Initial Developer. All Rights Reserved. Contributor(s): diff --git a/app/dialplan/dialplan_delete.php b/app/dialplan/dialplan_delete.php index 5c7bfdd550..4bfb0e9fbf 100644 --- a/app/dialplan/dialplan_delete.php +++ b/app/dialplan/dialplan_delete.php @@ -100,14 +100,11 @@ else { //strip duplicate contexts $dialplan_contexts = array_unique($dialplan_contexts, SORT_STRING); - //delete the dialplan contexts from memcache + //clear the cache + $cache = new cache; if (sizeof($dialplan_contexts) > 0) { - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - foreach($dialplan_contexts as $dialplan_context) { - $switch_cmd = "memcache delete dialplan:".$dialplan_context; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + foreach($dialplan_contexts as $dialplan_context) { + $cache->delete("dialplan:".$dialplan_context); } } } diff --git a/app/dialplan/dialplan_edit.php b/app/dialplan/dialplan_edit.php index e2abd8e1ef..842f793396 100644 --- a/app/dialplan/dialplan_edit.php +++ b/app/dialplan/dialplan_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2014 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): diff --git a/app/dialplan/resources/classes/dialplan.php b/app/dialplan/resources/classes/dialplan.php index 0ced365c3d..922819efaf 100644 --- a/app/dialplan/resources/classes/dialplan.php +++ b/app/dialplan/resources/classes/dialplan.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2010-2014 + Copyright (C) 2010-2015 All Rights Reserved. Contributor(s): diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index ae67d7dd5b..1bd22c29de 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -647,12 +647,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //commit the atomic transaction $count = $db->exec("COMMIT;"); //returns affected rows - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:public"; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:public"); //synchronize the xml config save_dialplan_xml(); diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index d538313a14..78f27df431 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -45,7 +45,6 @@ else { //show the header require_once "resources/header.php"; $document['title'] = $text['title-dialplan-outbound-add']; - require_once "resources/paging.php"; //get the http post values and set theme as php variables @@ -62,11 +61,11 @@ else { $gateway = check_str($_POST["gateway"]); $limit = check_str($_POST["limit"]); $accountcode = check_str($_POST["accountcode"]); - $toll_allow_enable = check_str($_POST["toll_allow_enabled"]); + //set default to enabled if (strlen($toll_allow_enable) == 0) { $toll_allow_enable = "false"; } - + //set the default type $gateway_type = 'gateway'; $gateway_2_type = 'gateway'; @@ -265,13 +264,13 @@ else { $label = $dialplan_expression; $abbrv = filename_safe($dialplan_expression); } - + // Use as outbound prefix all digits beetwen ^ and first ( $tmp_prefix = preg_replace("/^\^(\d{1,})\(.*/", "$1", $dialplan_expression); $tmp_prefix == $dialplan_expression ? $outbound_prefix = "" : $outbound_prefix = $tmp_prefix; - + if ($gateway_type == "gateway") { $dialplan_name = $gateway_name.".".$abbrv; $action_data = "sofia/gateway/".$gateway_uuid."/".$prefix_number."\$1"; @@ -532,19 +531,17 @@ else { } //end for each } - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$dialplan_context; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$dialplan_context); //synchronize the xml config save_dialplan_xml(); - $_SESSION["message"] = $text['message-update']; - header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3"); - return; + //redirect the browser + $_SESSION["message"] = $text['message-update']; + header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3"); + return; } //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) ?> diff --git a/app/extensions/extension_delete.php b/app/extensions/extension_delete.php index 007021abbc..48ed3155f0 100644 --- a/app/extensions/extension_delete.php +++ b/app/extensions/extension_delete.php @@ -41,10 +41,24 @@ else { } //check for the id - if (count($_GET)>0) { - $id = $_GET["id"]; + if (count($_GET) > 0) { + $id = check_str($_GET["id"]); } - if (strlen($id)>0) { + if (strlen($id) > 0) { + + //get the user_context + $sql = "select extension, user_context from v_extensions "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and extension_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $extension = $row["extension"]; + $user_context = $row["user_context"]; + } + unset ($prep_statement); + //delete the extension $sql = "delete from v_extensions "; $sql .= "where domain_uuid = '$domain_uuid' "; @@ -60,17 +74,20 @@ else { $prep_statement->execute(); unset($prep_statement, $sql); + //clear the cache + $cache = new cache; + $cache->delete("directory:".$extension."@".$user_context); + //synchronize configuration if (is_readable($_SESSION['switch']['extensions']['dir'])) { - require_once "app/extensions/resources/classes/extension.php"; $extension = new extension; $extension->xml(); } } - -$_SESSION["message"] = $text['message-delete']; -header("Location: extensions.php"); -return; +//redirect the browser + $_SESSION["message"] = $text['message-delete']; + header("Location: extensions.php"); + return; ?> \ No newline at end of file diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index df186a36cd..82889f1e95 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2008-2014 All Rights Reserved. + Copyright (C) 2008-2015 All Rights Reserved. Contributor(s): Mark J Crane @@ -659,12 +659,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $ext = new extension; } - //delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete directory:".$extension."@".$user_context; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("directory:".$extension."@".$user_context); } //show the action and redirect the user diff --git a/app/fax/fax_delete.php b/app/fax/fax_delete.php index 4204329908..d306e6c04e 100644 --- a/app/fax/fax_delete.php +++ b/app/fax/fax_delete.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -46,7 +46,7 @@ else { } //delete the fax extension - if (strlen($fax_uuid)>0) { + if (strlen($fax_uuid) > 0) { //get the dialplan uuid $sql = "select * from v_fax "; @@ -87,12 +87,9 @@ else { //apply settings reminder $_SESSION["reload_xml"] = true; - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd .= "memcache delete dialplan:".$_SESSION["context"]."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); } //redirect the user diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php index 3d065f68e0..879aa5fd06 100644 --- a/app/fax/fax_edit.php +++ b/app/fax/fax_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -516,12 +516,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //apply settings reminder $_SESSION["reload_xml"] = true; - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd .= "memcache delete dialplan:".$_SESSION["context"]; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); //redirect the browser if ($action == "update" && permission_exists('fax_extension_edit')) { diff --git a/app/fifo/fifo_add.php b/app/fifo/fifo_add.php index 57e0ad23e4..9f61dcbb6f 100644 --- a/app/fifo/fifo_add.php +++ b/app/fifo/fifo_add.php @@ -273,12 +273,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //synchronize the xml config save_dialplan_xml(); - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); //redirect the user $_SESSION["message"] = $text['message-add']; diff --git a/app/hot_desking/extension_delete.php b/app/hot_desking/extension_delete.php index c128a04ff5..909ea86144 100644 --- a/app/hot_desking/extension_delete.php +++ b/app/hot_desking/extension_delete.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -71,12 +71,9 @@ else { } unset ($prep_statement); -//delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } +//clear the cache + $cache = new cache; + $cache->delete("directory:".$extension."@".$_SESSION['domain_name']); //redirect the user $_SESSION["message"] = $text['message-delete']; diff --git a/app/hot_desking/extension_edit.php b/app/hot_desking/extension_edit.php index eb69a09faa..d800ab2550 100644 --- a/app/hot_desking/extension_edit.php +++ b/app/hot_desking/extension_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Copyright (C) 2008-2012 All Rights Reserved. + Copyright (C) 2008-2015 All Rights Reserved. Contributor(s): Mark J Crane @@ -147,12 +147,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } } - //delete extension from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete directory:".$extension."@".$_SESSION['domain_name']; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("directory:".$extension."@".$_SESSION['domain_name']); //set message and redirect user if ($action == "add") { diff --git a/app/ivr_menu/ivr_menu_delete.php b/app/ivr_menu/ivr_menu_delete.php index 376c2f8016..8160131971 100644 --- a/app/ivr_menu/ivr_menu_delete.php +++ b/app/ivr_menu/ivr_menu_delete.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -40,9 +40,10 @@ else { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } -if (count($_GET) > 0) { - $id = check_str($_GET["id"]); -} +//get the id + if (count($_GET) > 0) { + $id = check_str($_GET["id"]); + } if (strlen($id) > 0) { //include the ivr menu class @@ -56,12 +57,9 @@ if (strlen($id) > 0) { //synchronize the xml config save_dialplan_xml(); - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); } //redirect the user diff --git a/app/ivr_menu/ivr_menu_edit.php b/app/ivr_menu/ivr_menu_edit.php index 3ac37da086..fa540c24ad 100644 --- a/app/ivr_menu/ivr_menu_edit.php +++ b/app/ivr_menu/ivr_menu_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2013 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -229,12 +229,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } } - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); //redirect the user $_SESSION["message"] = $text['message-update']; diff --git a/app/ring_groups/ring_group_delete.php b/app/ring_groups/ring_group_delete.php index fbbe78796b..b69b193c3c 100644 --- a/app/ring_groups/ring_group_delete.php +++ b/app/ring_groups/ring_group_delete.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -95,12 +95,9 @@ else { //apply settings reminder $_SESSION["reload_xml"] = true; - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$ring_group_context; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$ring_group_context); } //redirect the user diff --git a/app/ring_groups/ring_group_edit.php b/app/ring_groups/ring_group_edit.php index abac7ff801..c41b38aeec 100644 --- a/app/ring_groups/ring_group_edit.php +++ b/app/ring_groups/ring_group_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2010-2014 + Portions created by the Initial Developer are Copyright (C) 2010-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -290,12 +290,9 @@ else { //apply settings reminder $_SESSION["reload_xml"] = true; - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$ring_group_context; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$ring_group_context); //set the message if ($action == "add") { diff --git a/app/sip_profiles/sip_profile_delete.php b/app/sip_profiles/sip_profile_delete.php index bc61d0b308..547d8537e9 100644 --- a/app/sip_profiles/sip_profile_delete.php +++ b/app/sip_profiles/sip_profile_delete.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -45,6 +45,20 @@ if (count($_GET)>0) { } if (strlen($id)>0) { + + //get the details fo the sip profile + $sql = "select * from v_sip_profiles "; + $sql .= "where sip_profile_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(); + foreach ($result as &$row) { + $sip_profile_name = $row["sip_profile_name"]; + $sip_profile_hostname = $row["sip_profile_hostname"]; + $sip_profile_description = $row["sip_profile_description"]; + } + unset ($prep_statement); + //delete the sip profile settings $sql = "delete from v_sip_profile_settings "; $sql .= "where sip_profile_uuid = '$id' "; @@ -69,12 +83,18 @@ if (strlen($id)>0) { //apply settings reminder $_SESSION["reload_xml"] = true; - //delete the sip profiles from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete configuration:sofia.conf"; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + //get the hostname + if ($sip_profile_name == nul) { + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + if ($fp) { + $switch_cmd = "hostname"; + $sip_profile_name = event_socket_request($fp, 'api '.$switch_cmd); + } } + + //clear the cache + $cache = new cache; + $cache->delete("configuration:sofia.conf:".$sip_profile_name); } //redirect the browser diff --git a/app/sip_profiles/sip_profile_edit.php b/app/sip_profiles/sip_profile_edit.php index c6def9f08e..700fc2eb79 100644 --- a/app/sip_profiles/sip_profile_edit.php +++ b/app/sip_profiles/sip_profile_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -123,13 +123,19 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { unset($sql); } //if ($action == "update") - //delete the sip profiles from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete configuration:sofia.conf:$sip_profile_hostname"; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); + //get the hostname + if ($sip_profile_name == nul) { + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + if ($fp) { + $switch_cmd = "hostname"; + $sip_profile_hostname = event_socket_request($fp, 'api '.$switch_cmd); + } } + //clear the cache + $cache = new cache; + $cache->delete("configuration:sofia.conf:".$sip_profile_hostname); + //redirect the browser $_SESSION["message"] = $text['message-update']; header("Location: sip_profiles.php"); diff --git a/app/time_conditions/time_condition_add.php b/app/time_conditions/time_condition_add.php index 6cbe9c231c..8aed56b671 100644 --- a/app/time_conditions/time_condition_add.php +++ b/app/time_conditions/time_condition_add.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2012 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s): @@ -514,12 +514,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //synchronize the xml config save_dialplan_xml(); - //delete the dialplan context from memcache - $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - if ($fp) { - $switch_cmd = "memcache delete dialplan:".$_SESSION["context"]; - $switch_result = event_socket_request($fp, 'api '.$switch_cmd); - } + //clear the cache + $cache = new cache; + $cache->delete("dialplan:".$_SESSION["context"]); //redirect the browser $_SESSION["message"] = $text['confirm-update-complete']; diff --git a/core/menu/menu_item_edit.php b/core/menu/menu_item_edit.php index 86c0f82076..a846fe87bd 100644 --- a/core/menu/menu_item_edit.php +++ b/core/menu/menu_item_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2014 + Portions created by the Initial Developer are Copyright (C) 2008-2015 the Initial Developer. All Rights Reserved. Contributor(s):