mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 12:58:40 +00:00
feat(web/user): website
This commit is contained in:
parent
1eb342120e
commit
4e9b2a748a
@ -818,6 +818,7 @@ CREATE TABLE `user_info` (
|
|||||||
`images_size_limit` int(11) UNSIGNED NOT NULL DEFAULT 104857600, /* 100 MiB */
|
`images_size_limit` int(11) UNSIGNED NOT NULL DEFAULT 104857600, /* 100 MiB */
|
||||||
`codeforces_handle` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
`codeforces_handle` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||||
`github` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
`github` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||||
|
`website` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||||
PRIMARY KEY (`username`),
|
PRIMARY KEY (`username`),
|
||||||
KEY `ac_num` (`ac_num`,`username`)
|
KEY `ac_num` (`ac_num`,`username`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||||
|
@ -122,6 +122,16 @@ EOD);
|
|||||||
|
|
||||||
$vdata['codeforces_handle'] = $codeforces_handle;
|
$vdata['codeforces_handle'] = $codeforces_handle;
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}, null);
|
||||||
|
$update_profile_form->addVInput('website', 'text', UOJLocale::get('user::website'), $user['website'],
|
||||||
|
function($url, &$vdata) {
|
||||||
|
if ($url && !validateURL($url)) {
|
||||||
|
return '链接格式不合法。';
|
||||||
|
}
|
||||||
|
|
||||||
|
$vdata['website'] = $url;
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}, null);
|
}, null);
|
||||||
$update_profile_form->handle = function(&$vdata) use ($user, $myUser) {
|
$update_profile_form->handle = function(&$vdata) use ($user, $myUser) {
|
||||||
@ -131,6 +141,7 @@ EOD);
|
|||||||
$esc_sex = DB::escape($_POST['sex']);
|
$esc_sex = DB::escape($_POST['sex']);
|
||||||
$esc_motto = DB::escape($vdata['motto']);
|
$esc_motto = DB::escape($vdata['motto']);
|
||||||
$esc_codeforces_handle = DB::escape($vdata['codeforces_handle']);
|
$esc_codeforces_handle = DB::escape($vdata['codeforces_handle']);
|
||||||
|
$esc_website = DB::escape($vdata['website']);
|
||||||
|
|
||||||
if (isSuperUser($myUser)) {
|
if (isSuperUser($myUser)) {
|
||||||
$esc_school = DB::escape($vdata['school']);
|
$esc_school = DB::escape($vdata['school']);
|
||||||
@ -138,7 +149,7 @@ EOD);
|
|||||||
DB::update("UPDATE user_info SET school = '$esc_school' WHERE username = '{$user['username']}'");
|
DB::update("UPDATE user_info SET school = '$esc_school' WHERE username = '{$user['username']}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::update("UPDATE user_info SET email = '$esc_email', qq = '$esc_qq', sex = '$esc_sex', motto = '$esc_motto', codeforces_handle = '$esc_codeforces_handle', github = '$esc_github' WHERE username = '{$user['username']}'");
|
DB::update("UPDATE user_info SET email = '$esc_email', qq = '$esc_qq', sex = '$esc_sex', motto = '$esc_motto', codeforces_handle = '$esc_codeforces_handle', github = '$esc_github', website = '$esc_website' WHERE username = '{$user['username']}'");
|
||||||
};
|
};
|
||||||
$update_profile_form->submit_button_config['margin_class'] = 'mt-3';
|
$update_profile_form->submit_button_config['margin_class'] = 'mt-3';
|
||||||
$update_profile_form->submit_button_config['text'] = '更新';
|
$update_profile_form->submit_button_config['text'] = '更新';
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
|
'website' => 'Website',
|
||||||
'admin' => 'Admin',
|
'admin' => 'Admin',
|
||||||
'student' => 'Student',
|
'student' => 'Student',
|
||||||
'teacher' => 'Teacher',
|
'teacher' => 'Teacher',
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
|
'website' => '网址',
|
||||||
'admin' => '管理员',
|
'admin' => '管理员',
|
||||||
'student' => '学生',
|
'student' => '学生',
|
||||||
'teacher' => '老师',
|
'teacher' => '老师',
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
ALTER TABLE `user_info` ADD COLUMN `codeforces_handle` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';
|
ALTER TABLE `user_info` ADD COLUMN `codeforces_handle` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';
|
||||||
ALTER TABLE `user_info` ADD COLUMN `github` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';
|
ALTER TABLE `user_info` ADD COLUMN `github` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';
|
||||||
|
ALTER TABLE `user_info` ADD COLUMN `website` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '';
|
||||||
|
@ -197,6 +197,14 @@ function fTime($time, $gran = -1) {
|
|||||||
</script>
|
</script>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
<?php if ($user['website']): ?>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<i class="bi bi-link-45deg me-1"></i>
|
||||||
|
<a class="text-decoration-none text-body text-break" href="<?= HTML::escape($user['website']) ?>" target="_blank">
|
||||||
|
<?= HTML::escape($user['website']) ?>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php endif ?>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="card-footer bg-transparent">
|
<div class="card-footer bg-transparent">
|
||||||
<?php $last_visited = strtotime($user['last_visited']) ?>
|
<?php $last_visited = strtotime($user['last_visited']) ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user