forked from Rainboylvx/cogs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
189 lines (189 loc) · 6.7 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
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
<?php
require_once("./include/header.php");
gethead(1,"","首页");
$p=new DataAccess();
$q=new DataAccess();
$sizee=$SET['style_ranksize'] - 7;
?>
<div class='row-fluid'>
<div class='span9'>
<div class='row-fluid'>
<div class='span4' id="index_page">
<?php
$now = time();
$noww = time() + 60*60*2;
$cnt = $p->dosql("select comptime.*,compbase.*,userinfo.nickname,groups.* from comptime,compbase,userinfo,groups where comptime.cbid=compbase.cbid and userinfo.uid=compbase.ouid and comptime.group=groups.gid and endtime > $now and starttime < $noww order by starttime asc");
if($cnt) {
for($i=0; $i<$cnt; $i++) {
$d=$p->rtnrlt($i);
?>
<table class='table table-striped table-condensed table-bordered fiexd'>
<tr>
<th style="min-width: 3em;">比赛</th>
<td><b><?php echo $d[cname] ?></b></td>
</tr>
<tr>
<th>状态</th>
<td><?php
if (time()>$d[endtime]) echo "<span class='did'>已结束</span>"; else
if (time()<$d[endtime] && time()>$d[starttime]) echo "<a href='contest/problem.php?ctid={$d[ctid]}'><span class='doing'>正在进行...</span></a>"; else
echo "<span class='todo'>还未开始</span>";
?></td>
</tr>
<tr>
<th>开始</th>
<td><?php echo date('Y-m-d H:i:s', $d[starttime]) ?></td>
</tr>
<tr>
<th>结束</th>
<td><?php echo date('Y-m-d H:i:s', $d[endtime]) ?></td>
</tr>
<tr>
<th>分组</th>
<td><a href="../user/index.php?gid=<?php echo $d['gid'] ?>"><?php echo $d['gname'] ?></a></td>
</tr>
<tr>
<th>介绍</th>
<td><?php echo BBCode($d[intro]) ?></td>
</tr>
</table>
<?php } ?>
<br />
<? } else { ?>
<table class='table table-striped table-condensed table-bordered fiexd'>
<?php
$cnt=$p->dosql("select * from page order by etime desc limit 6");
for($i=0;$i<$cnt;$i++) {
$d=$p->rtnrlt($i);
?>
<tr><td><a href="page/page.php?aid=<?=$d['aid']?>" title="<?=$d['title']?>"><?=shortname($d['title'])?></a></td></tr>
<?php } ?>
</table>
<? } ?>
</div>
<div class='span8' id="index_title">
<div>
<?=输出文本($SET['global_bulletin']); ?>
</div>
<div id='index'>
<?php echo 输出文本($SET['global_head']); ?>
</div>
<div>
<?php echo 输出文本($SET['global_index']); ?>
</div>
</div>
</div>
<div class='row-fluid'>
<div class='span4' id="index_problem">
<table class='table table-striped table-condensed table-bordered fiexd'>
<thead>
<tr>
<th style="min-width: 4ex;">PID</th>
<th>最新题目
<a href="problem/random.php" title="随机选择一道你没有通过的题目" class='btn btn-danger btn-mini pull-right' ><i class='icon icon-random icon-white'></i></a>
</th>
</thead>
</tr>
<?php
$cnt=$p->dosql("select * from problem where submitable=1 order by addtime desc limit {$SET['index_problem_size']}");
for($i=0;$i<$cnt;$i++) {
$d=$p->rtnrlt($i);
?>
<tr>
<td><?php echo $d['pid']; ?></td>
<td><? 是否通过($d['pid'], $q); ?>
<a href="problem/problem.php?pid=<?php echo $d['pid']; ?>" title="<?=$d['probname']?>"><?php echo shortname($d['probname']); ?></a></td>
</tr>
<?php } ?>
</table>
</div>
<div class='span8' id="index_submit">
<?
$uid=(int)$_SESSION['ID'];
$hasaa=$SET['index_submit_size'];
if(有此权限("修改题目") && 有此权限("查看题目")) {
$cnt=$p->dosql("select * from problem where submitable!=1 order by addtime desc limit 5");
if($cnt) {
$hasaa=$SET['index_submit_size'] - $cnt;
echo "<div class='alert'><span class='pull-right'>(其实只是设置为不可提交的题目)</span><h4>用户提交待审核题目:</h4><ul>";
for($i=0;$i<$cnt;$i++) {
$d=$p->rtnrlt($i);
echo "<li><a href='problem/problem.php?pid={$d['pid']}'>{$d['pid']}. {$d['probname']}</a> <a href='problem/editprob.php?action=edit&pid={$d['pid']}'>[编辑]</a></li>";
}
echo "</ul></div>";
}
} else {
$cnt=$p->dosql("select * from problem where addid=$uid and submitable!=1 order by addtime desc");
if($cnt) {
$hasaa=$SET['index_submit_size'] - $cnt;
echo "<div class='alert'><h4>已提交正在审核的题目:</h4><ul>";
for($i=0;$i<$cnt;$i++) {
$d=$p->rtnrlt($i);
echo "<li><a href='problem/problem.php?pid={$d['pid']}'>{$d['pid']}. {$d['probname']}</a> <a href='problem/editprob.php?action=edit&pid={$d['pid']}'>[编辑]</a></li>";
}
echo "</ul></div>";
}
}
?>
<table class='table table-striped table-condensed table-bordered fixed'>
<thead><tr>
<th>题目</th>
<th>用户</th>
<th style="min-width: 12ex;">评测结果</th>
<th style="min-width: 5ex;">得分</th>
<th style="min-width: 10ex;">提交时间</th>
</tr></thead>
<?php
$cnt=$p->dosql("select submit.sid,submit.pid,submit.uid,submit.result,submit.score,submit.accepted,submit.subtime,problem.probname,userinfo.nickname,userinfo.realname,userinfo.email,userinfo.memo from submit,problem,userinfo where submit.score>={$SET['index_submit_score']} and submit.uid=userinfo.uid and submit.pid=problem.pid order by submit.sid desc limit {$hasaa}");
for($i=0;$i<$cnt;$i++) {
$d=$p->rtnrlt($i);
?>
<tr>
<td class="wrap"><?php if(!$_GET['pid']) {
是否通过($d['pid'], $q);
echo "<a href='submit/?pid={$d['pid']}'>".shortname($d['probname'])."</a>";
echo "<a href='problem/problem.php?pid={$d['pid']}' title='{$d['probname']}' target='_blank'><span class='icon-share'></span></a>";
} else
echo "<a href='problem/problem.php?pid={$d['pid']}' title='{$d['probname']}' target='_blank'>".shortname($d['probname'])."</a>";
?></td>
<td class="wrap"><a href='user/detail.php?uid=<?=$d['uid']?>' title="<?=(sp2n(htmlspecialchars($d['memo'])))?>" target='_blank'><?=gravatar::showImage($d['email']);?></a>
<?php echo "<a href='submit/?uid={$d[uid]}'>";
if(有此权限("查看用户")) echo $d['realname']; else echo $d['nickname'];
echo "</a>"; ?></td>
<td><a href='submit/code.php?id=<?=$d['sid']?>' title="<?=$d['result']?>"><?=评测结果($d['result'], 10, true)?></a></td>
<td><span class="<?=$d['accepted']?'ok':'no'?>"><?=$d['score'] ?></span></td>
<td><?php echo date('H:i:s',$d['subtime']); ?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
<div class='span3' id="index_user">
<table class='table table-striped table-condensed table-bordered fixed'>
<thead>
<tr>
<th style="width: 2ex;"></th>
<th>用户排名</th>
<th style="width: 5ex;">积分</th>
<th style="width: 5ex;">题目</th>
</tr>
</thead>
<?php
$cnt=$p->dosql("select * from userinfo order by grade desc limit 0, {$SET['style_ranksize']}");
for($i=0;$i<$cnt;$i++) {
$d=$p->rtnrlt($i);
?>
<tr>
<td><i><?=$i+1 ?></i></td>
<td><a href="user/detail.php?uid=<?php echo $d['uid']; ?>" title="<?=(sp2n(htmlspecialchars($d['memo'])))?>"><?=gravatar::showImage($d['email'], $SET['index_rank_icon']);?><?php if(有此权限("查看用户")) echo $d['realname']; else echo $d['nickname'];?></a></td>
<td><?=$d['grade']?></td>
<td><?=$d['accepted']?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
<?php
require_once("./include/footer.php");
?>