From 4647a8c8baa772120f2f662fd4697117f0c41fbd Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 19 Jan 2023 16:06:42 +0800 Subject: [PATCH] refactor(problem): remove UOJProblem::type() --- web/app/controllers/problem.php | 4 ++-- web/app/controllers/problem_data_manage.php | 2 +- web/app/controllers/problem_managers_manage.php | 2 +- web/app/controllers/problem_statement_manage.php | 6 +++--- web/app/models/UOJProblem.php | 8 ++------ 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/web/app/controllers/problem.php b/web/app/controllers/problem.php index ffcd596..c5762c2 100644 --- a/web/app/controllers/problem.php +++ b/web/app/controllers/problem.php @@ -241,10 +241,10 @@ if (UOJContest::cur()) { type() == 'local') { + if (UOJProblem::info('type') == 'local') { $time_limit = $conf instanceof UOJProblemConf ? $conf->getVal('time_limit', 1) : null; $memory_limit = $conf instanceof UOJProblemConf ? $conf->getVal('memory_limit', 256) : null; - } else if (UOJProblem::cur()->type() == 'remote') { + } else if (UOJProblem::info('type') == 'remote') { $time_limit = UOJProblem::cur()->getExtraConfig('time_limit'); $memory_limit = UOJProblem::cur()->getExtraConfig('memory_limit'); } diff --git a/web/app/controllers/problem_data_manage.php b/web/app/controllers/problem_data_manage.php index ab65cee..91112c7 100644 --- a/web/app/controllers/problem_data_manage.php +++ b/web/app/controllers/problem_data_manage.php @@ -10,7 +10,7 @@ requirePHPLib('data'); UOJProblem::init(UOJRequest::get('id')) || UOJResponse::page404(); UOJProblem::cur()->userCanManage(Auth::user()) || UOJResponse::page403(); -UOJProblem::cur()->type() === 'local' || UOJResponse::page404(); +UOJProblem::info('type') === 'local' || UOJResponse::page404(); $problem = UOJProblem::info(); $problem_extra_config = UOJProblem::cur()->getExtraConfig(); diff --git a/web/app/controllers/problem_managers_manage.php b/web/app/controllers/problem_managers_manage.php index b381daa..9e8ca75 100644 --- a/web/app/controllers/problem_managers_manage.php +++ b/web/app/controllers/problem_managers_manage.php @@ -82,7 +82,7 @@ if (isSuperUser(Auth::user())) { 管理者 - type() == 'local') : ?> + - type() == 'local') : ?> +