2016-07-18 16:39:37 +00:00
< ? php
2022-10-17 14:13:08 +00:00
if ( ! Auth :: check ()) {
2016-07-18 16:39:37 +00:00
redirectToLogin ();
}
2022-04-03 10:18:17 +00:00
2022-10-17 14:13:08 +00:00
if ( ! validateUsername ( $_GET [ 'username' ]) || ! ( $user = queryUser ( $_GET [ 'username' ]))) {
become404Page ();
}
if ( ! isSuperUser ( $myUser ) && $myUser [ 'username' ] != $user [ 'username' ]) {
become403Page ();
}
2016-07-18 16:39:37 +00:00
$header_row = <<< EOD
< tr >
< th > 消息 </ th >
< th style = " width:15em " > 时间 </ th >
</ tr >
EOD ;
function echoSysMsg ( $msg ) {
2022-10-17 14:13:08 +00:00
echo $msg [ 'read_time' ] == null ? '<tr class="table-warning">' : '<tr>' ;
2016-07-18 16:39:37 +00:00
echo '<td>' ;
echo '<h4>' . $msg [ 'title' ] . '</h4>' ;
echo $msg [ 'content' ];
echo '</td>' ;
echo '<td>' . $msg [ 'send_time' ] . '</td>' ;
echo '</tr>' ;
}
2022-09-18 04:58:35 +00:00
?>
2016-07-18 16:39:37 +00:00
< ? php echoUOJPageHeader ( '系统消息' ) ?>
< h2 > 系统消息 </ h2 >
2022-10-17 14:13:08 +00:00
< ? php echoLongTable ( array ( '*' ), 'user_system_msg' , " receiver=' " . $user [ 'username' ] . " ' " , 'order by id desc' , $header_row , 'echoSysMsg' , array ( 'table_classes' => array ( 'table' ))) ?>
< ? php
if ( Auth :: id () == $user [ 'username' ]) {
DB :: update ( " update user_system_msg set read_time = now() where receiver = ' " . $user [ 'username' ] . " ' " );
}
?>
2016-07-18 16:39:37 +00:00
< ? php echoUOJPageFooter () ?>