1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-26 15:42:20 +00:00
plateforme-corres2math/dispatcher.php
2019-10-18 22:23:00 +02:00

87 lines
4.3 KiB
PHP

<?php
require_once "server_files/config.php";
require_once "server_files/classes/Document.php";
require_once "server_files/classes/Phase.php";
require_once "server_files/classes/Question.php";
require_once "server_files/classes/Reason.php";
require_once "server_files/classes/Role.php";
require_once "server_files/classes/SchoolClass.php";
require_once "server_files/classes/Team.php";
require_once "server_files/classes/User.php";
require_once "server_files/classes/ValidationStatus.php";
require_once "server_files/classes/Video.php";
require_once "server_files/services/mail.php";
require_once "server_files/utils.php";
require_once "server_files/model.php";
loadUserValues();
if (!isset($_GET["path"]))
require_once "server_files/403.php";
$path = $_GET["path"];
$ROUTES = [];
# URL paths
$ROUTES["^(|accueil|index|accueil\.php|accueil\.html|accueil\.py|index\.php|index\.html|index\.py)/?$"] = ["server_files/controllers/index.php"];
$ROUTES["^(modifier-page)$"] = ["server_files/controllers/index.php", "edit"];
$ROUTES["^ajouter-equipe$"] = ["server_files/controllers/ajouter_equipe.php"];
$ROUTES["^ajouter-admin$"] = ["server_files/controllers/ajouter_admin.php"];
$ROUTES["^calendrier/(modifier)$"] = ["server_files/controllers/calendrier.php", "edit"];
$ROUTES["^calendrier/?$"] = ["server_files/controllers/calendrier.php"];
$ROUTES["^commenter-echange-4$"] = ["server_files/controllers/commenter_echange.php"];
$ROUTES["^confirmer-mail/([a-z0-9]*)/?$"] = ["server_files/controllers/confirmer_mail.php", "token"];
$ROUTES["^connexion/(confirmation-mail)/?$"] = ["server_files/controllers/connexion.php", "confirmation-mail"];
$ROUTES["^connexion/(mdp-oublie)/?$"] = ["server_files/controllers/connexion.php", "mdp_oublie"];
$ROUTES["^connexion/(reinitialiser_mdp)/(.*)/?$"] = ["server_files/controllers/connexion.php", "reset_password", "token"];
$ROUTES["^connexion/?$"] = ["server_files/controllers/connexion.php"];
$ROUTES["^deconnexion/?$"] = ["server_files/controllers/deconnexion.php"];
$ROUTES["^envoyer-video-1$"] = ["server_files/controllers/envoyer_video.php"];
$ROUTES["^equipe/([A-Z]{3})/?$"] = ["server_files/controllers/equipe.php", "trigram"];
$ROUTES["^exporter-donnees/?$"] = ["server_files/controllers/exporter_donnees.php"];
$ROUTES["^file/([a-z0-9]{64})/?$"] = ["server_files/controllers/view_file.php", "file_id"];
$ROUTES["^informations/([0-9]*)/.*?$"] = ["server_files/controllers/informations.php", "id"];
$ROUTES["^inscription/?$"] = ["server_files/controllers/inscription.php"];
$ROUTES["^mon-compte/?$"] = ["server_files/controllers/mon_compte.php"];
$ROUTES["^mon-equipe/(diffusion-videos)/?$"] = ["server_files/controllers/mon_equipe.php", "publish_videos"];
$ROUTES["^mon-equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"];
$ROUTES["^mon-equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
$ROUTES["^ma-participation/?$"] = ["server_files/controllers/ma_participation.php"];
$ROUTES["^poser-questions-2$"] = ["server_files/controllers/poser_questions.php"];
$ROUTES["^probleme/([0-4])/?$"] = ["server_files/controllers/probleme.php", "probleme"];
$ROUTES["^profils-orphelins/?$"] = ["server_files/controllers/profils_orphelins.php"];
$ROUTES["^rejoindre-equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
$ROUTES["^repondre-questions-3$"] = ["server_files/controllers/repondre_questions.php"];
$ROUTES["^suivi-correspondances/?$"] = ["server_files/controllers/suivi_correspondances.php"];
# Assets files
$ROUTES["^Autorisation de droit à l'image - majeur.pdf$"] = ["assets/Autorisation de droit à l'image - majeur.pdf", "application/pdf"];
$ROUTES["^Autorisation de droit à l'image - mineur.pdf$"] = ["assets/Autorisation de droit à l'image - mineur.pdf", "application/pdf"];
$ROUTES["^favicon\.ico$"] = ["assets/favicon.ico", "image/x-icon"];
$ROUTES["^logo\.png"] = ["assets/logo.png", "image/png"];
$ROUTES["^style\.css$"] = ["assets/style.css", "text/css"];
foreach ($ROUTES as $route => $file) {
if (preg_match('#' . $route . '#', $path, $matches)) {
for ($i = 1; $i < sizeof($file); ++$i)
$_GET[$file[$i]] = $matches[$i];
if (!preg_match("#php$#", $file[0])) {
header("Content-Type: " . $file[1]);
readfile($file[0]);
exit();
}
/** @noinspection PhpIncludeInspection */
require $file[0];
exit();
}
}
require_once "server_files/404.php";