forked from Doomchinchilla/zKillboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
78 lines (64 loc) · 1.97 KB
/
init.php
File metadata and controls
78 lines (64 loc) · 1.97 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/* zKillboard
* Copyright (C) 2012-2013 EVE-KILL Team and EVSCO.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// config load
require_once( "config.php" );
if($debug)
{
ini_set('display_errors', 1);
error_reporting(E_ALL);
}
// vendor autoload
require( "vendor/autoload.php" );
// zkb class autoloader
spl_autoload_register("zkbautoload");
function zkbautoload($class_name)
{
$baseDir = dirname(__FILE__);
$fileName = "$baseDir/classes/$class_name.php";
if (file_exists($fileName))
{
require_once $fileName;
return;
}
}
// initiate the timer!
$timer = new Timer();
// Starting Slim Framework
$app = new \Slim\Slim($config);
// Session
//ini_set("session.save_path", $baseDir."cache/sessions/");
ini_set("session.save_path", "/dev/shm/zkillboard/");
session_cache_limiter(false);
session_start();
// Check if the user has autologin turned on
if(!User::isLoggedIn()) User::autoLogin();
// Theme
$viewtheme = null;
if(User::isLoggedIn())
$viewtheme = UserConfig::get("viewtheme");
$app->config(array("templates.path" => $baseDir."templates/" . ($viewtheme ? $viewtheme : "bootstrap")));
// 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" );
// Run the thing!
$app->run();