This repository was archived by the owner on Jun 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
230 lines (199 loc) · 6.83 KB
/
index.php
File metadata and controls
230 lines (199 loc) · 6.83 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<?php
/*
* Albatross Manager
*
* Index Page
*
* Description:
* Base page that manages all functions
*
* Copyright 2011 Samuel Bailey
*/
$pt[]['index.php :: start'] = microtime(true);
//error_log('REQUEST='.var_export($_REQUEST,true));
/*
// PHP Notice: Constant DS already defined
const DS = DIRECTORY_SEPARATOR;
// Not needed yet and needs testing
spl_autoload_register(function ($class)
{
$path = '';
$file = preg_replace('#\\\|_(?!.+\\\)#', DS, $class).'.php';
if (is_file('lib'.DS.$file)) $path = 'lib'.DS.$file;
elseif (is_file('conf'.DS.$file)) $path = 'conf'.DS.$file;
elseif (is_file('pages'.DS.$file)) $path = 'pages'.DS.$file;
if ($path) include $path;
});
*/
set_include_path(realpath('lib').':'.realpath('conf').':'.realpath('pages'));
// Check authentication
include_once 'auth.class.php';
include_once 'config.class.php';
$auth = new auth();
$pt[]['index.php :: include auth, config'] = microtime(true);
if ($_COOKIE['SESSION']) {
$login = $auth->authenticate_session();
if (!$login[0]) {
header('Location: /login.php');
}
} else {
header('Location: /login.php');
}
unset($login);
$pt[]['index.php :: check auth'] = microtime(true);
$uri = trim($_SERVER['REQUEST_URI'], '/');
$uri = explode('/', $uri);
$uri[0] = strtolower($uri[0]);
if (count($uri) > 1) {
$uri_fullcase[1] = $uri[1];
$uri[1] = strtolower($uri[1]);
} else {
$uri[1] = '';
}
if (count($uri) > 2) {
$uri_fullcase[2] = $uri[2];
$uri[2] = strtolower($uri[2]);
} else {
$uri[2] = '';
}
if (count($uri) > 3) {
$uri_fullcase[3] = $uri[3];
$uri[3] = strtolower($uri[3]);
} else {
$uri[3] = '';
}
if (count($uri) > 4) {
$uri_fullcase[4] = $uri[4];
$uri[4] = strtolower($uri[4]);
} else {
$uri[4] = '';
}
$page = $uri[0];
$subpage = $uri[1];
if ($page == '') {
$page = 'default';
}
$errormsg = '';
$pt[]['index.php :: setup uri and global vars'] = microtime(true);
?><!DOCTYPE html>
<html>
<head>
<title>Albatross Manager</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link type="text/css" href="/style.css" rel="stylesheet" media="screen,projection" />
</head>
<body>
<div id="container">
<div id="header">
<a href="/"><img class="logo" src="/images/albatross_logo.png" title="Albatross Manager" alt="Albatross Manager"></a>
<div class="menu">
<div class="right"><a href="/logout"><img src="/images/system-log-out.png" alt=""><br>Logout</a></div>
<div class="right">Username<br><?=$auth->uname;?><br>AccountID<br style="line-height:1.6em">z<?=$auth->acc_id;?></div>
<div><a href="/"><img src="/images/preferences-contact-list.png" alt=""><br>My Account</a></div>
<div><a href="/"><img src="/images/document-sign.png" alt=""><br>Pay Invoices</a></div>
<div><a href="/sites"><img src="/images/document-open-remote.png" alt=""><br>Manage Sites</a></div>
<div><a href="/email"><img src="/images/internet-mail.png" alt=""><br>Email Addresses</a></div>
<div><a href="/dns"><img src="/images/view-web-browser-dom-tree.png" alt=""><br>Domain Names</a></div>
<div><a href="/database"><img src="/images/server-database.png" alt=""><br>Databases</a></div>
<div><a href="/stats"><img src="/images/office-chart-bar-stacked.png" alt=""><br>Statistics</a></div>
<?php /*<div><a href="/logs"><img src="/images/text-x-log.png" alt=""><br>Logs</a></div>*/ ?>
<div><a href="/archive"><img src="/images/utilities-file-archiver.png" alt=""><br>Archives & Backups</a></div>
<div><a href="/"><img src="/images/help-about.png" alt=""><br>Support</a></div>
<div><a href="<?=$conf->webmail;?>" target="_new"><img src="/images/mail-read.png" alt=""><br>Webmail</a></div>
</div>
</div>
<div id="main">
<?php
// List of hardcoded dynamic url roots
$pages = array('logout', 'dns', 'email', 'stats', 'logs', 'database', 'sites', 'archive');
$thispage['menu'] = array();
$thispage['menu2'] = array();
$pt[]['index.php :: menu and page array'] = microtime(true);
if (in_array($page, $pages)) {
// Page Exists
include $page.'.menu.php';
} elseif ($page == 'default') {
// Default Page
include $page.'.menu.php';
} else {
// Page does not exist... anywhere!
header('Location: /');
}
unset($pages);
$pt[]['index.php :: post include page'] = microtime(true);
// Start individual page title and menu
?>
<div class="pagetitle fullwidth"><h1><?=$thispage['title'];?></h1></div>
<?php
if (count($thispage['menu']) > 0) {
echo "<div class=\"minormenu fullwidth\">\n";
echo "\t<div class=\"menu\">\n";
foreach ($thispage['menu'] as $item) {
if (array_key_exists('new_window', $item) and $item['new_window'] == true) {
$newwindow = ' target="_new"';
} else {
$newwindow = '';
}
echo "\t\t<div><a href=\"".$item['link'].'"'.$newwindow.'><img src="/images/'.$item['image'].'" alt=""><br>'.$item['title']."</a></div>\n";
}
echo "\t</div>\n";
echo "</div>\n";
}
if (count($thispage['menu2']) > 0) {
echo "<div class=\"minormenu fullwidth\">\n";
if (strlen($thispage['menu2']['title']) > 0) {
echo "\t<h3> ".$thispage['menu2']['title']."</h3>\n";
unset($thispage['menu2']['title']);
}
echo "\t<div class=\"menu\">\n";
foreach ($thispage['menu2'] as $item) {
echo "\t\t<div><a href=\"".$item['link'].'"><img src="/images/'.$item['image'].'" alt=""><br>'.$item['title']."</a></div>\n";
}
echo "\t</div>\n";
echo "</div>\n";
}
// End individual page title and menu
?>
<?php
$pt[]['index.php :: post included page menus'] = microtime(true);
// Start individual page data
if ($thispage['data']) {
include $thispage['data'];
}
// End individual page data
$pt[]['index.php :: post include thispage data'] = microtime(true);
?>
</div>
<div id="footer">
<ul>
<li>© 2011 <a href="http://www.cyprix.com.au/">Cyprix Enterprises</a></li>
<li>Icons by <a href="http://www.oxygen-icons.org/">Oxygen</a></li>
<li><a href="/">About Albatross</a></li>
<li><a href="/">Contact Us</a></li>
</ul>
</div>
</div>
</body>
</html>
<?php
$pt[]['index.php :: end'] = microtime(true);
// If enabled, display page tracing in hidden html
if ($conf->pt) {
echo "<!--\n";
echo "Page Trace\n";
echo "Order\tTime(s)\tSplit(ms)\tTrace\n";
$ptkey = array_keys($pt[0]);
$starttime = $pt[0][$ptkey[0]];
$prevtime = $starttime;
foreach ($pt as $key => $array) {
foreach ($array as $key2 => $value) {
$pt[$key][$key2] = $value - $starttime;
echo $key.":\t".round($pt[$key][$key2], 3)."\t".round(($value - $prevtime) * 1000, 3)."\t".$key2."\n";
$prevtime = $value;
}
}
echo 'Totaltime: '.round(($prevtime - $starttime), 3)."s\n";
echo "-->\n";
unset($ptkey, $starttime, $totaltime, $key, $key2, $array, $value, $prevtime);
}
unset($pt);