diff --git a/web/app/controllers/problem_solutions.php b/web/app/controllers/problem_solutions.php index 6ace983..2dca10b 100644 --- a/web/app/controllers/problem_solutions.php +++ b/web/app/controllers/problem_solutions.php @@ -35,8 +35,8 @@ if (UOJRequest::post('submit-remove_solution') === 'remove_solution') { sendSystemMsg( $blog->info['poster'], '题解移除通知', - "

" . UOJUser::getLink($blog->info['poster']) . " 您好:

" . - "

您为问题 " . UOJProblem::cur()->getLink(['with' => 'id']) . " 提交的题解 " . $blog->getLink() . " 已被" . (isSuperUser(Auth::user()) ? "管理员" : " " . UOJUser::getLink(Auth::user()) . " ") . "移除。

" + "

" . UOJUser::getLink($blog->info['poster'], ['color' => false]) . " 您好:

" . + "

您为问题 " . UOJProblem::cur()->getLink(['with' => 'id']) . " 提交的题解 " . $blog->getLink() . " 已被管理员移除。

" ); } diff --git a/web/app/controllers/subdomain/blog/blog.php b/web/app/controllers/subdomain/blog/blog.php index 5343ab8..89259d4 100644 --- a/web/app/controllers/subdomain/blog/blog.php +++ b/web/app/controllers/subdomain/blog/blog.php @@ -60,7 +60,7 @@ $comment_form->handle = function () { $page = floor($rank / 20) + 1; $uri = getLongTablePageUri($page) . '#' . "comment-{$comment_id}"; - $user_link = UOJUser::getLink(Auth::user()); + $user_link = UOJUser::getLink(Auth::user(), ['color' => false]); foreach ($referrers as $referrer) { $content = $user_link . ' 在博客 ' . $blog['title'] . ' 的评论里提到你:点击此处查看'; @@ -137,7 +137,7 @@ $reply_form->handle = function (&$vdata) { $page = floor($rank / 20) + 1; $uri = getLongTablePageUri($page) . '#' . "comment-{$reply_id}"; - $user_link = UOJUser::getLink(Auth::user()); + $user_link = UOJUser::getLink(Auth::user(), ['color' => false]); foreach ($referrers as $referrer) { $content = $user_link . ' 在博客 ' . $blog['title'] . ' 的评论里提到你:点击此处查看'; @@ -195,7 +195,7 @@ if (UOJUserBlog::userHasManagePermission(Auth::user())) { sendSystemMsg( $comment->info['poster'], '评论隐藏通知', - "

" . UOJUser::getLink($comment->info['poster']) . " 您好:

" . + "

" . UOJUser::getLink($comment->info['poster'], ['color' => false]) . " 您好:

" . "

您为博客 " . UOJBlog::cur()->getLink() . " 回复的评论 “" . substr($comment->info['content'], 0, 30) . "……” 已被管理员隐藏,隐藏原因为 “{$reason}”。

" ); } diff --git a/web/app/models/UOJContest.php b/web/app/models/UOJContest.php index 60e3905..4605ce2 100644 --- a/web/app/models/UOJContest.php +++ b/web/app/models/UOJContest.php @@ -66,7 +66,7 @@ class UOJContest { calcStandings($contest, $data, $score, $standings, ['update_contests_submissions' => true]); for ($i = 0; $i < count($standings); $i++) { - $user_link = UOJUser::getLink($standings[$i][2][0]); + $user_link = UOJUser::getLink($standings[$i][2][0], ['color' => false]); $tail = $standings[$i][0] == $total_score ? ',请继续保持。' : ',请继续努力!'; $content = '

' . $user_link . ' 您好:

'; diff --git a/web/app/models/UOJUser.php b/web/app/models/UOJUser.php index d4d104a..5bda744 100644 --- a/web/app/models/UOJUser.php +++ b/web/app/models/UOJUser.php @@ -247,7 +247,11 @@ class UOJUser { return $custom_color ?: '#0d6efd'; } - public static function getLink($user) { + public static function getLink($user, $cfg = []) { + $cfg += [ + 'color' => true, + ]; + if (is_string($user)) { $info = UOJUser::query($user); @@ -267,7 +271,7 @@ class UOJUser { return HTML::tag('span', [ 'class' => 'uoj-username', - 'data-color' => UOJUser::getUserColor($user), + 'data-color' => $cfg['color'] ? UOJUser::getUserColor($user) : '', 'data-realname' => trim(HTML::escape($realname)), ], $user['username']); }