1 | <?php |
---|
2 | require_once('db.php'); |
---|
3 | require_once('class.killboard.php'); |
---|
4 | |
---|
5 | $page = str_replace('.', '', $_GET['a']); |
---|
6 | $page = str_replace('/', '', $page); |
---|
7 | if ($page == '') |
---|
8 | { |
---|
9 | $page = 'home'; |
---|
10 | } |
---|
11 | if (substr($_SERVER['HTTP_USER_AGENT'], 0, 15) == 'EVE-minibrowser' && $page != 'igb' && $page != 'post_igb' && $page != 'portrait_grab' && $page != 'bills') |
---|
12 | { |
---|
13 | $page = 'igb'; |
---|
14 | } |
---|
15 | |
---|
16 | require_once('config.php'); |
---|
17 | $killboard = new Killboard(KB_SITE); |
---|
18 | $config = $killboard->getConfig(); |
---|
19 | // if ($killboard->isSuspended()) |
---|
20 | // $page = 'suspended'; |
---|
21 | |
---|
22 | if (substr($page, 0, 9) == 'settings_') |
---|
23 | { |
---|
24 | $settingsPage = true; |
---|
25 | } |
---|
26 | $mods_active = explode(',', $config->getConfig('mods_active')); |
---|
27 | $modOverrides = false; |
---|
28 | foreach ($mods_active as $mod) |
---|
29 | { |
---|
30 | if (file_exists('mods/'.$mod.'/'.$page.'.php')) |
---|
31 | { |
---|
32 | if ($modOverrides) |
---|
33 | { |
---|
34 | die('Error: Two or more of the mods you have activated are conflicting'); |
---|
35 | } |
---|
36 | $modOverrides = true; |
---|
37 | $modOverride = $mod; |
---|
38 | } |
---|
39 | } |
---|
40 | if (!$settingsPage && !file_exists('common/'.$page.'.php') && !$modOverrides) |
---|
41 | { |
---|
42 | $page = 'home'; |
---|
43 | } |
---|
44 | |
---|
45 | if (KB_CACHE == 1 && count($_POST) == 0 && !in_array($page, $cacheignore)) |
---|
46 | { |
---|
47 | $docache = true; |
---|
48 | } |
---|
49 | |
---|
50 | if ($docache) |
---|
51 | { |
---|
52 | if (!file_exists(KB_CACHEDIR . '/' . KB_SITE)) |
---|
53 | { |
---|
54 | @mkdir(KB_CACHEDIR . '/' . KB_SITE); |
---|
55 | } |
---|
56 | |
---|
57 | if ($cachetimes[$page]) |
---|
58 | { |
---|
59 | $cachetime = $cachetimes[$page]; |
---|
60 | } |
---|
61 | else |
---|
62 | { |
---|
63 | $cachetime = 5; |
---|
64 | } |
---|
65 | |
---|
66 | $cachetime = $cachetime * 60; |
---|
67 | |
---|
68 | $cachefile = KB_CACHEDIR . '/' . KB_SITE . '/' . md5($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . '.cache'; |
---|
69 | $timestamp = ((@file_exists($cachefile))) ? @filemtime($cachefile) : 0; |
---|
70 | |
---|
71 | if (time() - $cachetime < $timestamp) |
---|
72 | { |
---|
73 | ob_start('ob_gzhandler'); |
---|
74 | @readfile($cachefile); |
---|
75 | ob_end_flush(); |
---|
76 | exit(); |
---|
77 | } |
---|
78 | |
---|
79 | ob_start(); |
---|
80 | } |
---|
81 | |
---|
82 | if ($settingsPage) |
---|
83 | { |
---|
84 | include ('mods/'.substr($page, 9, strlen($page)-9).'/settings.php'); |
---|
85 | } |
---|
86 | elseif ($modOverrides) |
---|
87 | { |
---|
88 | include('mods/'.$modOverride.'/'.$page.'.php'); |
---|
89 | } |
---|
90 | else |
---|
91 | { |
---|
92 | include('common/'.$page.'.php'); |
---|
93 | } |
---|
94 | |
---|
95 | if ($docache) |
---|
96 | { |
---|
97 | $fp = @fopen($cachefile, 'w'); |
---|
98 | @fwrite($fp, ob_get_contents()); |
---|
99 | @fwrite($fp, '<!-- Generated from cache -->'); |
---|
100 | @fclose($fp); |
---|
101 | ob_end_flush(); |
---|
102 | } |
---|
103 | ?> |
---|