From fd313a7c6690223654de6ff38ea5314d4683aab2 Mon Sep 17 00:00:00 2001 From: "Harry G. Coin" Date: Mon, 25 Apr 2016 21:26:26 -0500 Subject: [PATCH] fixes so cli installs/upgrades work. Also another step along the way allowing freeswitch to run -u -g freeswitch and fusionpbx to run -u -g www-data --- app/access_controls/root.php | 5 ++++- app/adminer/root.php | 5 ++++- app/backup/root.php | 5 ++++- app/call_block/root.php | 5 ++++- app/call_broadcast/root.php | 5 ++++- app/call_center_active/root.php | 5 ++++- app/call_centers/root.php | 5 ++++- app/call_flows/root.php | 5 ++++- app/calls/root.php | 5 ++++- app/calls_active/root.php | 5 ++++- app/click_to_call/root.php | 5 ++++- app/conference_centers/root.php | 5 ++++- app/conferences/root.php | 5 ++++- app/conferences_active/root.php | 5 ++++- app/contacts/root.php | 5 ++++- app/destinations/root.php | 5 ++++- app/devices/root.php | 5 ++++- app/dialplan/root.php | 5 ++++- app/dialplan_inbound/root.php | 5 ++++- app/dialplan_outbound/root.php | 5 ++++- app/edit/root.php | 5 ++++- app/emails/root.php | 5 ++++- app/exec/root.php | 5 ++++- app/extensions/root.php | 5 ++++- app/fax/root.php | 5 ++++- app/fifo/root.php | 5 ++++- app/fifo_list/root.php | 5 ++++- app/follow_me/root.php | 5 ++++- app/gateways/root.php | 5 ++++- app/ivr_menus/root.php | 5 ++++- app/log_viewer/root.php | 5 ++++- app/modules/root.php | 5 ++++- app/music_on_hold/root.php | 5 ++++- app/operator_panel/root.php | 5 ++++- app/phrases/root.php | 5 ++++- app/provision/root.php | 5 ++++- app/recordings/root.php | 5 ++++- app/registrations/root.php | 5 ++++- app/ring_groups/root.php | 5 ++++- app/services/root.php | 5 ++++- app/settings/root.php | 5 ++++- app/sip_profiles/root.php | 5 ++++- app/sip_status/root.php | 5 ++++- app/system/root.php | 5 ++++- app/time_conditions/root.php | 5 ++++- app/traffic_graph/root.php | 5 ++++- app/vars/root.php | 5 ++++- app/voicemail_greetings/root.php | 5 ++++- app/voicemails/root.php | 5 ++++- app/xml_cdr/root.php | 5 ++++- core/apps/root.php | 5 ++++- core/databases/root.php | 5 ++++- core/default_settings/root.php | 5 ++++- core/domain_settings/root.php | 5 ++++- core/install/root.php | 5 ++++- core/menu/root.php | 5 ++++- core/notifications/root.php | 5 ++++- core/upgrade/root.php | 5 ++++- core/upgrade/upgrade.php | 15 +++++++++------ core/upgrade/upgrade_domains.php | 1 + core/user_settings/root.php | 5 ++++- core/users/root.php | 5 ++++- resources/captcha/root.php | 5 ++++- resources/classes/root.php | 5 ++++- resources/root.php | 5 ++++- root.php | 5 ++++- secure/root.php | 5 ++++- themes/default/root.php | 5 ++++- 68 files changed, 274 insertions(+), 72 deletions(-) mode change 100755 => 100644 app/backup/root.php diff --git a/app/access_controls/root.php b/app/access_controls/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/access_controls/root.php +++ b/app/access_controls/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/adminer/root.php b/app/adminer/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/adminer/root.php +++ b/app/adminer/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/backup/root.php b/app/backup/root.php old mode 100755 new mode 100644 index 55f9565d6a..cc8ae3bcff --- a/app/backup/root.php +++ b/app/backup/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/call_block/root.php b/app/call_block/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/call_block/root.php +++ b/app/call_block/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/call_broadcast/root.php b/app/call_broadcast/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/call_broadcast/root.php +++ b/app/call_broadcast/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/call_center_active/root.php b/app/call_center_active/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/call_center_active/root.php +++ b/app/call_center_active/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/call_centers/root.php b/app/call_centers/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/call_centers/root.php +++ b/app/call_centers/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/call_flows/root.php b/app/call_flows/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/call_flows/root.php +++ b/app/call_flows/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/calls/root.php b/app/calls/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/calls/root.php +++ b/app/calls/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/calls_active/root.php b/app/calls_active/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/calls_active/root.php +++ b/app/calls_active/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/click_to_call/root.php b/app/click_to_call/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/click_to_call/root.php +++ b/app/click_to_call/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/conference_centers/root.php b/app/conference_centers/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/conference_centers/root.php +++ b/app/conference_centers/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/conferences/root.php b/app/conferences/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/conferences/root.php +++ b/app/conferences/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/conferences_active/root.php b/app/conferences_active/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/conferences_active/root.php +++ b/app/conferences_active/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/contacts/root.php b/app/contacts/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/contacts/root.php +++ b/app/contacts/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/destinations/root.php b/app/destinations/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/destinations/root.php +++ b/app/destinations/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/devices/root.php b/app/devices/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/devices/root.php +++ b/app/devices/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/dialplan/root.php b/app/dialplan/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/dialplan/root.php +++ b/app/dialplan/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/dialplan_inbound/root.php b/app/dialplan_inbound/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/dialplan_inbound/root.php +++ b/app/dialplan_inbound/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/dialplan_outbound/root.php b/app/dialplan_outbound/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/dialplan_outbound/root.php +++ b/app/dialplan_outbound/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/edit/root.php b/app/edit/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/edit/root.php +++ b/app/edit/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/emails/root.php b/app/emails/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/emails/root.php +++ b/app/emails/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/exec/root.php b/app/exec/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/exec/root.php +++ b/app/exec/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/extensions/root.php b/app/extensions/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/extensions/root.php +++ b/app/extensions/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/fax/root.php b/app/fax/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/fax/root.php +++ b/app/fax/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/fifo/root.php b/app/fifo/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/fifo/root.php +++ b/app/fifo/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/fifo_list/root.php b/app/fifo_list/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/fifo_list/root.php +++ b/app/fifo_list/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/follow_me/root.php b/app/follow_me/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/follow_me/root.php +++ b/app/follow_me/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/gateways/root.php b/app/gateways/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/gateways/root.php +++ b/app/gateways/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/ivr_menus/root.php b/app/ivr_menus/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/ivr_menus/root.php +++ b/app/ivr_menus/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/log_viewer/root.php b/app/log_viewer/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/log_viewer/root.php +++ b/app/log_viewer/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/modules/root.php b/app/modules/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/modules/root.php +++ b/app/modules/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/music_on_hold/root.php b/app/music_on_hold/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/music_on_hold/root.php +++ b/app/music_on_hold/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/operator_panel/root.php b/app/operator_panel/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/operator_panel/root.php +++ b/app/operator_panel/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/phrases/root.php b/app/phrases/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/phrases/root.php +++ b/app/phrases/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/provision/root.php b/app/provision/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/provision/root.php +++ b/app/provision/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/recordings/root.php b/app/recordings/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/recordings/root.php +++ b/app/recordings/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/registrations/root.php b/app/registrations/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/registrations/root.php +++ b/app/registrations/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/ring_groups/root.php b/app/ring_groups/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/ring_groups/root.php +++ b/app/ring_groups/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/services/root.php b/app/services/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/services/root.php +++ b/app/services/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/settings/root.php b/app/settings/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/settings/root.php +++ b/app/settings/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/sip_profiles/root.php b/app/sip_profiles/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/sip_profiles/root.php +++ b/app/sip_profiles/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/sip_status/root.php b/app/sip_status/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/sip_status/root.php +++ b/app/sip_status/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/system/root.php b/app/system/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/system/root.php +++ b/app/system/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/time_conditions/root.php b/app/time_conditions/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/time_conditions/root.php +++ b/app/time_conditions/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/traffic_graph/root.php b/app/traffic_graph/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/traffic_graph/root.php +++ b/app/traffic_graph/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/vars/root.php b/app/vars/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/vars/root.php +++ b/app/vars/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/voicemail_greetings/root.php b/app/voicemail_greetings/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/voicemail_greetings/root.php +++ b/app/voicemail_greetings/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/voicemails/root.php b/app/voicemails/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/voicemails/root.php +++ b/app/voicemails/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/app/xml_cdr/root.php b/app/xml_cdr/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/app/xml_cdr/root.php +++ b/app/xml_cdr/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/apps/root.php b/core/apps/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/apps/root.php +++ b/core/apps/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/databases/root.php b/core/databases/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/databases/root.php +++ b/core/databases/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/default_settings/root.php b/core/default_settings/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/default_settings/root.php +++ b/core/default_settings/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/domain_settings/root.php b/core/domain_settings/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/domain_settings/root.php +++ b/core/domain_settings/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/install/root.php b/core/install/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/install/root.php +++ b/core/install/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/menu/root.php b/core/menu/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/menu/root.php +++ b/core/menu/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/notifications/root.php b/core/notifications/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/notifications/root.php +++ b/core/notifications/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/upgrade/root.php b/core/upgrade/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/upgrade/root.php +++ b/core/upgrade/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/upgrade/upgrade.php b/core/upgrade/upgrade.php index e422b549cb..7de3bbec35 100644 --- a/core/upgrade/upgrade.php +++ b/core/upgrade/upgrade.php @@ -25,14 +25,17 @@ */ //check the permission + if(defined('STDIN')) { - $document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]); - preg_match("/^(.*)\/core\/.*$/", $document_root, $matches); - $document_root = $matches[1]; - set_include_path($document_root); - require_once "resources/require.php"; - $_SERVER["DOCUMENT_ROOT"] = $document_root; +// $document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]); +// preg_match("/^(.*)\/core\/.*$/", $document_root, $matches); +// $document_root = $matches[1]; +// set_include_path($document_root); $format = 'text'; //html, text + include "root.php"; + require_once "resources/require.php"; + +// $_SERVER["DOCUMENT_ROOT"] = $document_root; } else { include "root.php"; diff --git a/core/upgrade/upgrade_domains.php b/core/upgrade/upgrade_domains.php index a4b8e97be9..546646d141 100644 --- a/core/upgrade/upgrade_domains.php +++ b/core/upgrade/upgrade_domains.php @@ -52,6 +52,7 @@ } //run all app_defaults.php files + require_once "resources/classes/config.php"; require_once "resources/classes/domains.php"; $domain = new domains; $domain->upgrade(); diff --git a/core/user_settings/root.php b/core/user_settings/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/user_settings/root.php +++ b/core/user_settings/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/core/users/root.php b/core/users/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/core/users/root.php +++ b/core/users/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/resources/captcha/root.php b/resources/captcha/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/resources/captcha/root.php +++ b/resources/captcha/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/resources/classes/root.php b/resources/classes/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/resources/classes/root.php +++ b/resources/classes/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/resources/root.php b/resources/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/resources/root.php +++ b/resources/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/root.php b/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/root.php +++ b/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/secure/root.php b/secure/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/secure/root.php +++ b/secure/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) { diff --git a/themes/default/root.php b/themes/default/root.php index 55f9565d6a..cc8ae3bcff 100644 --- a/themes/default/root.php +++ b/themes/default/root.php @@ -25,6 +25,7 @@ */ // make sure the PATH_SEPARATOR is defined + umask(2); if (!defined("PATH_SEPARATOR")) { if (strpos($_ENV["OS"], "Win") !== false) { define("PATH_SEPARATOR", ";"); @@ -33,10 +34,12 @@ } } + if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; + // 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)); + chdir(pathinfo(realpath($_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.php')) {