Ajout : ./garradin
[garradin.git] / www / _route.php
1 <?php
2
3 namespace Garradin;
4
5 // Routeur pour l'utilisation avec le serveur web intégré à PHP
6
7 const WWW_URI = '/';
8 //const WWW_URL = '/';
9
10 $uri = $_SERVER['REQUEST_URI'];
11
12 if (($pos = strpos($uri, '?')) !== false)
13 {
14 $uri = substr($uri, 0, $pos);
15 }
16
17 if (file_exists(__DIR__ . $uri))
18 {
19 return false;
20 }
21 elseif (preg_match('!/admin/plugin/(.+)/(.*)!', $uri, $match))
22 {
23 $_GET['_p'] = $match[1];
24 $_GET['_u'] = $match[2];
25 require __DIR__ . '/admin/plugin.php';
26 }
27 else
28 {
29 require __DIR__ . '/index.php';
30 }