From 546220f9123df8a252e8c145a7da46964751698d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Thu, 3 Sep 2015 15:57:57 +0200 Subject: [PATCH 01/31] Allow provisioning with internal addressbook and update snom320 template for it --- app/provision/resources/classes/provision.php | 8 ++++ .../templates/provision/snom/320/{$mac}.xml | 37 ++++++++++++------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 237de12212..4c1fe3215b 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -661,6 +661,14 @@ include "root.php"; } unset ($prep_statement); + //populate internal address book + $sql = "SELECT extension as , effective_caller_id_name, effective_caller_id_number, outbound_caller_id_name, outbound_caller_id_number, directory_full_name FROM v_extensions"; + $prep_statement = $this->db->prepare(check_sql($sql)); + $prep_statement->execute(); + $internal_addressbook = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $view->assign("internal_addressbook",$internal_addressbook); + unset ($prep_statement); + //set the mac address in the correct format switch (strtolower($device_vendor)) { case "aastra": diff --git a/resources/templates/provision/snom/320/{$mac}.xml b/resources/templates/provision/snom/320/{$mac}.xml index feb2b9c95c..760c5462db 100644 --- a/resources/templates/provision/snom/320/{$mac}.xml +++ b/resources/templates/provision/snom/320/{$mac}.xml @@ -100,19 +100,30 @@ g722,pcmu,pcma,gsm,g726-32,aal2-g726-32,g723,g729,telephone-event -line -line -line -line -line -line -line -line -line -line -line -line +{foreach $keys as $row} +{if $row.device_key_line == ""} + {if $row.device_key_category == "line"} + {$row.device_key_type} {$row.device_key_value} {$row.device_key_extension} + {else} + line + {/if} +{else} + {if $row.device_key_category == "line"} + {$row.device_key_type} {$row.device_key_value} {$row.device_key_extension} + {else} + line + {/if} +{/if} +{/foreach} - + +{foreach $internal_addressbook as $address} + + {$address.extension} + sip + {$address.directory_full_name} ({$address.extension}) + +{/foreach} + \ No newline at end of file From 1d60d8acb4338179e15ee3858ee39264663be317 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Mon, 14 Dec 2015 10:24:00 +0000 Subject: [PATCH 02/31] Initial changes to root.php added new $_SERVER['PROJECT_ROOT'] that takes into account sub-dir detection --- app/system/root.php | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/app/system/root.php b/app/system/root.php index 7b882438ea..321ba2ea9b 100644 --- a/app/system/root.php +++ b/app/system/root.php @@ -22,29 +22,45 @@ Contributor(s): Mark J Crane + Matthew Vale */ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file From 9da082409a170dffe420b9070169156ff98babce Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Mon, 21 Dec 2015 10:46:27 +0000 Subject: [PATCH 03/31] Added display of project root --- app/system/app_languages.php | 20 ++++++++++++++++++++ app/system/system.php | 15 ++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/app/system/app_languages.php b/app/system/app_languages.php index 08271e3487..00c99be294 100644 --- a/app/system/app_languages.php +++ b/app/system/app_languages.php @@ -20,6 +20,16 @@ $text['title-sys-info']['sv-se'] = "System Information"; $text['title-sys-info']['uk'] = "Інформація про систему"; $text['title-sys-info']['de-at'] = "System Information"; +$text['title-os-info']['en-us'] = "Operating System Information"; +$text['title-os-info']['es-cl'] = "Información de Sistema Operativo"; +$text['title-os-info']['pt-pt'] = "Informação do Sistema Operativo"; +$text['title-os-info']['fr-fr'] = ""; +$text['title-os-info']['pt-br'] = "Informação do Sistema operacional"; +$text['title-os-info']['pl'] = "Informacje o System operacyjny"; +$text['title-os-info']['sv-se'] = "Operativsystem Systeminformation"; +$text['title-os-info']['uk'] = "Інформація про Операційна система "; +$text['title-os-info']['de-at'] = "Informationen zum Betriebssystem"; + $text['title-memcache']['en-us'] = "Memcache Information"; $text['title-memcache']['es-cl'] = "Información de Memcache"; $text['title-memcache']['pt-pt'] = "Informação da Memcache"; @@ -90,6 +100,16 @@ $text['label-version']['sv-se'] = ""; $text['label-version']['uk'] = ""; $text['label-version']['de-at'] = ""; +$text['label-path']['en-us'] = "Project Path"; +$text['label-path']['es-cl'] = ""; +$text['label-path']['pt-pt'] = ""; +$text['label-path']['fr-fr'] = ""; +$text['label-path']['pt-br'] = ""; +$text['label-path']['pl'] = ""; +$text['label-path']['sv-se'] = ""; +$text['label-path']['uk'] = ""; +$text['label-path']['de-at'] = ""; + $text['label-git_info']['en-us'] = "Git Information"; $text['label-git_info']['es-cl'] = ""; $text['label-git_info']['pt-pt'] = ""; diff --git a/app/system/system.php b/app/system/system.php index 67bb23a234..0e394b0bbc 100644 --- a/app/system/system.php +++ b/app/system/system.php @@ -85,7 +85,7 @@ $document['title'] = $text['title-sys-status']; echo " \n"; echo "\n"; - $git_path = normalize_path_to_os($_SERVER["DOCUMENT_ROOT"]."/.git"); + $git_path = normalize_path_to_os($_SERVER['PROJECT_ROOT']."/.git"); if(file_exists($git_path)){ $git_exe = 'git'; if (strtoupper(substr(PHP_OS, 0, 3)) === 'SUN') { $git_exe = shell_exec('which git'); } @@ -107,6 +107,15 @@ $document['title'] = $text['title-sys-status']; echo "\n"; } + echo "\n"; + echo " \n"; + echo " ".$text['label-path']."\n"; + echo " \n"; + echo " \n"; + echo " ".$_SERVER['PROJECT_ROOT']."\n"; + echo " \n"; + echo "\n"; + $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { $switch_version = event_socket_request($fp, 'api version'); @@ -131,6 +140,10 @@ $document['title'] = $text['title-sys-status']; } } + echo "\n"; + echo " ".$text['title-os-info']."\n"; + echo "\n"; + echo "\n"; From 1ad1c31b272d8fc8462c8fd3a0cc4608dd24e7b5 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Fri, 8 Jan 2016 10:54:10 +0000 Subject: [PATCH 04/31] Rollout of root.php --- app/access_controls/root.php | 43 ++++++++---- app/adminer/root.php | 43 ++++++++---- app/backup/root.php | 43 ++++++++---- app/call_block/root.php | 45 +++++++----- app/call_broadcast/root.php | 43 ++++++++---- app/call_center_active/root.php | 43 ++++++++---- app/call_centers/root.php | 43 ++++++++---- app/call_flows/root.php | 43 ++++++++---- app/calls/root.php | 43 ++++++++---- app/calls_active/root.php | 43 ++++++++---- app/click_to_call/root.php | 43 ++++++++---- app/conference_centers/root.php | 43 ++++++++---- app/conferences/root.php | 43 ++++++++---- app/conferences_active/root.php | 43 ++++++++---- app/contacts/root.php | 43 ++++++++---- app/destinations/root.php | 43 ++++++++---- app/devices/root.php | 43 ++++++++---- app/dialplan/root.php | 43 ++++++++---- app/dialplan_inbound/root.php | 43 ++++++++---- app/dialplan_outbound/root.php | 43 ++++++++---- app/edit/root.php | 43 ++++++++---- app/emails/root.php | 43 ++++++++---- app/exec/root.php | 43 ++++++++---- app/extensions/root.php | 43 ++++++++---- app/fax/root.php | 43 ++++++++---- app/fifo/root.php | 43 ++++++++---- app/fifo_list/root.php | 43 ++++++++---- app/follow_me/root.php | 43 ++++++++---- app/gateways/root.php | 43 ++++++++---- app/ivr_menus/root.php | 43 ++++++++---- app/log_viewer/root.php | 43 ++++++++---- app/modules/root.php | 43 ++++++++---- app/music_on_hold/root.php | 43 ++++++++---- app/operator_panel/root.php | 43 ++++++++---- app/phrases/root.php | 43 ++++++++---- app/provision/root.php | 43 ++++++++---- app/recordings/root.php | 43 ++++++++---- app/registrations/root.php | 43 ++++++++---- app/ring_groups/root.php | 43 ++++++++---- app/services/root.php | 43 ++++++++---- app/settings/root.php | 43 ++++++++---- app/sip_profiles/root.php | 43 ++++++++---- app/sip_status/root.php | 43 ++++++++---- app/sql_query/root.php | 43 ++++++++---- app/system/root.php | 1 - app/time_conditions/root.php | 43 ++++++++---- app/traffic_graph/root.php | 43 ++++++++---- app/vars/root.php | 43 ++++++++---- app/voicemail_greetings/root.php | 43 ++++++++---- app/voicemails/root.php | 43 ++++++++---- app/xml_cdr/root.php | 43 ++++++++---- core/apps/root.php | 43 ++++++++---- core/databases/root.php | 43 ++++++++---- core/default_settings/root.php | 43 ++++++++---- core/domain_settings/root.php | 43 ++++++++---- core/install/root.php | 113 +++++++++++++++++-------------- core/menu/root.php | 43 ++++++++---- core/notifications/root.php | 43 ++++++++---- core/upgrade/root.php | 43 ++++++++---- core/user_settings/root.php | 45 ++++++++---- core/users/root.php | 43 ++++++++---- resources/captcha/root.php | 43 ++++++++---- resources/classes/root.php | 43 ++++++++---- resources/root.php | 45 ++++++++---- root.php | 43 ++++++++---- secure/root.php | 43 ++++++++---- themes/accessible/root.php | 43 ++++++++---- themes/enhanced/root.php | 43 ++++++++---- themes/minimized/root.php | 43 ++++++++---- 69 files changed, 2010 insertions(+), 991 deletions(-) diff --git a/app/access_controls/root.php b/app/access_controls/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/access_controls/root.php +++ b/app/access_controls/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/adminer/root.php b/app/adminer/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/adminer/root.php +++ b/app/adminer/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/backup/root.php b/app/backup/root.php index 7b882438ea..90a856f3a9 100755 --- a/app/backup/root.php +++ b/app/backup/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/call_block/root.php b/app/call_block/root.php index e791876a14..90a856f3a9 100644 --- a/app/call_block/root.php +++ b/app/call_block/root.php @@ -22,31 +22,44 @@ Contributor(s): Mark J Crane - - Callblock is written by Gerrit Visser */ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/call_broadcast/root.php b/app/call_broadcast/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/call_broadcast/root.php +++ b/app/call_broadcast/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/call_center_active/root.php b/app/call_center_active/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/call_center_active/root.php +++ b/app/call_center_active/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/call_centers/root.php b/app/call_centers/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/call_centers/root.php +++ b/app/call_centers/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/call_flows/root.php b/app/call_flows/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/call_flows/root.php +++ b/app/call_flows/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/calls/root.php b/app/calls/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/calls/root.php +++ b/app/calls/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/calls_active/root.php b/app/calls_active/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/calls_active/root.php +++ b/app/calls_active/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/click_to_call/root.php b/app/click_to_call/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/click_to_call/root.php +++ b/app/click_to_call/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/conference_centers/root.php b/app/conference_centers/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/conference_centers/root.php +++ b/app/conference_centers/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/conferences/root.php b/app/conferences/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/conferences/root.php +++ b/app/conferences/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/conferences_active/root.php b/app/conferences_active/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/conferences_active/root.php +++ b/app/conferences_active/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/contacts/root.php b/app/contacts/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/contacts/root.php +++ b/app/contacts/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/destinations/root.php b/app/destinations/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/destinations/root.php +++ b/app/destinations/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/devices/root.php b/app/devices/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/devices/root.php +++ b/app/devices/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/dialplan/root.php b/app/dialplan/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/dialplan/root.php +++ b/app/dialplan/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/dialplan_inbound/root.php b/app/dialplan_inbound/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/dialplan_inbound/root.php +++ b/app/dialplan_inbound/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/dialplan_outbound/root.php b/app/dialplan_outbound/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/dialplan_outbound/root.php +++ b/app/dialplan_outbound/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/edit/root.php b/app/edit/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/edit/root.php +++ b/app/edit/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/emails/root.php b/app/emails/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/emails/root.php +++ b/app/emails/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/exec/root.php b/app/exec/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/exec/root.php +++ b/app/exec/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/extensions/root.php b/app/extensions/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/extensions/root.php +++ b/app/extensions/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/fax/root.php b/app/fax/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/fax/root.php +++ b/app/fax/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/fifo/root.php b/app/fifo/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/fifo/root.php +++ b/app/fifo/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/fifo_list/root.php b/app/fifo_list/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/fifo_list/root.php +++ b/app/fifo_list/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/follow_me/root.php b/app/follow_me/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/follow_me/root.php +++ b/app/follow_me/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/gateways/root.php b/app/gateways/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/gateways/root.php +++ b/app/gateways/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/ivr_menus/root.php b/app/ivr_menus/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/ivr_menus/root.php +++ b/app/ivr_menus/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/log_viewer/root.php b/app/log_viewer/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/log_viewer/root.php +++ b/app/log_viewer/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/modules/root.php b/app/modules/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/modules/root.php +++ b/app/modules/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/music_on_hold/root.php b/app/music_on_hold/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/music_on_hold/root.php +++ b/app/music_on_hold/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/operator_panel/root.php b/app/operator_panel/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/operator_panel/root.php +++ b/app/operator_panel/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/phrases/root.php b/app/phrases/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/phrases/root.php +++ b/app/phrases/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/provision/root.php b/app/provision/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/provision/root.php +++ b/app/provision/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/recordings/root.php b/app/recordings/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/recordings/root.php +++ b/app/recordings/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/registrations/root.php b/app/registrations/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/registrations/root.php +++ b/app/registrations/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/ring_groups/root.php b/app/ring_groups/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/ring_groups/root.php +++ b/app/ring_groups/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/services/root.php b/app/services/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/services/root.php +++ b/app/services/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/settings/root.php b/app/settings/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/settings/root.php +++ b/app/settings/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/sip_profiles/root.php b/app/sip_profiles/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/sip_profiles/root.php +++ b/app/sip_profiles/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/sip_status/root.php b/app/sip_status/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/sip_status/root.php +++ b/app/sip_status/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/sql_query/root.php b/app/sql_query/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/sql_query/root.php +++ b/app/sql_query/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/system/root.php b/app/system/root.php index 321ba2ea9b..90a856f3a9 100644 --- a/app/system/root.php +++ b/app/system/root.php @@ -22,7 +22,6 @@ Contributor(s): Mark J Crane - Matthew Vale */ // make sure the PATH_SEPARATOR is defined diff --git a/app/time_conditions/root.php b/app/time_conditions/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/time_conditions/root.php +++ b/app/time_conditions/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/traffic_graph/root.php b/app/traffic_graph/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/traffic_graph/root.php +++ b/app/traffic_graph/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/vars/root.php b/app/vars/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/vars/root.php +++ b/app/vars/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/voicemail_greetings/root.php b/app/voicemail_greetings/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/voicemail_greetings/root.php +++ b/app/voicemail_greetings/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/voicemails/root.php b/app/voicemails/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/voicemails/root.php +++ b/app/voicemails/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/app/xml_cdr/root.php b/app/xml_cdr/root.php index 7b882438ea..90a856f3a9 100644 --- a/app/xml_cdr/root.php +++ b/app/xml_cdr/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/core/apps/root.php b/core/apps/root.php index 7b882438ea..90a856f3a9 100644 --- a/core/apps/root.php +++ b/core/apps/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/core/databases/root.php b/core/databases/root.php index 7b882438ea..90a856f3a9 100644 --- a/core/databases/root.php +++ b/core/databases/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/core/default_settings/root.php b/core/default_settings/root.php index 7b882438ea..90a856f3a9 100644 --- a/core/default_settings/root.php +++ b/core/default_settings/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/core/domain_settings/root.php b/core/domain_settings/root.php index 7b882438ea..90a856f3a9 100644 --- a/core/domain_settings/root.php +++ b/core/domain_settings/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/core/install/root.php b/core/install/root.php index 884d2b08a3..90a856f3a9 100644 --- a/core/install/root.php +++ b/core/install/root.php @@ -1,50 +1,65 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// make sure the PATH_SEPARATOR is defined - if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } - } - -// make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; - -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); - } - + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +// make sure the PATH_SEPARATOR is defined + if (!defined("PATH_SEPARATOR")) { + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } + } + +// make sure the document_root is set + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); + +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); + } + ?> \ No newline at end of file diff --git a/core/menu/root.php b/core/menu/root.php index 7b882438ea..90a856f3a9 100644 --- a/core/menu/root.php +++ b/core/menu/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/core/notifications/root.php b/core/notifications/root.php index 7b882438ea..90a856f3a9 100644 --- a/core/notifications/root.php +++ b/core/notifications/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/core/upgrade/root.php b/core/upgrade/root.php index 7b882438ea..90a856f3a9 100644 --- a/core/upgrade/root.php +++ b/core/upgrade/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/core/user_settings/root.php b/core/user_settings/root.php index c7906e24a5..90a856f3a9 100644 --- a/core/user_settings/root.php +++ b/core/user_settings/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } -?> +?> \ No newline at end of file diff --git a/core/users/root.php b/core/users/root.php index 7b882438ea..90a856f3a9 100644 --- a/core/users/root.php +++ b/core/users/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/resources/captcha/root.php b/resources/captcha/root.php index cf38657a09..90a856f3a9 100644 --- a/resources/captcha/root.php +++ b/resources/captcha/root.php @@ -23,26 +23,43 @@ Contributor(s): Mark J Crane */ + // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - define('PROJECT_PATH', '/fusionpbx'); - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - define('PROJECT_PATH', ''); - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/resources/classes/root.php b/resources/classes/root.php index 7b882438ea..90a856f3a9 100644 --- a/resources/classes/root.php +++ b/resources/classes/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/resources/root.php b/resources/root.php index c7906e24a5..90a856f3a9 100644 --- a/resources/root.php +++ b/resources/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } -?> +?> \ No newline at end of file diff --git a/root.php b/root.php index 7b882438ea..90a856f3a9 100644 --- a/root.php +++ b/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/secure/root.php b/secure/root.php index 7b882438ea..90a856f3a9 100644 --- a/secure/root.php +++ b/secure/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/themes/accessible/root.php b/themes/accessible/root.php index 7b882438ea..90a856f3a9 100644 --- a/themes/accessible/root.php +++ b/themes/accessible/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/themes/enhanced/root.php b/themes/enhanced/root.php index 7b882438ea..90a856f3a9 100644 --- a/themes/enhanced/root.php +++ b/themes/enhanced/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file diff --git a/themes/minimized/root.php b/themes/minimized/root.php index 7b882438ea..90a856f3a9 100644 --- a/themes/minimized/root.php +++ b/themes/minimized/root.php @@ -26,25 +26,40 @@ // make sure the PATH_SEPARATOR is defined if (!defined("PATH_SEPARATOR")) { - if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); } + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } } // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - //echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."
\n"; - //echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."
\n"; - //echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."
\n"; + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// if the project directory exists then add it to the include path otherwise add the document root to the include path - if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){ - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' ); - } - else { - if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); } - set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { + define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= DIRECTORY_SEPARATOR . $dirs[$i]; + if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); } ?> \ No newline at end of file From a2c845b2c933c33d50785c47ceec0287912a04df Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Fri, 8 Jan 2016 10:57:09 +0000 Subject: [PATCH 05/31] Changed upgrade to use PROJECT_ROOT instead --- core/upgrade/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/upgrade/index.php b/core/upgrade/index.php index 898d3a912d..7106b320ed 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -52,7 +52,7 @@ if (sizeof($_POST) > 0) { // run source update if ($do["source"] && permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx")) { - chdir($_SERVER["DOCUMENT_ROOT"]); + chdir($_SERVER["PROJECT_ROOT"]); exec("git pull", $response_source_update); $update_failed = true; if (sizeof($response_source_update) > 0) { From b81748bd22bbce5a785af19ae06a3ca5770b0bec Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Tue, 12 Jan 2016 14:37:15 +0000 Subject: [PATCH 06/31] change to use '/' instead of DIRECTOR_SEPERATOR --- app/access_controls/root.php | 12 ++++++------ app/adminer/root.php | 12 ++++++------ app/backup/root.php | 12 ++++++------ app/call_block/root.php | 12 ++++++------ app/call_broadcast/root.php | 12 ++++++------ app/call_center_active/root.php | 12 ++++++------ app/call_centers/root.php | 12 ++++++------ app/call_flows/root.php | 12 ++++++------ app/calls/root.php | 12 ++++++------ app/calls_active/root.php | 12 ++++++------ app/click_to_call/root.php | 12 ++++++------ app/conference_centers/root.php | 12 ++++++------ app/conferences/root.php | 12 ++++++------ app/conferences_active/root.php | 12 ++++++------ app/contacts/root.php | 12 ++++++------ app/destinations/root.php | 12 ++++++------ app/devices/root.php | 12 ++++++------ app/dialplan/root.php | 12 ++++++------ app/dialplan_inbound/root.php | 12 ++++++------ app/dialplan_outbound/root.php | 12 ++++++------ app/edit/root.php | 12 ++++++------ app/emails/root.php | 12 ++++++------ app/exec/root.php | 12 ++++++------ app/extensions/root.php | 12 ++++++------ app/fax/root.php | 12 ++++++------ app/fifo/root.php | 12 ++++++------ app/fifo_list/root.php | 12 ++++++------ app/follow_me/root.php | 12 ++++++------ app/gateways/root.php | 12 ++++++------ app/ivr_menus/root.php | 12 ++++++------ app/log_viewer/root.php | 12 ++++++------ app/modules/root.php | 12 ++++++------ app/music_on_hold/root.php | 12 ++++++------ app/operator_panel/root.php | 12 ++++++------ app/phrases/root.php | 12 ++++++------ app/provision/root.php | 12 ++++++------ app/recordings/root.php | 12 ++++++------ app/registrations/root.php | 12 ++++++------ app/ring_groups/root.php | 12 ++++++------ app/services/root.php | 12 ++++++------ app/settings/root.php | 12 ++++++------ app/sip_profiles/root.php | 12 ++++++------ app/sip_status/root.php | 12 ++++++------ app/sql_query/root.php | 12 ++++++------ app/system/root.php | 12 ++++++------ app/time_conditions/root.php | 12 ++++++------ app/traffic_graph/root.php | 12 ++++++------ app/vars/root.php | 12 ++++++------ app/voicemail_greetings/root.php | 12 ++++++------ app/voicemails/root.php | 12 ++++++------ app/xml_cdr/root.php | 12 ++++++------ core/apps/root.php | 12 ++++++------ core/databases/root.php | 12 ++++++------ core/default_settings/root.php | 12 ++++++------ core/domain_settings/root.php | 12 ++++++------ core/install/root.php | 12 ++++++------ core/menu/root.php | 12 ++++++------ core/notifications/root.php | 12 ++++++------ core/upgrade/root.php | 12 ++++++------ core/user_settings/root.php | 12 ++++++------ core/users/root.php | 12 ++++++------ resources/captcha/root.php | 12 ++++++------ resources/classes/root.php | 12 ++++++------ resources/root.php | 12 ++++++------ root.php | 12 ++++++------ secure/root.php | 12 ++++++------ themes/accessible/root.php | 12 ++++++------ themes/enhanced/root.php | 12 ++++++------ themes/minimized/root.php | 12 ++++++------ 69 files changed, 414 insertions(+), 414 deletions(-) diff --git a/app/access_controls/root.php b/app/access_controls/root.php index 90a856f3a9..7b68178790 100644 --- a/app/access_controls/root.php +++ b/app/access_controls/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/adminer/root.php b/app/adminer/root.php index 90a856f3a9..7b68178790 100644 --- a/app/adminer/root.php +++ b/app/adminer/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/backup/root.php b/app/backup/root.php index 90a856f3a9..7b68178790 100755 --- a/app/backup/root.php +++ b/app/backup/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/call_block/root.php b/app/call_block/root.php index 90a856f3a9..7b68178790 100644 --- a/app/call_block/root.php +++ b/app/call_block/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/call_broadcast/root.php b/app/call_broadcast/root.php index 90a856f3a9..7b68178790 100644 --- a/app/call_broadcast/root.php +++ b/app/call_broadcast/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/call_center_active/root.php b/app/call_center_active/root.php index 90a856f3a9..7b68178790 100644 --- a/app/call_center_active/root.php +++ b/app/call_center_active/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/call_centers/root.php b/app/call_centers/root.php index 90a856f3a9..7b68178790 100644 --- a/app/call_centers/root.php +++ b/app/call_centers/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/call_flows/root.php b/app/call_flows/root.php index 90a856f3a9..7b68178790 100644 --- a/app/call_flows/root.php +++ b/app/call_flows/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/calls/root.php b/app/calls/root.php index 90a856f3a9..7b68178790 100644 --- a/app/calls/root.php +++ b/app/calls/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/calls_active/root.php b/app/calls_active/root.php index 90a856f3a9..7b68178790 100644 --- a/app/calls_active/root.php +++ b/app/calls_active/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/click_to_call/root.php b/app/click_to_call/root.php index 90a856f3a9..7b68178790 100644 --- a/app/click_to_call/root.php +++ b/app/click_to_call/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/conference_centers/root.php b/app/conference_centers/root.php index 90a856f3a9..7b68178790 100644 --- a/app/conference_centers/root.php +++ b/app/conference_centers/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/conferences/root.php b/app/conferences/root.php index 90a856f3a9..7b68178790 100644 --- a/app/conferences/root.php +++ b/app/conferences/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/conferences_active/root.php b/app/conferences_active/root.php index 90a856f3a9..7b68178790 100644 --- a/app/conferences_active/root.php +++ b/app/conferences_active/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/contacts/root.php b/app/contacts/root.php index 90a856f3a9..7b68178790 100644 --- a/app/contacts/root.php +++ b/app/contacts/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/destinations/root.php b/app/destinations/root.php index 90a856f3a9..7b68178790 100644 --- a/app/destinations/root.php +++ b/app/destinations/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/devices/root.php b/app/devices/root.php index 90a856f3a9..7b68178790 100644 --- a/app/devices/root.php +++ b/app/devices/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/dialplan/root.php b/app/dialplan/root.php index 90a856f3a9..7b68178790 100644 --- a/app/dialplan/root.php +++ b/app/dialplan/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/dialplan_inbound/root.php b/app/dialplan_inbound/root.php index 90a856f3a9..7b68178790 100644 --- a/app/dialplan_inbound/root.php +++ b/app/dialplan_inbound/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/dialplan_outbound/root.php b/app/dialplan_outbound/root.php index 90a856f3a9..7b68178790 100644 --- a/app/dialplan_outbound/root.php +++ b/app/dialplan_outbound/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/edit/root.php b/app/edit/root.php index 90a856f3a9..7b68178790 100644 --- a/app/edit/root.php +++ b/app/edit/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/emails/root.php b/app/emails/root.php index 90a856f3a9..7b68178790 100644 --- a/app/emails/root.php +++ b/app/emails/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/exec/root.php b/app/exec/root.php index 90a856f3a9..7b68178790 100644 --- a/app/exec/root.php +++ b/app/exec/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/extensions/root.php b/app/extensions/root.php index 90a856f3a9..7b68178790 100644 --- a/app/extensions/root.php +++ b/app/extensions/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/fax/root.php b/app/fax/root.php index 90a856f3a9..7b68178790 100644 --- a/app/fax/root.php +++ b/app/fax/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/fifo/root.php b/app/fifo/root.php index 90a856f3a9..7b68178790 100644 --- a/app/fifo/root.php +++ b/app/fifo/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/fifo_list/root.php b/app/fifo_list/root.php index 90a856f3a9..7b68178790 100644 --- a/app/fifo_list/root.php +++ b/app/fifo_list/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/follow_me/root.php b/app/follow_me/root.php index 90a856f3a9..7b68178790 100644 --- a/app/follow_me/root.php +++ b/app/follow_me/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/gateways/root.php b/app/gateways/root.php index 90a856f3a9..7b68178790 100644 --- a/app/gateways/root.php +++ b/app/gateways/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/ivr_menus/root.php b/app/ivr_menus/root.php index 90a856f3a9..7b68178790 100644 --- a/app/ivr_menus/root.php +++ b/app/ivr_menus/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/log_viewer/root.php b/app/log_viewer/root.php index 90a856f3a9..7b68178790 100644 --- a/app/log_viewer/root.php +++ b/app/log_viewer/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/modules/root.php b/app/modules/root.php index 90a856f3a9..7b68178790 100644 --- a/app/modules/root.php +++ b/app/modules/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/music_on_hold/root.php b/app/music_on_hold/root.php index 90a856f3a9..7b68178790 100644 --- a/app/music_on_hold/root.php +++ b/app/music_on_hold/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/operator_panel/root.php b/app/operator_panel/root.php index 90a856f3a9..7b68178790 100644 --- a/app/operator_panel/root.php +++ b/app/operator_panel/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/phrases/root.php b/app/phrases/root.php index 90a856f3a9..7b68178790 100644 --- a/app/phrases/root.php +++ b/app/phrases/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/provision/root.php b/app/provision/root.php index 90a856f3a9..7b68178790 100644 --- a/app/provision/root.php +++ b/app/provision/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/recordings/root.php b/app/recordings/root.php index 90a856f3a9..7b68178790 100644 --- a/app/recordings/root.php +++ b/app/recordings/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/registrations/root.php b/app/registrations/root.php index 90a856f3a9..7b68178790 100644 --- a/app/registrations/root.php +++ b/app/registrations/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/ring_groups/root.php b/app/ring_groups/root.php index 90a856f3a9..7b68178790 100644 --- a/app/ring_groups/root.php +++ b/app/ring_groups/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/services/root.php b/app/services/root.php index 90a856f3a9..7b68178790 100644 --- a/app/services/root.php +++ b/app/services/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/settings/root.php b/app/settings/root.php index 90a856f3a9..7b68178790 100644 --- a/app/settings/root.php +++ b/app/settings/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/sip_profiles/root.php b/app/sip_profiles/root.php index 90a856f3a9..7b68178790 100644 --- a/app/sip_profiles/root.php +++ b/app/sip_profiles/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/sip_status/root.php b/app/sip_status/root.php index 90a856f3a9..7b68178790 100644 --- a/app/sip_status/root.php +++ b/app/sip_status/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/sql_query/root.php b/app/sql_query/root.php index 90a856f3a9..7b68178790 100644 --- a/app/sql_query/root.php +++ b/app/sql_query/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/system/root.php b/app/system/root.php index 90a856f3a9..7b68178790 100644 --- a/app/system/root.php +++ b/app/system/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/time_conditions/root.php b/app/time_conditions/root.php index 90a856f3a9..7b68178790 100644 --- a/app/time_conditions/root.php +++ b/app/time_conditions/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/traffic_graph/root.php b/app/traffic_graph/root.php index 90a856f3a9..7b68178790 100644 --- a/app/traffic_graph/root.php +++ b/app/traffic_graph/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/vars/root.php b/app/vars/root.php index 90a856f3a9..7b68178790 100644 --- a/app/vars/root.php +++ b/app/vars/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/voicemail_greetings/root.php b/app/voicemail_greetings/root.php index 90a856f3a9..7b68178790 100644 --- a/app/voicemail_greetings/root.php +++ b/app/voicemail_greetings/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/voicemails/root.php b/app/voicemails/root.php index 90a856f3a9..7b68178790 100644 --- a/app/voicemails/root.php +++ b/app/voicemails/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/app/xml_cdr/root.php b/app/xml_cdr/root.php index 90a856f3a9..7b68178790 100644 --- a/app/xml_cdr/root.php +++ b/app/xml_cdr/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/apps/root.php b/core/apps/root.php index 90a856f3a9..7b68178790 100644 --- a/core/apps/root.php +++ b/core/apps/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/databases/root.php b/core/databases/root.php index 90a856f3a9..7b68178790 100644 --- a/core/databases/root.php +++ b/core/databases/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/default_settings/root.php b/core/default_settings/root.php index 90a856f3a9..7b68178790 100644 --- a/core/default_settings/root.php +++ b/core/default_settings/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/domain_settings/root.php b/core/domain_settings/root.php index 90a856f3a9..7b68178790 100644 --- a/core/domain_settings/root.php +++ b/core/domain_settings/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/install/root.php b/core/install/root.php index 90a856f3a9..7b68178790 100644 --- a/core/install/root.php +++ b/core/install/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/menu/root.php b/core/menu/root.php index 90a856f3a9..7b68178790 100644 --- a/core/menu/root.php +++ b/core/menu/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/notifications/root.php b/core/notifications/root.php index 90a856f3a9..7b68178790 100644 --- a/core/notifications/root.php +++ b/core/notifications/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/upgrade/root.php b/core/upgrade/root.php index 90a856f3a9..7b68178790 100644 --- a/core/upgrade/root.php +++ b/core/upgrade/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/user_settings/root.php b/core/user_settings/root.php index 90a856f3a9..7b68178790 100644 --- a/core/user_settings/root.php +++ b/core/user_settings/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/core/users/root.php b/core/users/root.php index 90a856f3a9..7b68178790 100644 --- a/core/users/root.php +++ b/core/users/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/resources/captcha/root.php b/resources/captcha/root.php index 90a856f3a9..7b68178790 100644 --- a/resources/captcha/root.php +++ b/resources/captcha/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/resources/classes/root.php b/resources/classes/root.php index 90a856f3a9..7b68178790 100644 --- a/resources/classes/root.php +++ b/resources/classes/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/resources/root.php b/resources/root.php index 90a856f3a9..7b68178790 100644 --- a/resources/root.php +++ b/resources/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/root.php b/root.php index 90a856f3a9..7b68178790 100644 --- a/root.php +++ b/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/secure/root.php b/secure/root.php index 90a856f3a9..7b68178790 100644 --- a/secure/root.php +++ b/secure/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/themes/accessible/root.php b/themes/accessible/root.php index 90a856f3a9..7b68178790 100644 --- a/themes/accessible/root.php +++ b/themes/accessible/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/themes/enhanced/root.php b/themes/enhanced/root.php index 90a856f3a9..7b68178790 100644 --- a/themes/enhanced/root.php +++ b/themes/enhanced/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; diff --git a/themes/minimized/root.php b/themes/minimized/root.php index 90a856f3a9..7b68178790 100644 --- a/themes/minimized/root.php +++ b/themes/minimized/root.php @@ -34,23 +34,23 @@ } // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]); + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'fusionpbx')) { - define('PROJECT_PATH', DIRECTORY_SEPARATOR . 'fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . DIRECTORY_SEPARATOR . 'README.md')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $i = 1; $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { - $path .= DIRECTORY_SEPARATOR . $dirs[$i]; - if (file_exists($path . DIRECTORY_SEPARATOR . 'README.md')) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/README.md')) { break; } $i++; From bc78f557a97691e2453bd754c4ff931bb90b162c Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 13 Jan 2016 10:40:21 +0300 Subject: [PATCH 07/31] Add. Example of how run fax queue monitor. --- .../templates/conf/autoload_configs/lua.conf.xml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/resources/templates/conf/autoload_configs/lua.conf.xml b/resources/templates/conf/autoload_configs/lua.conf.xml index 534505dc3b..49326fea81 100644 --- a/resources/templates/conf/autoload_configs/lua.conf.xml +++ b/resources/templates/conf/autoload_configs/lua.conf.xml @@ -19,12 +19,14 @@ - - + + + + From 173ae7001d8092fc578fe723fc4aeaca5a187eed Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Wed, 13 Jan 2016 11:47:07 +0000 Subject: [PATCH 08/31] Added full logic to support cli as well --- .project.ROOT | 0 app/access_controls/root.php | 28 +++++- app/adminer/root.php | 28 +++++- app/backup/root.php | 28 +++++- app/call_block/root.php | 28 +++++- app/call_broadcast/root.php | 28 +++++- app/call_center_active/root.php | 28 +++++- app/call_centers/root.php | 28 +++++- app/call_flows/root.php | 28 +++++- app/calls/root.php | 28 +++++- app/calls_active/root.php | 28 +++++- app/click_to_call/root.php | 28 +++++- app/conference_centers/root.php | 28 +++++- app/conferences/root.php | 28 +++++- app/conferences_active/root.php | 28 +++++- app/contacts/root.php | 28 +++++- app/destinations/root.php | 28 +++++- app/devices/root.php | 28 +++++- app/dialplan/root.php | 28 +++++- app/dialplan_inbound/root.php | 28 +++++- app/dialplan_outbound/root.php | 28 +++++- app/edit/root.php | 28 +++++- app/emails/root.php | 28 +++++- app/exec/root.php | 28 +++++- app/extensions/root.php | 28 +++++- app/fax/root.php | 28 +++++- app/fifo/root.php | 28 +++++- app/fifo_list/root.php | 28 +++++- app/follow_me/root.php | 28 +++++- app/gateways/root.php | 28 +++++- app/ivr_menus/root.php | 28 +++++- app/log_viewer/root.php | 28 +++++- app/modules/root.php | 28 +++++- app/music_on_hold/root.php | 28 +++++- app/operator_panel/root.php | 28 +++++- app/phrases/root.php | 28 +++++- app/provision/root.php | 28 +++++- app/recordings/root.php | 28 +++++- app/registrations/root.php | 28 +++++- app/ring_groups/root.php | 28 +++++- app/services/root.php | 28 +++++- app/settings/root.php | 28 +++++- app/sip_profiles/root.php | 28 +++++- app/sip_status/root.php | 28 +++++- app/sql_query/root.php | 28 +++++- app/system/root.php | 28 +++++- app/tenant_settings/app_config.php | 34 +++++++ app/tenant_settings/app_defaults.php | 27 ++++++ app/tenant_settings/app_languages.php | 13 +++ app/tenant_settings/app_menu.php | 22 +++++ app/tenant_settings/root.php | 83 ++++++++++++++++ app/tenant_settings/tenant_settings.php | 123 ++++++++++++++++++++++++ app/time_conditions/root.php | 28 +++++- app/traffic_graph/root.php | 28 +++++- app/vars/root.php | 28 +++++- app/voicemail_greetings/root.php | 28 +++++- app/voicemails/root.php | 28 +++++- app/xml_cdr/root.php | 28 +++++- core/apps/root.php | 28 +++++- core/databases/root.php | 28 +++++- core/default_settings/root.php | 28 +++++- core/domain_settings/root.php | 28 +++++- core/install/root.php | 28 +++++- core/menu/root.php | 28 +++++- core/notifications/root.php | 28 +++++- core/upgrade/root.php | 28 +++++- core/user_settings/root.php | 28 +++++- core/users/root.php | 28 +++++- resources/captcha/root.php | 28 +++++- resources/classes/root.php | 28 +++++- resources/root.php | 28 +++++- root.php | 28 +++++- secure/root.php | 28 +++++- themes/accessible/root.php | 28 +++++- themes/enhanced/root.php | 28 +++++- themes/minimized/root.php | 28 +++++- 76 files changed, 1889 insertions(+), 345 deletions(-) create mode 100644 .project.ROOT create mode 100644 app/tenant_settings/app_config.php create mode 100644 app/tenant_settings/app_defaults.php create mode 100644 app/tenant_settings/app_languages.php create mode 100644 app/tenant_settings/app_menu.php create mode 100644 app/tenant_settings/root.php create mode 100644 app/tenant_settings/tenant_settings.php diff --git a/.project.ROOT b/.project.ROOT new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/access_controls/root.php b/app/access_controls/root.php index 7b68178790..f5570b5609 100644 --- a/app/access_controls/root.php +++ b/app/access_controls/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/adminer/root.php b/app/adminer/root.php index 7b68178790..f5570b5609 100644 --- a/app/adminer/root.php +++ b/app/adminer/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/backup/root.php b/app/backup/root.php index 7b68178790..f5570b5609 100755 --- a/app/backup/root.php +++ b/app/backup/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/call_block/root.php b/app/call_block/root.php index 7b68178790..f5570b5609 100644 --- a/app/call_block/root.php +++ b/app/call_block/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/call_broadcast/root.php b/app/call_broadcast/root.php index 7b68178790..f5570b5609 100644 --- a/app/call_broadcast/root.php +++ b/app/call_broadcast/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/call_center_active/root.php b/app/call_center_active/root.php index 7b68178790..f5570b5609 100644 --- a/app/call_center_active/root.php +++ b/app/call_center_active/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/call_centers/root.php b/app/call_centers/root.php index 7b68178790..f5570b5609 100644 --- a/app/call_centers/root.php +++ b/app/call_centers/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/call_flows/root.php b/app/call_flows/root.php index 7b68178790..f5570b5609 100644 --- a/app/call_flows/root.php +++ b/app/call_flows/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/calls/root.php b/app/calls/root.php index 7b68178790..f5570b5609 100644 --- a/app/calls/root.php +++ b/app/calls/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/calls_active/root.php b/app/calls_active/root.php index 7b68178790..f5570b5609 100644 --- a/app/calls_active/root.php +++ b/app/calls_active/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/click_to_call/root.php b/app/click_to_call/root.php index 7b68178790..f5570b5609 100644 --- a/app/click_to_call/root.php +++ b/app/click_to_call/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/conference_centers/root.php b/app/conference_centers/root.php index 7b68178790..f5570b5609 100644 --- a/app/conference_centers/root.php +++ b/app/conference_centers/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/conferences/root.php b/app/conferences/root.php index 7b68178790..f5570b5609 100644 --- a/app/conferences/root.php +++ b/app/conferences/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/conferences_active/root.php b/app/conferences_active/root.php index 7b68178790..f5570b5609 100644 --- a/app/conferences_active/root.php +++ b/app/conferences_active/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/contacts/root.php b/app/contacts/root.php index 7b68178790..f5570b5609 100644 --- a/app/contacts/root.php +++ b/app/contacts/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/destinations/root.php b/app/destinations/root.php index 7b68178790..f5570b5609 100644 --- a/app/destinations/root.php +++ b/app/destinations/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/devices/root.php b/app/devices/root.php index 7b68178790..f5570b5609 100644 --- a/app/devices/root.php +++ b/app/devices/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/dialplan/root.php b/app/dialplan/root.php index 7b68178790..f5570b5609 100644 --- a/app/dialplan/root.php +++ b/app/dialplan/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/dialplan_inbound/root.php b/app/dialplan_inbound/root.php index 7b68178790..f5570b5609 100644 --- a/app/dialplan_inbound/root.php +++ b/app/dialplan_inbound/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/dialplan_outbound/root.php b/app/dialplan_outbound/root.php index 7b68178790..f5570b5609 100644 --- a/app/dialplan_outbound/root.php +++ b/app/dialplan_outbound/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/edit/root.php b/app/edit/root.php index 7b68178790..f5570b5609 100644 --- a/app/edit/root.php +++ b/app/edit/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/emails/root.php b/app/emails/root.php index 7b68178790..f5570b5609 100644 --- a/app/emails/root.php +++ b/app/emails/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/exec/root.php b/app/exec/root.php index 7b68178790..f5570b5609 100644 --- a/app/exec/root.php +++ b/app/exec/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/extensions/root.php b/app/extensions/root.php index 7b68178790..f5570b5609 100644 --- a/app/extensions/root.php +++ b/app/extensions/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/fax/root.php b/app/fax/root.php index 7b68178790..f5570b5609 100644 --- a/app/fax/root.php +++ b/app/fax/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/fifo/root.php b/app/fifo/root.php index 7b68178790..f5570b5609 100644 --- a/app/fifo/root.php +++ b/app/fifo/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/fifo_list/root.php b/app/fifo_list/root.php index 7b68178790..f5570b5609 100644 --- a/app/fifo_list/root.php +++ b/app/fifo_list/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/follow_me/root.php b/app/follow_me/root.php index 7b68178790..f5570b5609 100644 --- a/app/follow_me/root.php +++ b/app/follow_me/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/gateways/root.php b/app/gateways/root.php index 7b68178790..f5570b5609 100644 --- a/app/gateways/root.php +++ b/app/gateways/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/ivr_menus/root.php b/app/ivr_menus/root.php index 7b68178790..f5570b5609 100644 --- a/app/ivr_menus/root.php +++ b/app/ivr_menus/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/log_viewer/root.php b/app/log_viewer/root.php index 7b68178790..f5570b5609 100644 --- a/app/log_viewer/root.php +++ b/app/log_viewer/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/modules/root.php b/app/modules/root.php index 7b68178790..f5570b5609 100644 --- a/app/modules/root.php +++ b/app/modules/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/music_on_hold/root.php b/app/music_on_hold/root.php index 7b68178790..f5570b5609 100644 --- a/app/music_on_hold/root.php +++ b/app/music_on_hold/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/operator_panel/root.php b/app/operator_panel/root.php index 7b68178790..f5570b5609 100644 --- a/app/operator_panel/root.php +++ b/app/operator_panel/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/phrases/root.php b/app/phrases/root.php index 7b68178790..f5570b5609 100644 --- a/app/phrases/root.php +++ b/app/phrases/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/provision/root.php b/app/provision/root.php index 7b68178790..f5570b5609 100644 --- a/app/provision/root.php +++ b/app/provision/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/recordings/root.php b/app/recordings/root.php index 7b68178790..f5570b5609 100644 --- a/app/recordings/root.php +++ b/app/recordings/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/registrations/root.php b/app/registrations/root.php index 7b68178790..f5570b5609 100644 --- a/app/registrations/root.php +++ b/app/registrations/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/ring_groups/root.php b/app/ring_groups/root.php index 7b68178790..f5570b5609 100644 --- a/app/ring_groups/root.php +++ b/app/ring_groups/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/services/root.php b/app/services/root.php index 7b68178790..f5570b5609 100644 --- a/app/services/root.php +++ b/app/services/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/settings/root.php b/app/settings/root.php index 7b68178790..f5570b5609 100644 --- a/app/settings/root.php +++ b/app/settings/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/sip_profiles/root.php b/app/sip_profiles/root.php index 7b68178790..f5570b5609 100644 --- a/app/sip_profiles/root.php +++ b/app/sip_profiles/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/sip_status/root.php b/app/sip_status/root.php index 7b68178790..f5570b5609 100644 --- a/app/sip_status/root.php +++ b/app/sip_status/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/sql_query/root.php b/app/sql_query/root.php index 7b68178790..f5570b5609 100644 --- a/app/sql_query/root.php +++ b/app/sql_query/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/system/root.php b/app/system/root.php index 7b68178790..f5570b5609 100644 --- a/app/system/root.php +++ b/app/system/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/tenant_settings/app_config.php b/app/tenant_settings/app_config.php new file mode 100644 index 0000000000..96cf025ccd --- /dev/null +++ b/app/tenant_settings/app_config.php @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/app/tenant_settings/app_defaults.php b/app/tenant_settings/app_defaults.php new file mode 100644 index 0000000000..2ac03f6e28 --- /dev/null +++ b/app/tenant_settings/app_defaults.php @@ -0,0 +1,27 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2015 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Matthew Vale +*/ + +?> \ No newline at end of file diff --git a/app/tenant_settings/app_languages.php b/app/tenant_settings/app_languages.php new file mode 100644 index 0000000000..5ec9b9f028 --- /dev/null +++ b/app/tenant_settings/app_languages.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/tenant_settings/app_menu.php b/app/tenant_settings/app_menu.php new file mode 100644 index 0000000000..573d9fb590 --- /dev/null +++ b/app/tenant_settings/app_menu.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/app/tenant_settings/root.php b/app/tenant_settings/root.php new file mode 100644 index 0000000000..f5570b5609 --- /dev/null +++ b/app/tenant_settings/root.php @@ -0,0 +1,83 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +// make sure the PATH_SEPARATOR is defined + if (!defined("PATH_SEPARATOR")) { + if (strpos($_ENV["OS"], "Win") !== false) { + define("PATH_SEPARATOR", ";"); + } else { + define("PATH_SEPARATOR", ":"); + } + } + + // make sure the document_root is set + $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } + $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); +// try to detect if a project path is being used + if (!defined('PROJECT_PATH')) { + if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { + define('PROJECT_PATH', '/fusionpbx'); + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { + define('PROJECT_PATH', ''); + } else { + $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); + $i = 1; + $path = $_SERVER["DOCUMENT_ROOT"]; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); + define('PROJECT_PATH', $project_path); + } + $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); + set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); + } + +?> \ No newline at end of file diff --git a/app/tenant_settings/tenant_settings.php b/app/tenant_settings/tenant_settings.php new file mode 100644 index 0000000000..6f9664579d --- /dev/null +++ b/app/tenant_settings/tenant_settings.php @@ -0,0 +1,123 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2015 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Matthew Vale +*/ +require_once "root.php"; +require_once "resources/require.php"; +require_once "resources/check_auth.php"; +if (permission_exists('tenant_settings_view')) { + //access granted +} +else { + echo "access denied"; + exit; +} +//add multi-lingual support + $language = new text; + $text = $language->get(); + +//header and paging + require_once "resources/header.php"; + $document['title'] = $text['title-tenant_settings']; + require_once "resources/paging.php"; + +//get variables used to control the order + $order_by = $_GET["order_by"]; + $order = $_GET["order"]; + +//copy settings javascript + if (permission_exists("tenant_settings_admin") && count($_SESSION['domains']) > 1) { + echo ""; + } + +//show the content + echo "
"; + echo ""; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
"; + echo " ".$text['header-default_settings'].""; + echo "

"; + echo " ".$text['description-default_settings']; + echo "
"; + echo " \n"; + if (permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) { + echo " "; + echo " "; + echo " \n"; + echo " "; + } + echo " "; + echo "
\n"; + echo "
"; + + +//include the footer + require_once "resources/footer.php"; +?> \ No newline at end of file diff --git a/app/time_conditions/root.php b/app/time_conditions/root.php index 7b68178790..f5570b5609 100644 --- a/app/time_conditions/root.php +++ b/app/time_conditions/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/traffic_graph/root.php b/app/traffic_graph/root.php index 7b68178790..f5570b5609 100644 --- a/app/traffic_graph/root.php +++ b/app/traffic_graph/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/vars/root.php b/app/vars/root.php index 7b68178790..f5570b5609 100644 --- a/app/vars/root.php +++ b/app/vars/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/voicemail_greetings/root.php b/app/voicemail_greetings/root.php index 7b68178790..f5570b5609 100644 --- a/app/voicemail_greetings/root.php +++ b/app/voicemail_greetings/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/voicemails/root.php b/app/voicemails/root.php index 7b68178790..f5570b5609 100644 --- a/app/voicemails/root.php +++ b/app/voicemails/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/app/xml_cdr/root.php b/app/xml_cdr/root.php index 7b68178790..f5570b5609 100644 --- a/app/xml_cdr/root.php +++ b/app/xml_cdr/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/apps/root.php b/core/apps/root.php index 7b68178790..f5570b5609 100644 --- a/core/apps/root.php +++ b/core/apps/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/databases/root.php b/core/databases/root.php index 7b68178790..f5570b5609 100644 --- a/core/databases/root.php +++ b/core/databases/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/default_settings/root.php b/core/default_settings/root.php index 7b68178790..f5570b5609 100644 --- a/core/default_settings/root.php +++ b/core/default_settings/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/domain_settings/root.php b/core/domain_settings/root.php index 7b68178790..f5570b5609 100644 --- a/core/domain_settings/root.php +++ b/core/domain_settings/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/install/root.php b/core/install/root.php index 7b68178790..f5570b5609 100644 --- a/core/install/root.php +++ b/core/install/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/menu/root.php b/core/menu/root.php index 7b68178790..f5570b5609 100644 --- a/core/menu/root.php +++ b/core/menu/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/notifications/root.php b/core/notifications/root.php index 7b68178790..f5570b5609 100644 --- a/core/notifications/root.php +++ b/core/notifications/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/upgrade/root.php b/core/upgrade/root.php index 7b68178790..f5570b5609 100644 --- a/core/upgrade/root.php +++ b/core/upgrade/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/user_settings/root.php b/core/user_settings/root.php index 7b68178790..f5570b5609 100644 --- a/core/user_settings/root.php +++ b/core/user_settings/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/core/users/root.php b/core/users/root.php index 7b68178790..f5570b5609 100644 --- a/core/users/root.php +++ b/core/users/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/resources/captcha/root.php b/resources/captcha/root.php index 7b68178790..f5570b5609 100644 --- a/resources/captcha/root.php +++ b/resources/captcha/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/resources/classes/root.php b/resources/classes/root.php index 7b68178790..f5570b5609 100644 --- a/resources/classes/root.php +++ b/resources/classes/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/resources/root.php b/resources/root.php index 7b68178790..f5570b5609 100644 --- a/resources/root.php +++ b/resources/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/root.php b/root.php index 7b68178790..f5570b5609 100644 --- a/root.php +++ b/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/secure/root.php b/secure/root.php index 7b68178790..f5570b5609 100644 --- a/secure/root.php +++ b/secure/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/themes/accessible/root.php b/themes/accessible/root.php index 7b68178790..f5570b5609 100644 --- a/themes/accessible/root.php +++ b/themes/accessible/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/themes/enhanced/root.php b/themes/enhanced/root.php index 7b68178790..f5570b5609 100644 --- a/themes/enhanced/root.php +++ b/themes/enhanced/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; diff --git a/themes/minimized/root.php b/themes/minimized/root.php index 7b68178790..f5570b5609 100644 --- a/themes/minimized/root.php +++ b/themes/minimized/root.php @@ -33,16 +33,34 @@ } } -// make sure the document_root is set + // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + if(PHP_SAPI == 'cli'){ + $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); + $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); + if (file_exists('/.project.ROOT')) { + $path = '/'; + } else { + $i = 1; + $path = ''; + while ($i < count($dirs)) { + $path .= '/' . $dirs[$i]; + if (file_exists($path. '/.project.ROOT')) { + break; + } + $i++; + } + } + $_SERVER["DOCUMENT_ROOT"] = $path; + }else{ + $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); + } $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); - // try to detect if a project path is being used if (!defined('PROJECT_PATH')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/README.md')) { + } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { define('PROJECT_PATH', ''); } else { $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); @@ -50,7 +68,7 @@ $path = $_SERVER["DOCUMENT_ROOT"]; while ($i < count($dirs)) { $path .= '/' . $dirs[$i]; - if (file_exists($path. '/README.md')) { + if (file_exists($path. '/.project.ROOT')) { break; } $i++; From 73b3afe5064109737dcf9188e83b2110715f6c26 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 13 Jan 2016 16:26:55 -0700 Subject: [PATCH 09/31] Add an option for toll allow and call group select list. --- app/extensions/extension_edit.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index a31b0d5b29..3bafa7c894 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -1645,7 +1645,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " ".$text['label-toll_allow']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (is_array($_SESSION['toll allow']['name'])) { + echo " \n"; + } + else { + echo " \n"; + } echo "
\n"; echo $text['description-toll_allow']."\n"; echo "\n"; @@ -1668,7 +1678,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " ".$text['label-call_group']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (is_array($_SESSION['toll allow']['name'])) { + echo " \n"; + } else { + echo " \n"; + } echo "
\n"; echo $text['description-call_group']."\n"; echo "\n"; From e186172b6fbf38e9d9878952364e8f5f748fb95d Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 13 Jan 2016 16:40:26 -0700 Subject: [PATCH 10/31] Use call group singular instead of plural. --- app/extensions/extension_edit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 3bafa7c894..a4ab457a6d 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -1678,10 +1678,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " ".$text['label-call_group']."\n"; echo "\n"; echo "\n"; - if (is_array($_SESSION['toll allow']['name'])) { + if (is_array($_SESSION['call group']['name'])) { echo " \n"; From b40415c53f9924f73fbc0e36ad4de2ee9d23d1a7 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 13 Jan 2016 17:57:25 -0700 Subject: [PATCH 11/31] If the call group or toll allow have a value set set selected. --- app/extensions/extension_edit.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index a4ab457a6d..5f7cd3c442 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -1646,10 +1646,15 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; if (is_array($_SESSION['toll allow']['name'])) { - echo " \n"; echo " \n"; foreach ($_SESSION['toll allow']['name'] as $name) { - echo " \n"; + if ($_SESSION['call group']['name'] == $call_group) { + echo " \n"; + } + else { + echo " \n"; + } } echo " \n"; } @@ -1679,10 +1684,15 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; if (is_array($_SESSION['call group']['name'])) { - echo " \n"; echo " \n"; foreach ($_SESSION['call group']['name'] as $name) { - echo " \n"; + if ($_SESSION['call group']['name'] == $call_group) { + echo " \n"; + } + else { + echo " \n"; + } } echo " \n"; } else { From 355bec91a255235eec68278a90ebf169a45ed079 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 14 Jan 2016 16:15:41 +0000 Subject: [PATCH 12/31] changed text.php to use $_SERVER["PROJECT_ROOT"] --- resources/classes/text.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/classes/text.php b/resources/classes/text.php index d82bb9449b..cbfce3ae1e 100644 --- a/resources/classes/text.php +++ b/resources/classes/text.php @@ -31,11 +31,11 @@ class text { public function get($language_code = null, $app_path = null, $exclude_global = false) { //get the global app_languages.php if(!$exclude_global){ - include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/app_languages.php"; + include $_SERVER["PROJECT_ROOT"]."/resources/app_languages.php"; } //get the app_languages.php if ($app_path != null) { - $lang_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/".$app_path."/app_languages.php"; + $lang_path = $_SERVER["PROJECT_ROOT"]."/".$app_path."/app_languages.php"; } else { $lang_path = getcwd().'/app_languages.php'; From b20a38f4548b1d706a7cf18fc398a55301fa8b67 Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Thu, 14 Jan 2016 16:25:05 +0000 Subject: [PATCH 13/31] added logic in cli mode to chdir to the correct directory first the webserver would normally do this for us, but we need to do it --- app/access_controls/root.php | 1 + app/adminer/root.php | 1 + app/backup/root.php | 1 + app/call_block/root.php | 1 + app/call_broadcast/root.php | 1 + app/call_center_active/root.php | 1 + app/call_centers/root.php | 1 + app/call_flows/root.php | 1 + app/calls/root.php | 1 + app/calls_active/root.php | 1 + app/click_to_call/root.php | 1 + app/conference_centers/root.php | 1 + app/conferences/root.php | 1 + app/conferences_active/root.php | 1 + app/contacts/root.php | 1 + app/destinations/root.php | 1 + app/devices/root.php | 1 + app/dialplan/root.php | 1 + app/dialplan_inbound/root.php | 1 + app/dialplan_outbound/root.php | 1 + app/edit/root.php | 1 + app/emails/root.php | 1 + app/exec/root.php | 1 + app/extensions/root.php | 1 + app/fax/root.php | 1 + app/fifo/root.php | 1 + app/fifo_list/root.php | 1 + app/follow_me/root.php | 1 + app/gateways/root.php | 1 + app/ivr_menus/root.php | 1 + app/log_viewer/root.php | 1 + app/modules/root.php | 1 + app/music_on_hold/root.php | 1 + app/operator_panel/root.php | 1 + app/phrases/root.php | 1 + app/provision/root.php | 1 + app/recordings/root.php | 1 + app/registrations/root.php | 1 + app/ring_groups/root.php | 1 + app/services/root.php | 1 + app/settings/root.php | 1 + app/sip_profiles/root.php | 1 + app/sip_status/root.php | 1 + app/sql_query/root.php | 1 + app/system/root.php | 1 + app/tenant_settings/root.php | 1 + app/time_conditions/root.php | 1 + app/traffic_graph/root.php | 1 + app/vars/root.php | 1 + app/voicemail_greetings/root.php | 1 + app/voicemails/root.php | 1 + app/xml_cdr/root.php | 1 + core/apps/root.php | 1 + core/databases/root.php | 1 + core/default_settings/root.php | 1 + core/domain_settings/root.php | 1 + core/install/root.php | 1 + core/menu/root.php | 1 + core/notifications/root.php | 1 + core/upgrade/root.php | 1 + core/user_settings/root.php | 1 + core/users/root.php | 1 + resources/captcha/root.php | 1 + resources/classes/root.php | 1 + resources/root.php | 1 + root.php | 1 + secure/root.php | 1 + themes/accessible/root.php | 1 + themes/enhanced/root.php | 1 + themes/minimized/root.php | 1 + 70 files changed, 70 insertions(+) diff --git a/app/access_controls/root.php b/app/access_controls/root.php index f5570b5609..899238f027 100644 --- a/app/access_controls/root.php +++ b/app/access_controls/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/adminer/root.php b/app/adminer/root.php index f5570b5609..899238f027 100644 --- a/app/adminer/root.php +++ b/app/adminer/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/backup/root.php b/app/backup/root.php index f5570b5609..899238f027 100755 --- a/app/backup/root.php +++ b/app/backup/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/call_block/root.php b/app/call_block/root.php index f5570b5609..899238f027 100644 --- a/app/call_block/root.php +++ b/app/call_block/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/call_broadcast/root.php b/app/call_broadcast/root.php index f5570b5609..899238f027 100644 --- a/app/call_broadcast/root.php +++ b/app/call_broadcast/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/call_center_active/root.php b/app/call_center_active/root.php index f5570b5609..899238f027 100644 --- a/app/call_center_active/root.php +++ b/app/call_center_active/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/call_centers/root.php b/app/call_centers/root.php index f5570b5609..899238f027 100644 --- a/app/call_centers/root.php +++ b/app/call_centers/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/call_flows/root.php b/app/call_flows/root.php index f5570b5609..899238f027 100644 --- a/app/call_flows/root.php +++ b/app/call_flows/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/calls/root.php b/app/calls/root.php index f5570b5609..899238f027 100644 --- a/app/calls/root.php +++ b/app/calls/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/calls_active/root.php b/app/calls_active/root.php index f5570b5609..899238f027 100644 --- a/app/calls_active/root.php +++ b/app/calls_active/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/click_to_call/root.php b/app/click_to_call/root.php index f5570b5609..899238f027 100644 --- a/app/click_to_call/root.php +++ b/app/click_to_call/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/conference_centers/root.php b/app/conference_centers/root.php index f5570b5609..899238f027 100644 --- a/app/conference_centers/root.php +++ b/app/conference_centers/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/conferences/root.php b/app/conferences/root.php index f5570b5609..899238f027 100644 --- a/app/conferences/root.php +++ b/app/conferences/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/conferences_active/root.php b/app/conferences_active/root.php index f5570b5609..899238f027 100644 --- a/app/conferences_active/root.php +++ b/app/conferences_active/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/contacts/root.php b/app/contacts/root.php index f5570b5609..899238f027 100644 --- a/app/contacts/root.php +++ b/app/contacts/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/destinations/root.php b/app/destinations/root.php index f5570b5609..899238f027 100644 --- a/app/destinations/root.php +++ b/app/destinations/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/devices/root.php b/app/devices/root.php index f5570b5609..899238f027 100644 --- a/app/devices/root.php +++ b/app/devices/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/dialplan/root.php b/app/dialplan/root.php index f5570b5609..899238f027 100644 --- a/app/dialplan/root.php +++ b/app/dialplan/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/dialplan_inbound/root.php b/app/dialplan_inbound/root.php index f5570b5609..899238f027 100644 --- a/app/dialplan_inbound/root.php +++ b/app/dialplan_inbound/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/dialplan_outbound/root.php b/app/dialplan_outbound/root.php index f5570b5609..899238f027 100644 --- a/app/dialplan_outbound/root.php +++ b/app/dialplan_outbound/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/edit/root.php b/app/edit/root.php index f5570b5609..899238f027 100644 --- a/app/edit/root.php +++ b/app/edit/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/emails/root.php b/app/emails/root.php index f5570b5609..899238f027 100644 --- a/app/emails/root.php +++ b/app/emails/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/exec/root.php b/app/exec/root.php index f5570b5609..899238f027 100644 --- a/app/exec/root.php +++ b/app/exec/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/extensions/root.php b/app/extensions/root.php index f5570b5609..899238f027 100644 --- a/app/extensions/root.php +++ b/app/extensions/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/fax/root.php b/app/fax/root.php index f5570b5609..899238f027 100644 --- a/app/fax/root.php +++ b/app/fax/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/fifo/root.php b/app/fifo/root.php index f5570b5609..899238f027 100644 --- a/app/fifo/root.php +++ b/app/fifo/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/fifo_list/root.php b/app/fifo_list/root.php index f5570b5609..899238f027 100644 --- a/app/fifo_list/root.php +++ b/app/fifo_list/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/follow_me/root.php b/app/follow_me/root.php index f5570b5609..899238f027 100644 --- a/app/follow_me/root.php +++ b/app/follow_me/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/gateways/root.php b/app/gateways/root.php index f5570b5609..899238f027 100644 --- a/app/gateways/root.php +++ b/app/gateways/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/ivr_menus/root.php b/app/ivr_menus/root.php index f5570b5609..899238f027 100644 --- a/app/ivr_menus/root.php +++ b/app/ivr_menus/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/log_viewer/root.php b/app/log_viewer/root.php index f5570b5609..899238f027 100644 --- a/app/log_viewer/root.php +++ b/app/log_viewer/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/modules/root.php b/app/modules/root.php index f5570b5609..899238f027 100644 --- a/app/modules/root.php +++ b/app/modules/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/music_on_hold/root.php b/app/music_on_hold/root.php index f5570b5609..899238f027 100644 --- a/app/music_on_hold/root.php +++ b/app/music_on_hold/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/operator_panel/root.php b/app/operator_panel/root.php index f5570b5609..899238f027 100644 --- a/app/operator_panel/root.php +++ b/app/operator_panel/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/phrases/root.php b/app/phrases/root.php index f5570b5609..899238f027 100644 --- a/app/phrases/root.php +++ b/app/phrases/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/provision/root.php b/app/provision/root.php index f5570b5609..899238f027 100644 --- a/app/provision/root.php +++ b/app/provision/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/recordings/root.php b/app/recordings/root.php index f5570b5609..899238f027 100644 --- a/app/recordings/root.php +++ b/app/recordings/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/registrations/root.php b/app/registrations/root.php index f5570b5609..899238f027 100644 --- a/app/registrations/root.php +++ b/app/registrations/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/ring_groups/root.php b/app/ring_groups/root.php index f5570b5609..899238f027 100644 --- a/app/ring_groups/root.php +++ b/app/ring_groups/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/services/root.php b/app/services/root.php index f5570b5609..899238f027 100644 --- a/app/services/root.php +++ b/app/services/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/settings/root.php b/app/settings/root.php index f5570b5609..899238f027 100644 --- a/app/settings/root.php +++ b/app/settings/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/sip_profiles/root.php b/app/sip_profiles/root.php index f5570b5609..899238f027 100644 --- a/app/sip_profiles/root.php +++ b/app/sip_profiles/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/sip_status/root.php b/app/sip_status/root.php index f5570b5609..899238f027 100644 --- a/app/sip_status/root.php +++ b/app/sip_status/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/sql_query/root.php b/app/sql_query/root.php index f5570b5609..899238f027 100644 --- a/app/sql_query/root.php +++ b/app/sql_query/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/system/root.php b/app/system/root.php index f5570b5609..899238f027 100644 --- a/app/system/root.php +++ b/app/system/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/tenant_settings/root.php b/app/tenant_settings/root.php index f5570b5609..899238f027 100644 --- a/app/tenant_settings/root.php +++ b/app/tenant_settings/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/time_conditions/root.php b/app/time_conditions/root.php index f5570b5609..899238f027 100644 --- a/app/time_conditions/root.php +++ b/app/time_conditions/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/traffic_graph/root.php b/app/traffic_graph/root.php index f5570b5609..899238f027 100644 --- a/app/traffic_graph/root.php +++ b/app/traffic_graph/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/vars/root.php b/app/vars/root.php index f5570b5609..899238f027 100644 --- a/app/vars/root.php +++ b/app/vars/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/voicemail_greetings/root.php b/app/voicemail_greetings/root.php index f5570b5609..899238f027 100644 --- a/app/voicemail_greetings/root.php +++ b/app/voicemail_greetings/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/voicemails/root.php b/app/voicemails/root.php index f5570b5609..899238f027 100644 --- a/app/voicemails/root.php +++ b/app/voicemails/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/app/xml_cdr/root.php b/app/xml_cdr/root.php index f5570b5609..899238f027 100644 --- a/app/xml_cdr/root.php +++ b/app/xml_cdr/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/apps/root.php b/core/apps/root.php index f5570b5609..899238f027 100644 --- a/core/apps/root.php +++ b/core/apps/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/databases/root.php b/core/databases/root.php index f5570b5609..899238f027 100644 --- a/core/databases/root.php +++ b/core/databases/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/default_settings/root.php b/core/default_settings/root.php index f5570b5609..899238f027 100644 --- a/core/default_settings/root.php +++ b/core/default_settings/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/domain_settings/root.php b/core/domain_settings/root.php index f5570b5609..899238f027 100644 --- a/core/domain_settings/root.php +++ b/core/domain_settings/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/install/root.php b/core/install/root.php index f5570b5609..899238f027 100644 --- a/core/install/root.php +++ b/core/install/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/menu/root.php b/core/menu/root.php index f5570b5609..899238f027 100644 --- a/core/menu/root.php +++ b/core/menu/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/notifications/root.php b/core/notifications/root.php index f5570b5609..899238f027 100644 --- a/core/notifications/root.php +++ b/core/notifications/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/upgrade/root.php b/core/upgrade/root.php index f5570b5609..899238f027 100644 --- a/core/upgrade/root.php +++ b/core/upgrade/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/user_settings/root.php b/core/user_settings/root.php index f5570b5609..899238f027 100644 --- a/core/user_settings/root.php +++ b/core/user_settings/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/core/users/root.php b/core/users/root.php index f5570b5609..899238f027 100644 --- a/core/users/root.php +++ b/core/users/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/resources/captcha/root.php b/resources/captcha/root.php index f5570b5609..899238f027 100644 --- a/resources/captcha/root.php +++ b/resources/captcha/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/resources/classes/root.php b/resources/classes/root.php index f5570b5609..899238f027 100644 --- a/resources/classes/root.php +++ b/resources/classes/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/resources/root.php b/resources/root.php index f5570b5609..899238f027 100644 --- a/resources/root.php +++ b/resources/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/root.php b/root.php index f5570b5609..899238f027 100644 --- a/root.php +++ b/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/secure/root.php b/secure/root.php index f5570b5609..899238f027 100644 --- a/secure/root.php +++ b/secure/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/themes/accessible/root.php b/themes/accessible/root.php index f5570b5609..899238f027 100644 --- a/themes/accessible/root.php +++ b/themes/accessible/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/themes/enhanced/root.php b/themes/enhanced/root.php index f5570b5609..899238f027 100644 --- a/themes/enhanced/root.php +++ b/themes/enhanced/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { diff --git a/themes/minimized/root.php b/themes/minimized/root.php index f5570b5609..899238f027 100644 --- a/themes/minimized/root.php +++ b/themes/minimized/root.php @@ -36,6 +36,7 @@ // make sure the document_root is set $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); if(PHP_SAPI == 'cli'){ + chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); if (file_exists('/.project.ROOT')) { From 0111fff25b4edf780c9f6e1ba941fc84604a3d5a Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Fri, 15 Jan 2016 10:35:19 +0000 Subject: [PATCH 14/31] BugFixes in languages.lua removed extra ;'s fix file_handle:close to be inside the if null check --- .../xml_handler/resources/scripts/languages/languages.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua b/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua index 7cf04fc700..44bda18a1a 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/languages/languages.lua @@ -125,7 +125,7 @@ if (x > 0) then table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); - table.insert(xml, [[ ]]);; + table.insert(xml, [[ ]]); end table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); @@ -139,7 +139,7 @@ if (x > 0) then table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); - table.insert(xml, [[ ]]);; + table.insert(xml, [[ ]]); end --read root xml language file, parse included xml files @@ -155,8 +155,8 @@ --freeswitch.consoleLog("notice", "file path = "..xml_file_path.."\n"); end end + file_handle:close(); end - file_handle:close(); --iterate array of file paths, get contents of other xml macro files for key, xml_file_path in pairs(xml_file_paths) do From 1502cf15ff45cb1f2a08f63484f13e480af9fe2b Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Fri, 15 Jan 2016 13:43:10 +0000 Subject: [PATCH 15/31] changed protocol to match request --- app/devices/device_edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 93fe7f9721..8bf8d1c9d5 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -553,7 +553,7 @@ require_once "resources/require.php"; else { $domain_name = $_SESSION['domain_name']; } - echo " window.location = 'https://".$domain_name."/app/provision?mac=".$device_mac_address."&file=' + d + '&content_type=application/octet-stream';\n"; + echo " window.location = '".$_SERVER['REQUEST_SCHEME']."://".$domain_name."/app/provision?mac=$device_mac_address&file=' + d + '&content_type=application/octet-stream';\n"; echo " }\n"; echo "\n"; From 8814c414a58ea9ba4ff80f8f77d605a0326d198e Mon Sep 17 00:00:00 2001 From: Matthew Vale Date: Fri, 15 Jan 2016 16:48:37 +0000 Subject: [PATCH 16/31] fix for when running in root and no leading / --- .htaccess | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.htaccess b/.htaccess index 5ac5a06847..948308689e 100644 --- a/.htaccess +++ b/.htaccess @@ -9,18 +9,18 @@ RewriteRule ^(cfg)([A-Fa-f0-9]{12})(\.(xml))$ app/provi RewriteRule ^(m3/settings/)([A-Fa-f0-9]{12})(\.(cfg))?$ app/provision/index.php?mac=$2 [QSA] #Grandstream -RewriteRule ^.*/provision/cfg([A-Fa-f0-9]{12})(\.(xml|cfg))?$ app/provision/?mac=$1 [QSA] +RewriteRule ^(?:.*/)?provision/cfg([A-Fa-f0-9]{12})(\.(xml|cfg))?$ app/provision/?mac=$1 [QSA] #Yealink -RewriteRule ^.*/provision/([A-Fa-f0-9]{12})(\.(xml|cfg))?$ app/provision/index.php?mac=$1 [QSA] +RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})(\.(xml|cfg))?$ app/provision/index.php?mac=$1 [QSA] #Polycom -RewriteRule ^.*/provision/000000000000.cfg$ app/provison/?mac=$1&file={$mac}.cfg [QSA] -RewriteRule ^.*/provision/features.cfg$ app/provision/?mac=$1&file=features.cfg [QSA] -RewriteRule ^.*/provision/([A-Fa-f0-9]{12})-sip.cfg$ app/provision/?mac=$1&file=sip.cfg [QSA] -RewriteRule ^.*/provision/([A-Fa-f0-9]{12})-phone.cfg$ app/provision/?mac=$1 [QSA] -RewriteRule ^.*/provision/([A-Fa-f0-9]{12})-registration.cfg$ app/provision/?mac=$1&file={$mac}-registration.cfg [QSA] -RewriteRule ^.*/provision/([A-Fa-f0-9]{12})-site.cfg$ app/provision/?mac=$1&file=site.cfg [QSA] -RewriteRule ^.*/provision/([A-Fa-f0-9]{12})-web.cfg$ app/provision/?mac=$1&file=web.cfg [QSA] +RewriteRule ^(?:.*/)?provision/000000000000.cfg$ app/provison/?mac=$1&file={$mac}.cfg [QSA] +RewriteRule ^(?:.*/)?provision/features.cfg$ app/provision/?mac=$1&file=features.cfg [QSA] +RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-sip.cfg$ app/provision/?mac=$1&file=sip.cfg [QSA] +RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-phone.cfg$ app/provision/?mac=$1 [QSA] +RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-registration.cfg$ app/provision/?mac=$1&file={$mac}-registration.cfg [QSA] +RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-site.cfg$ app/provision/?mac=$1&file=site.cfg [QSA] +RewriteRule ^(?:.*/)?provision/([A-Fa-f0-9]{12})-web.cfg$ app/provision/?mac=$1&file=web.cfg [QSA] Options -Indexes From e72f24429811a0ac0c16cebeb13bb23ed1394c3d Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 15 Jan 2016 13:36:46 -0700 Subject: [PATCH 17/31] Fix the syntax in the 7940 and 7960 directory-personal.xml configuration. --- resources/templates/provision/cisco/7940/directory-personal.xml | 1 - resources/templates/provision/cisco/7960/directory-personal.xml | 1 - 2 files changed, 2 deletions(-) diff --git a/resources/templates/provision/cisco/7940/directory-personal.xml b/resources/templates/provision/cisco/7940/directory-personal.xml index 2e6750eb98..0ad6f7b2bd 100644 --- a/resources/templates/provision/cisco/7940/directory-personal.xml +++ b/resources/templates/provision/cisco/7940/directory-personal.xml @@ -15,7 +15,6 @@ {$row.phone_extension} {/if} -{/if} {assign var=x value=$x+1} {/foreach} diff --git a/resources/templates/provision/cisco/7960/directory-personal.xml b/resources/templates/provision/cisco/7960/directory-personal.xml index 2e6750eb98..0ad6f7b2bd 100644 --- a/resources/templates/provision/cisco/7960/directory-personal.xml +++ b/resources/templates/provision/cisco/7960/directory-personal.xml @@ -15,7 +15,6 @@ {$row.phone_extension} {/if} -{/if} {assign var=x value=$x+1} {/foreach} From 49f156e6a257e1fa14782ffd9e8a8f1ac44e79ea Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 15 Jan 2016 13:43:40 -0700 Subject: [PATCH 18/31] A few more adjustments for the Cisco 79xx directories. --- .../templates/provision/cisco/7940/directory-extensions.xml | 1 - resources/templates/provision/cisco/7940/directory-personal.xml | 2 ++ .../templates/provision/cisco/7960/directory-extensions.xml | 1 - resources/templates/provision/cisco/7960/directory-personal.xml | 2 ++ 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/templates/provision/cisco/7940/directory-extensions.xml b/resources/templates/provision/cisco/7940/directory-extensions.xml index 91bf7b0550..66d2fc2830 100644 --- a/resources/templates/provision/cisco/7940/directory-extensions.xml +++ b/resources/templates/provision/cisco/7940/directory-extensions.xml @@ -15,7 +15,6 @@ {$row.extension} {/if} -{/if} {assign var=x value=$x+1} {/foreach} diff --git a/resources/templates/provision/cisco/7940/directory-personal.xml b/resources/templates/provision/cisco/7940/directory-personal.xml index 0ad6f7b2bd..49998680f6 100644 --- a/resources/templates/provision/cisco/7940/directory-personal.xml +++ b/resources/templates/provision/cisco/7940/directory-personal.xml @@ -15,9 +15,11 @@ {$row.phone_extension} {/if} +{/if} {assign var=x value=$x+1} {/foreach} + diff --git a/resources/templates/provision/cisco/7960/directory-extensions.xml b/resources/templates/provision/cisco/7960/directory-extensions.xml index 91bf7b0550..66d2fc2830 100644 --- a/resources/templates/provision/cisco/7960/directory-extensions.xml +++ b/resources/templates/provision/cisco/7960/directory-extensions.xml @@ -15,7 +15,6 @@ {$row.extension} {/if} -{/if} {assign var=x value=$x+1} {/foreach} diff --git a/resources/templates/provision/cisco/7960/directory-personal.xml b/resources/templates/provision/cisco/7960/directory-personal.xml index 0ad6f7b2bd..49998680f6 100644 --- a/resources/templates/provision/cisco/7960/directory-personal.xml +++ b/resources/templates/provision/cisco/7960/directory-personal.xml @@ -15,9 +15,11 @@ {$row.phone_extension} {/if} +{/if} {assign var=x value=$x+1} {/foreach} + From 8d5436e607d4dad30d4d1df22bdbca01664f455e Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 15 Jan 2016 13:45:32 -0700 Subject: [PATCH 19/31] Fix the domain_name syntax. --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 354f07ba0b..6ab6459452 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -135,7 +135,7 @@ 1 2 201 - ${domain_name}/app/provision + {$domain_name}/app/provision sipdnld.mitel.com 1 From 97aadbc9c050a1f061620dc815c50d67384fadec Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 15 Jan 2016 14:15:53 -0700 Subject: [PATCH 20/31] Default mitel tftp_config to 2. --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 6 +++--- resources/templates/provision/mitel/5340/MN_{$mac}.cfg | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 6ab6459452..00b2f47796 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -1,6 +1,6 @@ 1 - 1 + {if isset($mitel_tftp_config)}{$mitel_tftp_config}{else}2{/if} 0 1 02.00.00.24 @@ -71,7 +71,7 @@ 0 0 - 16 + 4 0 0 @@ -136,7 +136,7 @@ 2 201 {$domain_name}/app/provision - sipdnld.mitel.com + 1 0 diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index ea1c742f2d..0f6a556b0d 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -1,6 +1,6 @@ 1 - 1 + {if isset($mitel_tftp_config)}{$mitel_tftp_config}{else}2{/if} 0 1 02.00.00.24 From a312ff74157f63e1faa53f5074b24ed2dce5e754 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 15 Jan 2016 14:27:53 -0700 Subject: [PATCH 21/31] Add a line feed to the mitel/5324/MN_{$mac}.cfg template. --- resources/templates/provision/mitel/5324/MN_{$mac}.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 00b2f47796..0a2756b2f7 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -1,7 +1,7 @@ 1 - {if isset($mitel_tftp_config)}{$mitel_tftp_config}{else}2{/if} - 0 + {if isset($mitel_tftp_config)}{$mitel_tftp_config}{else}2 + {/if}0 1 02.00.00.24 R7.2.02.00.00.24 @@ -11,8 +11,8 @@ 5060 0 -1 - {if isset($mitel_vlan_id)}{$mitel_vlan_id}{else}-1{/if} - sip1 + {if isset($mitel_vlan_id)}{$mitel_vlan_id}{else}-1 + {/if}sip1 -example.com 0 0 From c4eca6c3309be608c5b12fa489df7e6fc6132ec1 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 15 Jan 2016 17:09:16 -0700 Subject: [PATCH 22/31] Mitel provisioning add MN_Generic.cfg and update the 5324 and 5340 templates. --- app/provision/MN_Generic.cfg | 12 ++++++++ .../provision/mitel/5324/MN_{$mac}.cfg | 8 ++--- .../provision/mitel/5340/MN_{$mac}.cfg | 30 +++++++++---------- 3 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 app/provision/MN_Generic.cfg diff --git a/app/provision/MN_Generic.cfg b/app/provision/MN_Generic.cfg new file mode 100644 index 0000000000..51f6a5fc44 --- /dev/null +++ b/app/provision/MN_Generic.cfg @@ -0,0 +1,12 @@ + + 2 + voip.fusionpbx.com/app/provision + + + 2 + voip.fusionpbx.com/app/provision + + + 2 + voip.fusionpbx.com/app/provision + \ No newline at end of file diff --git a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg index 0a2756b2f7..032e4ac9b0 100644 --- a/resources/templates/provision/mitel/5324/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5324/MN_{$mac}.cfg @@ -267,13 +267,13 @@ 0 0 - + - + - + - + diff --git a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg index 0f6a556b0d..0cc9e1d55b 100644 --- a/resources/templates/provision/mitel/5340/MN_{$mac}.cfg +++ b/resources/templates/provision/mitel/5340/MN_{$mac}.cfg @@ -1,7 +1,7 @@ 1 - {if isset($mitel_tftp_config)}{$mitel_tftp_config}{else}2{/if} - 0 + {if isset($mitel_tftp_config)}{$mitel_tftp_config}{else}2 + {/if}0 1 02.00.00.24 R7.2.02.00.00.24 @@ -11,8 +11,8 @@ 5060 0 -1 - {if isset($mitel_vlan_id)}{$mitel_vlan_id}{else}-1{/if} - sip1 + {if isset($mitel_vlan_id)}{$mitel_vlan_id}{else}-1 + {/if}sip1 -example.com 0 0 @@ -31,7 +31,7 @@ 1 0 1 - http://rss.news.yahoo.com/rss/topstories + 135.199.77.12 135.199.77.12 128.138.141.172 @@ -71,7 +71,7 @@ 0 0 - 16 + 4 0 0 @@ -135,8 +135,8 @@ 1 2 201 - sipdnld.mitel.com - sipdnld.mitel.com + {$domain_name}/app/provision + 1 0 @@ -267,13 +267,13 @@ 0 0 - + - + - + - + @@ -283,11 +283,11 @@ - + - + - + From 62d15752021fbcc81cc8daa6d6d78e384088d143 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 15 Jan 2016 17:35:00 -0700 Subject: [PATCH 23/31] Make the domain in MN_Generic.cfg dynamic. --- app/provision/MN_Generic.cfg | 12 ------------ .../templates/provision/mitel/5324/MN_Generic.cfg | 12 ++++++++++++ .../templates/provision/mitel/5340/MN_Generic.cfg | 12 ++++++++++++ 3 files changed, 24 insertions(+), 12 deletions(-) delete mode 100644 app/provision/MN_Generic.cfg create mode 100644 resources/templates/provision/mitel/5324/MN_Generic.cfg create mode 100644 resources/templates/provision/mitel/5340/MN_Generic.cfg diff --git a/app/provision/MN_Generic.cfg b/app/provision/MN_Generic.cfg deleted file mode 100644 index 51f6a5fc44..0000000000 --- a/app/provision/MN_Generic.cfg +++ /dev/null @@ -1,12 +0,0 @@ - - 2 - voip.fusionpbx.com/app/provision - - - 2 - voip.fusionpbx.com/app/provision - - - 2 - voip.fusionpbx.com/app/provision - \ No newline at end of file diff --git a/resources/templates/provision/mitel/5324/MN_Generic.cfg b/resources/templates/provision/mitel/5324/MN_Generic.cfg new file mode 100644 index 0000000000..a6c9816c11 --- /dev/null +++ b/resources/templates/provision/mitel/5324/MN_Generic.cfg @@ -0,0 +1,12 @@ + + 2 + {$domain}/app/provision + + + 2 + {$domain}/app/provision + + + 2 + {$domain}/app/provision + \ No newline at end of file diff --git a/resources/templates/provision/mitel/5340/MN_Generic.cfg b/resources/templates/provision/mitel/5340/MN_Generic.cfg new file mode 100644 index 0000000000..a6c9816c11 --- /dev/null +++ b/resources/templates/provision/mitel/5340/MN_Generic.cfg @@ -0,0 +1,12 @@ + + 2 + {$domain}/app/provision + + + 2 + {$domain}/app/provision + + + 2 + {$domain}/app/provision + \ No newline at end of file From a016780684685592c576ae632dcbdb46e4e01a7b Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 15 Jan 2016 17:54:06 -0700 Subject: [PATCH 24/31] Fix the domain name in MN_Generic.cfg. --- resources/templates/provision/mitel/5324/MN_Generic.cfg | 6 +++--- resources/templates/provision/mitel/5340/MN_Generic.cfg | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/templates/provision/mitel/5324/MN_Generic.cfg b/resources/templates/provision/mitel/5324/MN_Generic.cfg index a6c9816c11..5a3c0ee683 100644 --- a/resources/templates/provision/mitel/5324/MN_Generic.cfg +++ b/resources/templates/provision/mitel/5324/MN_Generic.cfg @@ -1,12 +1,12 @@ 2 - {$domain}/app/provision + {$domain_name}/app/provision 2 - {$domain}/app/provision + {$domain_name}/app/provision 2 - {$domain}/app/provision + {$domain_name}/app/provision \ No newline at end of file diff --git a/resources/templates/provision/mitel/5340/MN_Generic.cfg b/resources/templates/provision/mitel/5340/MN_Generic.cfg index a6c9816c11..5a3c0ee683 100644 --- a/resources/templates/provision/mitel/5340/MN_Generic.cfg +++ b/resources/templates/provision/mitel/5340/MN_Generic.cfg @@ -1,12 +1,12 @@ 2 - {$domain}/app/provision + {$domain_name}/app/provision 2 - {$domain}/app/provision + {$domain_name}/app/provision 2 - {$domain}/app/provision + {$domain_name}/app/provision \ No newline at end of file From 2829fefdd295782b017888a6f531641ebfcfcd44 Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Fri, 15 Jan 2016 20:11:38 -0800 Subject: [PATCH 25/31] Update cidlookup.conf.xml --- resources/templates/conf/autoload_configs/cidlookup.conf.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/templates/conf/autoload_configs/cidlookup.conf.xml b/resources/templates/conf/autoload_configs/cidlookup.conf.xml index ff3ac582a1..264f754e92 100644 --- a/resources/templates/conf/autoload_configs/cidlookup.conf.xml +++ b/resources/templates/conf/autoload_configs/cidlookup.conf.xml @@ -5,7 +5,7 @@ - --> + From 1a6d6308c75fd4f96ba92ddf98a3289df5e4620c Mon Sep 17 00:00:00 2001 From: blackc2004 Date: Fri, 15 Jan 2016 20:16:21 -0800 Subject: [PATCH 26/31] Update 980_cidlookup.xml --- app/dialplan/resources/switch/conf/dialplan/980_cidlookup.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/dialplan/resources/switch/conf/dialplan/980_cidlookup.xml b/app/dialplan/resources/switch/conf/dialplan/980_cidlookup.xml index 3ea14028df..6f22e46500 100644 --- a/app/dialplan/resources/switch/conf/dialplan/980_cidlookup.xml +++ b/app/dialplan/resources/switch/conf/dialplan/980_cidlookup.xml @@ -2,7 +2,8 @@ + - \ No newline at end of file + From 285cad06dae726c71e347d1cd6807d04fb35dbec Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 16 Jan 2016 09:44:15 -0700 Subject: [PATCH 27/31] Fix a problem with the provision url path which was caused by a pull request in the last 12 hours. --- app/devices/device_edit.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 8bf8d1c9d5..de92aec84d 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -553,7 +553,14 @@ require_once "resources/require.php"; else { $domain_name = $_SESSION['domain_name']; } - echo " window.location = '".$_SERVER['REQUEST_SCHEME']."://".$domain_name."/app/provision?mac=$device_mac_address&file=' + d + '&content_type=application/octet-stream';\n"; + + if (!isset($_SERVER['HTTP_PROTOCOL'])) { + $_SERVER['HTTP_PROTOCOL'] = 'http'; + if (isset($_SERVER['REQUEST_SCHEME'])) { $_SERVER['HTTP_PROTOCOL'] = $_SERVER['REQUEST_SCHEME']; } + if ($_SERVER['HTTPS'] = 'on') { $_SERVER['HTTP_PROTOCOL'] = 'https'; } + if ($_SERVER['SERVER_PORT'] = '443') { $_SERVER['HTTP_PROTOCOL'] = 'https'; } + } + echo " window.location = '".$_SERVER['HTTP_PROTOCOL']."://".$domain_name."/app/provision?mac=".$device_mac_address."&file=' + d + '&content_type=application/octet-stream';\n"; echo " }\n"; echo "\n"; From 74ca9eb980b45116d5a3c652adf36ff36360d24c Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 16 Jan 2016 09:54:01 -0700 Subject: [PATCH 28/31] Consolidate the SQL Queries for better performance. --- app/provision/resources/classes/provision.php | 8 -------- resources/templates/provision/snom/320/{$mac}.xml | 6 +++--- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 27a828ef0e..4c06d4ca71 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -743,14 +743,6 @@ include "root.php"; } unset ($prep_statement); - //populate internal address book - $sql = "SELECT extension as , effective_caller_id_name, effective_caller_id_number, outbound_caller_id_name, outbound_caller_id_number, directory_full_name FROM v_extensions"; - $prep_statement = $this->db->prepare(check_sql($sql)); - $prep_statement->execute(); - $internal_addressbook = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $view->assign("internal_addressbook",$internal_addressbook); - unset ($prep_statement); - //set the mac address in the correct format $mac = $this->format_mac($mac, $device_vendor); diff --git a/resources/templates/provision/snom/320/{$mac}.xml b/resources/templates/provision/snom/320/{$mac}.xml index 760c5462db..135fcb8e2e 100644 --- a/resources/templates/provision/snom/320/{$mac}.xml +++ b/resources/templates/provision/snom/320/{$mac}.xml @@ -117,11 +117,11 @@ {/foreach} -{foreach $internal_addressbook as $address} +{foreach $extensions as $row} - {$address.extension} + {$row.extension} sip - {$address.directory_full_name} ({$address.extension}) + {$row.directory_full_name} ({$row.extension}) {/foreach} From b67f9dee452ce745673ba0418c6d77eeec73a0a2 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 16 Jan 2016 10:33:46 -0700 Subject: [PATCH 29/31] This doesn't appear to be completed. The developer that created should talk to me about what its purpose is as this seems to duplicate domain settings. --- app/tenant_settings/app_config.php | 34 ------- app/tenant_settings/app_defaults.php | 27 ------ app/tenant_settings/app_languages.php | 13 --- app/tenant_settings/app_menu.php | 22 ----- app/tenant_settings/root.php | 84 ---------------- app/tenant_settings/tenant_settings.php | 123 ------------------------ 6 files changed, 303 deletions(-) delete mode 100644 app/tenant_settings/app_config.php delete mode 100644 app/tenant_settings/app_defaults.php delete mode 100644 app/tenant_settings/app_languages.php delete mode 100644 app/tenant_settings/app_menu.php delete mode 100644 app/tenant_settings/root.php delete mode 100644 app/tenant_settings/tenant_settings.php diff --git a/app/tenant_settings/app_config.php b/app/tenant_settings/app_config.php deleted file mode 100644 index 96cf025ccd..0000000000 --- a/app/tenant_settings/app_config.php +++ /dev/null @@ -1,34 +0,0 @@ - \ No newline at end of file diff --git a/app/tenant_settings/app_defaults.php b/app/tenant_settings/app_defaults.php deleted file mode 100644 index 2ac03f6e28..0000000000 --- a/app/tenant_settings/app_defaults.php +++ /dev/null @@ -1,27 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2015 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Matthew Vale -*/ - -?> \ No newline at end of file diff --git a/app/tenant_settings/app_languages.php b/app/tenant_settings/app_languages.php deleted file mode 100644 index 5ec9b9f028..0000000000 --- a/app/tenant_settings/app_languages.php +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/app/tenant_settings/app_menu.php b/app/tenant_settings/app_menu.php deleted file mode 100644 index 573d9fb590..0000000000 --- a/app/tenant_settings/app_menu.php +++ /dev/null @@ -1,22 +0,0 @@ - \ No newline at end of file diff --git a/app/tenant_settings/root.php b/app/tenant_settings/root.php deleted file mode 100644 index 899238f027..0000000000 --- a/app/tenant_settings/root.php +++ /dev/null @@ -1,84 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// make sure the PATH_SEPARATOR is defined - if (!defined("PATH_SEPARATOR")) { - if (strpos($_ENV["OS"], "Win") !== false) { - define("PATH_SEPARATOR", ";"); - } else { - define("PATH_SEPARATOR", ":"); - } - } - - // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - if(PHP_SAPI == 'cli'){ - chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); - $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); - $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); - if (file_exists('/.project.ROOT')) { - $path = '/'; - } else { - $i = 1; - $path = ''; - while ($i < count($dirs)) { - $path .= '/' . $dirs[$i]; - if (file_exists($path. '/.project.ROOT')) { - break; - } - $i++; - } - } - $_SERVER["DOCUMENT_ROOT"] = $path; - }else{ - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - } - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// try to detect if a project path is being used - if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { - define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) { - define('PROJECT_PATH', ''); - } else { - $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); - $i = 1; - $path = $_SERVER["DOCUMENT_ROOT"]; - while ($i < count($dirs)) { - $path .= '/' . $dirs[$i]; - if (file_exists($path. '/.project.ROOT')) { - break; - } - $i++; - } - $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); - define('PROJECT_PATH', $project_path); - } - $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); - set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); - } - -?> \ No newline at end of file diff --git a/app/tenant_settings/tenant_settings.php b/app/tenant_settings/tenant_settings.php deleted file mode 100644 index 6f9664579d..0000000000 --- a/app/tenant_settings/tenant_settings.php +++ /dev/null @@ -1,123 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2015 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Matthew Vale -*/ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('tenant_settings_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} -//add multi-lingual support - $language = new text; - $text = $language->get(); - -//header and paging - require_once "resources/header.php"; - $document['title'] = $text['title-tenant_settings']; - require_once "resources/paging.php"; - -//get variables used to control the order - $order_by = $_GET["order_by"]; - $order = $_GET["order"]; - -//copy settings javascript - if (permission_exists("tenant_settings_admin") && count($_SESSION['domains']) > 1) { - echo ""; - } - -//show the content - echo ""; - echo ""; - - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
"; - echo " ".$text['header-default_settings'].""; - echo "

