@@ -78,7 +78,7 @@ |
||
78 | 78 | $mid = floor(($right + $left)/2); |
79 | 79 | if($this->getSeed($mid) < $rank){ |
80 | 80 | $right = $mid; |
81 | - }else{ |
|
81 | + } else{ |
|
82 | 82 | $left = $mid; |
83 | 83 | } |
84 | 84 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if(empty($last_send) || time() - $last_send >= 300){ |
91 | 91 | $request->session()->put('last_email_send',time()); |
92 | 92 | return ResponseModel::success(200,null,0); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | $cooldown = 300 - (time() - $last_send); |
95 | 95 | return ResponseModel::success(200,null,$cooldown); |
96 | 96 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | foreach ($input as $key => $value) { |
110 | 110 | if(strlen($value) != 0){ |
111 | 111 | $account_model->setExtra($user_id,$key,$value,0); |
112 | - }else{ |
|
112 | + } else{ |
|
113 | 113 | $account_model->setExtra($user_id,$key,null); |
114 | 114 | } |
115 | 115 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | foreach ($input as $key => $value) { |
130 | 130 | if(strlen($value) != 0){ |
131 | 131 | $account_model->setExtra($user_id,$key,$value,0); |
132 | - }else{ |
|
132 | + } else{ |
|
133 | 133 | $account_model->setExtra($user_id,$key,null); |
134 | 134 | } |
135 | 135 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | } |
157 | 157 | return null; |
158 | - }else{ |
|
158 | + } else{ |
|
159 | 159 | foreach ($ret as $value) { |
160 | 160 | if(empty($value['secret_level']) || $value['secret_level'] <= $secret_level){ |
161 | 161 | $key_name = $this->user_extra[$value['key']] ?? 'unknown'; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | unset($ret['id']); |
188 | 188 | if(!is_null($value)){ |
189 | 189 | $ret['value'] = $value; |
190 | - }else{ |
|
190 | + } else{ |
|
191 | 191 | DB::table('users_extra')->where('uid',$uid)->where('key',$key)->delete(); |
192 | 192 | return true; |
193 | 193 | } |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | $ret['secret_level'] = $secret_level; |
196 | 196 | } |
197 | 197 | return DB::table('users_extra')->where('uid',$uid)->where('key',$key)->update($ret); |
198 | - }else{ |
|
198 | + } else{ |
|
199 | 199 | if($value === null){ |
200 | 200 | return true; |
201 | 201 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $key = array_search($key,$this->user_extra); |
221 | 221 | if($key){ |
222 | 222 | return DB::table('users_extra')->where('key',$key)->where('value',$value)->first(); |
223 | - }else{ |
|
223 | + } else{ |
|
224 | 224 | return null; |
225 | 225 | } |
226 | 226 | } |
@@ -132,7 +132,9 @@ |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | $editor_left_width = $account->getExtra(Auth::user()->id, 'editor_left_width'); |
135 | - if(empty($editor_left_width)) $editor_left_width='40'; |
|
135 | + if(empty($editor_left_width)) { |
|
136 | + $editor_left_width='40'; |
|
137 | + } |
|
136 | 138 | |
137 | 139 | return is_null($prob_detail) ? redirect("/problem") : view('problem.editor', [ |
138 | 140 | 'page_title'=>$prob_detail["title"], |
@@ -78,7 +78,7 @@ |
||
78 | 78 | $mid = floor(($right + $left)/2); |
79 | 79 | if($this->getSeed($mid) < $rank){ |
80 | 80 | $right = $mid; |
81 | - }else{ |
|
81 | + } else{ |
|
82 | 82 | $left = $mid; |
83 | 83 | } |
84 | 84 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | try{ |
44 | 44 | $github_user = Socialite::driver('github')->user(); |
45 | - }catch(\Laravel\Socialite\Two\InvalidStateException $e){ |
|
45 | + } catch(\Laravel\Socialite\Two\InvalidStateException $e){ |
|
46 | 46 | return redirect('/'); |
47 | 47 | } |
48 | 48 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ], |
87 | 87 | ] |
88 | 88 | ]); |
89 | - }else{ |
|
89 | + } else{ |
|
90 | 90 | $ret = $accountModel->findExtra('github_id',$github_user->id); |
91 | 91 | if(!empty($ret)){ |
92 | 92 | Auth::loginUsingId($ret['uid']); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $accountModel->setExtra($user_id,'github_homepage',($github_user->user)['html_url']); |
97 | 97 | $accountModel->setExtra($user_id,'github_token',$github_user->token,101); |
98 | 98 | return redirect('/'); |
99 | - }else{ |
|
99 | + } else{ |
|
100 | 100 | return view('oauth.index',[ |
101 | 101 | 'page_title'=>"OAuth", |
102 | 102 | 'site_title'=>config("app.name"), |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ], |
144 | 144 | ] |
145 | 145 | ]); |
146 | - }else{ |
|
146 | + } else{ |
|
147 | 147 | return view('oauth.index',[ |
148 | 148 | 'page_title'=>"OAuth", |
149 | 149 | 'site_title'=>config("app.name"), |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ], |
184 | 184 | ] |
185 | 185 | ]); |
186 | - }else{ |
|
186 | + } else{ |
|
187 | 187 | return view('oauth.index',[ |
188 | 188 | 'page_title'=>"OAuth", |
189 | 189 | 'site_title'=>config("app.name"), |
@@ -24,7 +24,7 @@ |
||
24 | 24 | if($groupModel->judgeClearance($groupModel->gid($request->gcode), Auth::user()->id)>=2){ |
25 | 25 | return $next($request); |
26 | 26 | } |
27 | - }elseif(isset($request->cid)) { |
|
27 | + } elseif(isset($request->cid)) { |
|
28 | 28 | //contest privilege |
29 | 29 | $contestModel=new ContestModel(); |
30 | 30 | if($contestModel->judgeClearance($request->cid, Auth::user()->id)==3){ |
@@ -65,20 +65,26 @@ discard block |
||
65 | 65 | |
66 | 66 | public static function getColor($rankTitle) |
67 | 67 | { |
68 | - if(is_null($rankTitle)) return ""; |
|
68 | + if(is_null($rankTitle)) { |
|
69 | + return ""; |
|
70 | + } |
|
69 | 71 | return self::$casualRanking[$rankTitle]; |
70 | 72 | } |
71 | 73 | |
72 | 74 | public static function getProfessionalColor($rankTitle) |
73 | 75 | { |
74 | - if(is_null($rankTitle)) return self::$professionalRanking["None"]; |
|
76 | + if(is_null($rankTitle)) { |
|
77 | + return self::$professionalRanking["None"]; |
|
78 | + } |
|
75 | 79 | return self::$professionalRanking[$rankTitle]; |
76 | 80 | } |
77 | 81 | |
78 | 82 | public function list($num) |
79 | 83 | { |
80 | 84 | $rankList=Cache::tags(['rank'])->get('general'); |
81 | - if($rankList==null) $rankList=[]; |
|
85 | + if($rankList==null) { |
|
86 | + $rankList=[]; |
|
87 | + } |
|
82 | 88 | $rankList=array_slice($rankList,0,$num); |
83 | 89 | $userInfoRaw=DB::table("users")->select("id as uid","avatar","name")->get()->all(); |
84 | 90 | $userInfo=[]; |
@@ -168,7 +174,9 @@ discard block |
||
168 | 174 | public function getRankTitle($rankVal) |
169 | 175 | { |
170 | 176 | foreach($this->casualRankingPer as $title=>$c){ |
171 | - if($rankVal<=$c) return $title; |
|
177 | + if($rankVal<=$c) { |
|
178 | + return $title; |
|
179 | + } |
|
172 | 180 | } |
173 | 181 | return Arr::last($this->casualRankingPer); |
174 | 182 | } |
@@ -176,7 +184,9 @@ discard block |
||
176 | 184 | public static function getProfessionalTitle($rankVal) |
177 | 185 | { |
178 | 186 | foreach(self::$professionalRankingPer as $title=>$point) { |
179 | - if($rankVal >= $point) return $title; |
|
187 | + if($rankVal >= $point) { |
|
188 | + return $title; |
|
189 | + } |
|
180 | 190 | } |
181 | 191 | return Arr::last(self::$professionalRankingPer); |
182 | 192 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | } |
44 | 44 | $result = $model->search($key); |
45 | 45 | $all_result[$name] = $result; |
46 | - }else{ |
|
46 | + } else{ |
|
47 | 47 | $all_result[$name] = [ |
48 | 48 | 'code' => -1, |
49 | 49 | 'msg' => 'cannot find class named '.$model_class |