2019-09-07 11:42:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once "server_files/config.php";
|
|
|
|
|
2019-09-07 16:43:51 +00:00
|
|
|
require_once "server_files/classes/Document.php";
|
2019-09-07 11:42:36 +00:00
|
|
|
require_once "server_files/classes/Role.php";
|
2019-09-07 13:51:16 +00:00
|
|
|
require_once "server_files/classes/SchoolClass.php";
|
2019-09-07 11:42:36 +00:00
|
|
|
require_once "server_files/classes/Team.php";
|
|
|
|
require_once "server_files/classes/Tournament.php";
|
|
|
|
require_once "server_files/classes/User.php";
|
|
|
|
require_once "server_files/classes/ValidationStatus.php";
|
2019-09-07 14:37:00 +00:00
|
|
|
require_once "server_files/services/mail.php";
|
|
|
|
require_once "server_files/utils.php";
|
2019-09-07 13:51:16 +00:00
|
|
|
require_once "server_files/model.php";
|
2019-09-07 11:42:36 +00:00
|
|
|
|
|
|
|
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["^ajouter_equipe$"] = ["server_files/controllers/ajouter_equipe.php"];
|
|
|
|
$ROUTES["^ajouter_organisateur$"] = ["server_files/controllers/ajouter_organisateur.php"];
|
|
|
|
$ROUTES["^ajouter_tournoi$"] = ["server_files/controllers/ajouter_tournoi.php"];
|
|
|
|
$ROUTES["^confirmer_mail/([a-z0-9]*)/?$"] = ["server_files/controllers/confirmer_mail.php", "token"];
|
2019-09-08 22:41:52 +00:00
|
|
|
$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"];
|
2019-09-07 11:42:36 +00:00
|
|
|
$ROUTES["^connexion/?$"] = ["server_files/controllers/connexion.php"];
|
|
|
|
$ROUTES["^deconnexion/?$"] = ["server_files/controllers/deconnexion.php"];
|
|
|
|
$ROUTES["^equipe/([A-Z]{3})/?$"] = ["server_files/controllers/equipe.php", "trigram"];
|
2019-09-07 17:01:23 +00:00
|
|
|
$ROUTES["^file/([a-z0-9]{64})/?$"] = ["server_files/controllers/view_file.php", "file_id"];
|
2019-09-07 11:42:36 +00:00
|
|
|
$ROUTES["^informations/([0-9]*)/.*?$"] = ["server_files/controllers/informations.php", "id"];
|
|
|
|
$ROUTES["^inscription/?$"] = ["server_files/controllers/inscription.php"];
|
2019-12-19 12:02:01 +00:00
|
|
|
$ROUTES["^mon-compte/?$"] = ["server_files/controllers/mon_compte.php"];
|
|
|
|
$ROUTES["^mon-equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"];
|
|
|
|
$ROUTES["^mon-equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
|
2019-09-07 11:42:36 +00:00
|
|
|
$ROUTES["^rejoindre_equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
|
|
|
|
$ROUTES["^solutions/?$"] = ["server_files/controllers/solutions.php"];
|
|
|
|
$ROUTES["^solutions_orga/?$"] = ["server_files/controllers/solutions_orga.php"];
|
|
|
|
$ROUTES["^syntheses/?$"] = ["server_files/controllers/syntheses.php"];
|
|
|
|
$ROUTES["^syntheses_orga/?$"] = ["server_files/controllers/syntheses_orga.php"];
|
2019-09-07 16:08:40 +00:00
|
|
|
$ROUTES["^tournoi/(.*)/(modifier)/?$"] = ["server_files/controllers/tournoi.php", "name", "modifier"];
|
2019-09-07 11:42:36 +00:00
|
|
|
$ROUTES["^tournoi/(.*)/?$"] = ["server_files/controllers/tournoi.php", "name"];
|
|
|
|
$ROUTES["^tournois/?$"] = ["server_files/controllers/tournois.php"];
|
|
|
|
|
|
|
|
# Assets files
|
|
|
|
|
|
|
|
$ROUTES["^favicon\.ico$"] = ["assets/favicon.ico", "image/x-icon"];
|
|
|
|
$ROUTES["^logo\.svg$"] = ["assets/logo.svg", "image/svg+xml"];
|
|
|
|
$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])) {
|
2019-09-08 17:12:35 +00:00
|
|
|
header("Content-Type: " . $file[1]);
|
2019-09-07 11:42:36 +00:00
|
|
|
readfile($file[0]);
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @noinspection PhpIncludeInspection */
|
|
|
|
require $file[0];
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once "server_files/404.php";
|