@@ -53,7 +53,7 @@ |
||
| 53 | 53 | if (!function_exists('emailVerified')) { |
| 54 | 54 | function emailVerified() |
| 55 | 55 | { |
| 56 | - if(Auth::check()){ |
|
| 56 | + if (Auth::check()) { |
|
| 57 | 57 | return !is_null(Auth::user()->email_verified_at); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $accountModel=new AccountModel(); |
| 29 | 29 | $info=$accountModel->detail(Auth::user()->id); |
| 30 | 30 | $feed=$accountModel->feed(Auth::user()->id); |
| 31 | - $extraInfo = $accountModel->getExtraInfo(Auth::user()->id,100); |
|
| 31 | + $extraInfo=$accountModel->getExtraInfo(Auth::user()->id, 100); |
|
| 32 | 32 | return view("account.dashboard", [ |
| 33 | 33 | 'page_title'=>"DashBoard", |
| 34 | 34 | 'site_title'=>"NOJ", |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $accountModel=new AccountModel(); |
| 47 | 47 | $info=$accountModel->detail(Auth::user()->id); |
| 48 | - if(!empty(session('last_email_send'))){ |
|
| 49 | - $email_cooldown = 300 - (time() - session('last_email_send')); |
|
| 48 | + if (!empty(session('last_email_send'))) { |
|
| 49 | + $email_cooldown=300-(time()-session('last_email_send')); |
|
| 50 | 50 | } |
| 51 | - $extraInfo = $accountModel->getExtraInfo(Auth::user()->id,100); |
|
| 51 | + $extraInfo=$accountModel->getExtraInfo(Auth::user()->id, 100); |
|
| 52 | 52 | return view("account.dashboard", [ |
| 53 | 53 | 'page_title'=>"Settings", |
| 54 | 54 | 'site_title'=>"NOJ", |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | $accountModel=new AccountModel(); |
| 29 | 29 | $info=$accountModel->detail($uid); |
| 30 | 30 | $feed=$accountModel->feed($uid); |
| 31 | - $extraInfo = $accountModel->getExtraInfo($uid,0); |
|
| 31 | + $extraInfo=$accountModel->getExtraInfo($uid, 0); |
|
| 32 | 32 | return view("account.dashboard", [ |
| 33 | 33 | 'page_title'=>$info["name"], |
| 34 | 34 | 'site_title'=>"NOJ", |
@@ -494,15 +494,15 @@ |
||
| 494 | 494 | 'desc' |
| 495 | 495 | ); |
| 496 | 496 | |
| 497 | - if($filter["pcode"]){ |
|
| 497 | + if ($filter["pcode"]) { |
|
| 498 | 498 | $paginator=$paginator->where(["pcode"=>$filter["pcode"]]); |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - if($filter["result"]){ |
|
| 501 | + if ($filter["result"]) { |
|
| 502 | 502 | $paginator=$paginator->where(["verdict"=>$filter["result"]]); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if($filter["account"]){ |
|
| 505 | + if ($filter["account"]) { |
|
| 506 | 506 | $paginator=$paginator->where(["name"=>$filter["account"]]); |
| 507 | 507 | } |
| 508 | 508 | |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | public function feed($uid=null) |
| 26 | 26 | { |
| 27 | 27 | $ret=[]; |
| 28 | - $solution=DB::table("problem_solution")->join("problem","problem.pid","=","problem_solution.pid")->where(["uid"=>$uid,"audit"=>1])->select("problem.pid as pid","pcode","title","problem_solution.created_at as created_at")->orderBy("problem_solution.created_at","DESC")->get()->all(); |
|
| 29 | - foreach($solution as &$s){ |
|
| 28 | + $solution=DB::table("problem_solution")->join("problem", "problem.pid", "=", "problem_solution.pid")->where(["uid"=>$uid, "audit"=>1])->select("problem.pid as pid", "pcode", "title", "problem_solution.created_at as created_at")->orderBy("problem_solution.created_at", "DESC")->get()->all(); |
|
| 29 | + foreach ($solution as &$s) { |
|
| 30 | 30 | $s["type"]="event"; |
| 31 | 31 | $s["color"]="wemd-orange"; |
| 32 | 32 | $s["icon"]="comment-check-outline"; |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | ])->join("problem", "problem.pid", "=", "submission.pid")->select('pcode')->distinct()->get()->all(); |
| 93 | 93 | $ret["solvedCount"]=count($ret["solved"]); |
| 94 | 94 | // Casual |
| 95 | - $ret["rank"]=Cache::tags(['rank',$ret["id"]])->get("rank", "N/A"); |
|
| 96 | - $ret["rankTitle"]=Cache::tags(['rank',$ret["id"]])->get("title"); |
|
| 95 | + $ret["rank"]=Cache::tags(['rank', $ret["id"]])->get("rank", "N/A"); |
|
| 96 | + $ret["rankTitle"]=Cache::tags(['rank', $ret["id"]])->get("title"); |
|
| 97 | 97 | $ret["rankTitleColor"]=RankModel::getColor($ret["rankTitle"]); |
| 98 | 98 | // Professional |
| 99 | 99 | $ret["professionalTitle"]=RankModel::getProfessionalTitle($ret["professional_rate"]); |
| 100 | 100 | $ret["professionalTitleColor"]=RankModel::getProfessionalColor($ret["professionalTitle"]); |
| 101 | 101 | // Administration Group |
| 102 | - $ret["admin"]=$uid==1?1:0; |
|
| 102 | + $ret["admin"]=$uid==1 ? 1 : 0; |
|
| 103 | 103 | if (Cache::tags(['bing', 'pic'])->get(date("Y-m-d"))==null) { |
| 104 | 104 | $bing=new BingPhoto([ |
| 105 | 105 | 'locale' => 'zh-CN', |
@@ -111,9 +111,9 @@ discard block |
||
| 111 | 111 | return $ret; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public function getExtraInfo($uid,$secret_level = 0){ |
|
| 115 | - $ret = DB::table('users_extra')->where('uid',$uid)->get()->all(); |
|
| 116 | - $key_meaning = [ |
|
| 114 | + public function getExtraInfo($uid, $secret_level=0) { |
|
| 115 | + $ret=DB::table('users_extra')->where('uid', $uid)->get()->all(); |
|
| 116 | + $key_meaning=[ |
|
| 117 | 117 | 0 => 'gender', |
| 118 | 118 | 1 => 'contact', |
| 119 | 119 | 2 => 'school', |
@@ -121,20 +121,20 @@ discard block |
||
| 121 | 121 | 4 => 'location', |
| 122 | 122 | 5 => 'editor_left_width', |
| 123 | 123 | ]; |
| 124 | - $result = []; |
|
| 125 | - if(!empty($ret)){ |
|
| 124 | + $result=[]; |
|
| 125 | + if (!empty($ret)) { |
|
| 126 | 126 | foreach ($ret as $value) { |
| 127 | - if(empty($value['secret_level']) || $value['secret_level'] <= $secret_level){ |
|
| 128 | - $key_name = $key_meaning[$value['key']] ?? 'unknown'; |
|
| 129 | - $result[$key_name] = $value['value']; |
|
| 127 | + if (empty($value['secret_level']) || $value['secret_level']<=$secret_level) { |
|
| 128 | + $key_name=$key_meaning[$value['key']] ?? 'unknown'; |
|
| 129 | + $result[$key_name]=$value['value']; |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | return $result; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - public function setExtraInfo($uid,$key_name,$value = null,$secret_level = -1){ |
|
| 137 | - $key_value = [ |
|
| 136 | + public function setExtraInfo($uid, $key_name, $value=null, $secret_level=-1) { |
|
| 137 | + $key_value=[ |
|
| 138 | 138 | 'gender' => 0, |
| 139 | 139 | 'contact' => 1, |
| 140 | 140 | 'school' => 2, |
@@ -143,31 +143,31 @@ discard block |
||
| 143 | 143 | 'editor_left_width' => 5, |
| 144 | 144 | //TODO... |
| 145 | 145 | ]; |
| 146 | - $key = $key_value[$key_name]; |
|
| 147 | - $ret = DB::table('users_extra')->where('uid',$uid)->where('key',$key)->first(); |
|
| 148 | - if(!empty($ret)){ |
|
| 146 | + $key=$key_value[$key_name]; |
|
| 147 | + $ret=DB::table('users_extra')->where('uid', $uid)->where('key', $key)->first(); |
|
| 148 | + if (!empty($ret)) { |
|
| 149 | 149 | unset($ret['id']); |
| 150 | - if(!is_null($value)){ |
|
| 151 | - $ret['value'] = $value; |
|
| 150 | + if (!is_null($value)) { |
|
| 151 | + $ret['value']=$value; |
|
| 152 | 152 | } |
| 153 | - if($secret_level != -1){ |
|
| 154 | - $ret['secret_level'] = $secret_level; |
|
| 153 | + if ($secret_level!=-1) { |
|
| 154 | + $ret['secret_level']=$secret_level; |
|
| 155 | 155 | } |
| 156 | - DB::table('users_extra')->where('uid',$uid)->where('key',$key)->update($ret); |
|
| 157 | - }else{ |
|
| 156 | + DB::table('users_extra')->where('uid', $uid)->where('key', $key)->update($ret); |
|
| 157 | + } else { |
|
| 158 | 158 | return DB::table('users_extra')->insertGetId( |
| 159 | 159 | [ |
| 160 | 160 | 'uid' => $uid, |
| 161 | 161 | 'key' => $key, |
| 162 | 162 | 'value' => $value, |
| 163 | - 'secret_level' => $secret_level == -1 ? 0 : $secret_level, |
|
| 163 | + 'secret_level' => $secret_level==-1 ? 0 : $secret_level, |
|
| 164 | 164 | ] |
| 165 | 165 | ); |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - public function unsetExtraInfoIfExist($uid,$key_name){ |
|
| 170 | - $key_value = [ |
|
| 169 | + public function unsetExtraInfoIfExist($uid, $key_name) { |
|
| 170 | + $key_value=[ |
|
| 171 | 171 | 'gender' => 0, |
| 172 | 172 | 'contact' => 1, |
| 173 | 173 | 'school' => 2, |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | 'editor_left_width' => 5, |
| 177 | 177 | //TODO... |
| 178 | 178 | ]; |
| 179 | - $key = $key_value[$key_name]; |
|
| 180 | - $ret = DB::table('users_extra')->where('uid',$uid)->where('key',$key)->delete(); |
|
| 179 | + $key=$key_value[$key_name]; |
|
| 180 | + $ret=DB::table('users_extra')->where('uid', $uid)->where('key', $key)->delete(); |
|
| 181 | 181 | } |
| 182 | 182 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | class AccountController extends Controller |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - public function updateAvatar(Request $request){ |
|
| 19 | + public function updateAvatar(Request $request) { |
|
| 20 | 20 | $isValid=$request->file('avatar')->isValid(); |
| 21 | 21 | if ($isValid) { |
| 22 | 22 | $extension=$request->file('avatar')->extension(); |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function changeBasicInfo(Request $request){ |
|
| 46 | + public function changeBasicInfo(Request $request) { |
|
| 47 | 47 | // if(!$request->has('username')){ |
| 48 | 48 | // return ResponseModel::err(1003); |
| 49 | 49 | // } |
| 50 | 50 | // $username = $request->input('username'); |
| 51 | - $describes = $request->input('describes'); |
|
| 52 | - if(strlen($describes) > 255){ |
|
| 51 | + $describes=$request->input('describes'); |
|
| 52 | + if (strlen($describes)>255) { |
|
| 53 | 53 | return ResponseModel::err(1006); |
| 54 | 54 | } |
| 55 | 55 | // $old_username=Auth::user()->name; |
@@ -58,79 +58,79 @@ discard block |
||
| 58 | 58 | // } |
| 59 | 59 | $user=Auth::user(); |
| 60 | 60 | // $user->name = $username; |
| 61 | - $user->describes = $describes; |
|
| 61 | + $user->describes=$describes; |
|
| 62 | 62 | $user->save(); |
| 63 | 63 | return ResponseModel::success(); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function changePassword(Request $request){ |
|
| 67 | - if(!$request->has('old_password') || !$request->has('new_password') || !$request->has('confirm_password')){ |
|
| 66 | + public function changePassword(Request $request) { |
|
| 67 | + if (!$request->has('old_password') || !$request->has('new_password') || !$request->has('confirm_password')) { |
|
| 68 | 68 | return ResponseModel::err(1003); |
| 69 | 69 | } |
| 70 | - $old_password = $request->input('old_password'); |
|
| 71 | - $new_password = $request->input('new_password'); |
|
| 72 | - $confirm_password = $request->input('confirm_password'); |
|
| 73 | - if($new_password != $confirm_password){ |
|
| 70 | + $old_password=$request->input('old_password'); |
|
| 71 | + $new_password=$request->input('new_password'); |
|
| 72 | + $confirm_password=$request->input('confirm_password'); |
|
| 73 | + if ($new_password!=$confirm_password) { |
|
| 74 | 74 | return ResponseModel::err(2004); |
| 75 | 75 | } |
| 76 | - if(strlen($new_password) < 8 || strlen($old_password) < 8){ |
|
| 76 | + if (strlen($new_password)<8 || strlen($old_password)<8) { |
|
| 77 | 77 | return ResponseModel::err(1006); |
| 78 | 78 | } |
| 79 | - $user = Auth::user(); |
|
| 80 | - if(!Hash::check($old_password, $user->password)){ |
|
| 79 | + $user=Auth::user(); |
|
| 80 | + if (!Hash::check($old_password, $user->password)) { |
|
| 81 | 81 | return ResponseModel::err(2005); |
| 82 | 82 | } |
| 83 | - $user->password = Hash::make($new_password); |
|
| 83 | + $user->password=Hash::make($new_password); |
|
| 84 | 84 | $user->save(); |
| 85 | 85 | return ResponseModel::success(); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function checkEmailCooldown(Request $request){ |
|
| 89 | - $last_send = $request->session()->get('last_email_send'); |
|
| 90 | - if(empty($last_send) || time() - $last_send >= 300){ |
|
| 91 | - $request->session()->put('last_email_send',time()); |
|
| 92 | - return ResponseModel::success(200,null,0); |
|
| 93 | - }else{ |
|
| 94 | - $cooldown = 300 - (time() - $last_send); |
|
| 95 | - return ResponseModel::success(200,null,$cooldown); |
|
| 88 | + public function checkEmailCooldown(Request $request) { |
|
| 89 | + $last_send=$request->session()->get('last_email_send'); |
|
| 90 | + if (empty($last_send) || time()-$last_send>=300) { |
|
| 91 | + $request->session()->put('last_email_send', time()); |
|
| 92 | + return ResponseModel::success(200, null, 0); |
|
| 93 | + } else { |
|
| 94 | + $cooldown=300-(time()-$last_send); |
|
| 95 | + return ResponseModel::success(200, null, $cooldown); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function changeExtraInfo(Request $request){ |
|
| 100 | - $input = $request->input(); |
|
| 101 | - $allow_change = ['gender','contact','school','country','location']; |
|
| 102 | - foreach($input as $key => $value){ |
|
| 103 | - if(!in_array($key,$allow_change)){ |
|
| 99 | + public function changeExtraInfo(Request $request) { |
|
| 100 | + $input=$request->input(); |
|
| 101 | + $allow_change=['gender', 'contact', 'school', 'country', 'location']; |
|
| 102 | + foreach ($input as $key => $value) { |
|
| 103 | + if (!in_array($key, $allow_change)) { |
|
| 104 | 104 | return ResponseModel::error(1007); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - $account_model = new AccountModel(); |
|
| 108 | - $user_id = Auth::user()->id; |
|
| 107 | + $account_model=new AccountModel(); |
|
| 108 | + $user_id=Auth::user()->id; |
|
| 109 | 109 | foreach ($input as $key => $value) { |
| 110 | - if(strlen($value) != 0){ |
|
| 111 | - $account_model->setExtraInfo($user_id,$key,$value,0); |
|
| 112 | - }else{ |
|
| 113 | - $account_model->unsetExtraInfoIfExist($user_id,$key); |
|
| 110 | + if (strlen($value)!=0) { |
|
| 111 | + $account_model->setExtraInfo($user_id, $key, $value, 0); |
|
| 112 | + } else { |
|
| 113 | + $account_model->unsetExtraInfoIfExist($user_id, $key); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | return ResponseModel::success(); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function saveEditorWidth(Request $request){ |
|
| 120 | - $input = $request->input(); |
|
| 121 | - $allow_change = ['editor_left_width']; |
|
| 122 | - foreach($input as $key => $value){ |
|
| 123 | - if(!in_array($key,$allow_change)){ |
|
| 119 | + public function saveEditorWidth(Request $request) { |
|
| 120 | + $input=$request->input(); |
|
| 121 | + $allow_change=['editor_left_width']; |
|
| 122 | + foreach ($input as $key => $value) { |
|
| 123 | + if (!in_array($key, $allow_change)) { |
|
| 124 | 124 | return ResponseModel::error(1007); |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | - $account_model = new AccountModel(); |
|
| 128 | - $user_id = Auth::user()->id; |
|
| 127 | + $account_model=new AccountModel(); |
|
| 128 | + $user_id=Auth::user()->id; |
|
| 129 | 129 | foreach ($input as $key => $value) { |
| 130 | - if(strlen($value) != 0){ |
|
| 131 | - $account_model->setExtraInfo($user_id,$key,$value,0); |
|
| 132 | - }else{ |
|
| 133 | - $account_model->unsetExtraInfoIfExist($user_id,$key); |
|
| 130 | + if (strlen($value)!=0) { |
|
| 131 | + $account_model->setExtraInfo($user_id, $key, $value, 0); |
|
| 132 | + } else { |
|
| 133 | + $account_model->unsetExtraInfoIfExist($user_id, $key); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | return ResponseModel::success(); |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | ]; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - $editor_left_width = $account->getExtraInfo(Auth::user()->id)['editor_left_width'] ?? '40'; |
|
| 134 | + $editor_left_width=$account->getExtraInfo(Auth::user()->id)['editor_left_width'] ?? '40'; |
|
| 135 | 135 | |
| 136 | 136 | return is_null($prob_detail) ? redirect("/problem") : view('problem.editor', [ |
| 137 | 137 | 'page_title'=>$prob_detail["title"], |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function index() |
| 23 | 23 | { |
| 24 | 24 | $contestModel=new ContestModel(); |
| 25 | - $return_list=$contestModel->list(Auth::check()?Auth::user()->id:0); |
|
| 25 | + $return_list=$contestModel->list(Auth::check() ?Auth::user()->id : 0); |
|
| 26 | 26 | $featured=$contestModel->featured(); |
| 27 | 27 | return view('contest.index', [ |
| 28 | 28 | 'page_title'=>"Contest", |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | ]; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - $editor_left_width = $accountModel->getExtraInfo(Auth::user()->id)['editor_left_width'] ?? '40'; |
|
| 160 | + $editor_left_width=$accountModel->getExtraInfo(Auth::user()->id)['editor_left_width'] ?? '40'; |
|
| 161 | 161 | |
| 162 | 162 | return view('contest.board.editor', [ |
| 163 | 163 | 'page_title'=>"Problem Detail", |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | // "gid"=>$gid |
| 124 | 124 | // ])->orderBy('begin_time', 'desc')->get()->all(); |
| 125 | 125 | $preQuery=DB::table($this->tableName); |
| 126 | - $paginator=$preQuery->where('gid','=',$gid)->orderBy('begin_time', 'desc')->paginate(10); |
|
| 126 | + $paginator=$preQuery->where('gid', '=', $gid)->orderBy('begin_time', 'desc')->paginate(10); |
|
| 127 | 127 | $contest_list=$paginator->all(); |
| 128 | - if(empty($contest_list)){ |
|
| 128 | + if (empty($contest_list)) { |
|
| 129 | 129 | return null; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | ->join('contest', 'group_member.gid', '=', 'contest.gid') |
| 161 | 161 | ->leftJoin('contest_participant', 'contest.cid', '=', 'contest_participant.cid') |
| 162 | 162 | ->where( |
| 163 | - function ($query) { |
|
| 163 | + function($query) { |
|
| 164 | 164 | $query->where('public', 1) |
| 165 | 165 | ->where('audit_status', 1); |
| 166 | 166 | } |
| 167 | 167 | ) |
| 168 | 168 | ->orWhere( |
| 169 | - function ($query) use ($uid) { |
|
| 169 | + function($query) use ($uid) { |
|
| 170 | 170 | $query->where('group_member.uid', $uid) |
| 171 | 171 | ->where('group_member.role', '>', 0); |
| 172 | 172 | // ->where(function ($query) use ($uid) { |
@@ -231,14 +231,14 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - public function registContest($cid,$uid) |
|
| 234 | + public function registContest($cid, $uid) |
|
| 235 | 235 | { |
| 236 | 236 | $registered=DB::table("contest_participant")->where([ |
| 237 | 237 | "cid"=>$cid, |
| 238 | 238 | "uid"=>$uid |
| 239 | 239 | ])->first(); |
| 240 | 240 | |
| 241 | - if(empty($registered)){ |
|
| 241 | + if (empty($registered)) { |
|
| 242 | 242 | DB::table("contest_participant")->insert([ |
| 243 | 243 | "cid"=>$cid, |
| 244 | 244 | "uid"=>$uid, |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | "problem_detail" => $prob_detail |
| 540 | 540 | ]; |
| 541 | 541 | } |
| 542 | - usort($ret, function ($a, $b) { |
|
| 542 | + usort($ret, function($a, $b) { |
|
| 543 | 543 | if ($a["score"]==$b["score"]) { |
| 544 | 544 | if ($a["penalty"]==$b["penalty"]) { |
| 545 | 545 | return 0; |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | "problem_detail" => $prob_detail |
| 587 | 587 | ]; |
| 588 | 588 | } |
| 589 | - usort($ret, function ($a, $b) { |
|
| 589 | + usort($ret, function($a, $b) { |
|
| 590 | 590 | if ($a["score"]==$b["score"]) { |
| 591 | 591 | if ($a["solved"]==$b["solved"]) { |
| 592 | 592 | return 0; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | { |
| 680 | 680 | return DB::table("contest_clarification")->where([ |
| 681 | 681 | "cid"=>$cid |
| 682 | - ])->where(function ($query) { |
|
| 682 | + ])->where(function($query) { |
|
| 683 | 683 | $query->where([ |
| 684 | 684 | "public"=>1 |
| 685 | 685 | ])->orWhere([ |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | "users.id", |
| 828 | 828 | "=", |
| 829 | 829 | "submission.uid" |
| 830 | - )->where(function ($query) use ($frozen_time) { |
|
| 830 | + )->where(function($query) use ($frozen_time) { |
|
| 831 | 831 | $query->where( |
| 832 | 832 | "submission_date", |
| 833 | 833 | "<", |
@@ -1020,12 +1020,12 @@ discard block |
||
| 1020 | 1020 | public function updateProfessionalRate($cid) |
| 1021 | 1021 | { |
| 1022 | 1022 | $basic=$this->basic($cid); |
| 1023 | - if($basic["rated"]&&!$basic["is_rated"]){ |
|
| 1023 | + if ($basic["rated"] && !$basic["is_rated"]) { |
|
| 1024 | 1024 | $ratingCalculator=new RatingCalculator($cid); |
| 1025 | - if($ratingCalculator->calculate()){ |
|
| 1025 | + if ($ratingCalculator->calculate()) { |
|
| 1026 | 1026 | $ratingCalculator->storage(); |
| 1027 | 1027 | return true; |
| 1028 | - }else{ |
|
| 1028 | + } else { |
|
| 1029 | 1029 | return false; |
| 1030 | 1030 | } |
| 1031 | 1031 | } else { |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | public function arrangeContest($gid, $config, $problems) |
| 1037 | 1037 | { |
| 1038 | - DB::transaction(function () use ($gid, $config, $problems) { |
|
| 1038 | + DB::transaction(function() use ($gid, $config, $problems) { |
|
| 1039 | 1039 | $cid=DB::table($this->tableName)->insertGetId([ |
| 1040 | 1040 | "gid"=>$gid, |
| 1041 | 1041 | "name"=>$config["name"], |