This repository was archived by the owner on May 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·84 lines (73 loc) · 2.14 KB
/
index.php
File metadata and controls
executable file
·84 lines (73 loc) · 2.14 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
79
80
81
82
83
84
<?php
if(!file_exists('config/config.php'))
{
header('Location: ./install');
}
require_once('config/config.php');
$template_dir = $smarty->getTemplateDir()[0];
if(isset($_SESSION['account']))
{
$user = unserialize($_SESSION['account']);
$user->updateData();
$_SESSION['account'] = serialize($user);
$smarty->assign('account', $user);
}
$page = 'index.php';
if ( $config['installed'] ) {
if(isset($_GET['p']) && !empty($_GET['p']))
{
$pages = array_filter(explode("/", $_GET['p']));
switch($pages[0]) {
case 'profile':
if(isset($pages[1]))
{
$admin = new Admin();
$search = $admin->getUser($pages[1]);
if($search)
{
$smarty->assign('user', $search);
} else {
$smarty->assign('user', '');
}
}
break;
case 'watch':
if(isset($pages[1]))
{
} else {
header("Location: ".$config['maindir']);
}
break;
case 'admin':
$admin = new Admin();
$possibleLogs = array('DESC', 'ASC');
$logOrder = 'DESC';
if(isset($pages[1]) && in_array($pages[1], $possibleLogs))
$logOrder = $pages[1];
$logs = $admin->getLogs($logOrder);
$smarty->assign('logs', $logs);
break;
}
$_GET['p'] = $pages[0];
$page = 'pages/'.$_GET['p'].'.php';
$smarty->assign('page', $_GET['p']);
if(!file_exists($template_dir.'/'.$page))
{
$page = '404.php';
}
} else {
$page = 'index.php';
}
} else {
if(!isset($_GET['p']) || $_GET['p'] != 'install') {
$installdir = $config['maindir']."/install";
header("Location: ".$installdir);
}
}
$smarty->assign("display_sidebar", $page != "index.php");
$smarty->display('head.php');
$smarty->display('nav.php');
//CUSTOM PAGE
$smarty->display($page);
$smarty->display('footer.php');
?>