Use __dir__ to find resources/require.php

This commit is contained in:
markjcrane
2023-06-16 22:49:09 -06:00
parent d4231ab0e1
commit 32051873be
21 changed files with 36 additions and 92 deletions
+2 -4
View File
@@ -49,13 +49,11 @@ class captcha {
*/
public function image_captcha() {
//set the include path
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
set_include_path(parse_ini_file($conf[0])['document.root']);
//includes files
require dirname(__DIR__, 2) . "/resources/require.php";
//includes files
require_once "resources/functions.php";
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ); //hide notices and warnings
//start the session
ini_set("session.cookie_httponly", True);
+4 -6
View File
@@ -63,13 +63,10 @@ class config {
* @var string $config_path - full path to the config.php file
*/
public function find() {
//set the include path
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
set_include_path(parse_ini_file($conf[0])['document.root']);
//includes files
require_once "resources/require.php";
// find the file
require dirname(__DIR__, 2) . "/resources/require.php";
//find the file
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
$this->config_path = $_SERVER["PROJECT_ROOT"]."/resources/config.php";
} elseif (file_exists("/etc/fusionpbx/config.php")) {
@@ -80,6 +77,7 @@ class config {
else {
$this->config_path = '';
}
//return the path
return $this->config_path;
}
+3
View File
@@ -391,6 +391,9 @@
*/
public function connect() {
//includes files
//require dirname(__DIR__, 2) . "/resources/require.php";
//set the include path
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
set_include_path(parse_ini_file($conf[0])['document.root']);
+3 -7
View File
@@ -601,18 +601,14 @@ if (!class_exists('domains')) {
*/
public function upgrade() {
//includes files
require dirname(__DIR__, 2) . "/resources/require.php";
//get the variables
$config = new config;
$config_path = $config->find();
$config->get();
//set the include path
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
set_include_path(parse_ini_file($conf[0])['document.root']);
//includes files
include "resources/require.php";
//check for default settings
$this->settings();
+2 -10
View File
@@ -43,12 +43,8 @@ if (!class_exists('schema')) {
$database->connect();
$this->db = $database->db;
//set the include path
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
set_include_path(parse_ini_file($conf[0])['document.root']);
//includes files
include "resources/require.php";
require_once dirname(__DIR__, 2) . "/resources/require.php";
//get the list of installed apps from the core and mod directories
$config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
@@ -491,12 +487,8 @@ if (!class_exists('schema')) {
$db_path = $config->db_path;
$db_port = $config->db_port;
//set the include path
$conf = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
set_include_path(parse_ini_file($conf[0])['document.root']);
//includes files
include "resources/require.php";
require_once dirname(__DIR__, 2) . "/resources/require.php";
//add multi-lingual support
if (!isset($text)) {