diff --git a/web/app/controllers/problem.php b/web/app/controllers/problem.php index 9d1c355..52895ff 100644 --- a/web/app/controllers/problem.php +++ b/web/app/controllers/problem.php @@ -323,12 +323,12 @@ if (UOJContest::cur()) {
-

+

-

+

-

+

printHTML(); ?> diff --git a/web/app/controllers/subdomain/blog/blog.php b/web/app/controllers/subdomain/blog/blog.php index f6079e3..0cd54c6 100644 --- a/web/app/controllers/subdomain/blog/blog.php +++ b/web/app/controllers/subdomain/blog/blog.php @@ -13,6 +13,8 @@ $blog = UOJBlog::info(); function getCommentContentToDisplay($comment) { if (!$comment['is_hidden']) { return $comment['content']; + } else if (UOJUserBlog::userHasManagePermission(Auth::user())) { + return '【' . HTML::escape($comment['reason_to_hide']) . '】' . $comment['content']; } else { return '【' . HTML::escape($comment['reason_to_hide']) . '】'; } @@ -162,6 +164,34 @@ $reply_form->handle = function (&$vdata) { $reply_form->config['ctrl_enter_submit'] = true; $reply_form->runAtServer(); +if (UOJUserBlog::userHasManagePermission(Auth::user())) { + $hide_form = new UOJForm('hide'); + $hide_form->addHidden('comment_hide_id', '', 'validateCommentId', null); + $hide_form->addSelect('comment_hide_type', [ + 'label' => '隐藏理由', + 'options' => UOJBlogComment::HIDE_REASONS, + 'default_value' => 'spam', + ]); + $hide_form->addInput('comment_hide_reason', [ + 'div_class' => 'mt-3', + 'label' => '自定义隐藏理由', + 'default_value' => '该评论由于违反社区规定,已被管理员隐藏', + 'validator_php' => 'validateString', + ]); + $hide_form->handle = function (&$vdata) { + if ($_POST['comment_hide_type'] == 'unhide') { + $reason = ''; + } else if ($_POST['comment_hide_type'] == 'other') { + $reason = $_POST['comment_hide_reason']; + } else { + $reason = '该评论由于' . UOJBlogComment::HIDE_REASONS[$_POST['comment_hide_type']] . ',已被管理员隐藏'; + } + + $vdata['comment_hide_id']->hide($reason); + }; + $hide_form->runAtServer(); +} + $comments_pag = new Paginator([ 'col_names' => ['*'], 'table_name' => 'blogs_comments', @@ -170,9 +200,38 @@ $comments_pag = new Paginator([ 'page_len' => 20 ]); ?> + + + + echoView(['show_title_only' => isset($_GET['page']) && $_GET['page'] != 1]) ?> + + + +

评论 @@ -216,13 +275,20 @@ $comments_pag = new Paginator([

-
+