chore(web): fix style

This commit is contained in:
Baoshuo Ren 2022-03-20 17:19:07 +08:00
parent ebdd8f2208
commit e3fc955b75
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
4 changed files with 48 additions and 32 deletions

View File

@ -16,9 +16,13 @@
function ($x) {
global $contest;
if (!validateUsername($x)) return '用户名不合法';
if (!validateUsername($x)) {
return '用户名不合法';
}
$user = queryUser($x);
if (!$user) return '用户不存在';
if (!$user) {
return '用户不存在';
}
if (hasRegistered($user, $contest)) {
return '该用户已经报名';
@ -34,7 +38,9 @@
$username = $_POST['new_username'];
$user = queryUser($username);
if (!$user) return;
if (!$user) {
return;
}
DB::query("replace into contests_registrants (username, user_rating, contest_id, has_participated) values ('{$user['username']}', {$user['rating']}, {$contest['id']}, 0)");
@ -47,9 +53,13 @@
function ($x) {
global $contest;
if (!validateUInt($x)) return '小组 ID 不合法';
if (!validateUInt($x)) {
return '小组 ID 不合法';
}
$group = queryGroup($x);
if (!$group) return '小组不存在';
if (!$group) {
return '小组不存在';
}
return '';
},

View File

@ -37,9 +37,13 @@
function ($x) {
global $group_id;
if (!validateUsername($x)) return '用户名不合法';
if (!validateUsername($x)) {
return '用户名不合法';
}
$user = queryUser($x);
if (!$user) return '用户不存在';
if (!$user) {
return '用户不存在';
}
if (queryUserInGroup($group_id, $x)) {
return '该用户已经在小组中';
@ -64,7 +68,9 @@
function ($x) {
global $group_id;
if (!validateUsername($x)) return '用户名不合法';
if (!validateUsername($x)) {
return '用户名不合法';
}
if (!queryUserInGroup($group_id, $x)) {
return '该用户不在小组中';
}

View File

@ -4,34 +4,34 @@
requirePHPLib('data');
if (isSuperUser($myUser)) {
$new_group_form = new UOJForm('new_group');
$new_group_form->handle = function() {
DB::query("insert into `groups` (title, is_hidden) values ('新小组', 1)");
};
$new_group_form->submit_button_config['align'] = 'right';
$new_group_form->submit_button_config['class_str'] = 'btn btn-primary';
$new_group_form->submit_button_config['text'] = UOJLocale::get('add new group');
$new_group_form->submit_button_config['smart_confirm'] = '';
$new_group_form->runAtServer();
$new_group_form = new UOJForm('new_group');
$new_group_form->handle = function() {
DB::query("insert into `groups` (title, is_hidden) values ('新小组', 1)");
};
$new_group_form->submit_button_config['align'] = 'right';
$new_group_form->submit_button_config['class_str'] = 'btn btn-primary';
$new_group_form->submit_button_config['text'] = UOJLocale::get('add new group');
$new_group_form->submit_button_config['smart_confirm'] = '';
$new_group_form->runAtServer();
}
function echoGroup($group) {
global $myUser;
global $myUser;
echo '<tr class="text-center">';
echo '<td>';
echo '#', $group['group_id'], '</td>';
echo '<tr class="text-center">';
echo '<td>';
echo '#', $group['group_id'], '</td>';
echo '<td class="text-left">';
if ($group['is_hidden']) {
echo ' <span class="text-danger">[隐藏]</span> ';
}
echo '<a href="/group/', $group['group_id'], '">', $group['title'], '</a>';
echo '</td>';
echo '<td class="text-left">';
if ($group['is_hidden']) {
echo ' <span class="text-danger">[隐藏]</span> ';
}
echo '<a href="/group/', $group['group_id'], '">', $group['title'], '</a>';
echo '</td>';
echo "<td>{$group['user_count']}</td>";
echo "<td>{$group['user_count']}</td>";
echo '</tr>';
echo '</tr>';
}
?>
@ -49,9 +49,9 @@
EOD;
if (isSuperUser($myUser)) {
$cond = "1";
$cond = "1";
} else {
$cond = 'is_hidden = 0';
$cond = 'is_hidden = 0';
}
$from = "`groups` a left join groups_users b on a.id = b.group_id";

View File

@ -55,7 +55,7 @@
insertBlog($data);
$blog = array('id' => DB::insert_id(), 'tags' => array());
$ret['blog_write_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}/write");
$ret['blog_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}");
$ret['blog_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}");
}
if ($data['tags'] !== $blog['tags']) {
DB::delete("delete from blogs_tags where blog_id = {$blog['id']}");