소스 검색

Merge pull request #13 from fusionpbx/master

11
blackc2004 9 년 전
부모
커밋
6a37e31eb4

+ 3 - 0
core/databases/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 3 - 0
core/default_settings/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 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) {
 				if ($original_domain_name != $domain_name) {
 
 
 					// update dialplans
 					// 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 = "update v_dialplans set ";
 							$sql .= "dialplan_context = '".$domain_name."' ";
 							$sql .= "dialplan_context = '".$domain_name."' ";
 							$sql .= "where dialplan_context = '".$original_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)
 					// 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 = "update v_extensions set ";
 							$sql .= "accountcode = '".$domain_name."' ";
 							$sql .= "accountcode = '".$domain_name."' ";
 							$sql .= "where accountcode = '".$original_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)
 					// 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 = "update v_xml_cdr set ";
 							$sql .= "domain_name = '".$domain_name."' ";
 							$sql .= "domain_name = '".$domain_name."' ";
 							$sql .= "where domain_name = '".$original_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
 					// 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 = "update v_billings set ";
 							$sql .= "type_value = '".$domain_name."' ";
 							$sql .= "type_value = '".$domain_name."' ";
 							$sql .= "where type_value = '".$original_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
 					// 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 = "select conference_session_uuid, recording from v_conference_sessions ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and recording like '%".$original_domain_name."%' ";
 							$sql .= "and recording like '%".$original_domain_name."%' ";
@@ -267,7 +267,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 						}
 
 
 					// update conference center greetings
 					// 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 = "select conference_center_uuid, conference_center_greeting from v_conference_centers ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and conference_center_greeting like '%".$original_domain_name."%' ";
 							$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
 					// 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 = "select ivr_menu_uuid, ivr_menu_greet_long, ivr_menu_greet_short from v_ivr_menus ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ( ";
 							$sql .= "and ( ";
@@ -323,7 +323,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 						}
 
 
 					// update ivr menu option parameters
 					// 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 = "select ivr_menu_option_uuid, ivr_menu_option_param from v_ivr_menu_options ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ivr_menu_option_param like '%".$original_domain_name."%' ";
 							$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
 					// 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 = "select call_center_queue_uuid, queue_record_template from v_call_center_queues ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and queue_record_template like '%".$original_domain_name."%' ";
 							$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
 					// 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 = "select call_center_agent_uuid, agent_contact from v_call_center_agents ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and agent_contact like '%".$original_domain_name."%' ";
 							$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
 					// 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 = "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 .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ( ";
 							$sql .= "and ( ";
@@ -433,7 +433,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 						}
 
 
 					// update ring group context, forward destination, timeout data
 					// 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 = "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 .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ( ";
 							$sql .= "and ( ";
@@ -468,7 +468,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						}
 						}
 
 
 					// update device lines server address, outbound proxy
 					// 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 = "select device_line_uuid, server_address, outbound_proxy from v_device_lines ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and ( ";
 							$sql .= "and ( ";
@@ -510,7 +510,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 						unset($dialplan_public_xml);
 						unset($dialplan_public_xml);
 
 
 					// update dialplan details
 					// 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 = "select dialplan_detail_uuid, dialplan_detail_data from v_dialplan_details ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "where domain_uuid = '".$domain_uuid."' ";
 							$sql .= "and dialplan_detail_data like '%".$original_domain_name."%' ";
 							$sql .= "and dialplan_detail_data like '%".$original_domain_name."%' ";

+ 3 - 0
core/domain_settings/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 1 - 1
core/install/index.php

@@ -31,7 +31,7 @@ require_once "resources/check_auth.php";
 //detect install state
 //detect install state
 
 
 $first_time_install = true;
 $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;
 	$first_time_install = false;
 } elseif (file_exists("/etc/fusionpbx/config.php")) {
 } elseif (file_exists("/etc/fusionpbx/config.php")) {
 	//linux
 	//linux

+ 1 - 1
core/install/install_first_time.php

@@ -78,7 +78,7 @@ date_default_timezone_set($timezone);
 
 
 //detect install state
 //detect install state
 $first_time_install = true;
 $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;
 	$first_time_install = false;
 } elseif (file_exists("/etc/fusionpbx/config.php")) {
 } elseif (file_exists("/etc/fusionpbx/config.php")) {
 	$first_time_install = false;
 	$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")){
 			} elseif (is_dir("/usr/local/etc/fusionpbx")){
 				$this->config_php = "/usr/local/etc/fusionpbx/config.php";
 				$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";
 				$this->config_php = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/config.php";
 			}
 			}
 			else {
 			else {

+ 3 - 0
core/install/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 3 - 0
core/menu/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 3 - 0
core/upgrade/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 3 - 0
core/user_settings/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 2 - 2
core/user_settings/user_dashboard.php

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

+ 3 - 0
core/users/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 1 - 1
core/users/usersupdate.php

@@ -341,7 +341,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
 
 
 
 
 	// if call center installed
 	// 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
 		// 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."' ";
 			$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();
 	session_start();
 
 
 //if config.php file does not exist then redirect to the install page
 //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
 		//do nothing
-	} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
+	} elseif (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
 		//original directory
 		//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.
 		//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")) {
 	} elseif (file_exists("/etc/fusionpbx/config.php")) {
 		//linux
 		//linux
 	} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
 	} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
