forked from featherbb/featherbb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
53 lines (42 loc) · 1.53 KB
/
index.php
File metadata and controls
53 lines (42 loc) · 1.53 KB
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
namespace FeatherBB;
use FeatherBB\Core\Interfaces\SlimStatic;
/**
* Copyright (C) 2015-2016 FeatherBB
* based on code by (C) 2008-2015 FluxBB
* and Rickard Andersson (C) 2002-2008 PunBB
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
*/
// Start a session for flash messages
session_cache_limiter(false);
session_start();
error_reporting(E_ALL); // Let's report everything for development
ini_set('display_errors', 1);
// Load Slim Framework
require 'vendor/autoload.php';
// Instantiate Slim and add CSRF
$feather = new \Slim\App();
SlimStatic::boot($feather);
// Allow static proxies to be called from anywhere in App
Statical::addNamespace('*', __NAMESPACE__.'\\*');
$feather_settings = array('config_file' => 'featherbb/config.php',
'cache_dir' => 'cache/',
'debug' => 'all'); // 3 levels : false, info (only execution time and number of queries), and all (display info + queries)
Feather::add(new \FeatherBB\Middleware\Csrf);
Feather::add(new \FeatherBB\Middleware\Auth);
Feather::add(new \FeatherBB\Middleware\Core($feather_settings));
// Permanently redirect paths with a trailing slash
// to their non-trailing counterpart
Feather::add(function ($req, $res, $next) {
$uri = $req->getUri();
$path = $uri->getPath();
if ($path != '/' && substr($path, -1) == '/') {
$uri = $uri->withPath(substr($path, 0, -1));
return $res->withRedirect((string)$uri, 301);
}
return $next($req, $res);
});
// Load the routes
require 'featherbb/routes.php';
// Run it, baby!
Feather::run();