Init Git Prod Mars 2026
This commit is contained in:
commit
d81efe93b1
362 files changed
+86627
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/_bootstrap.php';
|
||||
|
||||
require_auth_json(['client','praticien','secretaire','admin']);
|
||||
|
||||
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') {
|
||||
json_response(['ok'=>false,'error'=>'method_not_allowed'], 405);
|
||||
}
|
||||
|
||||
$input = read_json_body();
|
||||
$endpoint = trim((string)($input['endpoint'] ?? ''));
|
||||
|
||||
if ($endpoint === '') {
|
||||
json_response(['ok'=>false,'error'=>'bad_params'], 400);
|
||||
}
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("
|
||||
UPDATE push_subscriptions
|
||||
SET is_active = 0, updated_at = NOW()
|
||||
WHERE endpoint = :e
|
||||
AND compte_id = :cid
|
||||
");
|
||||
$stmt->execute([
|
||||
':e' => $endpoint,
|
||||
':cid' => (int)($_SESSION['compte_id'] ?? 0),
|
||||
]);
|
||||
|
||||
json_response(['ok'=>true]);
|
||||
|
||||
} catch (Throwable $e) {
|
||||
error_log('push unsubscribe error: '.$e->getMessage());
|
||||
json_response(['ok'=>false,'error'=>'server_error'], 500);
|
||||
}
|
||||
Reference in new issue
Block a user