mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-25 01:08:41 +00:00
Added created_at field to pastes
This commit is contained in:
parent
f25be16d1e
commit
8cbb222d0b
@ -702,12 +702,16 @@ create table pastes
|
||||
(
|
||||
`index` varchar(20) null,
|
||||
creator varchar(20) null,
|
||||
created_at datetime null,
|
||||
content text null
|
||||
);
|
||||
|
||||
create unique index pastes_index_uindex
|
||||
on pastes (`index`);
|
||||
|
||||
create index pastes_created_at_index
|
||||
on pastes (created_at);
|
||||
|
||||
alter table pastes
|
||||
add constraint pastes_pk
|
||||
primary key (`index`);
|
||||
|
@ -16,7 +16,7 @@ function handleUpload($zip_file_name, $content, $tot_size) {
|
||||
$index = uojRandString(20);
|
||||
$esc_index = DB::escape($index);
|
||||
}
|
||||
DB::query("insert into pastes (`index`, `creator`, `content`) values ('$esc_index', '${myUser['username']}', '$esc_content')");
|
||||
DB::query("insert into pastes (`index`, `creator`, `content`, `created_at`) values ('$esc_index', '${myUser['username']}', '$esc_content', '".date('Y-m-d H:i:s')."')");
|
||||
redirectTo("/pastes/".$index);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,9 @@
|
||||
$paste_id = $_GET['rand_str_id'];
|
||||
|
||||
$paste = DB::selectFirst("select * from pastes where `index` = '".DB::escape($paste_id)."'");
|
||||
|
||||
if (!$paste) {
|
||||
become404Page();
|
||||
}
|
||||
$REQUIRE_LIB['shjs'] = "";
|
||||
echoUOJPageHeader("Paste!");
|
||||
echoPasteContent($paste);
|
||||
|
@ -410,6 +410,7 @@ function echoPasteContent($paste) {
|
||||
$footer_text .= ", ".UOJLocale::get("problems::submitter") . <<<HTML
|
||||
: <a href="/user/profile/${paste['creator']}">${paste['creator']}</a>
|
||||
HTML;
|
||||
$footer_text .= ", ".UOJLocale::get("problems::submit time").": ".$paste['created_at'];
|
||||
|
||||
switch ($file_language) {
|
||||
case 'C++':
|
||||
|
Loading…
Reference in New Issue
Block a user