Replace the DOCUMENT_ROOT and PROJECT_ROOT variables

Use the __DIR__ constant and dirname as needed
This commit is contained in:
FusionPBX
2025-12-08 14:12:19 -07:00
committed by GitHub
parent df90513f86
commit 6b063f2c28
84 changed files with 217 additions and 210 deletions

View File

@@ -155,16 +155,16 @@ class ringbacks {
$this->tones_list = $tones->tones_list();
//get music on hold and recordings
if (is_dir($_SERVER["PROJECT_ROOT"] . '/app/music_on_hold')) {
if (is_dir(dirname(__DIR__, 4) . '/app/music_on_hold')) {
$music = new switch_music_on_hold;
$this->music_list = $music->get();
}
if (is_dir($_SERVER["PROJECT_ROOT"] . '/app/recordings')) {
if (is_dir(dirname(__DIR__, 4) . '/app/recordings')) {
$recordings = new switch_recordings;
$this->recordings_list = $recordings->list_recordings();
}
if (is_dir($_SERVER["PROJECT_ROOT"] . '/app/streams')) {
if (is_dir(dirname(__DIR__, 4) . '/app/streams')) {
$sql = "select * from v_streams ";
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
$sql .= "and stream_enabled = 'true' ";

View File

@@ -84,7 +84,7 @@ class switch_files {
} elseif (file_exists('/var/www/fusionpbx/app/switch/resources/scripts')) {
$source_directory = '/var/www/fusionpbx/app/switch/resources/scripts';
} else {
$source_directory = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/app/switch/resources/scripts';
$source_directory = dirname(__DIR__, 4) . '/app/switch/resources/scripts';
}
//get the destination directory
@@ -103,7 +103,7 @@ class switch_files {
unset($source_directory);
//copy the app/*/resource/install/scripts
$app_scripts = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . 'app/*/resource/scripts');
$app_scripts = glob(dirname(__DIR__, 4) . 'app/*/resource/scripts');
foreach ($app_scripts as $app_script) {
recursive_copy($app_script, $destination_directory);
}
@@ -131,7 +131,7 @@ class switch_files {
} elseif (file_exists('/var/www/fusionpbx/app/switch/resources/conf/languages')) {
$source_directory = '/var/www/fusionpbx/app/switch/resources/conf/languages';
} else {
$source_directory = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/app/switch/resources/conf/languages';
$source_directory = dirname(__DIR__, 4) . '/app/switch/resources/conf/languages';
}
//get the destination directory

View File

@@ -73,7 +73,7 @@
//registration count
$registrations = '';
if (permission_exists('switch_registrations') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) {
if (permission_exists('switch_registrations') && file_exists(dirname(__DIR__, 4)."/app/registrations/")) {
$registration = new registrations;
if (permission_exists("registration_all")) {
$registration->show = 'all';