/
index.php
36 lines (26 loc) · 1.02 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
<?php
session_start();
require '../vendor/autoload.php';
// Configuration
$config = Filehosting\Helpers\Util::readJSON(__DIR__ . '/../config.json');
// DI Container
$container = new Slim\Container ($config);
// File upload limits
ini_set('upload_max_filesize', $config['settings']['uploadedFileSizeLimit']);
ini_set('max_file_uploads', 1);
require '../app/container.php';
// Slim app instance
$app = new \Slim\App($container);
// Middlewares
$app->add($container['csrf']);
// Routes
$app->get('/', 'HomeController:index');
$app->get('/test', 'HomeController:test');
$app->post('/', 'HomeController:uploadFile');
$app->get('/file/{id}', 'DownloadController:index');
$app->get('/file/{id}/{filename}', 'DownloadController:forceFileDownload');
$app->post('/file/{id}', 'DownloadController:addComment');
$app->get('/search', 'SearchController:index');
// Route for file uploader
$app->get('/delete/file/{id}', 'DownloadController:deleteFile')->add(new Filehosting\Middlewares\UploaderAuthMiddleware($container['uploaderAuth']));
$app->run();