Connexion tocken, stripe 3D, tracking analytic

This commit is contained in:
Oleg Barykin committed 2026-03-11 21:44:19 +01:00
1 parent 1deb30fcd1
commit bd311da711
17 files changed
+3324 -455

No files matched your search

+81 -80
View File
@@ -1,47 +1,47 @@
<?php
$lang = $_SESSION['lang'] ?? 'fr';
$lang = $_SESSION['lang'] ?? 'fr';
$PAGE_TITLE = $PAGE_TITLE ?? ($translations['site_name'] ?? 'uslugi.fr');
$HEAD_EXTRA = $HEAD_EXTRA ?? '';
$PAGE_TITLE = $PAGE_TITLE ?? ($translations['site_name'] ?? 'uslugi.fr');
$HEAD_EXTRA = $HEAD_EXTRA ?? '';
$initiales = $initiales ?? ($GLOBALS['initiales'] ?? 'U');
$avatarSvg = $avatar_svg ?? ($GLOBALS['avatar_svg'] ?? null);
$pushCfg = $pushCfg ?? ($GLOBALS['pushCfg'] ?? []);
$alerte_abonnement = $alerte_abonnement ?? ($GLOBALS['alerte_abonnement'] ?? null);
$initiales = $initiales ?? ($GLOBALS['initiales'] ?? 'U');
$avatarSvg = $avatar_svg ?? ($GLOBALS['avatar_svg'] ?? null);
$pushCfg = $pushCfg ?? ($GLOBALS['pushCfg'] ?? []);
$alerte_abonnement = $alerte_abonnement ?? ($GLOBALS['alerte_abonnement'] ?? null);
require_once __DIR__ . '/../contact_admin.php';
require_once __DIR__ . '/../contact_admin.php';
// =====================================================
// [RETOUR / REFERER SÉCURISÉ]
// - Autorise le retour seulement si le referer est sur le même host
// =====================================================
$ref = $_SERVER['HTTP_REFERER'] ?? '';
$host = $_SERVER['HTTP_HOST'] ?? '';
$safeRef = '';
if ($ref) {
$u = parse_url($ref);
if (!empty($u['host']) && $u['host'] === $host) {
$safeRef = $ref;
}
}
$fallbackBack = $safeRef ?: '/';
// =====================================================
// [RETOUR / REFERER SÉCURISÉ]
// - Autorise le retour seulement si le referer est sur le même host
// =====================================================
$ref = $_SERVER['HTTP_REFERER'] ?? '';
$host = $_SERVER['HTTP_HOST'] ?? '';
$safeRef = '';
if ($ref) {
$u = parse_url($ref);
if (! empty($u['host']) && $u['host'] === $host) {
$safeRef = $ref;
}
}
$fallbackBack = $safeRef ?: '/';
// =====================================================
// [DETECTION MOBILE]
// - Très simple détection UA pour le logo adaptatif
// =====================================================
$is_mobile = preg_match('/Mobile|Android|iPhone|iPad/i', $_SERVER['HTTP_USER_AGENT']);
// =====================================================
// [DETECTION MOBILE]
// - Très simple détection UA pour le logo adaptatif
// =====================================================
$is_mobile = preg_match('/Mobile|Android|iPhone|iPad/i', $_SERVER['HTTP_USER_AGENT']);
?>
<!doctype html>
<html lang="fr">
<head>
<title><?= htmlspecialchars($PAGE_TITLE, ENT_QUOTES, 'UTF-8') ?></title>
<?= $HEAD_EXTRA ?>
<title><?php echo htmlspecialchars($PAGE_TITLE, ENT_QUOTES, 'UTF-8') ?></title>
<?php echo $HEAD_EXTRA ?>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<!-- Police Montserrat -->
<!-- Bootstrap -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
@@ -49,20 +49,21 @@ $is_mobile = preg_match('/Mobile|Android|iPhone|iPad/i', $_SERVER['HTTP_USER_AGE
<!-- Styles personnalisés -->
<link rel="stylesheet" href="<?= asset('/includes/site_style.css') ?>">
<link rel="stylesheet" href="<?= asset('/includes/custom_style.css') ?>"> <!-- ta home -->
<link rel="stylesheet" href="<?= asset('/includes/mobil_style.css') ?>">
<link rel="stylesheet" href="<?php echo asset('/includes/site_style.css') ?>">
<link rel="stylesheet" href="<?php echo asset('/includes/custom_style.css') ?>"> <!-- ta home -->
<link rel="stylesheet" href="<?php echo asset('/includes/mobil_style.css') ?>">
<?php include_once __DIR__ . '/../../includes/tracking.php'; ?>
</head>
<body>
<?php
// Pour n'afficher qu'une fois par compte (PWA)
$pushOnboardKey = 'uslugi_push_onboard_v1_' . (int)($_SESSION['compte_id'] ?? 0);
// Pour n'afficher qu'une fois par compte (PWA)
$pushOnboardKey = 'uslugi_push_onboard_v1_' . (int) ($_SESSION['compte_id'] ?? 0);
// helper traduction (si tu n'as pas déjà $t ici)
$t = function(string $k, string $fallback = '') use (&$translations): string {
$val = $translations[$k] ?? null;
return ($val === null || $val === '') ? $fallback : (string)$val;
};
// helper traduction (si tu n'as pas déjà $t ici)
$t = function (string $k, string $fallback = '') use (&$translations): string {
$val = $translations[$k] ?? null;
return ($val === null || $val === '') ? $fallback : (string) $val;
};
?>
<div class="modal fade" id="pushOnboardModal" tabindex="-1" aria-hidden="true">
@@ -70,17 +71,17 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
<?= htmlspecialchars($t('push_onboard_title', 'Activer les notifications ?'), ENT_QUOTES, 'UTF-8') ?>
<?php echo htmlspecialchars($t('push_onboard_title', 'Activer les notifications ?'), ENT_QUOTES, 'UTF-8') ?>
</h5>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="<?= htmlspecialchars($t('push_onboard_close_aria', 'Fermer'), ENT_QUOTES, 'UTF-8') ?>">
aria-label="<?php echo htmlspecialchars($t('push_onboard_close_aria', 'Fermer'), ENT_QUOTES, 'UTF-8') ?>">
</button>
</div>
<div class="modal-body">
<?= htmlspecialchars($t('push_onboard_body', 'Vous recevrez des alertes pour les nouveaux messages et rendez-vous.'), ENT_QUOTES, 'UTF-8') ?>
<?php echo htmlspecialchars($t('push_onboard_body', 'Vous recevrez des alertes pour les nouveaux messages et rendez-vous.'), ENT_QUOTES, 'UTF-8') ?>
</div>
<div class="modal-footer">
@@ -88,13 +89,13 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
class="btn btn-outline-secondary"
data-bs-dismiss="modal"
id="pushLaterBtn">
<?= htmlspecialchars($t('push_onboard_later', 'Plus tard'), ENT_QUOTES, 'UTF-8') ?>
<?php echo htmlspecialchars($t('push_onboard_later', 'Plus tard'), ENT_QUOTES, 'UTF-8') ?>
</button>
<button type="button"
class="btn btn-primary"
id="pushEnableBtn">
<?= htmlspecialchars($t('push_onboard_allow', 'Autoriser'), ENT_QUOTES, 'UTF-8') ?>
<?php echo htmlspecialchars($t('push_onboard_allow', 'Autoriser'), ENT_QUOTES, 'UTF-8') ?>
</button>
</div>
</div>
@@ -111,9 +112,9 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
- Menu "?" compact (aide)
================================================ -->
<header class="site-header py-2 border-bottom">
<?php if (!empty($_SESSION['admin_impersonate'])): ?>
<?php if (! empty($_SESSION['admin_impersonate'])): ?>
<div class="alert alert-warning text-center mb-0 rounded-0">
Вы вошли как другой пользователь.
<a href="/admin/tools/retour_admin.php"
@@ -125,11 +126,11 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
<?php endif; ?>
<?php $alerte_abonnement = $GLOBALS['alerte_abonnement'] ?? null; ?>
<?php if (!empty($alerte_abonnement)): ?>
<?php if (! empty($alerte_abonnement)): ?>
<div class="alert alert-warning m-0 py-1 px-2 rounded"
role="alert"
style="background:#F1F1F1; color:#E03C3F; font-size:14px; text-align:center;">
<?= htmlspecialchars((string)$alerte_abonnement, ENT_QUOTES, 'UTF-8') ?>
<?php echo htmlspecialchars((string) $alerte_abonnement, ENT_QUOTES, 'UTF-8') ?>
</div>
<?php endif; ?>
@@ -140,11 +141,11 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
<div class="brand">
<!-- Bouton retour -->
<a
href="<?= htmlspecialchars($fallbackBack, ENT_QUOTES, 'UTF-8') ?>"
href="<?php echo htmlspecialchars($fallbackBack, ENT_QUOTES, 'UTF-8') ?>"
id="btnBack"
class="btn btn-light btn-circle me-2"
style="border-radius:5px; box-shadow:0 1px 2px rgba(0,0,0,.08);"
aria-label="<?= htmlspecialchars($translations['retour'] ?? 'Retour', ENT_QUOTES, 'UTF-8') ?>"
aria-label="<?php echo htmlspecialchars($translations['retour'] ?? 'Retour', ENT_QUOTES, 'UTF-8') ?>"
>
<svg viewBox="0 0 24 24" width="20" height="20" fill="none" aria-hidden="true">
<path
@@ -179,9 +180,9 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
<!-- RDV (+ badge non lus) -->
<a
id="btn-rdv"
href="<?= ($_SESSION['role'] ?? '') === 'praticien'
? '/public/praticien/rendez_vous.php'
: '/public/client/mes_rendez_vous.php' ?>"
href="<?php echo($_SESSION['role'] ?? '') === 'praticien'
? '/public/praticien/rendez_vous.php'
: '/public/client/mes_rendez_vous.php' ?>"
class="nav-rdv position-relative"
>
<img src="/public/uploads/img/bell-on.png" width="22" alt="Rendez-vous">
@@ -192,7 +193,7 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
text-align:center; border-radius:999px; padding:0 5px; display:none;"
>0</span>
</a>
<!-- Messages (+ badge non lus) -->
<a href="/messages/" class="nav-msg position-relative">
@@ -208,38 +209,38 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
<!-- Menu principal -->
<div class="menu-wrap">
<button type="button" id="btnMenu">
<div class="avatar"><?= $initiales ?></div>
<div class="avatar"><?php echo $initiales ?></div>
</button>
<!-- Menu principal (liste) -->
<ul class="dropdown-menu-custom menu-panel" id="menu">
<?php if ($_SESSION['role'] === 'client'): ?>
<li onclick="location.href='/public/client/mes_rendez_vous.php'">
<?= htmlspecialchars($translations['menu_mes_rendez_vous']) ?>
<?php echo htmlspecialchars($translations['menu_mes_rendez_vous']) ?>
</li>
<li onclick="location.href='/public/client/list_praticien.php'">
<?= htmlspecialchars($translations['menu_liste_specialistes']) ?>
<?php echo htmlspecialchars($translations['menu_liste_specialistes']) ?>
</li>
<li onclick="location.href='/public/client/mes_favori.php'">
<?= htmlspecialchars($translations['menu_mes_favoris']) ?>
<?php echo htmlspecialchars($translations['menu_mes_favoris']) ?>
</li>
<?php else: ?>
<li onclick="location.href='/public/praticien/rendez_vous.php'">
<?= htmlspecialchars($translations['menu_mes_rendez_vous']) ?>
<?php echo htmlspecialchars($translations['menu_mes_rendez_vous']) ?>
</li>
<li onclick="location.href='/public/praticien/agenda.php'">
<?= htmlspecialchars($translations['menu_mon_agenda']) ?>
<?php echo htmlspecialchars($translations['menu_mon_agenda']) ?>
</li>
<li onclick="location.href='/public/praticien/disponibilites.php'">
<?= htmlspecialchars($translations['menu_mes_disponibilites']) ?>
<?php echo htmlspecialchars($translations['menu_mes_disponibilites']) ?>
</li>
<li onclick="location.href='/public/praticien/synchronisation.php'">
<?= htmlspecialchars($translations['menu_sync_agendas']) ?>
<?php echo htmlspecialchars($translations['menu_sync_agendas']) ?>
</li>
<!--<li onclick="location.href='/public/praticien/clients/index.php'">
<?= htmlspecialchars($translations['menu_mes_clients'] ?? 'Mes clients') ?>
<?php echo htmlspecialchars($translations['menu_mes_clients'] ?? 'Mes clients') ?>
</li>-->
<?php endif; ?>
<!-- Sous-menu Admin -->
@@ -250,7 +251,7 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
aria-expanded="false"
aria-controls="submenu-admin"
>
<?= htmlspecialchars($translations['menu_admin']) ?>
<?php echo htmlspecialchars($translations['menu_admin']) ?>
<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true">
<path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2"/>
</svg>
@@ -259,28 +260,28 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
<ul id="submenu-admin" class="submenu" hidden>
<?php if ($_SESSION['role'] === 'praticien'): ?>
<li onclick="location.href='/public/praticien/resiliation.php'">
<?= htmlspecialchars($translations['menu_gerer_abonnement']) ?>
<?php echo htmlspecialchars($translations['menu_gerer_abonnement']) ?>
</li>
<li onclick="location.href='/public/praticien/factures.php'">
<?= htmlspecialchars($translations['menu_mes_factures']) ?>
<?php echo htmlspecialchars($translations['menu_mes_factures']) ?>
</li>
<li onclick="location.href='/public/cabinet/invitations.php'">
<?= htmlspecialchars($translations['secretariat_inviter_secretaire']) ?>
<?php echo htmlspecialchars($translations['secretariat_inviter_secretaire']) ?>
</li>
<li onclick="location.href='/public/praticien/clients/index.php'">
<?= htmlspecialchars($translations['menu_mes_clients'] ?? 'Mes clients') ?>
<?php echo htmlspecialchars($translations['menu_mes_clients'] ?? 'Mes clients') ?>
</li>
<?php endif; ?>
<li onclick="location.href='/public/<?= $_SESSION['role'] ?>/informations.php'">
<?= htmlspecialchars($translations['menu_mes_informations']) ?>
<li onclick="location.href='/public/<?php echo $_SESSION['role'] ?>/informations.php'">
<?php echo htmlspecialchars($translations['menu_mes_informations']) ?>
</li>
<li onclick="location.href='/public/<?= $_SESSION['role'] ?>/compte.php'">
<?= htmlspecialchars($translations['menu_infos_connexion']) ?>
<li onclick="location.href='/public/<?php echo $_SESSION['role'] ?>/compte.php'">
<?php echo htmlspecialchars($translations['menu_infos_connexion']) ?>
</li>
<li onclick="location.href='/supprimer_compte.php'">
<?= htmlspecialchars($translations['menu_supprimer_compte']) ?>
<?php echo htmlspecialchars($translations['menu_supprimer_compte']) ?>
</li>
</ul>
</li>
@@ -289,10 +290,10 @@ $t = function(string $k, string $fallback = '') use (&$translations): string {
<!-- Déconnexion -->
<li onclick="closeMenu(); openContactAdmin()">
<?= htmlspecialchars($translations['contact_admin']) ?>
<?php echo htmlspecialchars($translations['contact_admin']) ?>
</li>
<li onclick="location.href='/public/deconnexion.php'">
<?= htmlspecialchars($translations['menu_deconnexion']) ?>
<?php echo htmlspecialchars($translations['menu_deconnexion']) ?>
</li>
</ul>
</div>
@@ -464,10 +465,10 @@ if ('serviceWorker' in navigator) {
if (!('serviceWorker' in navigator) || !('PushManager' in window)) return;
if (!('Notification' in window)) return;
const VAPID_PUBLIC = "<?= htmlspecialchars($pushCfg['vapid_public'] ?? '', ENT_QUOTES) ?>";
const VAPID_PUBLIC = "<?php echo htmlspecialchars($pushCfg['vapid_public'] ?? '', ENT_QUOTES) ?>";
if (!VAPID_PUBLIC) return;
const onboardKey = "<?= htmlspecialchars($pushOnboardKey, ENT_QUOTES) ?>";
const onboardKey = "<?php echo htmlspecialchars($pushOnboardKey, ENT_QUOTES) ?>";
function urlBase64ToUint8Array(base64String) {
const padding = '='.repeat((4 - (base64String.length % 4)) % 4);