From 1021dae8c0c266d51570b8e8dfe81e108ea4a71e Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sat, 2 Apr 2022 18:01:26 +0800 Subject: [PATCH] feat(web): throw 403 when need login --- web/app/controllers/add_contest.php | 2 +- web/app/controllers/announcements.php | 2 +- web/app/controllers/blog_show.php | 2 +- web/app/controllers/blogs.php | 2 +- web/app/controllers/contest_inside.php | 2 +- web/app/controllers/contest_manage.php | 2 +- web/app/controllers/contest_members.php | 2 +- web/app/controllers/contests.php | 2 +- web/app/controllers/download.php | 2 +- web/app/controllers/faq.php | 2 +- web/app/controllers/hack.php | 2 +- web/app/controllers/hack_list.php | 2 +- web/app/controllers/problem.php | 2 +- web/app/controllers/problem_data_manage.php | 2 +- web/app/controllers/problem_managers_manage.php | 2 +- web/app/controllers/problem_set.php | 2 +- web/app/controllers/problem_statement_manage.php | 2 +- web/app/controllers/problem_statistics.php | 2 +- web/app/controllers/ranklist.php | 2 +- web/app/controllers/subdomain/blog/aboutme.php | 2 +- web/app/controllers/subdomain/blog/archive.php | 2 +- web/app/controllers/subdomain/blog/blog.php | 2 +- web/app/controllers/subdomain/blog/blog_delete.php | 2 +- web/app/controllers/subdomain/blog/blog_write.php | 2 +- web/app/controllers/subdomain/blog/index.php | 2 +- web/app/controllers/subdomain/blog/slide.php | 2 +- web/app/controllers/subdomain/blog/slide_write.php | 2 +- web/app/controllers/submission.php | 2 +- web/app/controllers/submission_status_details.php | 2 +- web/app/controllers/submissions_list.php | 2 +- web/app/controllers/user_info.php | 2 +- web/app/libs/uoj-html-lib.php | 8 ++++---- 32 files changed, 35 insertions(+), 35 deletions(-) diff --git a/web/app/controllers/add_contest.php b/web/app/controllers/add_contest.php index dc70f3c..7b4be09 100644 --- a/web/app/controllers/add_contest.php +++ b/web/app/controllers/add_contest.php @@ -1,6 +1,6 @@ diff --git a/web/app/controllers/subdomain/blog/archive.php b/web/app/controllers/subdomain/blog/archive.php index ce9da53..018d223 100644 --- a/web/app/controllers/subdomain/blog/archive.php +++ b/web/app/controllers/subdomain/blog/archive.php @@ -2,7 +2,7 @@ requirePHPLib('form'); if (!Auth::check()) { - becomeMsgPage(UOJLocale::get('need login')); + become403Page(UOJLocale::get('need login')); } $blogs_cond = "poster = '".UOJContext::userid()."'"; diff --git a/web/app/controllers/subdomain/blog/blog.php b/web/app/controllers/subdomain/blog/blog.php index 82ffe04..26882b1 100644 --- a/web/app/controllers/subdomain/blog/blog.php +++ b/web/app/controllers/subdomain/blog/blog.php @@ -2,7 +2,7 @@ requirePHPLib('form'); if (!Auth::check()) { - becomeMsgPage(UOJLocale::get('need login')); + become403Page(UOJLocale::get('need login')); } if (!isset($_GET['id']) || !validateUInt($_GET['id']) || !($blog = queryBlog($_GET['id'])) || !UOJContext::isHis($blog)) { diff --git a/web/app/controllers/subdomain/blog/blog_delete.php b/web/app/controllers/subdomain/blog/blog_delete.php index 61c96bd..1253c47 100644 --- a/web/app/controllers/subdomain/blog/blog_delete.php +++ b/web/app/controllers/subdomain/blog/blog_delete.php @@ -2,7 +2,7 @@ requirePHPLib('form'); if (!Auth::check()) { - becomeMsgPage(UOJLocale::get('need login')); + become403Page(UOJLocale::get('need login')); } if (!UOJContext::hasBlogPermission()) { diff --git a/web/app/controllers/subdomain/blog/blog_write.php b/web/app/controllers/subdomain/blog/blog_write.php index d197a52..661ca0f 100644 --- a/web/app/controllers/subdomain/blog/blog_write.php +++ b/web/app/controllers/subdomain/blog/blog_write.php @@ -2,7 +2,7 @@ requirePHPLib('form'); if (!Auth::check()) { - becomeMsgPage(UOJLocale::get('need login')); + become403Page(UOJLocale::get('need login')); } if (!UOJContext::hasBlogPermission()) { diff --git a/web/app/controllers/subdomain/blog/index.php b/web/app/controllers/subdomain/blog/index.php index b33e993..4494476 100644 --- a/web/app/controllers/subdomain/blog/index.php +++ b/web/app/controllers/subdomain/blog/index.php @@ -1,6 +1,6 @@
404

唔……未找到该页面……你是从哪里点进来的……>_<……

', '404'); + becomeMsgPage('
404

' . $message . '

', '404'); } -function become403Page() { +function become403Page($message = '访问被拒绝,您可能需要适当的权限以访问此页面。') { header($_SERVER['SERVER_PROTOCOL'] . " 403 Forbidden", true, 403); - becomeMsgPage('
403

禁止入内! T_T

', '403'); + becomeMsgPage('
403

' . $message . '

', '403'); } function getUserLink($username) {