Edit: root.php updated

This commit is contained in:
reliberate 2016-02-24 12:49:20 -07:00
parent e736538654
commit da3112e0a5
1 changed files with 6 additions and 6 deletions

View File

@ -39,14 +39,14 @@
chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/.project.ROOT')) { if (file_exists('/project_root.php')) {
$path = '/'; $path = '/';
} else { } else {
$i = 1; $i = 1;
$path = ''; $path = '';
while ($i < count($dirs)) { while ($i < count($dirs)) {
$path .= '/' . $dirs[$i]; $path .= '/' . $dirs[$i];
if (file_exists($path. '/.project.ROOT')) { if (file_exists($path. '/project_root.php')) {
break; break;
} }
$i++; $i++;
@ -61,7 +61,7 @@
if (!defined('PROJECT_PATH')) { if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx'); define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', ''); define('PROJECT_PATH', '');
} else { } else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
@ -69,13 +69,13 @@
$path = $_SERVER["DOCUMENT_ROOT"]; $path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) { while ($i < count($dirs)) {
$path .= '/' . $dirs[$i]; $path .= '/' . $dirs[$i];
if (file_exists($path. '/.project.ROOT')) { if (file_exists($path. '/project_root.php')) {
break; break;
} }
$i++; $i++;
} }
if(!file_exists($path. '/.project.ROOT')){ if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance"); die("Failed to locate the Project Root by searching for project_root.php 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);