Only include the elements that are installed.

This commit is contained in:
Mark Crane 2013-09-15 05:06:34 +00:00
parent 4dd45b61b0
commit 1df6d68c31
1 changed files with 118 additions and 96 deletions

View File

@ -31,6 +31,7 @@ require_once "resources/require.php";
$v_path_show = true;
//get user defined variables
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/vars/app_config.php")) {
if (strlen($_SESSION['user_defined_variables']) == 0) {
$sql = "select * from v_vars ";
$sql .= "where var_cat = 'Defaults' ";
@ -70,6 +71,7 @@ require_once "resources/require.php";
//when this value is cleared it will re-read the user defined variables
$_SESSION["user_defined_variables"] = "set";
}
}
/*
function v_settings() {
@ -130,15 +132,16 @@ foreach($settings_array as $name => $value) {
*/
//create the recordings/archive/year/month/day directory structure
$v_recording_archive_dir = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d");
if(!is_dir($v_recording_archive_dir)) {
mkdir($v_recording_archive_dir, 0764, true);
$recording_archive_dir = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d");
if(!is_dir($recording_archive_dir)) {
mkdir($recording_archive_dir, 0764, true);
chmod($_SESSION['switch']['recordings']['dir']."/archive/".date("Y"), 0764);
chmod($_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M"), 0764);
chmod($v_recording_archive_dir, 0764);
chmod($recording_archive_dir, 0764);
}
//get the event socket information
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/settings/app_config.php")) {
if (strlen($_SESSION['event_socket_ip_address']) == 0) {
$sql = "select * from v_settings ";
$prep_statement = $db->prepare(check_sql($sql));
@ -153,8 +156,10 @@ foreach($settings_array as $name => $value) {
}
}
}
}
//get the extensions that are assigned to this user
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/extensions/app_config.php")) {
if (strlen($_SESSION["user_uuid"]) > 0 && count($_SESSION['user']['extension']) == 0) {
//get the user extension list
unset($_SESSION['user']['extension']);
@ -186,6 +191,7 @@ foreach($settings_array as $name => $value) {
}
}
}
}
function build_menu() {
global $v_menu_tab_show;
@ -326,6 +332,7 @@ function event_socket_request($fp, $cmd) {
function event_socket_request_cmd($cmd) {
global $db, $domain_uuid, $host;
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/settings/app_config.php")) {
$sql = "select * from v_settings ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
@ -337,6 +344,7 @@ function event_socket_request_cmd($cmd) {
break; //limit to 1 row
}
unset ($prep_statement);
}
$fp = event_socket_create($event_socket_ip_address, $event_socket_port, $event_socket_password);
$response = event_socket_request($fp, $cmd);
@ -3035,15 +3043,29 @@ if (!function_exists('save_switch_xml')) {
$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();
//save_ivr_menu_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();
}
}
}
}
?>