* 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

@@ -23,7 +23,7 @@ $failed = false;
// start validating
version_check($locale['step_requirements_php_version'], (PHP_VERSION_ID >= 50300), PHP_VERSION);
foreach(array('config.local.php', 'images/guilds', 'images/houses', 'images/gallery') as $value)
foreach(array('images/guilds', 'images/houses', 'images/gallery') as $value)
{
$perms = (int) substr(decoct(fileperms(BASE . $value)), 2);
version_check($locale['step_requirements_write_perms'] . ': ' . $value, $perms >= 660);

View File

@@ -9,7 +9,7 @@ $clients_list = array(
770,
772,
780,
7920,
792,
800,
810,
821,

View File

@@ -13,6 +13,8 @@ if(!isset($_SESSION['var_server_path'])) {
if(!$error) {
$content = "<?php";
$content .= PHP_EOL;
$content .= '// place for your configuration directives, so you can later easily update myaac';
$content .= PHP_EOL;
foreach($_SESSION as $key => $value)
{
if(strpos($key, 'var_') !== false)
@@ -221,7 +223,7 @@ if(!$error) {
}
}
if(!$error && (!isset($_SESSION['saved']))) {
if(!$error) {
$content .= '$config[\'installed\'] = true;';
$content .= PHP_EOL;
@@ -243,16 +245,21 @@ if(!$error) {
$content .= '$config[\'session_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
$content .= PHP_EOL;
$content .= '$config[\'cache_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
$content .= PHP_EOL;
$saved = true;
if(!$error) {
$saved = file_put_contents(BASE . 'config.local.php', $content);
}
$file = fopen(BASE . 'config.local.php', 'a+');
if($file) {
if($saved) {
if(!$error) {
fwrite($file, $content);
$_SESSION['saved'] = true;
}
}
else {
$_SESSION['config_content'] = $content;
unset($_SESSION['saved']);
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
warning($locale['step_database_error_file'] . '<br/>
<textarea cols="70" rows="10">' . $content . '</textarea>');

View File

@@ -192,13 +192,26 @@ else {
error(Spells::getLastError());
}
if(count($highscores_ignored_ids) == 0) {
$query = $db->query("SELECT `id` FROM `players` WHERE (`name` = " . $db->quote("Rook Sample") . " OR `name` = " . $db->quote("Sorcerer Sample") . " OR `name` = " . $db->quote("Druid Sample") . " OR `name` = " . $db->quote("Paladin Sample") . " OR `name` = " . $db->quote("Knight Sample") . ") ORDER BY `id`;");
$highscores_ignored_ids = array();
if($query->rowCount() > 0) {
foreach($query->fetchAll() as $result)
$highscores_ignored_ids[] = $result['id'];
}
else {
$highscores_ignored_ids[] = 0;
}
}
$content = PHP_EOL;
$content .= '$config[\'highscores_ids_hidden\'] = array(' . implode(', ', $highscores_ignored_ids) . ');';
$content .= PHP_EOL;
$file = fopen(BASE . 'config.local.php', 'a+');
if($file) {
fwrite($file, $content);
fclose($file);
}
else {
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);