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>
|
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
2013-06-11 05:48:58 +02:00
|
|
|
Mark J. Crane <markjcrane@fusionpbx.com>
|
2012-06-04 16:58:40 +02:00
|
|
|
*/
|
|
|
|
|
include "root.php";
|
2013-02-11 16:11:51 +01:00
|
|
|
|
2014-07-27 02:13:52 +02:00
|
|
|
//clear the session variables
|
|
|
|
|
session_start();
|
|
|
|
|
|
2013-02-11 16:11:51 +01:00
|
|
|
//if config.php file does not exist then redirect to the install page
|
2013-07-06 09:38:14 +02:00
|
|
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
|
2013-04-27 08:40:44 +02:00
|
|
|
//do nothing
|
2013-07-11 01:41:12 +02:00
|
|
|
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php")) {
|
2013-07-06 10:03:14 +02:00
|
|
|
//original directory
|
2013-08-21 17:49:38 +02:00
|
|
|
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php")) {
|
|
|
|
|
//move config.php from the includes to resources directory.
|
|
|
|
|
rename($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/includes/config.php", $_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/resources/config.php");
|
2014-07-27 02:13:52 +02:00
|
|
|
} elseif (file_exists("/etc/fusionpbx/config.php")) {
|
2013-04-27 08:40:44 +02:00
|
|
|
//linux
|
2014-07-27 02:13:52 +02:00
|
|
|
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
|
2013-04-27 08:40:44 +02:00
|
|
|
//bsd
|
2013-07-06 10:03:14 +02:00
|
|
|
} else {
|
2013-02-11 16:11:51 +01:00
|
|
|
header("Location: ".PROJECT_PATH."/resources/install.php");
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//adds multiple includes
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-02-11 16:11:51 +01:00
|
|
|
|
2014-07-27 02:13:52 +02:00
|
|
|
// if logged in, redirect to login destination
|
|
|
|
|
if (strlen($_SESSION["username"]) > 0) {
|
|
|
|
|
header("Location: ".$_SESSION['login']['destination']['url']);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//use custom index, if present, otherwise use custom login, if present, otherwise use default login
|
|
|
|
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/index.php")) {
|
2013-02-11 16:11:51 +01:00
|
|
|
require_once "themes/".$_SESSION['domain']['template']['name']."/index.php";
|
|
|
|
|
}
|
2014-07-27 02:13:52 +02:00
|
|
|
else if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/login.php")) {
|
|
|
|
|
require_once "themes/".$_SESSION['domain']['template']['name']."/login.php";
|
|
|
|
|
}
|
2013-02-11 16:11:51 +01:00
|
|
|
else {
|
2014-07-27 02:13:52 +02:00
|
|
|
require_once "resources/login.php";
|
2013-02-11 16:11:51 +01:00
|
|
|
}
|
2014-07-27 02:13:52 +02:00
|
|
|
}
|
2013-09-11 01:06:41 +02:00
|
|
|
?>
|