mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-23 05:18:41 +00:00
fix(web/blog/write): blog poster
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ab51b193f4
commit
9b691606d1
@ -40,7 +40,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($blog) {
|
if ($blog) {
|
||||||
$blog_editor->blog_url = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}");
|
$blog_editor->blog_url = HTML::blog_url(UOJContext::userid(), "/post/{$blog['id']}");
|
||||||
} else {
|
} else {
|
||||||
$blog_editor->blog_url = null;
|
$blog_editor->blog_url = null;
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@
|
|||||||
DB::update("update blogs set title = '".DB::escape($data['title'])."', content = '".DB::escape($data['content'])."', content_md = '".DB::escape($data['content_md'])."', is_hidden = {$data['is_hidden']} where id = {$id}");
|
DB::update("update blogs set title = '".DB::escape($data['title'])."', content = '".DB::escape($data['content'])."', content_md = '".DB::escape($data['content_md'])."', is_hidden = {$data['is_hidden']} where id = {$id}");
|
||||||
}
|
}
|
||||||
function insertBlog($data) {
|
function insertBlog($data) {
|
||||||
DB::insert("insert into blogs (title, content, content_md, poster, is_hidden, post_time) values ('".DB::escape($data['title'])."', '".DB::escape($data['content'])."', '".DB::escape($data['content_md'])."', '".Auth::id()."', {$data['is_hidden']}, now())");
|
DB::insert("insert into blogs (title, content, content_md, poster, is_hidden, post_time) values ('".DB::escape($data['title'])."', '".DB::escape($data['content'])."', '".DB::escape($data['content_md'])."', '".UOJContext::userid()."', {$data['is_hidden']}, now())");
|
||||||
}
|
}
|
||||||
|
|
||||||
$blog_editor->save = function($data) {
|
$blog_editor->save = function($data) {
|
||||||
@ -61,8 +61,8 @@
|
|||||||
insertBlog($data);
|
insertBlog($data);
|
||||||
$blog = array('id' => DB::insert_id(), 'tags' => array());
|
$blog = array('id' => DB::insert_id(), 'tags' => array());
|
||||||
$ret['blog_id'] = $blog['id'];
|
$ret['blog_id'] = $blog['id'];
|
||||||
$ret['blog_write_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}/write");
|
$ret['blog_write_url'] = HTML::blog_url(UOJContext::userid(), "/post/{$blog['id']}/write");
|
||||||
$ret['blog_url'] = HTML::blog_url(UOJContext::user()['username'], "/post/{$blog['id']}");
|
$ret['blog_url'] = HTML::blog_url(UOJContext::userid(), "/post/{$blog['id']}");
|
||||||
}
|
}
|
||||||
if ($data['tags'] !== $blog['tags']) {
|
if ($data['tags'] !== $blog['tags']) {
|
||||||
DB::delete("delete from blogs_tags where blog_id = {$blog['id']}");
|
DB::delete("delete from blogs_tags where blog_id = {$blog['id']}");
|
||||||
|
Loading…
Reference in New Issue
Block a user