-
Notifications
You must be signed in to change notification settings - Fork 4
/
day.php
38 lines (27 loc) · 859 Bytes
/
day.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
date_default_timezone_set('Europe/Paris');
require __DIR__.'/app/Config.php';
require __DIR__.'/app/Day.php';
require __DIR__.'/app/File.php';
require __DIR__.'/app/Line.php';
require __DIR__.'/app/Impact.php';
require __DIR__.'/app/Disruption.php';
if(isset($argv[1]) && $argv[1]) {
$_GET['date'] = $argv[1];
}
if(isset($argv[2]) && $argv[2]) {
$_GET['mode'] = $argv[2];
}
if(!isset($_GET['date'])) {
$_GET['date'] = null;
}
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'metros';
$day = new Day($_GET['date']);
$GLOBALS['isStaticResponse'] = isset($_SERVER['argv']) && !is_null($_SERVER['argv']);
function url($url) {
if($GLOBALS['isStaticResponse']) {
return $url;
}
preg_match('|/?([^/]*)/([^/]*).html|', $url, $matches);
return "?".http_build_query(['date' => $matches[1], 'mode' => $matches[2]]);
}