Fix the install.php.

This commit is contained in:
markjcrane 2016-03-26 09:18:36 -06:00
parent 6b657b0ef1
commit 90f30c53d7
1 changed files with 78 additions and 83 deletions

View File

@ -24,6 +24,7 @@
Mark J Crane <markjcrane@fusionpbx.com>
Matthew Vale <github@mafoo.org>
*/
//add the required includes
require_once "root.php";
require_once "resources/functions.php";
require_once "resources/classes/text.php";
@ -49,7 +50,7 @@ require_once "resources/classes/text.php";
$db_create_username = '';
$db_create_password = '';
//detect the iso country code from the locale
//detect the iso country code from the locale -
//TBD $locale = Locale::getDefault();
$timezone = 'UTC';
if (is_link('/etc/localtime')) {
@ -74,30 +75,26 @@ if (is_link('/etc/localtime')) {
}
}
//set the time zone
date_default_timezone_set($timezone);
//detect install state
$install_enabled = true;
//if the config.php exists deny access to install.php
if (file_exists($_SERVER["PROJECT_ROOT"]."/resources/config.php")) {
$install_enabled = false;
echo "access denied";
exit;
} elseif (file_exists("/etc/fusionpbx/config.php")) {
$install_enabled = false;
echo "access denied";
exit;
} elseif (file_exists("/usr/local/etc/fusionpbx/config.php")) {
$install_enabled = false;
}
if(!$install_enabled) {
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (!if_group("superadmin")) {
echo "access denied";
exit;
}
}
//intialize variables
$install_step = '';
$return_install_step = '';
//process the the HTTP POST
if (count($_POST) > 0) {
$install_language = check_str($_POST["install_language"]);
$install_step = check_str($_POST["install_step"]);
@ -117,8 +114,10 @@ if (count($_POST) > 0) {
}
}
//set the install step if it is not set
if(!$install_step) { $install_step = 'select_language'; }
//set the language for the install
$_SESSION['domain']['language']['code'] = $install_language;
//add multi-lingual support
@ -132,14 +131,12 @@ if(!$install_step) { $install_step = 'select_language'; }
}
//set a default enviroment if first_time
if($install_enabled){
//initialize some varibles to cut down on warnings
$_SESSION['message'] = '';
$v_link_label_play = '';
$v_link_label_pause = '';
$default_login = 0;
$onload = '';
}
//get the contents of the template and save it to the template variable
$template = file_get_contents($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes/'.$default_template.'/template.php');
@ -343,17 +340,15 @@ if(!$install_step) { $install_step = 'select_language'; }
echo "<p>Unkown install_step '$install_step'</p>\n";
}
if($install_enabled){
//get the default theme
$set_session_theme = 1;
$domains_processed = 1;
include "themes/".$default_template."/app_defaults.php";
include "themes/".$default_template."/template.php";
unset($set_session_theme, $domains_processed);
//initialize some defaults so we can be 'logged in'
$_SESSION['username'] = 'install_enabled';
$_SESSION['permissions'][]['permission_name'] = 'superadmin';
$_SESSION['menu'] = '';
}
//$_SESSION['username'] = 'install_enabled';
//$_SESSION['permissions'][]['permission_name'] = 'superadmin';
//$_SESSION['menu'] = '';
//add the content to the template and then send output
$body = ob_get_contents(); //get the output from the buffer