forked from Doomchinchilla/zKillboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·42 lines (32 loc) · 998 Bytes
/
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
<?php
// Include Init
require_once( "init.php" );
// initiate the timer!
$timer = new Timer();
// Starting Slim Framework
$app = new \Slim\Slim($config);
// Session
$session = new zKBSession();
session_set_save_handler($session, true);
session_cache_limiter(false);
session_start();
// Check if the user has autologin turned on
if(!User::isLoggedIn()) User::autoLogin();
// Theme
if(User::isLoggedIn())
$theme = UserConfig::get("theme");
if(!is_dir("themes/$theme") || !isset($theme))
$theme = "zkillboard";
$app->config(array("templates.path" => $baseDir."themes/" . $theme));
// Error handling
$app->error(function (\Exception $e) use ($app){
include ( "view/error.php" );
});
// Load the routes - always keep at the bottom of the require list ;)
include( "routes.php" );
// Load twig stuff
include( "twig.php" );
// Load the theme stuff AFTER routes and Twig, so themers can add crap to twig's global space
require_once("themes/$theme/$theme.php");
// Run the thing!
$app->run();