Fixed First Start

This commit is contained in:
2026-08-20 09:02:05 +01:00
parent a2f36b6fac
commit 1ea31362c4
5 changed files with 54 additions and 20 deletions
Regular → Executable
+22 -7
View File
@@ -11,6 +11,17 @@ if (session_status() === PHP_SESSION_NONE) {
define("ROOT_DIR", __DIR__ . "/");
require_once(__DIR__ . "/functions/lang.php");
// Check if installation is already completed or lock file exists
$installed_lock = __DIR__ . "/config/installed.lock";
$completed_file = __DIR__ . "/first_start.php.completed";
if (file_exists($completed_file) || file_exists($installed_lock)) {
header("Location: index.php?page=login");
exit;
}
// Handle language selection
if (isset($_GET['set_lang'])) {
set_active_lang($_GET['set_lang']);
@@ -142,14 +153,18 @@ if ($db_needed == "yes"){
require_once(CONFIG_FOLD . "db.php");
}
?>';
file_put_contents(__DIR__ . "/config/settings.php", $settings_file_content);
if (@file_put_contents(__DIR__ . "/config/settings.php", $settings_file_content) === false) {
$msg_error = __('err_setup_write_permissions');
} else {
// Rename first_start.php to first_start.php.completed to prevent installer re-entry
if (!@rename(__FILE__, __DIR__ . "/first_start.php.completed")) {
@file_put_contents(__DIR__ . "/config/installed.lock", date('Y-m-d H:i:s'));
}
// Rename first_start.php to first_start.php.completed to prevent installer re-entry
@rename(__FILE__, __DIR__ . "/first_start.php.completed");
// Redirect to login page
header("Location: index.php?page=login&installed=1");
exit;
// Redirect to login page
header("Location: index.php?page=login&installed=1");
exit;
}
}
}
}