Browse Source

Change $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH to $_SERVER["PROJECT_ROOT"].

markjcrane 9 years ago
parent
commit
041fecce3b

+ 14 - 14
core/domain_settings/domain_edit.php

@@ -133,7 +133,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 				if ($original_domain_name != $domain_name) {
 
 					// update dialplans
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/dialplan/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplan/app_config.php")){
 							$sql = "update v_dialplans set ";
 							$sql .= "dialplan_context = '".$domain_name."' ";
 							$sql .= "where dialplan_context = '".$original_domain_name."' ";
@@ -143,7 +143,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update extensions (accountcode, user_context, dial_domain)
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/extensions/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/extensions/app_config.php")){
 							$sql = "update v_extensions set ";
 							$sql .= "accountcode = '".$domain_name."' ";
 							$sql .= "where accountcode = '".$original_domain_name."' ";
@@ -167,7 +167,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update cdr records (domain_name, context)
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/xml_cdr/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/xml_cdr/app_config.php")){
 							$sql = "update v_xml_cdr set ";
 							$sql .= "domain_name = '".$domain_name."' ";
 							$sql .= "where domain_name = '".$original_domain_name."' ";
@@ -184,7 +184,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update billing, if installed
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
 							$sql = "update v_billings set ";
 							$sql .= "type_value = '".$domain_name."' ";
 							$sql .= "where type_value = '".$original_domain_name."' ";
@@ -242,7 +242,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update conference session recording paths
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/conference_centers/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/conference_centers/app_config.php")){
 							$sql = "select conference_session_uuid, recording from v_conference_sessions ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and recording like '%".$original_domain_name."%' ";
@@ -267,7 +267,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update conference center greetings
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/conference_centers/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/conference_centers/app_config.php")){
 							$sql = "select conference_center_uuid, conference_center_greeting from v_conference_centers ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and conference_center_greeting like '%".$original_domain_name."%' ";
@@ -292,7 +292,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update ivr menu greetings
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ivr_menu/app_config.php")){
 							$sql = "select ivr_menu_uuid, ivr_menu_greet_long, ivr_menu_greet_short from v_ivr_menus ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ( ";
@@ -323,7 +323,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update ivr menu option parameters
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ivr_menu/app_config.php")){
 							$sql = "select ivr_menu_option_uuid, ivr_menu_option_param from v_ivr_menu_options ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ivr_menu_option_param like '%".$original_domain_name."%' ";
@@ -348,7 +348,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update call center queue record templates
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_center/app_config.php")){
 							$sql = "select call_center_queue_uuid, queue_record_template from v_call_center_queues ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and queue_record_template like '%".$original_domain_name."%' ";
@@ -373,7 +373,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update call center agent contacts
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_center/app_config.php")){
 							$sql = "select call_center_agent_uuid, agent_contact from v_call_center_agents ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and agent_contact like '%".$original_domain_name."%' ";
@@ -398,7 +398,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update call flows data, anti-data and contexts
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_flows/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_flows/app_config.php")){
 							$sql = "select call_flow_uuid, call_flow_data, call_flow_anti_data, call_flow_context from v_call_flows ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ( ";
@@ -433,7 +433,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update ring group context, forward destination, timeout data
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ring_groups/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ring_groups/app_config.php")){
 							$sql = "select ring_group_uuid, ring_group_context, ring_group_forward_destination, ring_group_timeout_data from v_ring_groups ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ( ";
@@ -468,7 +468,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 
 					// update device lines server address, outbound proxy
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/devices/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/devices/app_config.php")){
 							$sql = "select device_line_uuid, server_address, outbound_proxy from v_device_lines ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ( ";
@@ -510,7 +510,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						unset($dialplan_public_xml);
 
 					// update dialplan details
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/dialplan/app_config.php")){
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplan/app_config.php")){
 							$sql = "select dialplan_detail_uuid, dialplan_detail_data from v_dialplan_details ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and dialplan_detail_data like '%".$original_domain_name."%' ";

+ 1 - 1
core/install/index.php

@@ -31,7 +31,7 @@ require_once "resources/check_auth.php";
 //detect install state
 
 $first_time_install = true;
-if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
 	$first_time_install = false;
 } elseif (file_exists("/etc/fusionpbx/config.php")) {
 	//linux

+ 1 - 1
core/install/install_first_time.php

@@ -78,7 +78,7 @@ date_default_timezone_set($timezone);
 
 //detect install state
 $first_time_install = true;
-if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
 	$first_time_install = false;
 } elseif (file_exists("/etc/fusionpbx/config.php")) {
 	$first_time_install = false;

+ 1 - 1
core/install/resources/classes/install_fusionpbx.php

@@ -56,7 +56,7 @@ include "root.php";
 			} elseif (is_dir("/usr/local/etc/fusionpbx")){
 				$this->config_php = "/usr/local/etc/fusionpbx/config.php";
 			}
