31 lines
959 B
PHP
31 lines
959 B
PHP
<?php
|
|
/*
|
|
* Reflector Dashboard — web front-end for SvxReflector
|
|
* Copyright (C) 2026 SA7AUX (Björn)
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify it under
|
|
* the terms of the GNU Affero General Public License as published by the Free
|
|
* Software Foundation, either version 3 of the License, or (at your option) any
|
|
* later version. See the LICENSE file for details.
|
|
*/
|
|
declare(strict_types=1);
|
|
require __DIR__ . '/lib.php';
|
|
|
|
$j = json_in();
|
|
$consent = (string)($j['consent'] ?? '');
|
|
if ($consent !== 'necessary' && $consent !== 'all') {
|
|
json_out(['ok'=>false,'error'=>'bad_consent'], 400);
|
|
}
|
|
|
|
$maxAge = 60 * 60 * 24 * 365;
|
|
setcookie('cookie_consent', $consent, [
|
|
'expires' => time() + $maxAge,
|
|
'path' => '/',
|
|
'secure' => (bool)(cfg()['session']['cookie_secure'] ?? false),
|
|
'httponly' => false,
|
|
'samesite' => 'Lax',
|
|
]);
|
|
|
|
json_out(['ok'=>true, 'consent'=>$consent]);
|