$sql = "update v_device_lines set "; $sql .= "password = '******' "; $sql .= "where domain_uuid = '" . $domain_uuid . "' "; $sql .= "and server_address = '" . $_SESSION['domain_name'] . "' "; $sql .= "and user_id = '" . $extension . "' "; $db->exec(check_sql($sql)); unset($sql); } //if ($action == "update") //check the permissions if (permission_exists('extension_add') || permission_exists('extension_edit')) { //synchronize configuration if (is_writable($_SESSION['switch']['extensions']['dir'])) { require_once "app/extensions/resources/classes/extension.php"; $ext = new extension(); $ext->xml(); unset($ext); } //write the provision files if (is_dir($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/app/provision')) { require_once "app/provision/provision_write.php"; $ext = new extension(); } //clear the cache $cache = new cache(); $cache->delete("directory:" . $extension . "@" . $user_context); } //show the action and redirect the user if ($action == "add") { //prepare for alternating the row style $c = 0;
function save_switch_xml() { if (is_readable($_SESSION['switch']['dialplan']['dir'])) { save_dialplan_xml(); } if (is_readable($_SESSION['switch']['extensions']['dir'])) { if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/extensions/resources/classes/extension.php")) { require_once $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "app/extensions/resources/classes/extension.php"; $extension = new extension(); $extension->xml(); } } if (is_readable($_SESSION['switch']['conf']['dir'])) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/settings/app_config.php")) { save_setting_xml(); } if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/modules/app_config.php")) { save_module_xml(); } if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/vars/app_config.php")) { save_var_xml(); } if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/call_center/app_config.php")) { save_call_center_xml(); } if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/gateways/app_config.php")) { save_gateway_xml(); } //if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")) { // save_ivr_menu_xml(); //} if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/sip_profiles/app_config.php")) { save_sip_profile_xml(); } } }
$sql .= "and domain_uuid = '" . $domain_uuid . "' "; $db->exec(check_sql($sql)); unset($sql); } unset($sql, $prep_statement, $result); } // update session domain name $_SESSION['domains'][$domain_uuid]['domain_name'] = $domain_name; // recreate dialplan and extension xml files if (is_readable($_SESSION['switch']['dialplan']['dir'])) { save_dialplan_xml(); } if (is_readable($_SESSION['switch']['extensions']['dir'])) { require_once $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/extensions/resources/classes/extension.php"; $extension = new extension(); $extension->xml(); } // if single-tenant and variables exist, update variables > domain value to match new domain if (count($_SESSION['domains']) == 1 && file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/vars/")) { $sql = "update v_vars set "; $sql .= "var_value = '" . $domain_name . "' "; $sql .= "where var_name = 'domain' "; $db->exec(check_sql($sql)); unset($sql); } } } //upgrade the domains if (permission_exists('upgrade_apps') || if_group("superadmin")) { require_once "core/upgrade/upgrade_domains.php"; }