@@ -59,8 +59,7 @@ include "root.php";
 	if (strlen($_SESSION["username"]) > 0) {
 	if (strlen($_SESSION["username"]) > 0) {
 		if (strlen($_SESSION['login']['destination']['url']) > 0) {
 		if (strlen($_SESSION['login']['destination']['url']) > 0) {
 			header("Location: ".$_SESSION['login']['destination']['url']);
 			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");
 			header("Location: ".PROJECT_PATH."/core/user_settings/user_dashboard.php");
 		}
 		}
 		else {
 		else {
@@ -70,10 +69,9 @@ include "root.php";
 	}
 	}
 	else {
 	else {
 		//use custom index, if present, otherwise use custom login, if present, otherwise use default login
 		//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";
 			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";
 			require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
 		}
 		}
 		else {
 		else {

+ 4 - 4
login.php

@@ -40,12 +40,12 @@ include "root.php";
 	session_destroy();
 	session_destroy();
 
 
 //if config.php file does not exist then redirect to the install page
 //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
 		//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.
 		//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")){
 	else if (file_exists("/etc/fusionpbx/config.php")){
 		//linux
 		//linux
@@ -68,7 +68,7 @@ include "root.php";
 	}
 	}
 
 
 //use custom login, if present, otherwise use default login
 //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";
 		require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
 	}
 	}
 	else {
 	else {

+ 3 - 0
resources/captcha/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 2 - 2
resources/classes/config.php

@@ -70,8 +70,8 @@ class config {
 		//get the PROJECT PATH
 		//get the PROJECT PATH
 			include "root.php";
 			include "root.php";
 		// find the file
 		// 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")) {
 			} elseif (file_exists("/etc/fusionpbx/config.php")) {
 				$this->config_path = "/etc/fusionpbx/config.php";
 				$this->config_path = "/etc/fusionpbx/config.php";
 			} elseif (file_exists("/usr/local/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) {
 				if (strlen($this->type) == 0 && strlen($this->db_name) == 0) {
 					//include config.php
 					//include config.php
 						include "root.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")){
 						} elseif (file_exists("/etc/fusionpbx/config.php")){
 							//linux
 							//linux
 							include "/etc/fusionpbx/config.php";
 							include "/etc/fusionpbx/config.php";

+ 1 - 1
resources/classes/destinations.php

@@ -186,7 +186,7 @@ class destinations {
 				$destination = $row['field']['destination'];
 				$destination = $row['field']['destination'];
 
 
 				//add multi-lingual support
 				//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;
 					$language2 = new text;
 					$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
 					$text2 = $language2->get($_SESSION['domain']['language']['code'], 'app/'.$name);
 				}
 				}

+ 3 - 0
resources/classes/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 15 - 5
resources/classes/vcard.php

@@ -13,10 +13,10 @@ class vcard {
 	var $revision_date;
 	var $revision_date;
 	var $card;
 	var $card;
 
 
-	/*
-	The class constructor. You can set some defaults here if desired.
-	*/
-	function vcard() {
+	/**
+	 * Called when the object is created
+	 */
+	public function __construct() {
 	$this->log = "New vcard() called<br />";
 	$this->log = "New vcard() called<br />";
 	$this->data = array(
 	$this->data = array(
 		"display_name"=>null
 		"display_name"=>null
@@ -59,7 +59,17 @@ class vcard {
 		,"sort_string"=>null
 		,"sort_string"=>null
 		,"note"=>null
 		,"note"=>null
 		);
 		);
-	return true;
+		return true;
+	}
+
+	/**
+	 * Called when there are no references to a particular object
+	 * unset the variables used in the class
+	 */
+	public function __destruct() {
+		foreach ($this as $key => $value) {
+			unset($this->$key);
+		}
 	}
 	}
 
 
 	/*
 	/*

+ 1 - 1
resources/header.php

@@ -87,7 +87,7 @@ require_once "resources/require.php";
 	unset($menu_prep_statement, $menu_result, $menu_row);
 	unset($menu_prep_statement, $menu_result, $menu_row);
 
 
 //get the content
 //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 = "select * from v_rss ";
 		$sql .= "where domain_uuid =:domain_uuid ";
 		$sql .= "where domain_uuid =:domain_uuid ";
 		$sql .= "and rss_category = 'content' ";
 		$sql .= "and rss_category = 'content' ";

+ 3 - 0
resources/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 3 - 0
root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 3 - 0
themes/accessible/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 3 - 0
themes/enhanced/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}

+ 3 - 0
themes/minimized/root.php

@@ -74,6 +74,9 @@
 				}
 				}
 				$i++;
 				$i++;
 			}
 			}
+			if(!file_exists($path. '/.project.ROOT')){
+				die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
+			}
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
 			define('PROJECT_PATH', $project_path);
 			define('PROJECT_PATH', $project_path);
 		}
 		}