70 lines
2.6 KiB
PHP
70 lines
2.6 KiB
PHP
<?php
|
|
// Mapping inverse
|
|
$UGLY_TO_PRETTY = [
|
|
//racine
|
|
'/index.php' => '/',
|
|
'/result_search.php' => '/recherche',
|
|
'/detail_public.php' => '/specialistes',
|
|
'/connexion.php' => '/login',
|
|
'/choix_inscr.php' => '/choix-inscription',
|
|
'/inscription_client.php' => '/inscription-client',
|
|
'/inscription_praticien.php' => '/inscription-praticien',
|
|
'/mdp_oublie.php' => '/mot-de-passe-oublie',
|
|
'/avis_public.php' => '/avis',
|
|
//dossier client
|
|
'/public/client/informations.php' => '/profil',
|
|
'/public/client/modifier.php' => '/modifier-profil',
|
|
'/public/client/compte.php' => '/mon-compte',
|
|
'/public/client/list_praticien.php' => '/trouver-specialistes',
|
|
'/public/client/mes_favori.php' => '/mes-preferences',
|
|
'/public/client/detail_praticien.php' => '/specialiste',
|
|
'/public/client/avis.php' => '/donner-avis',
|
|
'/public/client/reserver_rdv.php' => '/reservation',
|
|
'/public/client/mes_rendez_vous.php' => '/mes-rendez-vous',
|
|
|
|
//Dossier praticien
|
|
'/public/praticien/informations.php' => '/profil-pro',
|
|
'/public/praticien/modifier.php' => '/modifier-profil-pro',
|
|
'/public/praticien/compte.php' => '/mon-compte-pro',
|
|
'/public/praticien/disponibilites.php' => '/mes-creneaux',
|
|
'/public/praticien/disponibilites_date.php' => '/mes-creneaux-date',
|
|
'/public/praticien/rendez_vous.php' => '/mes-consultations',
|
|
'/public/praticien/rendez_vous_du_jour.php' => '/consultations-du-jour',
|
|
'/public/praticien/agenda.php' => '/agenda',
|
|
'/public/praticien/synchronisation.php' => '/connecter-agenda',
|
|
'/public/praticien/resiliation.php' => '/abonnement',
|
|
'/public/praticien/factures.php' => '/mes-factures',
|
|
|
|
//Dossier messages
|
|
|
|
];
|
|
$PRETTY_TO_UGLY = array_flip($UGLY_TO_PRETTY);
|
|
|
|
// Quel slug demandé ? ex: page-1.htm
|
|
$slug = $_GET['slug'] ?? '';
|
|
$slug = '/' . ltrim($slug, '/');
|
|
|
|
if (!isset($PRETTY_TO_UGLY[$slug])) {
|
|
http_response_code(404);
|
|
echo 'Page non trouvée';
|
|
exit;
|
|
}
|
|
|
|
$targetRelative = $PRETTY_TO_UGLY[$slug]; // ex: /public/client/informations.php
|
|
$targetAbsolute = $_SERVER['DOCUMENT_ROOT'] . $targetRelative;
|
|
|
|
if (!is_file($targetAbsolute)) {
|
|
http_response_code(404);
|
|
echo 'Cible introuvable';
|
|
exit;
|
|
}
|
|
|
|
// Marquer qu'on passe par router pour éviter boucle
|
|
define('ROUTED_PRETTY', true);
|
|
|
|
// Aller dans le bon dossier
|
|
chdir(dirname($targetAbsolute));
|
|
|
|
// Inclure la vraie page
|
|
require $targetAbsolute;
|