-			elseif (is_dir($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources")) {
+			elseif (is_dir($_SERVER["PROJECT_ROOT"]."/resources")) {
 				$this->config_php = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php";
 			}
 			else {

+ 2 - 2
core/user_settings/user_dashboard.php

@@ -28,9 +28,9 @@
 	include "root.php";
 
 //if config.php file does not exist then redirect to the install page
-	if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+	if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
 		//do nothing
-	} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+	} elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
 		//original directory
 	} elseif (file_exists("/etc/fusionpbx/config.php")){
 		//linux

+ 1 - 1
core/users/usersupdate.php

@@ -341,7 +341,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
 
 
 	// if call center installed
-	if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")) {
+	if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_center/app_config.php")) {
 
 		// update agent and tiers tables
 			$sql  = "update v_call_center_agents set agent_name = '".$username."' where domain_uuid = '".$domain_uuid."' and agent_name = '".$username_old."' ";

+ 7 - 9
index.php

@@ -30,13 +30,13 @@ include "root.php";
 	session_start();
 
 //if config.php file does not exist then redirect to the install page
-	if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+	if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
 		//do nothing
-	} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+	} elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
 		//original directory
-	} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
+	} elseif (file_exists($_SERVER["PROJECT_ROOT"]."/includes/config.php")) {
 		//move config.php from the includes to resources directory.
-		rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
+		rename($_SERVER["PROJECT_ROOT"]."/includes/config.php", $_SERVER["PROJECT_ROOT"]."/resources/config.php");
 	} elseif (file_exists("/etc/fusionpbx/config.php")) {
 		//linux
 	} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
@@ -59,8 +59,7 @@ include "root.php";
 	if (strlen($_SESSION["username"]) > 0) {
 		if (strlen($_SESSION['login']['destination']['url']) > 0) {
 			header("Location: ".$_SESSION['login']['destination']['url']);
-		}elseif(file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/core/user_settings/user_dashboard.php"))
-		{
+		} elseif (file_exists($_SERVER["PROJECT_ROOT"]."/core/user_settings/user_dashboard.php")) {
 			header("Location: ".PROJECT_PATH."/core/user_settings/user_dashboard.php");
 		}
 		else {
@@ -70,10 +69,9 @@ include "root.php";
 	}
 	else {
 		//use custom index, if present, otherwise use custom login, if present, otherwise use default login
-		if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
+		if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
 			require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";
-		}
-		else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
+		} else if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
 			require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
 		}
 		else {

+ 4 - 4
login.php

@@ -40,12 +40,12 @@ include "root.php";
 	session_destroy();
 
 //if config.php file does not exist then redirect to the install page
-	if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+	if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
 		//original directory
 	}
-	else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
+	else if (file_exists($_SERVER["PROJECT_ROOT"]."/includes/config.php")) {
 		//move config.php from the includes to resources directory.
-		rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
+		rename($_SERVER["PROJECT_ROOT"]."/includes/config.php", $_SERVER["PROJECT_ROOT"]."/resources/config.php");
 	}
 	else if (file_exists("/etc/fusionpbx/config.php")){
 		//linux
@@ -68,7 +68,7 @@ include "root.php";
 	}
 
 //use custom login, if present, otherwise use default login
-	if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")){
+	if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/login.php")){
 		require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
 	}
 	else {

+ 2 - 2
resources/classes/config.php

@@ -70,8 +70,8 @@ class config {
 		//get the PROJECT PATH
 			include "root.php";
 		// find the file
-			if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
-				$this->config_path = $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
+			if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
+				$this->config_path = $_SERVER["PROJECT_ROOT"]."/resources/config.php";
 			} elseif (file_exists("/etc/fusionpbx/config.php")) {
 				$this->config_path = "/etc/fusionpbx/config.php";
 			} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {

+ 4 - 4
resources/classes/database.php

@@ -54,10 +54,10 @@ include "root.php";
 				if (strlen($this->type) == 0 && strlen($this->db_name) == 0) {
 					//include config.php
 						include "root.php";
-						if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
-							include $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
-						} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
-							include $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php";
+						if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
+							include $_SERVER["PROJECT_ROOT"]."/resources/config.php";
+						} elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
+							include $_SERVER["PROJECT_ROOT"]."/resources/config.php";
 						} elseif (file_exists("/etc/fusionpbx/config.php")){
 							//linux
 							include "/etc/fusionpbx/config.php";

+ 1 - 1
resources/classes/destinations.php

@@ -186,7 +186,7 @@ class destinations {
 				$destination = $row['field']['destination'];
 
 				//add multi-lingual support
-				if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/".$name."/app_languages.php")) {
+				if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
 					$language2 = new text;
 					$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
 				}

+ 1 - 1
resources/header.php

@@ -87,7 +87,7 @@ require_once "resources/require.php";
 	unset($menu_prep_statement, $menu_result, $menu_row);
 
 //get the content
-	if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/content/app_config.php")) {
+	if (file_exists($_SERVER["PROJECT_ROOT"]."/app/content/app_config.php")) {
 		$sql = "select * from v_rss ";
 		$sql .= "where domain_uuid =:domain_uuid ";
 		$sql .= "and rss_category = 'content' ";