* switch to 0.7.5-dev

* fix when config.local.php doesn't exist
* fix when reinstalling aac with samples already installed
* some optimisations to installation script
* forgot to fclose on config.local.php
This commit is contained in:
slawkens1
2017-12-24 13:00:14 +01:00
parent b83fb05b82
commit 4d690992ac
9 changed files with 67 additions and 17 deletions

View File

@@ -5,7 +5,9 @@ require('../common.php');
require(SYSTEM . 'functions.php');
require(BASE . 'install/includes/functions.php');
require(BASE . 'install/includes/locale.php');
require(BASE . 'config.local.php');
if(file_exists(BASE . 'config.local.php'))
require(BASE . 'config.local.php');
// twig
require_once LIBS . 'Twig/Autoloader.php';
@@ -31,15 +33,31 @@ if(!in_array($step, $steps)) // check if step is valid
die('ERROR: Unknown step.');
$errors = array();
if($step == 'database')
{
foreach($_POST['vars'] as $key => $value)
{
if($step == 'database') {
foreach($_SESSION as $key => $value) {
if(strpos($key, 'var_') === false || strpos($key, 'account') !== false || strpos($key, 'password') !== false) {
continue;
}
$key = str_replace('var_', '', $key);
if($key != 'usage' && empty($value))
{
$errors[] = $locale['please_fill_all'];
break;
}
else if($key == 'server_path')
{
$config['server_path'] = $value;
// take care of trailing slash at the end
if($config['server_path'][strlen($config['server_path']) - 1] != '/')
$config['server_path'] .= '/';
if(!file_exists($config['server_path'] . 'config.lua')) {
$errors[] = $locale['step_database_error_config'];
break;
}
}
else if($key == 'mail_admin' && !Validator::email($value))
{
$errors[] = $locale['step_config_mail_admin_error'];
@@ -56,6 +74,16 @@ if($step == 'database')
$step = 'config';
}
}
else if($step == 'admin') {
$config_failed = true;
if(file_exists(BASE . 'config.local.php') && isset($config['installed']) && $config['installed'] && isset($_SESSION['saved'])) {
$config_failed = false;
}
if($config_failed) {
$step = 'database';
}
}
else if($step == 'finish') {
// password
$password = $_SESSION['var_password'];