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

@@ -35,7 +35,7 @@
//set the directory
$xml_dir = $settings->get('switch','conf').'/autoload_configs';
$xml_file = $xml_dir."/acl.conf.xml";
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/acl.conf';
$xml_file_alt = dirname(__DIR__, 2).'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/acl.conf';
//load the xml and save it into an array
if (file_exists($xml_file)) {

View File

@@ -78,7 +78,7 @@
}
//if call center app is installed then update the user_status
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/call_centers')) {
if (is_dir(dirname(__DIR__, 2).'/app/call_centers')) {
//get the call center agent uuid
$sql = "select call_center_agent_uuid from v_call_center_agents ";
$sql .= "where domain_uuid = :domain_uuid ";

View File

@@ -709,10 +709,10 @@ if (permission_exists('call_block_all') || permission_exists('call_block_ring_gr
echo " <input type='hidden' name='xml_cdrs[$x][uuid]' value='".escape($row['xml_cdr_uuid'])."' />\n";
echo " </td>\n";
if (
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template', 'default')."/images/icon_cdr_inbound_voicemail.png") &&
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template', 'default')."/images/icon_cdr_inbound_answered.png") &&
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template', 'default')."/images/icon_cdr_outbound_failed.png") &&
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template', 'default')."/images/icon_cdr_outbound_answered.png")
file_exists(dirname(__DIR__, 2)."/themes/".$settings->get('domain', 'template', 'default')."/images/icon_cdr_inbound_voicemail.png") &&
file_exists(dirname(__DIR__, 2)."/themes/".$settings->get('domain', 'template', 'default')."/images/icon_cdr_inbound_answered.png") &&
file_exists(dirname(__DIR__, 2)."/themes/".$settings->get('domain', 'template', 'default')."/images/icon_cdr_outbound_failed.png") &&
file_exists(dirname(__DIR__, 2)."/themes/".$settings->get('domain', 'template', 'default')."/images/icon_cdr_outbound_answered.png")
) {
$title_mod = null;
echo " <td class='center' ".$list_row_onclick_toggle.">";

View File

@@ -124,7 +124,7 @@ function upload_file($sql, $broadcast_phone_numbers) {
if (if_group("superadmin")) {
$broadcast_accountcode = $_POST["broadcast_accountcode"];
}
else if (if_group("admin") && file_exists($_SERVER["PROJECT_ROOT"]."/app/billing/app_config.php")){
else if (if_group("admin") && file_exists(dirname(__DIR__, 2)."/app/billing/app_config.php")){
$sql = "select count(*) ";
$sql .= "from v_billings ";
$sql .= "where domain_uuid = :domain_uuid ";

View File

@@ -34,7 +34,7 @@
//set the directory
$xml_dir = $settings->get('switch','conf').'/autoload_configs';
$xml_file = $xml_dir."/conference.conf";
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf';
$xml_file_alt = dirname(__DIR__, 2).'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf';
//rename the file
if (file_exists($xml_dir.'/conference.conf.xml.noload')) {

View File

@@ -34,7 +34,7 @@
//set the directory
$xml_dir = $settings->get('switch','conf').'/autoload_configs';
$xml_file = $xml_dir."/conference.conf";
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf';
$xml_file_alt = dirname(__DIR__, 2).'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/conference.conf';
//rename the file
if (file_exists($xml_dir.'/conference.conf.xml.noload')) {

View File

@@ -2007,7 +2007,7 @@
}
//hold music
if (permission_exists("destination_hold_music") && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/music_on_hold')) {
if (permission_exists("destination_hold_music") && is_dir(dirname(__DIR__, 2).'/app/music_on_hold')) {
echo "<tr id='tr_hold_music'>\n";
echo "<td width=\"30%\" class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_hold_music']."\n";

View File

@@ -100,7 +100,7 @@
if ($destination_action == $value) {
if ($group == 'other') {
if (!isset($language2) && !isset($text2)) {
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/dialplans/app_languages.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/dialplans/app_languages.php")) {
$language2 = new text;
$text2 = $language2->get($settings->get('domain', 'language', 'en-us'), 'app/dialplans');
}
@@ -108,7 +108,7 @@
$actions[] = trim($text2['title-other'].' &#x203A; '.$text2['option-'.str_replace('&lowbar;','_',$key)]);
}
else {
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$group."/app_languages.php")) {
if (file_exists(dirname(__DIR__, 2)."/app/".$group."/app_languages.php")) {
$language3 = new text;
$text3 = $language3->get($settings->get('domain', 'language', 'en-us'), 'app/'.$group);
$actions[] = trim($text3['title-'.$group].' &#x203A; '.$key);

View File

@@ -405,7 +405,7 @@
$destination = $row['field']['destination'] ?? '';
//add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
if (file_exists(dirname(__DIR__, 4)."/app/".$name."/app_languages.php")) {
$text2 = $language2->get($this->language, 'app/'.$name);
}
@@ -540,7 +540,7 @@
$selected = (isset($destination_key) && $key == $destination_key) ? "selected='selected'" : '';
//add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$key."/app_languages.php")) {
if (file_exists(dirname(__DIR__, 4)."/app/".$key."/app_languages.php")) {
$text2 = $language2->get($this->language, 'app/'.$key);
$found = 'true';
}
@@ -617,7 +617,7 @@
$destination = $row['field']['destination'] ?? '';
//add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
if (file_exists(dirname(__DIR__, 4)."/app/".$name."/app_languages.php")) {
$language2 = new text;
$text2 = $language2->get($this->language, 'app/'.$name);
}
@@ -729,7 +729,7 @@
$destination = $row['field']['destination'] ?? null;
//add multi-lingual support
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/".$name."/app_languages.php")) {
if (file_exists(dirname(__DIR__, 4)."/app/".$name."/app_languages.php")) {
$language2 = new text;
$text2 = $language2->get($this->language, 'app/'.$name);
}

View File

@@ -162,7 +162,7 @@ if ($domains_processed == 1) {
if ($num_rows == 0) {
//get the vendor array
require_once $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/devices/app_config.php';
require_once dirname(__DIR__, 2).'/'.PROJECT_PATH.'/app/devices/app_config.php';
//get the groups and create an array to use the name to get the uuid
$sql = "select * from v_groups ";

View File

@@ -61,7 +61,7 @@
//get the vendor array
$x = 0;
require_once $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/devices/app_config.php';
require_once dirname(__DIR__, 2).'/'.PROJECT_PATH.'/app/devices/app_config.php';
//get the groups and create an array to use the name to get the uuid
$sql = "select * from v_groups ";

View File

@@ -500,7 +500,7 @@ class device {
} elseif (file_exists('/etc/fusionpbx/resources/templates/provision')) {
$this->template_dir = '/etc/fusionpbx/resources/templates/provision';
} else {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
}
} elseif (PHP_OS == "FreeBSD") {
@@ -511,23 +511,23 @@ class device {
} elseif (file_exists('/usr/local/etc/fusionpbx/resources/templates/provision')) {
$this->template_dir = '/usr/local/etc/fusionpbx/resources/templates/provision';
} else {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
}
} elseif (PHP_OS == "NetBSD") {
//set the default template_dir
if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
} elseif (PHP_OS == "OpenBSD") {
//set the default template_dir
if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
} else {
//set the default template_dir
if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
}

View File

@@ -169,7 +169,7 @@ class dialplan {
$x = 0;
//get the array of xml files
$xml_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/resources/switch/conf/dialplan/*.xml");
$xml_list = glob(dirname(__DIR__, 4) . "/*/*/resources/switch/conf/dialplan/*.xml");
//add a band-aid for CLI editors with faulty syntax highlighting
/* **/
@@ -1052,7 +1052,7 @@ class dialplan {
public function defaults() {
//get the array of xml files and then process thm
$xml_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/resources/switch/conf/dialplan/*.xml");
$xml_list = glob(dirname(__DIR__, 4) . "/*/*/resources/switch/conf/dialplan/*.xml");
foreach ($xml_list as $xml_file) {
//get and parse the xml
$xml_string = file_get_contents($xml_file);

View File

@@ -11,7 +11,7 @@
//includes files
require_once "resources/pdo.php";
require $_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/functions/transcribe.php";
require dirname(__DIR__, 4)."/app/email_queue/resources/functions/transcribe.php";
//increase limits
set_time_limit(0);
@@ -134,7 +134,7 @@
//process the messages
if (is_array($email_queue) && @sizeof($email_queue) != 0) {
foreach($email_queue as $row) {
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
$command = PHP_BINARY." ".dirname(__DIR__, 4)."/app/email_queue/resources/jobs/email_send.php ";
$command .= "'action=send&email_queue_uuid=".$row["email_queue_uuid"]."&hostname=".$hostname."'";
if (isset($debug)) {
//run process inline to see debug info

View File

@@ -160,7 +160,7 @@
//process the messages
if (is_array($email_queue) && @sizeof($email_queue) != 0) {
foreach($email_queue as $row) {
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php ";
$command = PHP_BINARY." ".dirname(__DIR__, 4)."/app/email_queue/resources/jobs/email_send.php ";
$command .= "'action=send&email_queue_uuid=".$row["email_queue_uuid"]."&hostname=".$hostname."'";
if (isset($debug)) {
//run process inline to see debug info

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";

View File

@@ -438,8 +438,8 @@ if (!function_exists('fax_split_dtmf')) {
$logo = $settings->get('fax','cover_logo');
}
else if (substr($settings->get('fax','cover_logo'), 0, 1) == '/') {
if (substr($settings->get('fax','cover_logo'), 0, strlen($_SERVER['DOCUMENT_ROOT'])) != $_SERVER['DOCUMENT_ROOT']) {
$logo = $_SERVER['DOCUMENT_ROOT'].$settings->get('fax','cover_logo');
if (substr($settings->get('fax','cover_logo'), 0, strlen(dirname(__DIR__, 2))) != dirname(__DIR__, 2)) {
$logo = dirname(__DIR__, 2).$settings->get('fax','cover_logo');
}
else {
$logo = $settings->get('fax','cover_logo');

View File

@@ -149,12 +149,12 @@
unset($parameters);
//change the working directory
chdir($_SERVER['DOCUMENT_ROOT']);
chdir(dirname(__DIR__, 4));
//process the messages
if (is_array($fax_queue) && @sizeof($fax_queue) != 0) {
foreach($fax_queue as $row) {
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
$command = PHP_BINARY." ".dirname(__DIR__, 4)."/app/fax_queue/resources/job/fax_send.php ";
$command .= "'action=send&fax_queue_uuid=".$row["fax_queue_uuid"]."&hostname=".$hostname."&debug=true'";
if (isset($debug)) {
//run process inline to see debug info

View File

@@ -141,7 +141,7 @@
}
//change the working directory
chdir($_SERVER['DOCUMENT_ROOT']);
chdir(dirname(__DIR__, 4));
//get the messages waiting in the fax queue
while (true) {
@@ -195,7 +195,7 @@
//process the messages
if (is_array($fax_queue) && @sizeof($fax_queue) != 0) {
foreach($fax_queue as $row) {
$command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/fax_queue/resources/job/fax_send.php ";
$command = PHP_BINARY." ".dirname(__DIR__, 4)."/app/fax_queue/resources/job/fax_send.php ";
$command .= "'action=send&fax_queue_uuid=".$row["fax_queue_uuid"]."&hostname=".$hostname."'";
if (isset($debug)) {
//run process inline to see debug info

View File

@@ -51,7 +51,7 @@ if ($domains_processed == 1) {
if ($num_rows == 0) {
//set the alternate directory
$xml_file_alt = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/local_stream.conf';
$xml_file_alt = dirname(__DIR__, 2).'/'.PROJECT_PATH.'/app/switch/resources/conf/autoload_configs/local_stream.conf';
//load the xml and save it into an array
if (file_exists($xml_file)) {

View File

@@ -153,7 +153,7 @@ class switch_music_on_hold {
$select .= " </optgroup>\n";
}
//recordings
if (is_dir($_SERVER["PROJECT_ROOT"] . '/app/recordings')) {
if (is_dir(dirname(__DIR__, 4) . '/app/recordings')) {
$recordings_c = new switch_recordings;
$recordings = $recordings_c->list_recordings();
if (is_array($recordings) && sizeof($recordings) > 0) {
@@ -165,7 +165,7 @@ class switch_music_on_hold {
}
}
//streams
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' ";
@@ -246,7 +246,7 @@ class switch_music_on_hold {
if (file_exists('/usr/share/examples/fusionpbx')) {
$file_contents = file_get_contents("/usr/share/examples/fusionpbx/resources/templates/conf/autoload_configs/local_stream.conf.xml");
} else {
$file_contents = file_get_contents($_SERVER["PROJECT_ROOT"] . "/app/switch/resources/conf/autoload_configs/local_stream.conf.xml");
$file_contents = file_get_contents(dirname(__DIR__, 4) . "/app/switch/resources/conf/autoload_configs/local_stream.conf.xml");
}
//check where the default music is stored
$default_moh_prefix = 'music/default';

View File

@@ -498,7 +498,7 @@
closelog();
//device logs
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/device_logs/app_config.php")){
if (file_exists(dirname(__DIR__, 2)."/app/device_logs/app_config.php")){
require_once "app/device_logs/resources/device_logs.php";
}

View File

@@ -110,7 +110,7 @@ class provision {
} elseif (file_exists('/etc/fusionpbx/resources/templates/provision')) {
$this->template_dir = '/etc/fusionpbx/resources/templates/provision';
} else {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
}
} elseif (PHP_OS == "FreeBSD") {
@@ -121,23 +121,23 @@ class provision {
} elseif (file_exists('/usr/local/etc/fusionpbx/resources/templates/provision')) {
$this->template_dir = '/usr/local/etc/fusionpbx/resources/templates/provision';
} else {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
}
} elseif (PHP_OS == "NetBSD") {
//set the default template_dir
if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
} elseif (PHP_OS == "OpenBSD") {
//set the default template_dir
if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
} else {
//set the default template_dir
if (empty($this->template_dir)) {
$this->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/resources/templates/provision';
$this->template_dir = dirname(__DIR__, 4) . '/resources/templates/provision';
}
}

View File

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

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';

View File

@@ -279,12 +279,12 @@
$hud_stat = $stats[$scope]['domains']['total'] - $stats[$scope]['domains']['disabled'];
$hud_stat_title = $text['label-active_domains'];
}
else if (permission_exists('extension_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/")) {
else if (permission_exists('extension_view') && file_exists(dirname(__DIR__, 4)."/app/extensions/")) {
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/app/extensions/extensions.php'\"";
$hud_stat = $stats[$scope]['extensions']['total'] - $stats[$scope]['extensions']['disabled'];
$hud_stat_title = $text['label-active_extensions'];
}
else if ((permission_exists('user_view') || if_group("superadmin")) && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/users/")) {
else if ((permission_exists('user_view') || if_group("superadmin")) && file_exists(dirname(__DIR__, 4)."/core/users/")) {
$onclick = "onclick=\"document.location.href='".PROJECT_PATH."/core/users/users.php'\"";
$hud_stat = $stats[$scope]['users']['total'] - $stats[$scope]['users']['disabled'];
$hud_stat_title = $text['label-active_users'];
@@ -381,7 +381,7 @@
}
//devices
if (permission_exists('device_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/devices/")) {
if (permission_exists('device_view') && file_exists(dirname(__DIR__, 4)."/app/devices/")) {
$tr_link = "href='".PROJECT_PATH."/app/devices/devices.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-devices']."</a></td>\n";
@@ -392,7 +392,7 @@
}
//extensions
if (permission_exists('extension_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/")) {
if (permission_exists('extension_view') && file_exists(dirname(__DIR__, 4)."/app/extensions/")) {
$tr_link = "href='".PROJECT_PATH."/app/extensions/extensions.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-extensions']."</a></td>\n";
@@ -403,7 +403,7 @@
}
//gateways
if (permission_exists('gateway_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/gateways/")) {
if (permission_exists('gateway_view') && file_exists(dirname(__DIR__, 4)."/app/gateways/")) {
$tr_link = "href='".PROJECT_PATH."/app/gateways/gateways.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-gateways']."</a></td>\n";
@@ -414,7 +414,7 @@
}
//users
if ((permission_exists('user_view') || if_group("superadmin")) && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/users/")) {
if ((permission_exists('user_view') || if_group("superadmin")) && file_exists(dirname(__DIR__, 4)."/core/users/")) {
$tr_link = "href='".PROJECT_PATH."/core/users/users.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-users']."</a></td>\n";
@@ -425,7 +425,7 @@
}
//destinations
if (permission_exists('destination_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/destinations/")) {
if (permission_exists('destination_view') && file_exists(dirname(__DIR__, 4)."/app/destinations/")) {
$tr_link = "href='".PROJECT_PATH."/app/destinations/destinations.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-destinations']."</a></td>\n";
@@ -436,7 +436,7 @@
}
//call center queues
if (permission_exists('call_center_active_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/call_centers/")) {
if (permission_exists('call_center_active_view') && file_exists(dirname(__DIR__, 4)."/app/call_centers/")) {
$tr_link = "href='".PROJECT_PATH."/app/call_centers/call_center_queues.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-call_center_queues']."</a></td>\n";
@@ -447,7 +447,7 @@
}
//ivr menus
if (permission_exists('ivr_menu_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/ivr_menus/")) {
if (permission_exists('ivr_menu_view') && file_exists(dirname(__DIR__, 4)."/app/ivr_menus/")) {
$tr_link = "href='".PROJECT_PATH."/app/ivr_menus/ivr_menus.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-ivr_menus']."</a></td>\n";
@@ -458,7 +458,7 @@
}
//ring groups
if (permission_exists('ring_group_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/ring_groups/")) {
if (permission_exists('ring_group_view') && file_exists(dirname(__DIR__, 4)."/app/ring_groups/")) {
$tr_link = "href='".PROJECT_PATH."/app/ring_groups/ring_groups.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-ring_groups']."</a></td>\n";
@@ -469,7 +469,7 @@
}
//voicemails
if (permission_exists('voicemail_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) {
if (permission_exists('voicemail_view') && file_exists(dirname(__DIR__, 4)."/app/voicemails/")) {
$tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemails.php'";
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]." hud_text'><a ".$tr_link.">".$text['label-voicemail']."</a></td>\n";
@@ -480,7 +480,7 @@
}
//messages
if (permission_exists('voicemail_message_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) {
if (permission_exists('voicemail_message_view') && file_exists(dirname(__DIR__, 4)."/app/voicemails/")) {
echo "<tr>\n";
echo "<th class='hud_heading' width='50%'>".$text['label-item']."</th>\n";
echo "<th class='hud_heading' width='50%' style='text-align: center; padding-left: 0; padding-right: 0;'>".$text['label-new']."</th>\n";

View File

@@ -261,7 +261,7 @@
//disk_free_space returns the number of bytes available on the drive;
//1 kilobyte = 1024 byte
//1 megabyte = 1024 kilobyte
$drive_letter = substr($_SERVER["DOCUMENT_ROOT"], 0, 2);
$drive_letter = substr(dirname(__DIR__, 4), 0, 2);
$disk_size = round(disk_total_space($drive_letter) / 1024 / 1024, 2);
$disk_size_free = round(disk_free_space($drive_letter) / 1024 / 1024, 2);
$disk_percent_available = round(($disk_size_free / $disk_size) * 100, 2);
@@ -309,7 +309,7 @@
}
//memcache information
if (permission_exists("system_view_memcache") && file_exists($_SERVER["PROJECT_ROOT"] . "/app/sip_status/app_config.php")) {
if (permission_exists("system_view_memcache") && file_exists(dirname(__DIR__, 4) . "/app/sip_status/app_config.php")) {
$memcache_fail = true;
$mod = new modules;
if ($mod->active("mod_memcache")) {

View File

@@ -339,7 +339,7 @@ Con Portions created by the Initial Developer are Copyright (C) 2008-2025
//disk_free_space returns the number of bytes available on the drive;
//1 kilobyte = 1024 byte
//1 megabyte = 1024 kilobyte
$drive_letter = substr($_SERVER["DOCUMENT_ROOT"], 0, 2);
$drive_letter = substr(dirname(__DIR__, 2), 0, 2);
$disk_size = round(disk_total_space($drive_letter)/1024/1024, 2);
$disk_size_free = round(disk_free_space($drive_letter)/1024/1024, 2);
$disk_percent_available = round(($disk_size_free/$disk_size) * 100, 2);
@@ -437,7 +437,7 @@ Con Portions created by the Initial Developer are Copyright (C) 2008-2025
}
//memcache information
if (permission_exists("system_view_memcache") && file_exists($_SERVER["PROJECT_ROOT"]."/app/sip_status/app_config.php")){
if (permission_exists("system_view_memcache") && file_exists(dirname(__DIR__, 2)."/app/sip_status/app_config.php")){
echo "<div class='card'>\n";
echo "<table width='100%' border='0' cellpadding='7' cellspacing='0'>\n";
echo " <tr>\n";

View File

@@ -24,7 +24,7 @@
$widget_label = $text['label-'.$widget_key] ?? $widget_name;
//used for missed and recent calls
$theme_image_path = $_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template', 'default')."/images/";
$theme_image_path = dirname(__DIR__, 4)."/themes/".$settings->get('domain', 'template', 'default')."/images/";
//voicemail
echo "<div class='hud_box'>\n";

View File

@@ -828,7 +828,7 @@
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('voicemail_sms_edit') && file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH.'/app/sms/')) {
if (permission_exists('voicemail_sms_edit') && file_exists(dirname(__DIR__, 2).'/app/sms/')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_sms_to']."\n";

View File

@@ -1584,7 +1584,7 @@ class xml_cdr {
|| '+' . ($value['destination_prefix'] ?? '') . ($value['destination_area_code'] ?? '') . $value['destination_number'] == $detail_action
|| ($value['destination_prefix'] ?? '') . ($value['destination_area_code'] ?? '') . $value['destination_number'] == $detail_action
|| ($value['destination_area_code'] ?? '') . $value['destination_number'] == $detail_action) {
if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/" . $application . "/app_languages.php")) {
if (file_exists(dirname(__DIR__, 4) . "/app/" . $application . "/app_languages.php")) {
$value['application'] = $application;
return $value;
}
@@ -1593,7 +1593,7 @@ class xml_cdr {
//find all other matching actions
if (!empty($value['extension']) && $value['extension'] == $detail_action || preg_match('/^' . preg_quote($value['extension'] ?? '') . '$/', $detail_action)) {
if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/" . $application . "/app_languages.php")) {
if (file_exists(dirname(__DIR__, 4) . "/app/" . $application . "/app_languages.php")) {
$value['application'] = $application;
return $value;
}

View File

@@ -833,7 +833,7 @@
if (is_array($result)) {
//determine if theme images exist
$theme_image_path = $_SERVER["DOCUMENT_ROOT"]."/themes/".$settings->get('domain', 'template', 'default')."/images/";
$theme_image_path = dirname(__DIR__, 2)."/themes/".$settings->get('domain', 'template', 'default')."/images/";
$theme_cdr_images_exist = (
file_exists($theme_image_path."icon_cdr_inbound_answered.png") &&
file_exists($theme_image_path."icon_cdr_inbound_no_answer.png") &&