2016-07-18 16:39:37 +00:00
< ? php
2022-03-17 04:00:03 +00:00
if ( ! Auth :: check ()) {
2022-04-02 10:01:26 +00:00
become403Page ( UOJLocale :: get ( 'need login' ));
2022-03-17 04:00:03 +00:00
}
2022-04-03 10:18:17 +00:00
if ( ! isNormalUser ( $myUser )) {
become403Page ();
}
2016-07-18 16:39:37 +00:00
$username = $_GET [ 'username' ];
2022-03-25 05:16:37 +00:00
$REQUIRE_LIB [ 'github_contribution_graph' ] = '' ;
2016-07-18 16:39:37 +00:00
?>
< ? php if ( validateUsername ( $username ) && ( $user = queryUser ( $username ))) : ?>
< ? php echoUOJPageHeader ( $user [ 'username' ] . ' - ' . UOJLocale :: get ( 'user profile' )) ?>
< ? php
$esc_email = HTML :: escape ( $user [ 'email' ]);
$esc_qq = HTML :: escape ( $user [ 'qq' ] != 0 ? $user [ 'qq' ] : 'Unfilled' );
$esc_sex = HTML :: escape ( $user [ 'sex' ]);
$col_sex = " color:blue " ;
2020-06-25 12:41:16 +00:00
if ( $esc_sex == " M " ) {
2016-07-18 16:39:37 +00:00
$esc_sex = " ♂ " ;
$col_sex = " color:blue " ;
2020-06-25 12:41:16 +00:00
} elseif ( $esc_sex == " F " ) {
2016-07-18 16:39:37 +00:00
$esc_sex = " ♀ " ;
$col_sex = " color:red " ;
} else {
$esc_sex = " " ;
$col_sex = " color:black " ;
}
$esc_motto = HTML :: escape ( $user [ 'motto' ]);
?>
2019-09-10 02:15:20 +00:00
< div class = " card border-info " >
< h5 class = " card-header bg-info " >< ? = UOJLocale :: get ( 'user profile' ) ?> </h5>
< div class = " card-body " >
< div class = " row mb-4 " >
< div class = " col-md-4 order-md-9 " >
< img class = " media-object img-thumbnail d-block mx-auto " alt = " <?= $user['username'] ?> Avatar " src = " <?= HTML::avatar_addr( $user , 256) ?> " />
2016-07-18 16:39:37 +00:00
</ div >
2019-09-10 02:15:20 +00:00
< div class = " col-md-8 order-md-1 " >
2022-03-17 10:26:29 +00:00
< h2 >< span class = " uoj-honor " data - realname = " <?= $user['realname'] ?> " >< ? = $user [ 'username' ] ?> </span> <span><strong style="<?= $col_sex ?>"><?= $esc_sex ?></strong></span></h2>
2016-07-18 16:39:37 +00:00
< div class = " list-group " >
< div class = " list-group-item " >
< h4 class = " list-group-item-heading " >< ? = UOJLocale :: get ( 'email' ) ?> </h4>
< p class = " list-group-item-text " >< ? = $esc_email ?> </p>
</ div >
< div class = " list-group-item " >
< h4 class = " list-group-item-heading " >< ? = UOJLocale :: get ( 'QQ' ) ?> </h4>
< p class = " list-group-item-text " >< ? = $esc_qq ?> </p>
</ div >
< div class = " list-group-item " >
< h4 class = " list-group-item-heading " >< ? = UOJLocale :: get ( 'motto' ) ?> </h4>
< p class = " list-group-item-text " >< ? = $esc_motto ?> </p>
</ div >
< ? php if ( isSuperUser ( $myUser )) : ?>
< div class = " list-group-item " >
< h4 class = " list-group-item-heading " > register time </ h4 >
< p class = " list-group-item-text " >< ? = $user [ 'register_time' ] ?> </p>
</ div >
< div class = " list-group-item " >
< h4 class = " list-group-item-heading " > remote_addr </ h4 >
< p class = " list-group-item-text " >< ? = $user [ 'remote_addr' ] ?> </p>
</ div >
< div class = " list-group-item " >
< h4 class = " list-group-item-heading " > http_x_forwarded_for </ h4 >
< p class = " list-group-item-text " >< ? = $user [ 'http_x_forwarded_for' ] ?> </p>
</ div >
< ? php endif ?>
</ div >
</ div >
</ div >
< ? php if ( Auth :: check ()) : ?>
< ? php if ( Auth :: id () != $user [ 'username' ]) : ?>
< a type = " button " class = " btn btn-info btn-sm " href = " /user/msg?enter=<?= $user['username'] ?> " >< span class = " glyphicon glyphicon-envelope " ></ span > < ? = UOJLocale :: get ( 'send private message' ) ?> </a>
< ? php else : ?>
< a type = " button " class = " btn btn-info btn-sm " href = " /user/modify-profile " >< span class = " glyphicon glyphicon-pencil " ></ span > < ? = UOJLocale :: get ( 'modify my profile' ) ?> </a>
< ? php endif ?>
< ? php endif ?>
< a type = " button " class = " btn btn-success btn-sm " href = " <?= HTML::blog_url( $user['username'] , '/') ?> " >< span class = " glyphicon glyphicon-arrow-right " ></ span > < ? = UOJLocale :: get ( 'visit his blog' , $username ) ?> </a>
< div class = " top-buffer-lg " ></ div >
< div class = " list-group " >
2022-03-25 05:16:37 +00:00
< div class = " list-group-item " >
< ? php
$_result = DB :: query ( " select date(submit_time), problem_id from submissions where submitter = ' { $username } ' and score = 100 and date(submit_time) between date_sub(curdate(), interval 1 year) and curdate() " );
$result = [];
$vis = [];
while ( $row = DB :: fetch ( $_result )) {
$id = $row [ 'date(submit_time)' ] . ':' . $row [ 'problem_id' ];
if ( ! $vis [ $id ]) {
$vis [ $id ] = 1 ;
$result [ strtotime ( $row [ 'date(submit_time)' ]) * 1000 ] ++ ;
}
}
?>
< h4 class = " list-group-item-heading " >< ? = UOJLocale :: get ( 'n accepted in last year' , count ( $result )) ?> </h4>
< div id = " accepted-graph " ></ div >
< script >
var accepted_graph_data = [
< ? php
foreach ( $result as $key => $val ) {
echo " { timestamp: { $key } , count: { $val } }, " ;
}
?>
];
$ ( document ) . ready ( function () {
$ ( '#accepted-graph' ) . github_graph ({
data : accepted_graph_data ,
texts : [ 'AC' , 'AC' ],
h_days : [ 'Tue' , 'Thu' , 'Sat' ],
});
});
</ script >
</ div >
2016-07-18 16:39:37 +00:00
< div class = " list-group-item " >
< ? php
2022-03-24 05:30:00 +00:00
$ac_problems = DB :: selectAll ( " select a.problem_id as problem_id, b.title as title from best_ac_submissions a inner join problems b on a.problem_id = b.id where submitter = ' { $user [ 'username' ] } '; " );
2016-07-18 16:39:37 +00:00
?>
< h4 class = " list-group-item-heading " >< ? = UOJLocale :: get ( 'accepted problems' ) . ': ' . UOJLocale :: get ( 'n problems in total' , count ( $ac_problems )) ?> </h4>
< p class = " list-group-item-text " >
< ? php
foreach ( $ac_problems as $problem ) {
2022-03-24 05:30:00 +00:00
echo '<a href="/problem/' , $problem [ 'problem_id' ], '" style="display:inline-block; margin-right:0.25em;">#' , $problem [ 'problem_id' ], '. ' , $problem [ 'title' ], '</a>' ;
2016-07-18 16:39:37 +00:00
}
if ( empty ( $ac_problems )) {
echo UOJLocale :: get ( 'none' );
}
?>
</ p >
</ div >
</ div >
</ div >
</ div >
< ? php else : ?>
< ? php echoUOJPageHeader ( '不存在该用户' . ' - 用户信息' ) ?>
2019-09-10 02:15:20 +00:00
< div class = " card border-danger " >
< div class = " card-header bg-danger " > 用户信息 </ div >
< div class = " card-body " >
2016-07-18 16:39:37 +00:00
< h4 > 不存在该用户 </ h4 >
</ div >
</ div >
< ? php endif ?>
< ? php echoUOJPageFooter () ?>