Пример #1
0
 public function avatar_src($size = 50, $default = null)
 {
     if (!$default) {
         $default = "http://" . $_SERVER['HTTP_HOST'] . "/zest/images/icon_user.gif";
     }
     return gravatar::get_src($this->email, $size, $default);
 }
Пример #2
0
 public function render($options = null)
 {
     if (!$options) {
         $config = Kohana::config_load('zest');
         $options = $config['comment'];
     }
     $array = array("date_format" => 'D jS M Y', "image" => array(50, 50), "html" => '{AVATAR}{DATE} by {AUTHOR}<br/><p>{TEXT}</p><a href="{DELETE_LINK}" title="delete comment"></a><div class="spacer">&nbsp;</div>', "default_image" => 'http://' . $_SERVER['HTTP_HOST'] . '/zest/images/user_icon.gif', "template" => '');
     $array = arr::overwrite($array, $options);
     if (isset($array['template']) && $array['template'] != "") {
         $html = zest::template_to_html('snippets/' . $array['template']);
     } else {
         $html = $array['html'];
     }
     $html = str_replace('{DATE}', date($array['date_format'], strtotime($this->date)), $html);
     $html = str_replace('{AVATAR}', gravatar::render($this->email, $array['image'][0], $array['default_image']), $html);
     if ($this->fl_deleted == 1) {
         $html = str_replace('{TEXT}', '<i>This comment has been deleted.</i>', $html);
     } else {
         $html = str_replace('{TEXT}', $this->title, $html);
     }
     $html = str_replace('{AUTHOR}', $this->display_name, $html);
     if ($this->can_modify()) {
         $html = str_replace('{DELETE_LINK}', $this->delete_url(), $html);
     }
     return $html;
 }
Пример #3
0
 /**
  *
  * @param string $default
  */
 public static function setDefaultImage($default)
 {
     self::$default = urlencode($default);
 }
Пример #4
0
$cnt = $q->dosql($sql);
for ($i = 0; $i < $cnt; $i++) {
    $e = $q->rtnrlt($i);
    ?>
<tr><td>
<div class="wrap">
<?php 
    echo BBCode($e['detail']);
    ?>
</div>
<div>
<a href="../user/detail.php?uid=<?php 
    echo $e['uid'];
    ?>
"><?php 
    echo gravatar::showImage($e['email']);
    echo $e['nickname'];
    ?>
</a>
<div class="pull-right">
<?php 
    if ($e['showcode']) {
        $sql = "select sid from submit where uid='{$e['uid']}' and pid='{$d['pid']}' order by subtime desc";
        $r->dosql($sql);
        $f = $r->rtnrlt(0);
        ?>
    <a href="../submit/code.php?id=<?php 
        echo $f['sid'];
        ?>
" title="查看该用户最后一次提交的代码"><i class='icon icon-download'></i></a>
<?php 
Пример #5
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>");
}
Пример #6
0
  </tr>
<?php 
    $tu = 0;
    for ($i = 0; $i < $cnt; $i++) {
        $d = $p->rtnrlt($i);
        if ($d[uid] == $tu) {
            continue;
        }
        $tu = $d[uid];
        ?>
  <tr>
    <td><a target="_blank" href="../user/detail.php?uid=<?php 
        echo $d[uid];
        ?>
"><?php 
        echo gravatar::showImage($d['email'], 64);
        echo "<br />";
        if (有此权限("查看用户")) {
            echo $d['realname'];
        } else {
            echo $d['nickname'];
        }
        ?>
</a></td>
    <td>
	
<table class='table table-striped table-condensed table-bordered fiexd'>
	  <tr>
		<th style="width: 5em;">CSID</th>
		<th style="width: 15em;">题目名</th>
		<th style="width: 4em;">代码</th>
Пример #7
0
</tr>
<tr>
<th>用户头像
<p>&nbsp;</p>
<?php 
if ($_SESSION['ID'] == $uid) {
    ?>
<a href="../mail" class="btn btn-success" title="信件"><span class='icon-envelope icon-white'></span></a>
<p style="line-height: 2px;">&nbsp;</p>
<a href="panel.php" class="btn btn-primary" title="设置"><span class='icon-cog icon-white'></span></a>
<?php 
}
?>
</th>
<td><?php 
echo gravatar::showImage($d['email'], 200);
?>
</td>
</tr>
<tr>
<th>用户昵称</th>
<td><?php 
echo $d['nickname'];
?>
</td>
</tr>
<tr>
<th>E-mail</th>
<td><a href="mailto:<?php 
echo $d['email'];
?>
Пример #8
0
<th>内存</th>
<th>得分</th>
</tr>
<?php 
    $sql = "select * from compscore,userinfo where userinfo.uid=compscore.uid and compscore.pid={$pid} and compscore.ctid={$ctid} order by compscore.score desc, compscore.runtime asc, compscore.memory asc";
    $cnt = $r->dosql($sql);
    for ($i = 0; $i < $cnt; $i++) {
        $f = $r->rtnrlt($i);
        ?>
<tr>
<td><a href="../user/detail.php?uid=<?php 
        echo $f['uid'];
        ?>
" target="_blank">
<?php 
        echo gravatar::showImage($f['email'], 14);
        echo 有此权限('查看用户') ? $f['realname'] : $f['nickname'];
        ?>
</a></td>
<td class="wrap"><a href="code.php?csid=<?php 
        echo $f['csid'];
        ?>
" target="_blank"><?php 
        echo 评测结果($f['result'], 20);
        ?>
</a></td>
<td><?php 
        printf("%.3f", $f['runtime'] / 1000.0);
        ?>
</td>
<td><?php 
Пример #9
0
		<td><?php 
echo $this->escape($user_info['identity']);
?>
</td>
	</tr>
	<tr>
		<td>备注</td>
		<td><?php 
echo $this->escape($user_info['memo']);
?>
</td>
	</tr>
</table>

<?php 
echo gravatar::showImage($user_info['email']);
?>

<?php 
$user_record = $user->getRecord();
?>
<p>该用户从<?php 
echo $this->formatTime($user_info['register_time']);
?>
起,提交了 <?php 
echo $user_record->getRecordsCount();
?>
 次,通过了 <?php 
echo $user_record->getAcceptedProblemsCount();
?>
 道题,通过率为 <?php 
Пример #10
0
for ($i = 0; $i < $cnt; $i++) {
    $d = $p->rtnrlt($i);
    ?>
<tr>
<td><i><?php 
    echo $i + 1;
    ?>
</i></td>
<td><a href="user/detail.php?uid=<?php 
    echo $d['uid'];
    ?>
" title="<?php 
    echo sp2n(htmlspecialchars($d['memo']));
    ?>
"><?php 
    echo gravatar::showImage($d['email'], $SET['index_rank_icon']);
    if (有此权限("查看用户")) {
        echo $d['realname'];
    } else {
        echo $d['nickname'];
    }
    ?>
</a></td>
<td><?php 
    echo $d['grade'];
    ?>
</td>
<td><?php 
    echo $d['accepted'];
    ?>
</td>