Use require.php
This commit is contained in:
parent
ab646085be
commit
38150d25aa
|
|
@ -24,17 +24,13 @@
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//add the document root to the include path
|
//include file
|
||||||
$config_glob = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
|
require dirname(__DIR__, 2) . "/resources/require.php";
|
||||||
if (is_array($config_glob) && count($config_glob) > 0) {
|
|
||||||
$config_glob = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
|
//if the config file doesn't exist and the config.php does exist use it to write a new config file
|
||||||
$conf = parse_ini_file($config_glob[0]);
|
if (!$config_exists && file_exists("/etc/fusionpbx/config.php")) {
|
||||||
set_include_path($conf['document.root']);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//include the config.php
|
//include the config.php
|
||||||
$config_php_glob = glob("{/usr/local/etc,/etc}/fusionpbx/config.php", GLOB_BRACE);
|
include("/etc/fusionpbx/config.php");
|
||||||
include($config_php_glob[0]);
|
|
||||||
|
|
||||||
//set the default config file location
|
//set the default config file location
|
||||||
if (stristr(PHP_OS, 'BSD')) {
|
if (stristr(PHP_OS, 'BSD')) {
|
||||||
|
|
@ -123,15 +119,10 @@
|
||||||
if(!$file_handle){ return; }
|
if(!$file_handle){ return; }
|
||||||
fwrite($file_handle, $conf);
|
fwrite($file_handle, $conf);
|
||||||
fclose($file_handle);
|
fclose($file_handle);
|
||||||
|
|
||||||
//set the include path
|
|
||||||
$config_glob = glob("{/usr/local/etc,/etc}/fusionpbx/config.conf", GLOB_BRACE);
|
|
||||||
$conf = parse_ini_file($config_glob[0]);
|
|
||||||
set_include_path($conf['document.root']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//include files
|
//include files
|
||||||
require_once "resources/require.php";
|
require dirname(__DIR__, 2) . "/resources/require.php";
|
||||||
|
|
||||||
//check the permission
|
//check the permission
|
||||||
if(defined('STDIN')) {
|
if(defined('STDIN')) {
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,12 @@
|
||||||
$conf = parse_ini_file($config_glob[0]);
|
$conf = parse_ini_file($config_glob[0]);
|
||||||
set_include_path($conf['document.root']);
|
set_include_path($conf['document.root']);
|
||||||
|
|
||||||
|
//config file
|
||||||
|
$config_file = $config_glob[0] ?? '';
|
||||||
|
|
||||||
|
//check if the config file exists
|
||||||
|
$config_exists = file_exists($config_file) ? true : false;
|
||||||
|
|
||||||
//set the server variables and define project path constant
|
//set the server variables and define project path constant
|
||||||
$_SERVER["DOCUMENT_ROOT"] = $conf['document.root'];
|
$_SERVER["DOCUMENT_ROOT"] = $conf['document.root'];
|
||||||
$_SERVER["PROJECT_ROOT"] = $conf['document.root'];
|
$_SERVER["PROJECT_ROOT"] = $conf['document.root'];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue