-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
59 lines (46 loc) · 1.4 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
header("X-Bypass-Cache: true");
ob_start();
require("libs/core.php");
$core=new Core();
$pages = array();
$pages['home'] = true;
$pages['register'] = true;
$pages['login'] = true;
$pages['ucp'] = true;
$pages['logout'] = true;
$alias = array();
$alias['404'] = "home";
$alias['test'] = "ucp";
$alias['logout'] = "ucp";
$alias['results'] = "ucp";
$alias['newPost'] = "ucp";
$language = new Language;
$path = explode("?", $_SERVER['REQUEST_URI']);
$path=explode("/", $path[0]);
$page = $path[1];
if(!isset($page) || $page == "") $page = "home";
else $page = strtolower($page);
if (!isset($pages[$page]) || $pages[$page] == "") {
if(!isset($alias[$page]) || $alias[$page] == "") {
$page = "404";
if($alias[$page] != "") $page = $alias[$page];
} else $page = $alias[$page];
}
if (isset($_COOKIE['SID'])) { //Session active
$session = new Session();
if(isset($_SESSION['auth']) && $_SESSION['auth'] === true && ($page == "home" || $page == ""))
$page = "ucp";
}
if($page == "ucp" && (!isset($_SESSION['auth']) || $_SESSION['auth'] == 0)) $page = "home";
//capture buffer (debug, warnings...) to avoid breaking html
$buffer = ob_get_clean();
$core->buffer = true;
//start showing content...
$header = new Template("header");
//$language->loadDictionary("header");
$footer = new Template("footer");
include("controllers/".$page.".php");
//Show all buffer contents after contents is displayed
//echo $buffer;
?>