mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-29 18:26:20 +00:00
25 lines
644 B
PHP
25 lines
644 B
PHP
|
<?php
|
||
|
|
||
|
Auth::check() || redirectToLogin();
|
||
|
|
||
|
$parsedown_type = UOJRequest::post('parsedown_type', 'is_string', 'default');
|
||
|
$purifier_type = UOJRequest::post('purifier_type', 'is_string', 'default');
|
||
|
|
||
|
$markdown = UOJRequest::post('markdown', 'is_string', '');
|
||
|
|
||
|
$parsedown = HTML::parsedown();
|
||
|
|
||
|
if ($purifier_type == 'inline') {
|
||
|
$purifier = HTML::purifier_inline();
|
||
|
} else {
|
||
|
$purifier = HTML::purifier();
|
||
|
}
|
||
|
|
||
|
if ($parsedown_type == 'inline') {
|
||
|
$html = $purifier->purify($parsedown->line(UOJRequest::post('markdown', 'is_string')));
|
||
|
} else {
|
||
|
$html = $purifier->purify($parsedown->text(UOJRequest::post('markdown', 'is_string')));
|
||
|
}
|
||
|
|
||
|
die($html);
|