Retire clé export et ajoute demo
This commit is contained in:
+5
-1
@@ -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'])) {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user