mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +02:00
* 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:
@@ -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);
|
||||
|
@@ -9,7 +9,7 @@ $clients_list = array(
|
||||
770,
|
||||
772,
|
||||
780,
|
||||
7920,
|
||||
792,
|
||||
800,
|
||||
810,
|
||||
821,
|
||||
|
@@ -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>');
|
||||
|
@@ -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']);
|
||||
|
Reference in New Issue
Block a user