mirror of
https://github.com/slawkens/myaac.git
synced 2025-09-14 04:23:34 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4eab805d26 | ||
![]() |
3f24f961b1 | ||
![]() |
0b86459940 |
@@ -26,7 +26,7 @@
|
||||
if (version_compare(phpversion(), '8.1', '<')) die('PHP version 8.1 or higher is required.');
|
||||
|
||||
const MYAAC = true;
|
||||
const MYAAC_VERSION = '1.8.1';
|
||||
const MYAAC_VERSION = '1.8.2-dev';
|
||||
const DATABASE_VERSION = 45;
|
||||
const TABLE_PREFIX = 'myaac_';
|
||||
define('START_TIME', microtime(true));
|
||||
|
@@ -42,45 +42,44 @@ if(!$error) {
|
||||
$configToSave['cache_prefix'] = 'myaac_' . generateRandomString(8, true, false, true);
|
||||
$configToSave['database_auto_migrate'] = true;
|
||||
|
||||
if(!$error) {
|
||||
$content = '';
|
||||
$saved = Settings::saveConfig($configToSave, BASE . 'config.local.php', $content);
|
||||
if ($saved) {
|
||||
success($locale['step_database_config_saved']);
|
||||
$_SESSION['saved'] = true;
|
||||
$content = '';
|
||||
$saved = Settings::saveConfig($configToSave, BASE . 'config.local.php', $content);
|
||||
if ($saved || file_exists(BASE . 'config.local.php')) {
|
||||
success($locale['step_database_config_saved']);
|
||||
$_SESSION['saved'] = true;
|
||||
|
||||
require BASE . 'config.local.php';
|
||||
require BASE . 'install/includes/config.php';
|
||||
require BASE . 'config.local.php';
|
||||
require BASE . 'install/includes/config.php';
|
||||
|
||||
if (!$error) {
|
||||
require BASE . 'install/includes/database.php';
|
||||
if (!$error) {
|
||||
require BASE . 'install/includes/database.php';
|
||||
|
||||
if (isset($database_error)) { // we failed connect to the database
|
||||
error($database_error);
|
||||
if (isset($database_error)) { // we failed connect to the database
|
||||
error($database_error);
|
||||
}
|
||||
else {
|
||||
if (!$db->hasTable('accounts')) {
|
||||
$tmp = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
|
||||
error($tmp);
|
||||
$error = true;
|
||||
}
|
||||
else {
|
||||
if (!$db->hasTable('accounts')) {
|
||||
$tmp = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
|
||||
error($tmp);
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$twig->display('install.installer.html.twig', array(
|
||||
'url' => 'tools/5-database.php',
|
||||
'message' => $locale['loading_spinner']
|
||||
));
|
||||
}
|
||||
if (!$error) {
|
||||
$twig->display('install.installer.html.twig', array(
|
||||
'url' => 'tools/5-database.php',
|
||||
'message' => $locale['loading_spinner']
|
||||
));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$_SESSION['config_content'] = $content;
|
||||
unset($_SESSION['saved']);
|
||||
|
||||
$locale['step_database_error_file'] = str_replace('$FILE$', '<b>' . BASE . 'config.php</b>', $locale['step_database_error_file']);
|
||||
error($locale['step_database_error_file'] . '<br/>
|
||||
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
||||
}
|
||||
} else {
|
||||
$error = true;
|
||||
$_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']);
|
||||
error($locale['step_database_error_file'] . '<br/>
|
||||
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -94,19 +94,30 @@ $dispatcher = FastRoute\cachedDispatcher(function (FastRoute\RouteCollector $r)
|
||||
$routesFinal[] = ['*', $page, '__database__/' . $page, 100];
|
||||
}
|
||||
|
||||
$routes = require SYSTEM . 'routes.php';
|
||||
Plugins::clearWarnings();
|
||||
foreach (Plugins::getRoutes() as $route) {
|
||||
$routesFinal[] = [$route[0], $route[1], $route[2], $route[3] ?? 1000];
|
||||
|
||||
foreach (Plugins::getRoutes() as $pluginRoute) {
|
||||
|
||||
$routesFinal[] = [$pluginRoute[0], $pluginRoute[1], $pluginRoute[2], $pluginRoute[3] ?? 1000];
|
||||
|
||||
// Possibility to override routes with plugins pages, like characters.php
|
||||
foreach ($routes as &$route) {
|
||||
if (str_contains($pluginRoute[2], 'pages/' . $route[2])) {
|
||||
$route[2] = $pluginRoute[2];
|
||||
}
|
||||
}
|
||||
/*
|
||||
echo '<pre>';
|
||||
var_dump($route[1], $route[3], $route[2]);
|
||||
var_dump($pluginRoute[1], $pluginRoute[3], $pluginRoute[2]);
|
||||
echo '/<pre>';
|
||||
*/
|
||||
}
|
||||
|
||||
$routes = require SYSTEM . 'routes.php';
|
||||
foreach ($routes as $route) {
|
||||
if (!str_contains($route[2], '__redirect__') && !str_contains($route[2], '__database__')) {
|
||||
if (!str_contains($route[2], '__redirect__') && !str_contains($route[2], '__database__')
|
||||
&& !str_contains($route[2], 'plugins/')
|
||||
) {
|
||||
if (!is_file(BASE . 'system/pages/' . $route[2])) {
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user