"; - echo " ".$text['description-default_settings']; - echo "
"; - echo " \n"; - if (permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) { - echo " "; - echo " "; - echo " \n"; - echo " "; - } - echo " "; - echo "
\n"; - echo "
"; - - -//include the footer - require_once "resources/footer.php"; -?> \ No newline at end of file From afd92882c93954b5165d93fb90f82b3508f56e0f Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 16 Jan 2016 11:58:22 -0700 Subject: [PATCH 30/31] Set the mac address to lower case. --- app/provision/resources/classes/provision.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 4c06d4ca71..06a52de6a4 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -209,7 +209,7 @@ include "root.php"; $prep_statement_2 = $this->db->prepare(check_sql($sql)); if ($prep_statement_2) { //use the prepared statement - $prep_statement_2->bindParam(':mac', $mac); + $prep_statement_2->bindParam(':mac', strtolower($mac)); if($provision['http_domain_filter'] == "true") { $prep_statement_2->bindParam(':domain_uuid', $domain_uuid); } From 3eda2664fdb62bafb486be7cf3fb479c0446b286 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Sat, 16 Jan 2016 12:02:32 -0700 Subject: [PATCH 31/31] Set the mac address to lower case in a different location. --- app/provision/resources/classes/provision.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/provision/resources/classes/provision.php b/app/provision/resources/classes/provision.php index 06a52de6a4..6525c68a0d 100644 --- a/app/provision/resources/classes/provision.php +++ b/app/provision/resources/classes/provision.php @@ -160,6 +160,9 @@ include "root.php"; $mac = $this->mac; $file = $this->file; + //set the mac address to lower case to be consistent with the database + $mac = strtolower($mac); + //get the device template if (strlen($_REQUEST['template']) > 0) { $device_template = $_REQUEST['template']; @@ -209,7 +212,7 @@ include "root.php"; $prep_statement_2 = $this->db->prepare(check_sql($sql)); if ($prep_statement_2) { //use the prepared statement - $prep_statement_2->bindParam(':mac', strtolower($mac)); + $prep_statement_2->bindParam(':mac', $mac); if($provision['http_domain_filter'] == "true") { $prep_statement_2->bindParam(':domain_uuid', $domain_uuid); }