diff --git a/CHANGELOG b/CHANGELOG
index 7b1dd5a4..81d982d5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
[0.7.3 - 18.12.2017]
- * auto generate myaac cache & session prefix on install to be unique accross installations
- * fixed hidding shop system menu on tibiacom template when disabled in config
+ * auto generate myaac cache & session prefix on install to be unique across installations
+ * fixed hiding shop system menu on tibiacom template when disabled in config
* prevent adding duplicated newses with installation
* some changes to sample characters: chanced town_id to 1, posx: 1000, posy: 1000, posz: 1000 and default group_id to 1 so you can change in-game outfits and they will be used
* added version 772 constant to install client choose (OTHire)
diff --git a/TODO b/TODO
index 7baa22ab..626c7c8d 100644
--- a/TODO
+++ b/TODO
@@ -3,16 +3,12 @@
0.*
* support duplicated vocation names with different ids
* plugins: option to define custom requirements check in json file, to check if system meets the requirement
- * inform user about Twig cache failure on installation, instead of 500 error
* add support for defining max myaac version in plugin.json file
* cache Menus in templates
* don't show error indicators on first time load - createaccount page
* update Twig to the latest version from 1.x branch
* semantic versioning support for plugins (github.com/composer/semver)
- * database towns table support for TFS 1.3
- * players.is_sample is waste, better save in config.php array of ignored ids
* add some notice to the user that installing step "Import Schema" will take some time
- * remember client version in session on install
1.0:
* i18n support (issue #1 on github)
@@ -24,6 +20,7 @@
* var/ (for logs, cache and data), config/, bin, public/ (for index and images and other public content), system/ (for php files and classess)
* rename templates to layouts as templates is meant to be used for twig templates
* change gifts_system to shop_system configurable
+ * move most used options in system/templates dir to separate directories (more transparent)
At any time between (version not specified):
* better news archive with search function (like on tibia.com)
@@ -33,4 +30,5 @@ At any time between (version not specified):
* possibility to add extra cache engines with plugins
* preferably configurable (enable/disable) forum TinyMCE editor
* new cache engine - plain php, is good with pure php 7.0+ and opcache
- * OTAdmin support in Admin Panel
\ No newline at end of file
+ * OTAdmin support in Admin Panel
+ * database towns table support for TFS 1.3
\ No newline at end of file
diff --git a/install/includes/functions.php b/install/includes/functions.php
index 4c138c55..e4ce4522 100644
--- a/install/includes/functions.php
+++ b/install/includes/functions.php
@@ -78,4 +78,23 @@ function next_form($previous = true, $next = true)
' . next_buttons($previous, $next) . '
';
}
-?>
\ No newline at end of file
+
+function win_is_writable($path) {
+ if($path[strlen( $path ) - 1] == '/') { // if it looks like a directory, check a random file within the directory
+ return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
+ } elseif(is_dir( $path )) { // If it's a directory (and not a file) check a random file within the directory
+ return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
+ }
+
+ // check tmp file for read/write capabilities
+ $should_delete_tmp_file = !file_exists( $path );
+ $f = @fopen( $path, 'a' );
+ if ( $f === false )
+ return false;
+
+ fclose( $f );
+ if($should_delete_tmp_file)
+ unlink($path);
+
+ return true;
+}
\ No newline at end of file
diff --git a/install/includes/twig_error.html b/install/includes/twig_error.html
new file mode 100644
index 00000000..933a36c1
--- /dev/null
+++ b/install/includes/twig_error.html
@@ -0,0 +1,11 @@
+We have detected that you don't have access to write to the system/cache directory. Under linux you can fix it by using this two command, where first one should be enough (for apache):
chown -R www-data.www-data /var/www/*
chmod -R 660 system/cache
+
+
\ No newline at end of file
diff --git a/install/index.php b/install/index.php
index fdb6e86e..22c87b3d 100644
--- a/install/index.php
+++ b/install/index.php
@@ -91,16 +91,19 @@ else if($step == 'finish') {
$error = false;
-// step include
-ob_start();
+clearstatcache();
+if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
+ ob_start();
-$step_id = array_search($step, $steps);
-require('steps/' . $step_id . '-' . $step . '.php');
-$content = ob_get_contents();
-ob_end_clean();
+ $step_id = array_search($step, $steps);
+ require('steps/' . $step_id . '-' . $step . '.php');
+ $content = ob_get_contents();
+ ob_end_clean();
+}
+else {
+ $content = error(file_get_contents(BASE . 'install/includes/twig_error.html'), true);
+}
// render
require('template/template.php');
-//$_SESSION['laststep'] = $step;
-
-?>
+//$_SESSION['laststep'] = $step;
\ No newline at end of file
diff --git a/install/steps/5-database.php b/install/steps/5-database.php
index 56f7912c..5ab0fb23 100644
--- a/install/steps/5-database.php
+++ b/install/steps/5-database.php
@@ -240,9 +240,9 @@ if(!$error) {
$content .= PHP_EOL;
$content .= '$config[\'client_download_linux\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/tar/linux\';';
$content .= PHP_EOL;
- $content .= '$config[\'session_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '\';';
+ $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 .= '$config[\'cache_prefix\'] = \'myaac_' . generateRandomString(8, true, false, true, false) . '_\';';
$content .= PHP_EOL;
$file = fopen(BASE . 'config.local.php', 'a+');
diff --git a/system/init.php b/system/init.php
index 0067c7d4..da60a5d1 100644
--- a/system/init.php
+++ b/system/init.php
@@ -149,7 +149,7 @@ $config['data_path'] = $tmp;
unset($tmp);
// new config values for compability
-if($config['highscores_ids_hidden'] == null) {
+if(!isset($config['highscores_ids_hidden'])) {
$config['highscores_ids_hidden'] = array();
}
diff --git a/system/migrations/19.php b/system/migrations/19.php
index aa34aaed..50baa271 100644
--- a/system/migrations/19.php
+++ b/system/migrations/19.php
@@ -1,3 +1,3 @@
\ No newline at end of file
diff --git a/system/templates/install.config.html.twig b/system/templates/install.config.html.twig
index 90548b19..874e1d5e 100644
--- a/system/templates/install.config.html.twig
+++ b/system/templates/install.config.html.twig
@@ -23,7 +23,7 @@
@@ -38,7 +38,7 @@
-
+