Browse Source

Merge branch 'master' into intercept_load_balance

# Conflicts:
#	resources/install/scripts/resources/functions/database.lua
Alexey Melnichuk 10 years ago
parent
commit
82c36eb7c5

+ 19 - 1
core/databases/app_defaults.php

@@ -182,7 +182,25 @@ if ($domains_processed == 1) {
 				}
 				$tmp .= "\n";
 			}
-
+			$tmp .= "--set defaults\n";
+			$tmp .= "	expire = {}\n";
+			$tmp .= "	expire[\"directory\"] = \"3600\";\n";
+			$tmp .= "	expire[\"dialplan\"] = \"3600\";\n";
+			$tmp .= "	expire[\"languages\"] = \"3600\";\n";
+			$tmp .= "	expire[\"sofia.conf\"] = \"3600\";\n";
+			$tmp .= "	expire[\"acl.conf\"] = \"3600\";\n";
+			$tmp .= "\n";
+			$tmp .= "--set xml_handler\n";
+			$tmp .= "	xml_handler = {}\n";
+			$tmp .= "	xml_handler[\"fs_path\"] = false;\n";
+			$tmp .= "\n";
+			$tmp .= "--set the debug options\n";
+			$tmp .= "	debug[\"params\"] = false;\n";
+			$tmp .= "	debug[\"sql\"] = false;\n";
+			$tmp .= "	debug[\"xml_request\"] = false;\n";
+			$tmp .= "	debug[\"xml_string\"] = false;\n";
+			$tmp .= "	debug[\"cache\"] = false;\n";
+			$tmp .= "\n";
 			$tmp .= "--additional info\n";
 			$tmp .= "	domain_count = ".count($_SESSION["domains"]).";\n";
 			$tmp .= correct_path("	temp_dir = [[".$_SESSION['server']['temp']['dir']."]];\n");

+ 15 - 1
core/default_settings/app_defaults.php

@@ -17,7 +17,7 @@
 
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	Portions created by the Initial Developer are Copyright (C) 2008-2015
 	the Initial Developer. All Rights Reserved.
 
 	Contributor(s):
