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

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