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") &&

View File

@@ -106,7 +106,7 @@ class plugin_database {
//initialize a template object
$view = new template();
$view->engine = 'smarty';
$view->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/core/authentication/resources/views/';
$view->template_dir = dirname(__DIR__, 5) . '/core/authentication/resources/views/';
$view->cache_dir = sys_get_temp_dir();
$view->init();
@@ -210,7 +210,7 @@ class plugin_database {
$user_authorized = false;
//check if contacts app exists
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/core/contacts/') ? true : false;
$contacts_exists = file_exists(dirname(__DIR__, 5) . '/core/contacts/') ? true : false;
//check the username and password if they don't match then redirect to the login
$sql = "select ";

View File

@@ -101,7 +101,7 @@ class plugin_email {
//initialize a template object
$view = new template();
$view->engine = 'smarty';
$view->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/core/authentication/resources/views/';
$view->template_dir = dirname(__DIR__, 5) . '/core/authentication/resources/views/';
$view->cache_dir = sys_get_temp_dir();
$view->init();
@@ -335,7 +335,7 @@ class plugin_email {
//initialize a template object
$view = new template();
$view->engine = 'smarty';
$view->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/core/authentication/resources/views/';
$view->template_dir = dirname(__DIR__, 5) . '/core/authentication/resources/views/';
$view->cache_dir = sys_get_temp_dir();
$view->init();
@@ -416,7 +416,7 @@ class plugin_email {
unset($_POST['authentication_code']);
//check if contacts app exists
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/core/contacts/') ? true : false;
$contacts_exists = file_exists(dirname(__DIR__, 5) . '/core/contacts/') ? true : false;
//get the user details
if ($auth_valid) {

View File

@@ -72,7 +72,7 @@ class plugin_ldap {
//initialize a template object
$view = new template();
$view->engine = 'smarty';
$view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/authentication/resources/views/';
$view->template_dir = dirname(__DIR__, 5).'/core/authentication/resources/views/';
$view->cache_dir = sys_get_temp_dir();
$view->init();

View File

@@ -113,7 +113,7 @@ class plugin_totp {
//initialize a template object
$view = new template();
$view->engine = 'smarty';
$view->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/core/authentication/resources/views/';
$view->template_dir = dirname(__DIR__, 5) . '/core/authentication/resources/views/';
$view->cache_dir = sys_get_temp_dir();
$view->init();
@@ -214,7 +214,7 @@ class plugin_totp {
//initialize a template object
$view = new template();
$view->engine = 'smarty';
$view->template_dir = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/core/authentication/resources/views/';
$view->template_dir = dirname(__DIR__, 5) . '/core/authentication/resources/views/';
$view->cache_dir = sys_get_temp_dir();
$view->init();
@@ -347,7 +347,7 @@ class plugin_totp {
unset($_POST['authentication_code']);
//check if contacts app exists
$contacts_exists = file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/core/contacts/') ? true : false;
$contacts_exists = file_exists(dirname(__DIR__, 5) . '/core/contacts/') ? true : false;
//get the user details
if ($auth_valid) {

View File

@@ -253,10 +253,10 @@
}
echo button::create(['type'=>'button','label'=>$text['button-qr_code'],'icon'=>'qrcode','collapse'=>'hide-sm-dn','onclick'=>"$('#qr_code_container').fadeIn(400);"]);
echo button::create(['type'=>'button','label'=>$text['button-vcard'],'icon'=>'address-card','collapse'=>'hide-sm-dn','link'=>'contacts_vcard.php?id='.urlencode($contact_uuid).'&type=download']);
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/invoices')) {
if (is_dir(dirname(__DIR__, 2).'/app/invoices')) {
echo button::create(['type'=>'button','label'=>$text['button-invoices'],'icon'=>'file-invoice-dollar','collapse'=>'hide-sm-dn','link'=>'../invoices/invoices.php?id='.urlencode($contact_uuid)]);
}
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/certificates')) {
if (is_dir(dirname(__DIR__, 2).'/app/certificates')) {
echo button::create(['type'=>'button','label'=>$text['button-certificate'],'icon'=>'certificate','collapse'=>'hide-sm-dn','link'=>'../certificates/index.php?name='.urlencode($contact_name_given." ".$contact_name_family)]);
}
if (!empty($contact_user_uuid) && permission_exists('user_edit') && is_uuid($contact_user_uuid)) {

View File

@@ -201,7 +201,7 @@ if (!empty($_GET)) {
}
//include
require_once $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/qr/qrcode.php";
require_once dirname(__DIR__, 2)."/resources/qr/qrcode.php";
//error correction level
//QR_ERROR_CORRECT_LEVEL_L : $e = 0;

View File

@@ -174,7 +174,7 @@ if ($domains_processed == 1) {
unset($sql, $parameters);
//add the dashboards
$dashboard_config_file = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/dashboard/resources/dashboard/config.php');
$dashboard_config_file = glob(dirname(__DIR__, 2).'/core/dashboard/resources/dashboard/config.php');
$x = 0;
foreach($dashboard_config_file as $file) {
include ($file);
@@ -224,7 +224,7 @@ if ($domains_processed == 1) {
unset($sql, $parameters);
//add the dashboard widgets
$config_files = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/*/*/resources/dashboard/config.php');
$config_files = glob(dirname(__DIR__, 2).'/*/*/resources/dashboard/config.php');
$x = 0;
foreach($config_files as $file) {
include ($file);

View File

@@ -523,7 +523,7 @@
//build the $widget_tools array
$i = 0;
foreach(glob($_SERVER["DOCUMENT_ROOT"].'/*/*/resources/dashboard/*.php') as $value) {
foreach(glob(dirname(__DIR__, 2).'/*/*/resources/dashboard/*.php') as $value) {
//skip adding config.php to the array
if (basename($value) === 'config.php') {
@@ -534,14 +534,14 @@
$value = str_replace('\\', '/', $value);
//prepare the key
$key_replace[] = $_SERVER["DOCUMENT_ROOT"].'/core/';
$key_replace[] = $_SERVER["DOCUMENT_ROOT"].'/app/';
$key_replace[] = dirname(__DIR__, 2).'/core/';
$key_replace[] = dirname(__DIR__, 2).'/app/';
$key_replace[] = 'resources/dashboard/';
$key_replace[] = '.php';
$key = str_replace($key_replace, '', $value);
//prepare the value
$value_replace[] = $_SERVER["DOCUMENT_ROOT"].'/';
$value_replace[] = dirname(__DIR__, 2).'/';
$value = str_replace($value_replace, '', $value);
//build the array
@@ -847,8 +847,8 @@ document.addEventListener('DOMContentLoaded', function() {
echo " <tr id='tr_widget_icon' ".(!in_array('widget_icon', $widget_settings) ? "style='display: none;'" : null).">\n";
echo " <td class='vncell'>".$text['label-icon']."</td>\n";
echo " <td class='vtable' style='vertical-align: bottom;'>\n";
if (file_exists($_SERVER["PROJECT_ROOT"].'/resources/fontawesome/fa_icons.php')) {
include $_SERVER["PROJECT_ROOT"].'/resources/fontawesome/fa_icons.php';
if (file_exists(dirname(__DIR__, 2).'/resources/fontawesome/fa_icons.php')) {
include dirname(__DIR__, 2).'/resources/fontawesome/fa_icons.php';
}
if (!empty($font_awesome_icons) && is_array($font_awesome_icons)) {
echo "<table cellpadding='0' cellspacing='0' border='0'>\n";

View File

@@ -397,8 +397,8 @@
elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) {
echo " <select class='formfld' id='default_setting_value' name='default_setting_value' style=''>\n";
//add all the themes to the list
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
$theme_dir = dirname(__DIR__, 2).'/themes';
if ($handle = opendir(dirname(__DIR__, 2).'/themes')) {
while (false !== ($dir_name = readdir($handle))) {
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && is_dir($theme_dir.'/'.$dir_name)) {
$dir_label = str_replace('_', ' ', $dir_name);

View File

@@ -212,7 +212,7 @@
//get the list of installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list = glob(dirname(__DIR__, 2) . "/*/*/app_config.php");
$x=0;
foreach ($config_list as $config_path) {
include($config_path);

View File

@@ -481,8 +481,8 @@
echo " <select class='formfld' id='domain_setting_value' name='domain_setting_value' style=''>\n";
echo " <option value=''></option>\n";
//add all the themes to the list
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
$theme_dir = dirname(__DIR__, 2).'/themes';
if ($handle = opendir(dirname(__DIR__, 2).'/themes')) {
while (false !== ($dir_name = readdir($handle))) {
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && is_dir($theme_dir.'/'.$dir_name)) {
$dir_label = str_replace('_', ' ', $dir_name);

View File

@@ -472,7 +472,7 @@
}
//if single-tenant and variables exist, update variables > domain value to match new domain
if (count($_SESSION['domains']) == 1 && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/vars/")) {
if (count($_SESSION['domains']) == 1 && file_exists(dirname(__DIR__, 2)."/app/vars/")) {
$sql = "update v_vars set ";
$sql .= "var_value = :var_value ";
$sql .= "where var_name = 'domain' ";

View File

@@ -74,7 +74,7 @@
}
//get the domains
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/app_config.php") && !is_cli()){
if (file_exists(dirname(__DIR__, 2)."/app/domains/app_config.php") && !is_cli()){
require_once "app/domains/resources/domains.php";
}

View File

@@ -30,7 +30,7 @@
require_once "resources/paging.php";
//redirect admin to app instead
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/app_config.php") && !permission_exists('domain_all') && !is_cli()) {
if (file_exists(dirname(__DIR__, 2)."/app/domains/app_config.php") && !permission_exists('domain_all') && !is_cli()) {
header("Location: ".PROJECT_PATH."/app/domains/domains.php");
exit;
}

View File

@@ -64,7 +64,7 @@ class permission {
function delete() {
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list = glob(dirname(__DIR__, 4) . "/*/*/app_config.php");
$x = 0;
foreach ($config_list as $config_path) {
include($config_path);
@@ -165,7 +165,7 @@ class permission {
$this->database_group_permissions = $this->database->select($sql, null, 'all');
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list = glob(dirname(__DIR__, 4) . "/*/*/app_config.php");
$x = 0;
foreach ($config_list as $config_path) {
include($config_path);

View File

@@ -27,8 +27,8 @@
//set the include path
$document_root = dirname(__DIR__, 2);
set_include_path($document_root);
$_SERVER["DOCUMENT_ROOT"] = $document_root;
$_SERVER["PROJECT_ROOT"] = $document_root;
//defined for backwards compatibility
define("PROJECT_PATH", '');
//includes files
@@ -172,7 +172,7 @@
sleep(1);
//add the database schema
$output = shell_exec('cd '.$_SERVER["DOCUMENT_ROOT"].' && php /var/www/fusionpbx/core/upgrade/upgrade_schema.php');
$output = shell_exec('cd '.dirname(__DIR__, 2).' && php /var/www/fusionpbx/core/upgrade/upgrade_schema.php');
//connect to the database
$database = new database;
@@ -222,7 +222,7 @@
$_SESSION['domain_name'] = $domain_name;
//app defaults
$output = shell_exec('cd '.$_SERVER["DOCUMENT_ROOT"].' && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php');
$output = shell_exec('cd '.dirname(__DIR__, 2).' && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php');
//prepare the user settings
$admin_username = $_SESSION['install']['admin_username'];
@@ -306,7 +306,7 @@
}
#app defaults
$output = shell_exec('cd '.$_SERVER["DOCUMENT_ROOT"].' && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php');
$output = shell_exec('cd '.dirname(__DIR__, 2).' && php /var/www/fusionpbx/core/upgrade/upgrade_domains.php');
//install completed - prompt the user to login
header("Location: /logout.php");
@@ -330,7 +330,7 @@
//initialize a template object
$view = new template();
$view->engine = 'smarty';
$view->template_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/core/install/resources/views/';
$view->template_dir = dirname(__DIR__, 2).'/core/install/resources/views/';
$view->cache_dir = sys_get_temp_dir();
$view->init();

View File

@@ -72,7 +72,7 @@ class install {
$system_drive = getenv('SystemDrive');
$config_path = $system_drive . DIRECTORY_SEPARATOR . 'ProgramData' . DIRECTORY_SEPARATOR . 'fusionpbx';
$config_file = $config_path . DIRECTORY_SEPARATOR . 'config.conf';
$document_root = $_SERVER["DOCUMENT_ROOT"];
$document_root = dirname(__DIR__, 4);
$conf_dir = $_SERVER['ProgramFiles'] . DIRECTORY_SEPARATOR . 'freeswitch' . DIRECTORY_SEPARATOR . 'conf';
$sounds_dir = $_SERVER['ProgramFiles'] . DIRECTORY_SEPARATOR . 'freeswitch' . DIRECTORY_SEPARATOR . 'sounds';
@@ -82,7 +82,7 @@ class install {
$voicemail_dir = $_SERVER['ProgramFiles'] . DIRECTORY_SEPARATOR . 'freeswitch' . DIRECTORY_SEPARATOR . 'voicemail';
$scripts_dir = $_SERVER['ProgramFiles'] . DIRECTORY_SEPARATOR . 'freeswitch' . DIRECTORY_SEPARATOR . 'scripts';
$php_dir = dirname(PHP_BINARY);
$cache_location = dirname($_SERVER['DOCUMENT_ROOT']) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'fusionpbx';
$cache_location = dirname(dirname(__DIR__, 4)) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'fusionpbx';
break;
}

View File

@@ -423,8 +423,8 @@
echo " <tr>";
echo " <td class='vncell'>".$text['label-icon']."</td>";
echo " <td class='vtable' style='vertical-align: bottom;'>";
if (file_exists($_SERVER["PROJECT_ROOT"].'/resources/fontawesome/fa_icons.php')) {
include $_SERVER["PROJECT_ROOT"].'/resources/fontawesome/fa_icons.php';
if (file_exists(dirname(__DIR__, 2).'/resources/fontawesome/fa_icons.php')) {
include dirname(__DIR__, 2).'/resources/fontawesome/fa_icons.php';
}
if (!empty($font_awesome_icons) && is_array($font_awesome_icons)) {
echo "<table cellpadding='0' cellspacing='0' border='0'>\n";

View File

@@ -54,7 +54,7 @@
$language = $settings->get('domain', 'language', 'en-us');
//find optional apps with repos
$updateable_repos = git_find_repos($_SERVER["PROJECT_ROOT"]."/app");
$updateable_repos = git_find_repos(dirname(__DIR__, 2)."/app");
if (!empty($updateable_repos) && is_array($updateable_repos) && @sizeof($updateable_repos) != 0) {
foreach ($updateable_repos as $app_path => $repo) {
//set the value
@@ -97,7 +97,7 @@
//run source update
if (!empty($action["upgrade_source"]) && permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx")) {
$project_update_status = git_pull($_SERVER["PROJECT_ROOT"]);
$project_update_status = git_pull(dirname(__DIR__, 2));
$_SESSION["response"]["upgrade_source"] = $project_update_status['message'];
@@ -289,7 +289,7 @@
echo "<br /><br />";
echo "<div class='card'>\n";
if (permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx") && is_writeable($_SERVER["PROJECT_ROOT"]."/.git")) {
if (permission_exists("upgrade_source") && !is_dir("/usr/share/examples/fusionpbx") && is_writeable(dirname(__DIR__, 2)."/.git")) {
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr onclick=\"$('#tr_applications').slideToggle('fast');\">\n";
echo " <td width='30%' class='vncellreq' style='vertical-align: middle;'>\n";
@@ -318,7 +318,7 @@
echo " <input type='checkbox' name='action[upgrade_source]' id='do_source' value='1' onclick=\"event.stopPropagation(); if (this.checked == false) { document.getElementById('view_source_code_options').checked = false; }\">\n";
echo " &nbsp;".$text['description-upgrade_source']."<br />\n";
//show current git version info
chdir($_SERVER["PROJECT_ROOT"]);
chdir(dirname(__DIR__, 2));
exec("git rev-parse --abbrev-ref HEAD 2>&1", $git_current_branch, $branch_return_value);
$git_current_branch = $git_current_branch[0];
exec("git log --pretty=format:'%H' -n 1 2>&1", $git_current_commit, $commit_return_value);

View File

@@ -67,7 +67,7 @@
$system_drive = getenv('SystemDrive');
$config_path = $system_drive . DIRECTORY_SEPARATOR . 'ProgramData' . DIRECTORY_SEPARATOR . 'fusionpbx' ;
$config_file = $config_path.DIRECTORY_SEPARATOR.'config.conf';
$document_root = $_SERVER["DOCUMENT_ROOT"];
$document_root = dirname(__DIR__, 2);
$conf_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'conf';
$sounds_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'sounds';
@@ -77,7 +77,7 @@
$voicemail_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'voicemail';
$scripts_dir = $_SERVER['ProgramFiles'].DIRECTORY_SEPARATOR.'freeswitch'.DIRECTORY_SEPARATOR.'scripts';
$php_dir = dirname(PHP_BINARY);
$cache_location = dirname($_SERVER['DOCUMENT_ROOT']).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'fusionpbx';
$cache_location = dirname(dirname(__DIR__, 2)).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'fusionpbx';
}
//make the config directory

View File

@@ -28,7 +28,6 @@
if(defined('STDIN')) {
//includes files
require_once dirname(__DIR__, 2) . "/resources/require.php";
$_SERVER["DOCUMENT_ROOT"] = $document_root;
$display_type = 'text'; //html, text
}
else if (!$included) {

View File

@@ -446,8 +446,8 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) {
echo " <select class='formfld' id='user_setting_value' name='user_setting_value' style=''>\n";
echo " <option value=''></option>\n";
//add all the themes to the list
$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
$theme_dir = dirname(__DIR__, 2).'/themes';
if ($handle = opendir(dirname(__DIR__, 2).'/themes')) {
while (false !== ($dir_name = readdir($handle))) {
if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && is_dir($theme_dir.'/'.$dir_name)) {
$dir_label = str_replace('_', ' ', $dir_name);

View File

@@ -163,7 +163,7 @@ if ($domains_processed == 1) {
}
//insert default password reset email template
if (file_exists($_SERVER['DOCUMENT_ROOT'].'/app/email_templates')) {
if (file_exists(dirname(__DIR__, 2).'/app/email_templates')) {
//add the email templates to the database
$sql = "select count(*) as num_rows from v_email_templates ";

View File

@@ -578,7 +578,7 @@
settings::clear_cache();
//if call center installed
if ($action == 'edit' && permission_exists('user_edit') && file_exists($_SERVER["PROJECT_ROOT"]."/app/call_centers/app_config.php")) {
if ($action == 'edit' && permission_exists('user_edit') && file_exists(dirname(__DIR__, 2)."/app/call_centers/app_config.php")) {
//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

@@ -464,7 +464,7 @@
settings::clear_cache();
//if call center installed
if ($action == 'edit' && file_exists($_SERVER["PROJECT_ROOT"]."/app/call_centers/app_config.php")) {
if ($action == 'edit' && file_exists(dirname(__DIR__, 2)."/app/call_centers/app_config.php")) {
//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

@@ -32,7 +32,7 @@
if (!empty($settings->get('login', 'destination'))) {
header("Location: ".$settings->get('login', 'destination'));
}
elseif (file_exists($_SERVER["PROJECT_ROOT"]."/core/dashboard/app_config.php")) {
elseif (file_exists(__DIR__."/core/dashboard/app_config.php")) {
header("Location: ".PROJECT_PATH."/core/dashboard/");
}
else {
@@ -42,7 +42,7 @@
}
else {
//use custom index, if present, otherwise use custom login, if present, otherwise use default login
if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".($settings->get('domain', 'template') ?? '')."/index.php")) {
if (file_exists(__DIR__."/themes/".($settings->get('domain', 'template') ?? '')."/index.php")) {
require_once "themes/".$settings->get('domain', 'template', 'default')."/index.php";
}
else {

View File

@@ -167,7 +167,7 @@
header("Location: ".$settings->get('login', 'destination', ''));
exit;
}
elseif (file_exists($_SERVER["PROJECT_ROOT"]."/core/dashboard/app_config.php")) {
elseif (file_exists(dirname(__DIR__, 1)."/core/dashboard/app_config.php")) {
header("Location: ".PROJECT_PATH."/core/dashboard/");
exit;
}

View File

@@ -66,7 +66,7 @@ class captcha {
$text = $this->code;
// Set the font path
$font_path = $_SERVER["DOCUMENT_ROOT"] . "/resources/captcha/fonts";
$font_path = dirname(__DIR__, 2) . "/resources/captcha/fonts";
// Array of fonts
//$fonts[] = 'ROUGD.TTF';

View File

@@ -19,21 +19,29 @@
* @param string $config_file Configuration file currently in use
* @param string $config_path_and_filename Full path and configuration file currently in use
*
* @internal the @param statements are used because they match the magic __get function that allows those to be
* accessed publicly
* @internal the @param statements are used because they match the magic __get function that allows those to be accessed publicly
*/
final class config {
// Full path and filename of config.conf
/**
* Configuration object used to hold a single instance
*
* @var array
* @var config
*/
public static $config = null;
// The internal array that holds the configuration in the config.conf file
/**
* The full path and file name for the config file.
*
* @var string
*/
private $file;
/**
* The array of settings contained in the config file.
*
* @var array
*/
private $configuration;
/**

View File

@@ -1651,7 +1651,7 @@ class database {
$transaction_type = 'delete';
//log the transaction results
if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/database_transactions/app_config.php")) {
if (file_exists(dirname(__DIR__, 2) . "/app/database_transactions/app_config.php")) {
$sql = "insert into " . self::TABLE_PREFIX . "database_transactions ";
$sql .= "(";
$sql .= "database_transaction_uuid, ";
@@ -1792,7 +1792,7 @@ class database {
$applications = [$schema, self::singular($schema)];
foreach ($directories as $directory) {
foreach ($applications as $application) {
$path = $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/$directory/$application/app_config.php";
$path = dirname(__DIR__, 2) . "/$directory/$application/app_config.php";
$app_config_files = glob($path);
if ($app_config_files !== false) {
$config_list = array_merge($config_list, $app_config_files);
@@ -3269,7 +3269,7 @@ class database {
}
//log the transaction results
if ($transaction_save && $database_updated && file_exists($_SERVER["PROJECT_ROOT"] . "/app/database_transactions/app_config.php")) {
if ($transaction_save && $database_updated && file_exists(dirname(__DIR__, 2) . "/app/database_transactions/app_config.php")) {
try {
//build the json string from the array
if (!empty($old_array)) {
@@ -3515,12 +3515,12 @@ class database {
*
* @return null Does not return any values
* @uses PROJECT_PATH Global variable
* @uses $_SERVER['DOCUMENT_ROOT'] Global variable
* @uses dirname(__DIR__, 2) Global variable
* @internal Moved to class to conserve resources.
*/
public static function get_apps() {
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list = glob(dirname(__DIR__, 2) . "/*/*/app_config.php");
$x = 0;
if (is_array($config_list)) {
foreach ($config_list as $config_path) {

View File

@@ -340,8 +340,8 @@ class domains {
$config_path = $config->config_file;
//get the list of installed apps from the core and app directories (note: GLOB_BRACE doesn't work on some systems)
$config_list_1 = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list_2 = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_menu.php");
$config_list_1 = glob(dirname(__DIR__, 2) . "/*/*/app_config.php");
$config_list_2 = glob(dirname(__DIR__, 2) . "/*/*/app_menu.php");
$config_list = array_merge((array)$config_list_1, (array)$config_list_2);
unset($config_list_1, $config_list_2);
$x = 0;
@@ -358,7 +358,7 @@ class domains {
unset($sql);
//get the list of installed apps from the core and mod directories
$default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php");
$default_list = glob(dirname(__DIR__, 2) . "/*/*/app_defaults.php");
//loop through all domains
$domains_processed = 1;
@@ -408,7 +408,7 @@ class domains {
unset($sql);
//get the list of default settings
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list = glob(dirname(__DIR__, 2) . "/*/*/app_config.php");
$x = 0;
foreach ($config_list as $config_path) {
include($config_path);
@@ -517,7 +517,7 @@ class domains {
unset($result, $row);
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list = glob(dirname(__DIR__, 2) . "/*/*/app_config.php");
$x = 0;
if (isset($config_list)) foreach ($config_list as $config_path) {
include($config_path);

View File

@@ -125,8 +125,8 @@ class email {
//includes
require_once('resources/pop3/mime_parser.php');
require_once('resources/pop3/rfc822_addresses.php');
if (file_exists($_SERVER["PROJECT_ROOT"] . "/app/emails/email_transcription.php")) {
require_once($_SERVER["PROJECT_ROOT"] . "/app/emails/email_transcription.php");
if (file_exists(dirname(__DIR__, 2) . "/app/emails/email_transcription.php")) {
require_once(dirname(__DIR__, 2) . "/app/emails/email_transcription.php");
}
//parse the email message

View File

@@ -530,7 +530,7 @@ class groups {
$num_rows = $this->database->select($sql, null, 'column');
if ($num_rows == 0) {
//build the apps array
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list = glob(dirname(__DIR__, 2) . "/*/*/app_config.php");
$x = 0;
foreach ($config_list as $config_path) {
include($config_path);

View File

@@ -944,7 +944,7 @@ class menu {
public function restore_default() {
//get the $apps array from the installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_menu.php");
$config_list = glob(dirname(__DIR__, 2) . "/*/*/app_menu.php");
$x = 0;
if (is_array($config_list)) {
foreach ($config_list as $config_path) {

View File

@@ -58,7 +58,7 @@ class schema {
$this->database = $setting_array['database'] ?? database::new();
//get the list of installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
$config_list = glob(dirname(__DIR__, 2) . "/*/*/app_config.php");
$x = 0;
foreach ($config_list as $config_path) {
try {

View File

@@ -61,7 +61,7 @@ class sounds {
}
}
//recordings
if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('recordings', $this->sound_types))) && file_exists($_SERVER["PROJECT_ROOT"] . "/app/recordings/app_config.php")) {
if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('recordings', $this->sound_types))) && file_exists(dirname(__DIR__, 2) . "/app/recordings/app_config.php")) {
$sql = "select recording_name, recording_filename from v_recordings ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "order by recording_name asc ";
@@ -79,7 +79,7 @@ class sounds {
unset($sql, $parameters, $recordings, $row);
}
//phrases
if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('phrases', $this->sound_types))) && file_exists($_SERVER["PROJECT_ROOT"] . "/app/phrases/app_config.php")) {
if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('phrases', $this->sound_types))) && file_exists(dirname(__DIR__, 2) . "/app/phrases/app_config.php")) {
$sql = "select * from v_phrases ";
$sql .= "where domain_uuid = :domain_uuid ";
$parameters['domain_uuid'] = $_SESSION["domain_uuid"];
@@ -94,7 +94,7 @@ class sounds {
unset($sql, $parameters, $phrases, $row);
}
//sounds
if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('sounds', $this->sound_types))) && file_exists($_SERVER["PROJECT_ROOT"] . "/app/phrases/app_config.php")) {
if ((empty($this->sound_types) || (is_array($this->sound_types) && in_array('sounds', $this->sound_types))) && file_exists(dirname(__DIR__, 2) . "/app/phrases/app_config.php")) {
$file = new file;
$sound_files = $file->sounds();
if (is_array($sound_files) && @sizeof($sound_files) != 0) {

View File

@@ -102,8 +102,8 @@ class text implements clear_cache {
}
//get the global app_languages.php so we can get the list of languages
if (file_exists($_SERVER["PROJECT_ROOT"] . "/resources/app_languages.php")) {
include $_SERVER["PROJECT_ROOT"] . "/resources/app_languages.php";
if (file_exists(dirname(__DIR__, 2) . "/resources/app_languages.php")) {
include dirname(__DIR__, 2) . "/resources/app_languages.php";
}
//get the list of languages, remove en-us, sort it then put en-us in front
@@ -174,7 +174,7 @@ class text implements clear_cache {
//get the app_languages.php
if ($app_path != null) {
$lang_path = $_SERVER["PROJECT_ROOT"] . "/" . $app_path;
$lang_path = dirname(__DIR__, 2) . "/" . $app_path;
} else {
$lang_path = getcwd();
}
@@ -190,8 +190,8 @@ class text implements clear_cache {
}
//get the global app_languages.php
if (!$exclude_global && file_exists($_SERVER["PROJECT_ROOT"] . "/resources/app_languages.php")) {
require $_SERVER["PROJECT_ROOT"] . "/resources/app_languages.php";
if (!$exclude_global && file_exists(dirname(__DIR__, 2) . "/resources/app_languages.php")) {
require dirname(__DIR__, 2) . "/resources/app_languages.php";
}
if (file_exists($lang_path . "/app_languages.php") && ($lang_path != 'resources' or $exclude_global)) {
@@ -241,11 +241,11 @@ class text implements clear_cache {
$languages = [];
//retrieve all the languages
$files = glob($_SERVER["PROJECT_ROOT"] . "/*/*/app_languages.php");
$files = glob(dirname(__DIR__, 2) . "/*/*/app_languages.php");
foreach ($files as $file) {
include $file;
}
include $_SERVER["PROJECT_ROOT"] . "/resources/app_languages.php";
include dirname(__DIR__, 2) . "/resources/app_languages.php";
//check every tag
foreach ($text as $lang_codes) {
@@ -290,7 +290,7 @@ class text implements clear_cache {
if ($app_path == null) {
throw new Exception("\$app_path must be specified");
}
$lang_path = $_SERVER["PROJECT_ROOT"] . "/$app_path/app_languages.php";
$lang_path = dirname(__DIR__, 2) . "/$app_path/app_languages.php";
if (!file_exists($lang_path)) {
throw new Exception("could not find app_languages for '$app_path'");
}
@@ -453,11 +453,11 @@ class text implements clear_cache {
//retrieve all the languages
$text = [];
$files = glob($_SERVER["PROJECT_ROOT"] . "/*/*/app_languages.php");
$files = glob(dirname(__DIR__, 2) . "/*/*/app_languages.php");
foreach ($files as $file) {
include $file;
}
include $_SERVER["PROJECT_ROOT"] . "/resources/app_languages.php";
include dirname(__DIR__, 2) . "/resources/app_languages.php";
//check every tag
foreach ($text as $label_name => $values) {
@@ -471,7 +471,7 @@ class text implements clear_cache {
//retrieve all the menus
$x = 0;
$files = glob($_SERVER["PROJECT_ROOT"] . "/*/*");
$files = glob(dirname(__DIR__, 2) . "/*/*");
foreach ($files as $file) {
if (file_exists($file . "/app_menu.php"))
include $file . "/app_menu.php";

View File

@@ -29,8 +29,8 @@ require_once dirname(__DIR__, 2) . "/resources/require.php";
//load icons
$font_awesome_icons = [];
if (file_exists($_SERVER["PROJECT_ROOT"].'/resources/fontawesome/metadata/icons.json')) {
$icons_json = file_get_contents($_SERVER["PROJECT_ROOT"].'/resources/fontawesome/metadata/icons.json');
if (file_exists(dirname(__DIR__, 2).'/resources/fontawesome/metadata/icons.json')) {
$icons_json = file_get_contents(dirname(__DIR__, 2).'/resources/fontawesome/metadata/icons.json');
if (!empty($icons_json)) {
$icons_array = json_decode($icons_json, true);
if (!empty($icons_array) && is_array($icons_array)) {

View File

@@ -46,10 +46,10 @@
$body = ob_get_contents();
ob_end_clean(); //clean the buffer
//set a default template
//set the default template
if (empty($_SESSION["template_full_path"])) { //build template if session template has no length
//set the template base path
$template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
$template_base_path = dirname(__DIR__, 1).'/themes';
//get the contents of the template and save it to the template variable
$template_full_path = $template_base_path.'/'.$settings->get('domain', 'template', 'default').'/template.php';
@@ -185,7 +185,7 @@
$authenticated = isset($_SESSION['username']) && !empty($_SESSION['username']) ? true : false;
$view->assign('authenticated', $authenticated);
//domains application path
$view->assign('domains_app_path', PROJECT_PATH.(file_exists($_SERVER['DOCUMENT_ROOT'].'/app/domains/domains.php') ? '/app/domains/domains.php' : '/core/domains/domains.php'));
$view->assign('domains_app_path', PROJECT_PATH.(file_exists(dirname(__DIR__, 1).'/app/domains/domains.php') ? '/app/domains/domains.php' : '/core/domains/domains.php'));
//domain count
$view->assign('domain_count', $domain_count);
//domain selector row background colors
@@ -289,7 +289,7 @@
//session timer
if ($authenticated &&
file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH.'/app/session_timer/session_timer.php') &&
file_exists(dirname(__DIR__, 1).'/app/session_timer/session_timer.php') &&
$settings->get('security', 'session_timer_enabled', false)
) {
include_once PROJECT_PATH.'app/session_timer/session_timer.php';

View File

@@ -2457,7 +2457,7 @@ if (!function_exists('import_fonts')) {
correctly.
*/
$file = file_get_contents($_SERVER["DOCUMENT_ROOT"] . $file_to_parse);
$file = file_get_contents(dirname(__DIR__, 1) . $file_to_parse);
$lines = explode("\n", $file);
$style_counter = 0;

View File

@@ -54,7 +54,7 @@
}
//set the template base directory path
$template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
$template_base_path = dirname(__DIR__, 1).'/themes';
//start the output buffer
include $template_base_path.'/'.$settings->get('domain', 'template', 'default').'/config.php';
@@ -111,7 +111,7 @@
ob_start();
//for translate tool (if available)
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate/translate_header.php")) {
if (file_exists(dirname(__DIR__, 1)."/app/translate/translate_header.php")) {
require_once("app/translate/translate_header.php");
}

View File

@@ -105,7 +105,7 @@ if ($db_type == "sqlite") {
//set the document_root
if (empty($document_root)) {
$document_root = $_SERVER["DOCUMENT_ROOT"];
$document_root = dirname(__DIR__, 1);
}
//prepare the database connection

View File

@@ -77,8 +77,8 @@
//debug info
//echo "Include Path: ".get_include_path()."\n";
//echo "Document Root: ".$_SERVER["DOCUMENT_ROOT"]."\n";
//echo "Project Root: ".$_SERVER["PROJECT_ROOT"]."\n";
//echo "Document Root: ".dirname(__DIR__, 1)."\n";
//echo "Project Root: ".dirname(__DIR__, 1)."\n";
//include global functions
@@ -130,7 +130,7 @@
if (!empty($_GET["domain_uuid"]) && is_uuid($_GET["domain_uuid"]) && !empty($_GET["domain_change"]) && $_GET["domain_change"] == "true" && permission_exists('domain_select')) {
//include domains
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/domains/app_config.php") && !permission_exists('domain_all')) {
if (file_exists(dirname(__DIR__, 1)."/app/domains/app_config.php") && !permission_exists('domain_all')) {
include_once "app/domains/domains.php";
}

View File

@@ -834,7 +834,7 @@ if (!function_exists('save_call_center_xml')) {
$path = "/usr/share/examples/fusionpbx/resources/templates/conf";
}
else {
$path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/switch/resources/conf";
$path = dirname(__DIR__, 1)."/app/switch/resources/conf";
}
//get the contents of the template
@@ -878,7 +878,7 @@ if (!function_exists('switch_conf_xml')) {
$path = "/usr/share/examples/fusionpbx/resources/templates/conf";
}
else {
$path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/switch/resources/conf";
$path = dirname(__DIR__, 1)."/app/switch/resources/conf";
}
$file_contents = file_get_contents($path."/autoload_configs/switch.conf.xml");
@@ -889,7 +889,7 @@ if (!function_exists('switch_conf_xml')) {
$php_bin = 'php.exe';
}
$secure_path = path_join($_SERVER["DOCUMENT_ROOT"], PROJECT_PATH, 'secure');
$secure_path = path_join(dirname(__DIR__, 1), PROJECT_PATH, 'secure');
$v_mail_bat = path_join($secure_path, 'mailto.bat');
$v_mail_cmd = '@' .
@@ -906,7 +906,7 @@ if (!function_exists('switch_conf_xml')) {
}
else {
if (file_exists(PHP_BINDIR.'/php')) { define("PHP_BIN", "php"); }
$v_mailer_app = PHP_BINDIR."/".PHP_BIN." ".$_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/secure/v_mailto.php";
$v_mailer_app = PHP_BINDIR."/".PHP_BIN." ".dirname(__DIR__, 1)."/secure/v_mailto.php";
$v_mailer_app_args = "-t";
}
@@ -939,7 +939,7 @@ if (!function_exists('xml_cdr_conf_xml')) {
$path = "/usr/share/examples/fusionpbx/resources/templates/conf";
}
else {
$path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/switch/resources/conf";
$path = dirname(__DIR__, 1)."/app/switch/resources/conf";
}
$file_contents = file_get_contents($path."/autoload_configs/xml_cdr.conf.xml");
@@ -1008,10 +1008,10 @@ if (!function_exists('save_sip_profile_xml')) {
//get the xml sip profile template
if ($sip_profile_name == "internal" || $sip_profile_name == "external" || $sip_profile_name == "internal-ipv6") {
$file_contents = file_get_contents($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/sip_profiles/resources/xml/sip_profiles/".$sip_profile_name.".xml");
$file_contents = file_get_contents(dirname(__DIR__, 1)."/app/sip_profiles/resources/xml/sip_profiles/".$sip_profile_name.".xml");
}
else {
$file_contents = file_get_contents($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/sip_profiles/resources/xml/sip_profiles/default.xml");
$file_contents = file_get_contents(dirname(__DIR__, 1)."/app/sip_profiles/resources/xml/sip_profiles/default.xml");
}
//get the sip profile settings
@@ -1063,33 +1063,33 @@ if (!function_exists('save_switch_xml')) {
global $settings;
if (is_readable($settings->get('switch', 'extensions'))) {
if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/extensions/resources/classes/extension.php")) {
if (file_exists(dirname(__DIR__, 1)."/app/extensions/resources/classes/extension.php")) {
$extension = new extension;
$extension->xml();
}
}
if (is_readable($settings->get('switch', 'conf'))) {
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/settings/app_config.php")) {
if (file_exists(dirname(__DIR__, 1)."/app/settings/app_config.php")) {
save_setting_xml();
}
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/modules/app_config.php")) {
if (file_exists(dirname(__DIR__, 1)."/app/modules/app_config.php")) {
$module = new modules;
$module->xml();
//$msg = $module->msg;
}
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/vars/app_config.php")) {
if (file_exists(dirname(__DIR__, 1)."/app/vars/app_config.php")) {
save_var_xml();
}
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/call_center/app_config.php")) {
if (file_exists(dirname(__DIR__, 1)."/app/call_center/app_config.php")) {
save_call_center_xml();
}
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/gateways/app_config.php")) {
if (file_exists(dirname(__DIR__, 1)."/app/gateways/app_config.php")) {
save_gateway_xml();
}
//if (file_exists($_SERVER["PROJECT_ROOT"]."/app/ivr_menu/app_config.php")) {
//if (file_exists(dirname(__DIR__, 1)."/app/ivr_menu/app_config.php")) {
// save_ivr_menu_xml();
//}
if (file_exists($_SERVER["PROJECT_ROOT"]."/app/sip_profiles/app_config.php")) {
if (file_exists(dirname(__DIR__, 1)."/app/sip_profiles/app_config.php")) {
save_sip_profile_xml();
}
}

View File

@@ -77,8 +77,8 @@
//includes
//require_once('resources/pop3/mime_parser.php');
//require_once('resources/pop3/rfc822_addresses.php');
//if (file_exists($_SERVER["PROJECT_ROOT"]."/app/emails/email_transcription.php")) {
// require_once($_SERVER["PROJECT_ROOT"]."/app/emails/email_transcription.php");
//if (file_exists(dirname(__DIR__, 1)."/app/emails/email_transcription.php")) {
// require_once(dirname(__DIR__, )."/app/emails/email_transcription.php");
//}
//parse the email

View File

@@ -29,7 +29,7 @@
//get the background images
$relative_path = PROJECT_PATH.'/themes/default/images/backgrounds';
$backgrounds = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$relative_path);
$backgrounds = opendir(dirname(__DIR__, 2).'/'.$relative_path);
unset($array);
$x = 0;
while (false !== ($file = readdir($backgrounds))) {

View File

@@ -446,9 +446,9 @@ if ($background_images_enabled) {
}
if ($image_source == 'folder') {
if (file_exists($_SERVER["DOCUMENT_ROOT"].$source_path)) {
if (file_exists(dirname(__DIR__, 2).$source_path)) {
//retrieve a random background image
$dir_list = opendir($_SERVER["DOCUMENT_ROOT"].$source_path);
$dir_list = opendir(dirname(__DIR__, 2).$source_path);
$v_background_array = array();
$x = 0;
while (false !== ($file = readdir($dir_list))) {