Init Git Prod Mars 2026

This commit is contained in:
Oleg Barykin committed 2026-03-05 10:25:39 +01:00
commit d81efe93b1
362 files changed
+86627

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
<?php
// /messages/api/archive_conversation.php
declare(strict_types=1);
require_once __DIR__ . '/../_bootstrap.php';
header('Content-Type: application/json; charset=utf-8');
if (!hash_equals($_SESSION['_csrf'] ?? '', $_POST['_csrf'] ?? '')) {
json_response(['error' => 'csrf'], 419);
}
$role = $GLOBALS['MESSAGES_CTX']['role'];
$meId = $GLOBALS['MESSAGES_CTX']['me_id'];
$convId = (int)($_POST['conversation_id'] ?? 0);
$archive= (int)($_POST['archive'] ?? 1);
if ($convId <= 0) json_response(['error' => 'bad_params'], 400);
assert_conversation_access($pdo, $convId, $role, $meId);
$col = ($role === 'praticien') ? 'archived_by_praticien' : 'archived_by_client';
$pdo->prepare("UPDATE conversations SET $col = ? WHERE id = ?")->execute([$archive ? 1 : 0, $convId]);
json_response(['ok' => true, 'archived' => (bool)$archive]);