@@ -30,12 +30,26 @@ if ($domains_processed == 1) {
 	//define array of settings
 		$x = 0;
 		$array[$x]['default_setting_category'] = 'domain';
+		$array[$x]['default_setting_subcategory'] = 'time_zone';
+		$array[$x]['default_setting_name'] = 'name';
+		$array[$x]['default_setting_value'] = '';
+		$array[$x]['default_setting_enabled'] = 'true';
+		$array[$x]['default_setting_description'] = '';
+		$x++;
+		$array[$x]['default_setting_category'] = 'domain';
 		$array[$x]['default_setting_subcategory'] = 'language';
 		$array[$x]['default_setting_name'] = 'code';
 		$array[$x]['default_setting_value'] = 'en-us';
 		$array[$x]['default_setting_enabled'] = 'true';
 		$array[$x]['default_setting_description'] = '';
 		$x++;
+		$array[$x]['default_setting_category'] = 'domain';
+		$array[$x]['default_setting_subcategory'] = 'bridge';
+		$array[$x]['default_setting_name'] = 'text';
+		$array[$x]['default_setting_value'] = 'outbound';
+		$array[$x]['default_setting_enabled'] = 'true';
+		$array[$x]['default_setting_description'] = 'outbound,loopback,lcr';
+		$x++;
 		$array[$x]['default_setting_category'] = 'security';
 		$array[$x]['default_setting_subcategory'] = 'password_length';
 		$array[$x]['default_setting_name'] = 'var';

+ 33 - 1
core/default_settings/default_setting_edit.php

@@ -92,6 +92,38 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 			// fix null
 			$default_setting_order = ($default_setting_order != '') ? $default_setting_order : 'null';
 
+			//update switch timezone variables
+			if ($default_setting_category == "domain" && $default_setting_subcategory == "time_zone" && $default_setting_name == "name" ) {
+				//get the action
+					$sql = "select * from v_vars ";
+					$sql .= "where var_name = 'timezone' ";
+					$prep_statement = $db->prepare(check_sql($sql));
+					$prep_statement->execute();
+					$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+					$var_action = "add";
+					foreach ($result as $row) {
+						$var_action = "update";
+					}
+					unset ($prep_statement);
+
+				//update the timezone
+					if ($var_action == "update") {
+						$sql = "update v_vars ";
+						$sql .= "set var_value = '".$default_setting_value."' ";
+						$sql .= "where var_name = 'timezone' ";
+					}
+					else {
+						$sql = "insert into v_vars ";
+						$sql .= "(var_uuid, var_name, var_value, var_cat, var_enabled) ";
+						$sql .= "values ('".uuid()."', 'timezone', '$default_setting_value', 'Defaults', 'true'); ";
+					}
+					$db->query($sql);
+					unset($sql);
+
+				//synchronize the configuration
+					save_var_xml();
+			}
+
 			if ($action == "add" && permission_exists('default_setting_add')) {
 				$sql = "insert into v_default_settings ";
 				$sql .= "(";
@@ -566,4 +598,4 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 
 //include the footer
 	require_once "resources/footer.php";
-?>
+?>

+ 73 - 4
core/domain_settings/domain_setting_edit.php

@@ -47,9 +47,10 @@ else {
 		$action = "add";
 	}
 
-if (strlen($_GET["domain_uuid"]) > 0) {
-	$domain_uuid = check_str($_GET["domain_uuid"]);
-}
+//set the domain_uuid
+	if (strlen($_GET["domain_uuid"]) > 0) {
+		$domain_uuid = check_str($_GET["domain_uuid"]);
+	}
 
 //get http post variables and set them to php variables
 	if (count($_POST) > 0) {
@@ -92,7 +93,75 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 
 	//add or update the database
 		if ($_POST["persistformvar"] != "true") {
-			$domain_setting_order = ($domain_setting_order != '') ? $domain_setting_order : 'null';
+			// fix null
+				$domain_setting_order = ($domain_setting_order != '') ? $domain_setting_order : 'null';
+
+			//update switch timezone variables
+				if ($domain_setting_category == "domain" && $domain_setting_subcategory == "time_zone" && $domain_setting_name == "name" ) {
+					//get the dialplan_uuid
+						$sql = "select * from v_dialplans ";
+						$sql .= "where domain_uuid = '".$domain_uuid."' ";
+						$sql .= "and app_uuid = '9f356fe7-8cf8-4c14-8fe2-6daf89304458' ";
+						$prep_statement = $db->prepare(check_sql($sql));
+						$prep_statement->execute();
+						$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+						foreach ($result as $row) {
+							$dialplan_uuid = $row["dialplan_uuid"];
+						}
+						unset ($prep_statement);
+
+					//get the action
+						$sql = "select * from v_dialplan_details ";
+						$sql .= "where domain_uuid = '".$domain_uuid."' ";
+						$sql .= "and dialplan_uuid = '".$dialplan_uuid."' ";
+						$sql .= "and dialplan_detail_tag = 'action' ";
+						$sql .= "and dialplan_detail_type = 'set' ";
+						$sql .= "and dialplan_detail_data like 'timezone=%' ";
+						$prep_statement = $db->prepare(check_sql($sql));
+						$prep_statement->execute();
+						$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+						$detail_action = "add";
+						foreach ($result as $row) {
+							$dialplan_detail_uuid = $row["dialplan_detail_uuid"];
+							$detail_action = "update";
+						}
+						unset ($prep_statement);
+
+					//update the timezone
+						if ($detail_action == "update") {
+							$sql = "update v_dialplan_details ";
+							$sql .= "set dialplan_detail_data = 'timezone=".$domain_setting_value."' ";
+							$sql .= "where dialplan_detail_uuid = '".$dialplan_detail_uuid."' ";
+						}
+						else {
+							$dialplan_detail_uuid = uuid();
+							$dialplan_detail_group = 0;
+							$sql = "insert into v_dialplan_details ";
+							$sql .= "(";
+							$sql .= "domain_uuid, ";
+							$sql .= "dialplan_detail_uuid, ";
+							$sql .= "dialplan_uuid, ";
+							$sql .= "dialplan_detail_tag, ";
+							$sql .= "dialplan_detail_type, ";
+							$sql .= "dialplan_detail_data, ";
+							$sql .= "dialplan_detail_inline, ";
+							$sql .= "dialplan_detail_group ";
+							$sql .= ") ";
+							$sql .= "values ";
+							$sql .= "(";
+							$sql .= "'".$domain_uuid."', ";
+							$sql .= "'".$dialplan_detail_uuid."', ";
+							$sql .= "'".$dialplan_uuid."', ";
+							$sql .= "'action', ";
+							$sql .= "'set', ";
+							$sql .= "'timezone=".$domain_setting_value."', ";
+							$sql .= "'true', ";
+							$sql .= "'".$dialplan_detail_group."' ";
+							$sql .= "); ";
+						}
+						$db->query($sql);
+						unset($sql);
+				}
 
 			//add the domain
 				if ($action == "add" && permission_exists('domain_setting_add')) {

+ 2 - 2
resources/functions.php

@@ -27,7 +27,7 @@
 
 	if (!function_exists('software_version')) {
 		function software_version() {
-			return '4.0.0';
+			return '4.0.1';
 		}
 	}
 
@@ -1326,4 +1326,4 @@ function number_pad($number,$n) {
 	   }
 }
 
-?>
+?>