2012-06-04 16:58:40 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
2022-10-10 21:16:32 +02:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2022
|
2012-06-04 16:58:40 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
2014-01-19 02:30:10 +01:00
|
|
|
|
2022-10-10 21:16:32 +02:00
|
|
|
//add the document root to 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']);
|
2014-01-19 02:30:10 +01:00
|
|
|
|
2022-10-10 21:16:32 +02:00
|
|
|
//set the server variables and define project path constant
|
|
|
|
|
$_SERVER["DOCUMENT_ROOT"] = $conf['document.root'];
|
|
|
|
|
$_SERVER["PROJECT_PATH"] = $conf['project.path'];
|
|
|
|
|
if (isset($conf['project.path'])) {
|
|
|
|
|
$_SERVER["PROJECT_ROOT"] = $conf['document.root'].$conf['project.path'];
|
2014-01-19 02:30:10 +01:00
|
|
|
}
|
2022-10-10 21:16:32 +02:00
|
|
|
else {
|
|
|
|
|
$_SERVER["PROJECT_ROOT"] = $conf['document.root'];
|
2014-01-19 02:30:10 +01:00
|
|
|
}
|
2022-10-10 21:16:32 +02:00
|
|
|
define("PROJECT_PATH", $conf['project.path']);
|
|
|
|
|
|
|
|
|
|
//set the error reporting
|
|
|
|
|
ini_set('display_errors', '1');
|
2022-10-11 00:59:57 +02:00
|
|
|
//error_reporting($conf['error.reporting']);
|
|
|
|
|
error_reporting (E_ALL ^ E_NOTICE); // hide notices
|
|
|
|
|
|
2022-10-10 21:16:32 +02:00
|
|
|
|
|
|
|
|
//get the database connection settings
|
|
|
|
|
//$db_type = $settings['database']['type'];
|
|
|
|
|
//$db_host = $settings['database']['host'];
|
|
|
|
|
//$db_port = $settings['database']['port'];
|
|
|
|
|
//$db_name = $settings['database']['name'];
|
|
|
|
|
//$db_username = $settings['database']['username'];
|
|
|
|
|
//$db_password = $settings['database']['password'];
|
|
|
|
|
|
|
|
|
|
//get the database connection settings
|
|
|
|
|
$db_type = $conf['database.0.type'];
|
|
|
|
|
$db_host = $conf['database.0.host'];
|
|
|
|
|
$db_port = $conf['database.0.port'];
|
|
|
|
|
$db_name = $conf['database.0.name'];
|
|
|
|
|
$db_username = $conf['database.0.username'];
|
|
|
|
|
$db_password = $conf['database.0.password'];
|
|
|
|
|
|
|
|
|
|
//debug info
|
|
|
|
|
//echo "Include Path: ".get_include_path()."\n";
|
|
|
|
|
//echo "Document Root: ".$_SERVER["DOCUMENT_ROOT"]."\n";
|
|
|
|
|
//echo "Project Root: ".$_SERVER["PROJECT_ROOT"]."\n";
|
2014-01-19 02:30:10 +01:00
|
|
|
|
|
|
|
|
//class auto loader
|
2021-11-26 21:13:04 +01:00
|
|
|
include "resources/classes/auto_loader.php";
|
2014-01-19 02:30:10 +01:00
|
|
|
$autoload = new auto_loader();
|
|
|
|
|
|
|
|
|
|
//additional includes
|
|
|
|
|
require_once "resources/php.php";
|
|
|
|
|
require_once "resources/functions.php";
|
2022-10-10 21:16:32 +02:00
|
|
|
if (is_array($conf) && count($conf) > 0) {
|
2016-05-05 21:22:08 +02:00
|
|
|
require "resources/pdo.php";
|
2021-11-26 20:34:02 +01:00
|
|
|
require_once "resources/cidr.php";
|
2020-11-04 01:21:41 +01:00
|
|
|
if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/resources/switch.php")) {
|
2020-11-03 20:16:00 +01:00
|
|
|
require_once "resources/switch.php";
|
|
|
|
|
}
|
2016-05-05 21:22:08 +02:00
|
|
|
}
|
2015-01-18 08:54:19 +01:00
|
|
|
|
|
|
|
|
//change language on the fly - for translate tool (if available)
|
2016-04-26 03:19:58 +02:00
|
|
|
if (isset($_REQUEST['view_lang_code']) && ($_REQUEST['view_lang_code']) != '') {
|
2015-01-18 08:54:19 +01:00
|
|
|
$_SESSION['domain']['language']['code'] = $_REQUEST['view_lang_code'];
|
|
|
|
|
}
|
2020-11-04 01:21:41 +01:00
|
|
|
|
2016-04-26 03:19:58 +02:00
|
|
|
?>
|