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

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