diff --git a/web/app/controllers/super_manage.php b/web/app/controllers/super_manage.php index 6aa3191..4e688d7 100644 --- a/web/app/controllers/super_manage.php +++ b/web/app/controllers/super_manage.php @@ -142,11 +142,23 @@ break; case 'problem_uploader': DB::update("update user_info set usergroup = 'U' where username = '{$username}'"); - DB::update("update user_info set usertype = 'problem_uploader' where username = '{$username}'"); + $user = queryUser($username); + $usertype = explode(',', $user['usertype']); + if (!in_array('problem_uploader', $usertype)) { + $usertype[] = 'problem_uploader'; + } + $usertype = implode(',', $usertype); + DB::update("update user_info set usertype = '{$usertype}' where username = '{$username}'"); break; case 'problem_manager': DB::update("update user_info set usergroup = 'U' where username = '{$username}'"); - DB::update("update user_info set usertype = 'problem_manager' where username = '{$username}'"); + $user = queryUser($username); + $usertype = explode(',', $user['usertype']); + if (!in_array('problem_manager', $usertype)) { + $usertype[] = 'problem_manager'; + } + $usertype = implode(',', $usertype); + DB::update("update user_info set usertype = '{$usertype}' where username = '{$username}'"); break; case 'superuser': DB::update("update user_info set usergroup = 'S' where username = '{$username}'"); @@ -427,7 +439,7 @@ EOD; echo << ${hislink} - {$row['usergroup']} + {$row['usergroup']}, {$row['usertype']} {$row['register_time']} EOD; diff --git a/web/app/libs/uoj-utility-lib.php b/web/app/libs/uoj-utility-lib.php index 6fecced..902d7ef 100644 --- a/web/app/libs/uoj-utility-lib.php +++ b/web/app/libs/uoj-utility-lib.php @@ -130,10 +130,18 @@ function blog_name_decode($name) { } function isProblemUploader($user) { - return $user != null && $user['usertype'] == 'problem_uploader'; + if ($user == null) { + return false; + } + $usertype = explode(',', $user['usertype']); + return in_array('problem_uploader', $usertype); } function isProblemManager($user) { - return $user != null && $user['usertype'] == 'problem_manager'; + if ($user == null) { + return false; + } + $usertype = explode(',', $user['usertype']); + return in_array('problem_manager', $usertype); } function isSuperUser($user) {