From 9b691606d1de437aef3e868b2de89514d0082cf7 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 18 Oct 2022 09:18:09 +0800 Subject: [PATCH] fix(web/blog/write): blog poster --- web/app/controllers/subdomain/blog/blog_write.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/app/controllers/subdomain/blog/blog_write.php b/web/app/controllers/subdomain/blog/blog_write.php index 85bb219..860af62 100644 --- a/web/app/controllers/subdomain/blog/blog_write.php +++ b/web/app/controllers/subdomain/blog/blog_write.php @@ -40,7 +40,7 @@ ); } 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 { $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}"); } 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) { @@ -61,8 +61,8 @@ insertBlog($data); $blog = array('id' => DB::insert_id(), 'tags' => array()); $ret['blog_id'] = $blog['id']; - $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_write_url'] = HTML::blog_url(UOJContext::userid(), "/post/{$blog['id']}/write"); + $ret['blog_url'] = HTML::blog_url(UOJContext::userid(), "/post/{$blog['id']}"); } if ($data['tags'] !== $blog['tags']) { DB::delete("delete from blogs_tags where blog_id = {$blog['id']}");