2015-04-18 20:40:07 +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>
|
2023-01-28 01:19:00 +01:00
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2023
|
2015-04-18 20:40:07 +02:00
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J. Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
2021-08-01 06:53:13 +02:00
|
|
|
|
2022-10-11 00:35:14 +02:00
|
|
|
//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']);
|
|
|
|
|
|
2021-08-01 06:53:13 +02:00
|
|
|
//start the session
|
2015-12-22 04:52:54 +01:00
|
|
|
ini_set("session.cookie_httponly", True);
|
2016-12-12 07:00:53 +01:00
|
|
|
if (!isset($_SESSION)) { session_start(); }
|
2015-04-18 20:40:07 +02:00
|
|
|
|
2022-10-12 18:46:19 +02:00
|
|
|
//if config.conf file does not exist then redirect to the install page
|
|
|
|
|
if (file_exists("/usr/local/etc/fusionpbx/config.conf")) {
|
2022-10-11 03:34:55 +02:00
|
|
|
//BSD
|
2023-05-10 06:27:09 +02:00
|
|
|
}
|
|
|
|
|
elseif (file_exists("/etc/fusionpbx/config.conf")) {
|
2022-10-11 03:34:55 +02:00
|
|
|
//Linux
|
2023-05-10 06:27:09 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2022-10-16 05:11:06 +02:00
|
|
|
header("Location: /core/install/install.php");
|
2015-04-18 20:40:07 +02:00
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//adds multiple includes
|
|
|
|
|
require_once "resources/require.php";
|
|
|
|
|
|
2021-08-01 06:53:13 +02:00
|
|
|
//if logged in, redirect to login destination
|
2021-08-02 01:13:59 +02:00
|
|
|
if (isset($_SESSION["username"])) {
|
2023-01-28 01:19:00 +01:00
|
|
|
if (isset($_SESSION['login']['destination']['text'])) {
|
|
|
|
|
header("Location: ".$_SESSION['login']['destination']['text']);
|
2023-05-10 06:27:09 +02:00
|
|
|
}
|
|
|
|
|
elseif (file_exists($_SERVER["PROJECT_ROOT"]."/core/dashboard/app_config.php")) {
|
2021-11-10 16:29:08 +01:00
|
|
|
header("Location: ".PROJECT_PATH."/core/dashboard/");
|
2021-08-02 01:13:59 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
require_once "resources/header.php";
|
|
|
|
|
require_once "resources/footer.php";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2015-04-18 20:40:07 +02:00
|
|
|
//use custom index, if present, otherwise use custom login, if present, otherwise use default login
|
2016-01-17 08:01:13 +01:00
|
|
|
if (file_exists($_SERVER["PROJECT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
|
2015-04-18 20:40:07 +02:00
|
|
|
require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";
|
|
|
|
|
}
|
|
|
|
|
else {
|
2023-05-10 06:27:09 +02:00
|
|
|
header("Location: ".PROJECT_PATH."/core/dashboard/");
|
2015-04-18 20:40:07 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-12 07:00:53 +01:00
|
|
|
?>
|