+ ID |
+ 标题 |
+ 状态 |
+ 结束时间 |
+
EOD,
- function($row) use ($group, $now) {
- $end_time = DateTime::createFromFormat('Y-m-d H:i:s', $row['end_time']);
+ function($row) use ($group) {
+ $end_time = DateTime::createFromFormat('Y-m-d H:i:s', $row['end_time']);
- echo '';
- echo '', $row['list_id'], ' | ';
- echo '', '', HTML::escape($row['title']), '', ' | ';
- if ($end_time < $now) {
- echo '已结束 | ';
- } else {
- echo '进行中 | ';
- }
- echo '', $end_time->format('Y-m-d H:i:s'), ' | ';
- echo '
';
- },
- [
- 'echo_full' => true,
- 'div_classes' => ['table-responsive'],
- 'table_classes' => ['table', 'align-middle', 'mb-0'],
- ]
- );
+ echo '';
+ echo '', $row['list_id'], ' | ';
+ echo '', '', HTML::escape($row['title']), '', ' | ';
+ if ($end_time < UOJTime::$time_now) {
+ echo '已结束 | ';
+ } else {
+ echo '进行中 | ';
+ }
+ echo '', $end_time->format('Y-m-d H:i:s'), ' | ';
+ echo '
';
+ },
+ [
+ 'echo_full' => true,
+ 'div_classes' => ['table-responsive'],
+ 'table_classes' => ['table', 'align-middle', 'mb-0'],
+ ]
+ );
?>
diff --git a/web/app/controllers/group_manage.php b/web/app/controllers/group_manage.php
index a19dcaa..d06ed82 100644
--- a/web/app/controllers/group_manage.php
+++ b/web/app/controllers/group_manage.php
@@ -54,7 +54,8 @@
return '名称过长';
}
- if (HTML::escape($title) === '') {
+ $title = HTML::escape($title);
+ if ($title === '') {
return '无效编码';
}
@@ -199,7 +200,6 @@ function(res) {
EOD);
$add_new_assignment_form->runAtServer();
- $now = new DateTime();
$hidden_time = new DateTime();
$hidden_time->sub(new DateInterval('P7D'));
} elseif ($cur_tab == 'users') {
@@ -349,7 +349,7 @@ EOD);
操作 |
EOD,
- function($row) use ($group, $now, $hidden_time) {
+ function($row) use ($group, $hidden_time) {
$list = queryProblemList($row['list_id']);
$end_time = DateTime::createFromFormat('Y-m-d H:i:s', $row['end_time']);
@@ -363,7 +363,7 @@ EOD,
echo '';
if ($end_time < $hidden_time) {
echo '已隐藏 | ';
- } elseif ($end_time < $now) {
+ } elseif ($end_time < UOJTime::$time_now) {
echo '已结束 | ';
} else {
echo '进行中 | ';
diff --git a/web/app/controllers/list_edit.php b/web/app/controllers/list_edit.php
index 3cccc09..0f79cd5 100644
--- a/web/app/controllers/list_edit.php
+++ b/web/app/controllers/list_edit.php
@@ -55,7 +55,8 @@
return '标题过长';
}
- if (HTML::escape($title) === '') {
+ $title = HTML::escape($title);
+ if ($title === '') {
return '无效编码';
}
@@ -80,18 +81,18 @@
}
foreach ($tags_raw as $tag) {
- $tag = trim($tag);
+ $tag = HTML::escape(trim($tag));
if (strlen($tag) == 0) {
continue;
}
if (strlen($tag) > 30) {
- return '标签 “' . HTML::escape($tag) .'” 太长';
+ return '标签 “' . $tag .'” 太长';
}
if (in_array($tag, $tags, true)) {
- return '标签 “' . HTML::escape($tag) .'” 重复出现';
+ return '标签 “' . $tag .'” 重复出现';
}
$tags[] = $tag;
@@ -322,7 +323,6 @@ function(res) {
EOD);
$add_new_assignment_form->runAtServer();
- $now = new DateTime();
$hidden_time = new DateTime();
$hidden_time->sub(new DateInterval('P7D'));
}
@@ -480,7 +480,7 @@ EOD,
操作 |
EOD,
- function($row) use ($list, $now, $hidden_time) {
+ function($row) use ($list, $hidden_time) {
$group = queryGroup($row['group_id']);
$end_time = DateTime::createFromFormat('Y-m-d H:i:s', $row['end_time']);
@@ -489,7 +489,7 @@ EOD,
echo '', '', HTML::escape($group['title']), '', ' | ';
if ($end_time < $hidden_time) {
echo '已隐藏 | ';
- } elseif ($end_time < $now) {
+ } elseif ($end_time < UOJTime::$time_now) {
echo '已结束 | ';
} else {
echo '进行中 | ';
diff --git a/web/app/views/sidebar.php b/web/app/views/sidebar.php
index f573d29..4d024e2 100644
--- a/web/app/views/sidebar.php
+++ b/web/app/views/sidebar.php
@@ -56,15 +56,12 @@