-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
53 lines (42 loc) · 1.44 KB
/
index.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php declare(strict_types=1);
include_once(__DIR__ . '/vendor/autoload.php');
/** Routage */
use Psr\Log\{LogLevel};
use Oeuvres\Kit\{Route, I18n, Http, Log, LoggerWeb};
// debug routing
// Log::setLogger(new LoggerWeb(LogLevel::DEBUG));
// Run a scan on the work directory
Route::route(
'/working', // path to request
__DIR__ . '/action/working.php', // contents to include
[], // parameters
__DIR__ . '/tmpl_action.php' // template
);
// transform zip
Route::route('/zipwork', __DIR__ . '/action/zipwork.php', [], __DIR__ . '/tmpl_action.php');
// read a file from temp
Route::get(
'/read/(.*)',
__DIR__ . '/action/read.php',
['zip_file' => '$1'],
null
);
// upload file
Route::post('/upload', __DIR__ . '/action/upload.php', [], null);
// download transformed uploaded file
Route::get('/download', __DIR__ . '/action/download.php', [], null);
// list files working
Route::get('/listing', __DIR__ . '/action/listing.php', [], null);
// register the default template in which include content
Route::template(__DIR__ . '/tmpl.php');
// welcome page
Route::get('/', __DIR__ . '/page/accueil.php');
// try if a local php page is available
Route::get('/(.*)', __DIR__ . '/page/$1.php');
// or a local html page
Route::get('/(.*)', __DIR__ . '/page/$1.html');
// Catch all, php or html
Route::route('/404', __DIR__ . '/page/404.php');
Route::route('/404', __DIR__ . '/page/404.html');
// No Route has worked
echo "Bad routage, 404.";