diff --git a/web/app/controllers/contest_inside.php b/web/app/controllers/contest_inside.php index 6de26a2..e9cbdb8 100644 --- a/web/app/controllers/contest_inside.php +++ b/web/app/controllers/contest_inside.php @@ -563,6 +563,7 @@ EOD;

修改我的赛后总结

+
赛后总结支持 Markdown 语法。
printHTML(); ?>
diff --git a/web/app/controllers/subdomain/blog/self_reviews.php b/web/app/controllers/subdomain/blog/self_reviews.php index cc9c736..6e0580b 100644 --- a/web/app/controllers/subdomain/blog/self_reviews.php +++ b/web/app/controllers/subdomain/blog/self_reviews.php @@ -41,7 +41,10 @@ $col_names = array('contest_id'); $header_row .= ''.UOJLocale::get('contests::contest self review').''; $header_row .= ''; - $print_row = function($row) { + $parsedown = HTML::parsedown(); + $purifier = HTML::purifier_inline(); + + $print_row = function($row) use ($parsedown, $purifier) { global $username; $contest_id = $row['contest_id']; @@ -49,9 +52,6 @@ $col_names = array('contest_id'); $contest_problems = queryContestProblems($contest_id); $n_contest_problems = count($contest_problems); - $result = ''; - $purifier = HTML::purifier_inline(); - for ($i = 0; $i < $n_contest_problems; $i++) { $problem_id = $contest_problems[$i]['problem_id']; $problem = queryProblemBrief($problem_id); @@ -65,12 +65,12 @@ $col_names = array('contest_id'); $problem_review_id = "review-$contest_id-$i"; $result .= '' . chr(ord('A') + $i) . '. ' . $problem['title'] . ''; - $result .= '' . $purifier->purify($problem_self_review != null ? $problem_self_review['content'] : '') . ''; + $result .= '' . $purifier->purify($problem_self_review != null ? $parsedown->line($problem_self_review['content']) : '') . ''; if ($i == 0) { $contest_review_id = "review-$contest_id-overall"; $contest_self_review = DB::selectFirst("select content from contests_reviews where contest_id = $contest_id and problem_id = -1 and poster = '$username'"); - $result .= '' . $purifier->purify($contest_self_review != null ? $contest_self_review['content'] : '') . ''; + $result .= '' . $purifier->purify($contest_self_review != null ? $parsedown->line($contest_self_review['content']) : '') . ''; } $result .= ''; diff --git a/web/app/libs/uoj-contest-lib.php b/web/app/libs/uoj-contest-lib.php index b1e03a6..d2115b6 100644 --- a/web/app/libs/uoj-contest-lib.php +++ b/web/app/libs/uoj-contest-lib.php @@ -112,7 +112,9 @@ function calcStandings($contest, $contest_data, &$score, &$standings, $update_co } if ($show_reviews) { + $parsedown = HTML::parsedown(); $purifier = HTML::purifier_inline(); + foreach ($contest_data['people'] as $person) { foreach ($contest_data['problems'] as $key => $problem) { $review_result = DB::selectFirst("select content from contests_reviews where contest_id = {$contest['id']} and problem_id = {$problem} and poster = '{$person[0]}'"); @@ -122,7 +124,7 @@ function calcStandings($contest, $contest_data, &$score, &$standings, $update_co } if ($review_result['content']) { - $score[$person[0]][$key][] = $purifier->purify($review_result['content']); + $score[$person[0]][$key][] = $purifier->purify($parsedown->line($review_result['content'])); } } } @@ -147,7 +149,7 @@ function calcStandings($contest, $contest_data, &$score, &$standings, $update_co $review_result = DB::selectFirst("select content from contests_reviews where contest_id = {$contest['id']} and problem_id = -1 and poster = '{$person[0]}'"); if ($review_result['content']) { - $cur[] = $purifier->purify($review_result['content']); + $cur[] = $purifier->purify($parsedown->line($review_result['content'])); } }