Fixed First Start
This commit is contained in:
Regular → Executable
+22
-7
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user