-
Notifications
You must be signed in to change notification settings - Fork 23
/
ucenter.php
197 lines (176 loc) · 5.96 KB
/
ucenter.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
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
<?php
require_once('predis/autoload.php');
require_once('util4p/util.php');
require_once('util4p/ReSession.class.php');
require_once('util4p/AccessController.class.php');
require_once('global.inc.php');
require_once('config.inc.php');
require_once('secure.inc.php');
require_once('init.inc.php');
if (Session::get('uid') === null) {
header('location:/?notloged');
exit;
}
$page_type = 'home';
$uid = Session::get('uid');
$nickname = Session::get('nickname');
if (isset($_GET['logs'])) {
$page_type = 'logs';
} elseif (isset($_GET['logs_all'])) {
$page_type = 'logs_all';
} elseif (isset($_GET['links'])) {
$page_type = 'links';
} elseif (isset($_GET['links_all'])) {
$page_type = 'links_all';
} elseif (isset($_GET['visitors'])) {
$page_type = 'visitors';
} elseif (isset($_GET['home'])) {
$page_type = 'home';
}
$entries = array(
array('home', '个人主页'),
array('links', '我的短链'),
array('links_all', '链接管理'),
array('logs', '近期登陆'),
array('logs_all', '站点日志'),
array('visitors', '访客统计')
);
$visible_entries = array();
foreach ($entries as $entry) {
if (AccessController::hasAccess(Session::get('role', 'visitor'), 'ucenter.' . $entry[0])) {
$visible_entries[] = array($entry[0], $entry[1]);
}
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<?php require('head.php'); ?>
<title>管理中心 | 短网址生成器</title>
<link href="static/lib/bootstrap-table-1.12.1/bootstrap-table.min.css" rel="stylesheet">
<script type="text/javascript">
var page_type = "<?= $page_type ?>";
</script>
</head>
<body>
<div class="wrapper">
<?php require('header.php'); ?>
<?php require('modals.php'); ?>
<div class="container">
<div class="row">
<div class="hidden-xs hidden-sm col-md-2 col-lg-2">
<div class="panel panel-default">
<div class="panel-heading">Menu Bar</div>
<ul class="nav nav-pills nav-stacked panel-body">
<?php foreach ($visible_entries as $entry) { ?>
<li role="presentation" <?php if ($page_type == $entry[0]) echo 'class="disabled"'; ?>>
<a href="?<?= $entry[0] ?>"><?= $entry[1] ?></a>
</li>
<?php } ?>
</ul>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-10 col-lg-10">
<div class="visible-xs visible-sm">
<div class="panel panel-default">
<div class="panel-heading">Menu Bar</div>
<ul class="nav nav-pills panel-body">
<?php foreach ($visible_entries as $entry) { ?>
<li role="presentation" <?php if ($page_type == $entry[0]) echo 'class="disabled"'; ?>>
<a href="?<?= $entry[0] ?>"><?= $entry[1] ?></a>
</li>
<?php } ?>
</ul>
</div>
</div>
<?php if ($page_type === 'home') { ?>
<div id="home">
<div class="panel panel-default">
<div class="panel-heading">欢迎页</div>
<div class="panel-body">
欢迎回来, <?php echo htmlspecialchars($nickname) ?>.<br />
现在时刻: <?php echo date('H:i:s', time()) ?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">通知</div>
<div class="panel-body">
<h4 class="text-info">通知</h4>
<p>Nothing new here.</p>
</div>
</div>
</div>
<?php } elseif ($page_type === 'links' || $page_type === 'links_all') { ?>
<div id="links">
<div class="panel panel-default">
<div class="panel-heading">短链接列表</div>
<div class="panel-body">
<div class="table-responsive">
<div id="toolbar">
<button id="btn-link-add" class="btn btn-primary">
<i class="glyphicon glyphicon-plus"></i> 添加短链接
</button>
</div>
<table id="table-link" data-toolbar="#toolbar" class="table table-striped">
</table>
</div>
</div>
</div>
</div>
<?php } elseif ($page_type === 'logs' || $page_type === 'logs_all') { ?>
<div id="logs">
<div class="panel panel-default">
<div class="panel-heading">日志</div>
<div class="panel-body">
<div class="table-responsive">
<div id="toolbar"></div>
<table id="table-log" data-toolbar="#toolbar" class="table table-striped">
</table>
</div>
</div>
</div>
</div>
<?php } elseif ($page_type === 'visitors') { ?>
<div id="visitors">
<div class="panel panel-default">
<div class="panel-heading">访问量统计</div>
<div class="panel-body">
<table class="table table-striped table-bordered">
<tr>
<th>全站 PV</th>
<td><span class="cr_count_site_pv">Loading</span></td>
</tr>
<tr>
<th>全站 UV</th>
<td><span class="cr_count_site_uv">Loading</span></td>
</tr>
<tr>
<th>今日 PV</th>
<td><span class="cr_count_site_pv_24h">Loading</span></td>
</tr>
<tr>
<th>今日 UV</th>
<td><span class="cr_count_site_uv_24h">Loading</span></td>
</tr>
</table>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div> <!-- /container -->
<!--This div exists to avoid footer from covering main body-->
<div class="push"></div>
</div>
<?php require('footer.php'); ?>
<script src="static/lib/chart.js-2.7.3/Chart.min.js"></script>
<script src="static/lib/bootstrap-table-1.12.1/bootstrap-table.min.js"></script>
<script src="static/lib/bootstrap-table-1.12.1/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="static/lib/bootstrap-table-1.12.1/extensions/mobile/bootstrap-table-mobile.min.js"></script>
<script src="static/lib/bootstrap-table-1.12.1/extensions/export/bootstrap-table-export.min.js"></script>
<script src="static/lib/tableexport.jquery.plugin-1.10.1/tableExport.min.js"></script>
<script src="static/link.js"></script>
<script src="static/ucenter.js"></script>
</body>
</html>