Пример #1
0
function Navigation($p)
{
    global $SET;
    $navbar = "";
    if ($_SESSION['style']) {
        $navbar = "navbar-inverse";
    }
    HTML("<div id='nav' class='navbar {$navbar}'>");
    HTML("<div class='navbar-inner'>");
    HTML("<div class='container-fluid'>");
    HTML("<a href='" . 路径("index.php") . "' class='brand'>COGS</a>");
    HTML("<a class='btn btn-navbar' data-toggle='collapse' data-target='.nav-collapse'><span class='icon-bar'></span><span class='icon-bar'></span><span class='icon-bar'></span></a>");
    HTML("<div class='nav-collapse'>");
    HTML("<ul class='nav'>");
    HTML("<li class='dropdown'>");
    HTML("<a id='fenleibar' href='#' class='dropdown-toggle' data-toggle='dropdown'><b class='caret'></b></a>");
    HTML("<ul class='dropdown-menu span11' id='catebar'>");
    $sql = "select * from category order by cname";
    $cnt = $p->dosql($sql);
    for ($i = 0; $i < $cnt; $i++) {
        $d = $p->rtnrlt($i);
        HTML("<li style='width: 100px'><a href='" . 路径("problem/index.php?caid={$d['caid']}") . "' title='" . sp2n(htmlspecialchars($d['memo'])) . "'>{$d['cname']}</a></li>");
    }
    HTML("</ul>");
    HTML("</li>");
    if (strpos($SET['cur'], "comment")) {
        $active['comment'] = 'active';
    } else {
        if (strpos($SET['cur'], "contest")) {
            $active['contest'] = 'active';
        } else {
            if (strpos($SET['cur'], "problem")) {
                $active['problem'] = 'active';
            } else {
                if (strpos($SET['cur'], "submit")) {
                    $active['submit'] = 'active';
                } else {
                    if (strpos($SET['cur'], "page")) {
                        $active['page'] = 'active';
                    } else {
                        if (strpos($SET['cur'], "user")) {
                            $active['user'] = '******';
                        } else {
                            if (strpos($SET['cur'], "docs")) {
                                $active['docs'] = 'active';
                            } else {
                                if (strpos($SET['cur'], "admin")) {
                                    $active['admin'] = 'active';
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    HTML("<li class='{$active['problem']}'><a href='" . 路径("problem/index.php") . "'>题目</a></li>");
    HTML("<li class='{$active['submit']}'><a href='" . 路径("submit/index.php") . "'>记录</a></li>");
    $context = "比赛";
    $now = time();
    $cnt2 = $p->dosql("select ctid from comptime where starttime < {$now} and endtime > {$now}");
    if ($cnt2) {
        $context .= "<span class='doing'>({$cnt2})</span>";
    }
    $cnt1 = $p->dosql("select ctid from comptime where starttime > {$now} and endtime > {$now}");
    if ($cnt1) {
        $context .= "<span class='todo'>({$cnt1})</span>";
    }
    HTML("<li class='{$active['contest']}'><a href='" . 路径("contest/index.php") . "'>{$context}</a></li>");
    HTML("<li class='{$active['page']}'><a href='" . 路径("page/index.php") . "'>页面</a></li>");
    HTML("<li class='{$active['user']}'><a href='" . 路径("user/index.php") . "'>用户</a></li>");
    HTML("<li class='{$active['comment']}'><a href='" . 路径("problem/comments.php") . "'>评论</a></li>");
    HTML("<form class='navbar-search' method='get' action=\"" . 路径("problem/index.php") . "\" >");
    HTML("<input name='key' type='text' id='key' class='search-query span2' placeholder='搜索题目' />");
    HTML("</form>");
    HTML("</ul>");
    HTML("<ul class='nav pull-right'>");
    HTML("<li class='{$active['docs']}'><a href='" . 路径("docs/index.php") . "'>帮助</a></li>");
    if (有此权限('可以管理')) {
        HTML("<li class='{$active['admin']}'><a href='" . 路径("admin/index.php") . "'>管理</a></li>");
    }
    HTML("<li class='divider-vertical'></li>");
    HTML("<li class='dropdown'>");
    if ($uid = (int) $_SESSION['ID']) {
        $sql = "select * from userinfo where uid='{$uid}'";
        $p->dosql($sql);
        $d = $p->rtnrlt(0);
        $nickname = $d['nickname'];
        $cnt1 = $p->dosql("select mid from mail where readed = 0 and toid = {$uid}");
        if ($cnt1 > 0) {
            $mails .= "<span class='doing'>({$cnt1})</span>";
        }
        $cnt1 = $p->dosql("select mid from mail where readed = 0 and fromid = {$uid}");
        if ($cnt1 > 0) {
            $mails .= "<span class='todo'>({$cnt1})</span>";
        }
    } else {
        $nickname = "登录";
    }
    HTML("<a href='#' class='dropdown-toggle' data-toggle='dropdown'>{$nickname}{$mails}<b class='caret'></b></a>");
    HTML("<ul class='dropdown-menu'>");
    if ($uid = (int) $_SESSION['ID']) {
        HTML("<li class='span2'><a id='userbar' href='" . 路径("user/detail.php?uid={$uid}") . "'><span class='username'>" . $d['nickname'] . "</span><span class='avatar'>" . gravatar::showImage($d['email'], 28) . "</span></a></li>");
        列表("user/panel.php", "cog", "设置");
        列表("mail/index.php", "envelope", "信件" . $mails);
        列表("user/dologout.php", "off", "退出");
    } else {
        ?>
<li class='span3'><form method="post" action="<?php 
        echo 路径("user/dologin.php");
        ?>
" class='form-inline center'>
<input name="from" type="hidden" id="from" value="<?php 
        echo $SET['URI'];
        ?>
" />
<input name="username" type="text" class='input-small span2' placeholder='用户名' /><br />
<input name="password" type="password" class='input-small span2' placeholder='密码' /><br />
<label class="checkbox">
<input name="savepwd" type="checkbox" value="1" />保存 Cookies
</label><br />
<button class='btn btn-primary'>登录</button>
</form></li>
<li class='divider'></li>
<?php 
        列表("user/register.php", "user", "注册");
        列表("user/lost.php", "eye-open", "忘记密码");
    }
    HTML("</ul>");
    HTML("</li>");
    HTML("</ul>");
    HTML("</div>");
    HTML("</div>");
    HTML("</div>");
    HTML("</div>");
}
Пример #2
0
    ?>
</td>
    <td><?php 
    echo $tmp['cnt'];
    ?>
</td>
    <td><?php 
    echo $tmp['state'];
    ?>
</td>
    <td><?php 
    echo $tmp['ver'];
    ?>
</td>
    <td><?php 
    echo sp2n(htmlspecialchars($d['memo']));
    ?>
</td>
    <td><a href='<?php 
    echo $d['address'];
    ?>
' target='_blank'><?php 
    echo $d['address'];
    ?>
</a></td>
    <td><?php 
    echo $d['priority'];
    ?>
</td>
<?php 
    if (有此权限('管理评测')) {
Пример #3
0
<td><?php 
echo $d['toid'];
?>
</td>
</tr>
<tr>
<th>发送时间</th>
<td><?php 
echo date('Y-m-d H:i:s', $d['time']);
?>
</td>
</tr>
<tr>
<th>邮件内容</th>
<td><div class="MainText" width=400px><?php 
echo nl2br(sp2n(htmlspecialchars($d['msg'])));
?>
</div></td>
</tr>
</table>

<form id="form" name="form" method="post" action="index.php">
<input name="fromid" type="hidden" value=<?php 
echo $uid;
?>
 />
<input name="toid" type="hidden" value=<?php 
echo $d['fromid'];
?>
 />
<input name="title" type="hidden" value="回(<?php 
Пример #4
0
$sql = "select pid, probname, filename from problem order by acceptcnt desc";
$cnt = $p->dosql($sql);
for ($i = 0; $i < $cnt; $i++) {
    $d = $p->rtnrlt($i);
    echo "<a href=\"../problem/problem.php?pid={$d['pid']}\">{$d['probname']} ({$d['filename']})</a>\n";
}
?>
<h2><a href="../contest/index.php">比赛</a></h2>
<?php 
$sql = "select comptime.cbid, comptime.ctid, compbase.cname, comptime.intro from comptime, compbase where comptime.cbid=compbase.cbid order by comptime.ctid desc";
$cnt = $p->dosql($sql);
for ($i = 0; $i < $cnt; $i++) {
    $d = $p->rtnrlt($i);
    echo "<span id='{$d['ctid']}'>";
    echo "<a href=\"../contest/problem.php?ctid={$d['ctid']}\">{$d['cname']}</a>\n";
    echo nl2br(sp2n(htmlspecialchars($d[intro])));
    echo "</span>";
}
?>
<h2><a href="../user/index.php">用户</a></h2>
<?php 
$sql = "select uid, usr, nickname from userinfo order by grade desc";
$cnt = $p->dosql($sql);
for ($i = 0; $i < $cnt; $i++) {
    $d = $p->rtnrlt($i);
    echo "<a href=\"../user/detail.php?uid={$d['uid']}\">{$d['nickname']} ({$d['usr']})</a>\n";
}
?>
<h2><a href="../docs/index.php">文档</a></h2>
<a href="../user/login.php">登录</a>
<a href="../user/register.php">注册</a>