1
0
mirror of https://github.com/renbaoshuo/UOJ-Luogu-RemoteJudge.git synced 2024-12-26 11:32:00 +00:00

chore: add some patch files

This commit is contained in:
Baoshuo Ren 2023-03-21 21:25:06 +08:00
parent b67f2e505e
commit 01dbc95da0
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,23 @@
--- UOJ-System/web/app/libs/uoj-html-lib.php 2022-12-30 09:54:05.452022649 +0800
+++ UOJ-Luogu-RemoteJudge/web/app/libs/uoj-html-lib.php 2023-03-21 21:22:31.783213786 +0800
@@ -989,3 +989,20 @@
$config['get_row_index'] = '';
echoLongTable($col_names, 'user_info', '1', $tail, $header_row, $print_row, $config);
}
+
+function renderMarkdown($content_md) {
+ $purifier = HTML::pruifier();
+
+ try {
+ $v8 = new V8Js();
+ $v8->content_md = $content_md;
+ $v8->executeString(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/js/marked.js'), 'marked.js');
+ $content = $v8->executeString('marked(PHP.content_md)');
+ } catch (V8JsException $e) {
+ throw new Exception('V8Js error: ' . $e->getMessage());
+ }
+
+ $content = $purifier->purify($content);
+
+ return $content;
+}

View File

@ -0,0 +1,10 @@
--- UOJ-System/web/app/libs/uoj-validate-lib.php 2022-12-30 09:54:05.452022649 +0800
+++ UOJ-Luogu-RemoteJudge/web/app/libs/uoj-validate-lib.php 2023-03-21 21:23:42.635610391 +0800
@@ -47,3 +47,7 @@
function validateIP($ip) {
return filter_var($ip, FILTER_VALIDATE_IP) !== false;
}
+
+function validateLuoguProblemId($str) {
+ return preg_match('/^(P|B)[1-9][0-9]{3,5}$/', $str);
+}