Version stable, aprelic, connexion CFRS et autres corrections
This commit is contained in:
1 parent
865de8a976
commit
e9d0010451
62 files changed
+17483
-7256
No files matched your search
+106
-34
@@ -1,28 +1,30 @@
|
||||
<?php
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/search_helpers.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',
|
||||
// racine
|
||||
'/index.php' => '/',
|
||||
'/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 praticien
|
||||
// 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',
|
||||
@@ -34,36 +36,106 @@ $UGLY_TO_PRETTY = [
|
||||
'/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
|
||||
// Quel slug demandé ?
|
||||
$slug = $_GET['slug'] ?? '';
|
||||
$slug = '/' . ltrim($slug, '/');
|
||||
$slug = '/' . trim($slug, '/');
|
||||
|
||||
if (!isset($PRETTY_TO_UGLY[$slug])) {
|
||||
// =========================
|
||||
// Routes dynamiques recherche
|
||||
// =========================
|
||||
|
||||
// /recherche
|
||||
if ($slug === '/recherche') {
|
||||
$targetRelative = '/result_search.php';
|
||||
$targetAbsolute = $_SERVER['DOCUMENT_ROOT'] . $targetRelative;
|
||||
|
||||
define('ROUTED_PRETTY', true);
|
||||
chdir(dirname($targetAbsolute));
|
||||
require $targetAbsolute;
|
||||
exit;
|
||||
}
|
||||
// /recherche/ville/{ville}
|
||||
if (preg_match('#^/recherche/ville/([^/]+)$#', $slug, $m)) {
|
||||
$_GET['ville'] = seo_unslug(rawurldecode($m[1]));
|
||||
|
||||
$targetRelative = '/result_search.php';
|
||||
$targetAbsolute = $_SERVER['DOCUMENT_ROOT'] . $targetRelative;
|
||||
|
||||
define('ROUTED_PRETTY', true);
|
||||
chdir(dirname($targetAbsolute));
|
||||
require $targetAbsolute;
|
||||
exit;
|
||||
}
|
||||
// /recherche/{specialite}
|
||||
if (preg_match('#^/recherche/([^/]+)$#', $slug, $m)) {
|
||||
$_GET['specialite'] = seo_unslug(rawurldecode($m[1]));
|
||||
|
||||
$targetRelative = '/result_search.php';
|
||||
$targetAbsolute = $_SERVER['DOCUMENT_ROOT'] . $targetRelative;
|
||||
|
||||
define('ROUTED_PRETTY', true);
|
||||
chdir(dirname($targetAbsolute));
|
||||
require $targetAbsolute;
|
||||
exit;
|
||||
}
|
||||
|
||||
// /recherche/{specialite}/{ville}
|
||||
if (preg_match('#^/recherche/([^/]+)/([^/]+)$#', $slug, $m)) {
|
||||
$_GET['specialite'] = seo_unslug(rawurldecode($m[1]));
|
||||
$_GET['ville'] = seo_unslug(rawurldecode($m[2]));
|
||||
|
||||
$targetRelative = '/result_search.php';
|
||||
$targetAbsolute = $_SERVER['DOCUMENT_ROOT'] . $targetRelative;
|
||||
|
||||
define('ROUTED_PRETTY', true);
|
||||
chdir(dirname($targetAbsolute));
|
||||
require $targetAbsolute;
|
||||
exit;
|
||||
}
|
||||
// /specialistes/{specialite}/{ville}/{nom-id}
|
||||
if (preg_match('#^/specialistes/([^/]+)/([^/]+)/([^/]+)-([0-9]+)$#', $slug, $m)) {
|
||||
$_GET['id'] = (int) $m[4];
|
||||
|
||||
$targetRelative = '/detail_public.php';
|
||||
$targetAbsolute = $_SERVER['DOCUMENT_ROOT'] . $targetRelative;
|
||||
|
||||
define('ROUTED_PRETTY', true);
|
||||
chdir(dirname($targetAbsolute));
|
||||
require $targetAbsolute;
|
||||
exit;
|
||||
}
|
||||
// /sitemap.xml
|
||||
if ($slug === '/sitemap.xml') {
|
||||
$targetRelative = '/sitemap_xml.php';
|
||||
$targetAbsolute = $_SERVER['DOCUMENT_ROOT'] . $targetRelative;
|
||||
|
||||
define('ROUTED_PRETTY', true);
|
||||
chdir(dirname($targetAbsolute));
|
||||
require $targetAbsolute;
|
||||
exit;
|
||||
}
|
||||
// =========================
|
||||
// Routes fixes existantes
|
||||
// =========================
|
||||
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
|
||||
$targetRelative = $PRETTY_TO_UGLY[$slug];
|
||||
$targetAbsolute = $_SERVER['DOCUMENT_ROOT'] . $targetRelative;
|
||||
|
||||
if (!is_file($targetAbsolute)) {
|
||||
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;
|
||||
Reference in new issue
Block a user