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

@@ -178,7 +178,7 @@
unset($array);
//get the source extension voicemail data
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) {
if (is_dir(dirname(__DIR__, 2).'/app/voicemails')) {
//get the voicemails
$sql = "select ";

View File

@@ -332,7 +332,7 @@
}
//delete the line from the v_device_lines
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/devices')) {
if (is_dir(dirname(__DIR__, 2).'/app/devices')) {
if (!empty($_REQUEST["delete_type"]) && $_REQUEST["delete_type"] == "device_line" && is_uuid($_REQUEST["delete_uuid"]) && permission_exists("extension_delete")) {
//set the variables
$device_line_uuid = $_REQUEST["delete_uuid"];
@@ -729,7 +729,7 @@
}
//add or update voicemail
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) {
if (is_dir(dirname(__DIR__, 2).'/app/voicemails')) {
//set the voicemail password
if (empty($voicemail_password)) {
$voicemail_password = generate_password($voicemail_password_length, 1);
@@ -856,7 +856,7 @@
}
//write the provision files
if (!empty($provision_path) && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/provision')) {
if (!empty($provision_path) && is_dir(dirname(__DIR__, 2).'/app/provision')) {
$prov = new provision;
$prov->domain_uuid = $domain_uuid;
$response = $prov->write();
@@ -959,7 +959,7 @@
}
//get the voicemail data
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) {
if (is_dir(dirname(__DIR__, 2).'/app/voicemails')) {
$sql = "select * from v_voicemails ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and voicemail_id = :voicemail_id ";
@@ -1329,7 +1329,7 @@
echo " </tr>";
}
if (permission_exists('voicemail_edit') && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) {
if (permission_exists('voicemail_edit') && is_dir(dirname(__DIR__, 2).'/app/voicemails')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_password']."\n";
@@ -1357,7 +1357,7 @@
}
if (permission_exists('device_edit') && (empty($extension_type) || $extension_type != 'virtual')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/devices')) {
if (is_dir(dirname(__DIR__, 2).'/app/devices')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-provisioning']."\n";
@@ -1794,7 +1794,7 @@
echo "</tr>\n";
}
if (permission_exists('voicemail_edit') && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) {
if (permission_exists('voicemail_edit') && is_dir(dirname(__DIR__, 2).'/app/voicemails')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_enabled']."\n";
@@ -2040,7 +2040,7 @@
echo "</tr>\n";
}
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/music_on_hold') && permission_exists('extension_hold_music')) {
if (is_dir(dirname(__DIR__, 2).'/app/music_on_hold') && permission_exists('extension_hold_music')) {
echo "<tr>\n";
echo "<td width=\"30%\" class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-hold_music']."\n";

View File

@@ -658,7 +658,7 @@ class extension {
}
//include ring group destinations, if exists
if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/ring_groups/app_config.php")) {
if (file_exists(dirname(__DIR__, 4) . "/app/ring_groups/app_config.php")) {
$array['ring_group_destinations'][$x]['destination_number'] = $extensions[$x]['extension'];
$array['ring_group_destinations'][$x]['domain_uuid'] = $this->domain_uuid;
if (is_numeric($extensions[$x]['number_alias'])) {
@@ -669,7 +669,7 @@ class extension {
}
//include extension settings, if exists
if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/extension_settings/app_config.php")) {
if (file_exists(dirname(__DIR__, 4) . "/app/extension_settings/app_config.php")) {
$array['extension_settings'][$x]['extension_uuid'] = $record['uuid'];
$array['extension_settings'][$x]['domain_uuid'] = $this->domain_uuid;
}
@@ -849,7 +849,7 @@ class extension {
//write the provision files
if (!empty($this->settings->get('provision', 'path'))) {
if (is_dir($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/app/provision')) {
if (is_dir(dirname(__DIR__, 4) . '/app/provision')) {
$prov = new provision;
$prov->domain_uuid = $this->domain_uuid;
$response = $prov->write();

View File

@@ -46,7 +46,7 @@
//validate the token
$token = new token;
if (!$token->validate($_SERVER["DOCUMENT_ROOT"].'/extensions/resources/dashboard/caller_id.php')) {
if (!$token->validate(dirname(__DIR__, 4).'/extensions/resources/dashboard/caller_id.php')) {
message::add($text['message-invalid_token'],'negative');
header('Location: /core/dashboard/');
exit;
@@ -166,7 +166,7 @@
//create token
$object = new token;
$token = $object->create($_SERVER["DOCUMENT_ROOT"].'/extensions/resources/dashboard/caller_id.php');
$token = $object->create(dirname(__DIR__, 4).'/extensions/resources/dashboard/caller_id.php');
//caller id
echo "<div class='hud_box'>\n";