Retire clé export et ajoute demo

This commit is contained in:
Johnnybegood90
2026-03-15 03:08:16 +01:00
parent 16abfab05b
commit bdf3b4797d
4 changed files with 34 additions and 3 deletions
+5 -1
View File
@@ -3,6 +3,10 @@
require_once __DIR__ . '/common.php';
function gridtv_require_admin(array $config, string $page_title = 'Admin'): array {
if (gridtv_is_demo_mode()) {
return ['unlocked' => true, 'error' => '', 'demo' => true];
}
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
@@ -12,7 +16,7 @@ function gridtv_require_admin(array $config, string $page_title = 'Admin'): arra
$error = '';
if ($admin_key !== '' && hash_equals($admin_key, (string) $session_key)) {
return ['unlocked' => true, 'error' => ''];
return ['unlocked' => true, 'error' => '', 'demo' => false];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['admin_key_input'])) {
+8
View File
@@ -4,6 +4,14 @@ function gridtv_config_path(): string {
return dirname(__DIR__, 2) . '/config.json';
}
function gridtv_demo_path(): string {
return dirname(__DIR__, 2) . '/.demo';
}
function gridtv_is_demo_mode(): bool {
return file_exists(gridtv_demo_path());
}
function gridtv_load_config(): array {
$config_path = gridtv_config_path();
if (!file_exists($config_path)) {