@@ -129,7 +129,7 @@ |
||
| 129 | 129 | 'removed_at' => $ban_time |
| 130 | 130 | ]); |
| 131 | 131 | return ; |
| 132 | - }else{ |
|
| 132 | + } else{ |
|
| 133 | 133 | sendMessage([ |
| 134 | 134 | 'sender' => 1, |
| 135 | 135 | 'receiver' => $abuse->user_id, |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | $p = ProblemModel::where('pcode','like',$prefix.'%')->orderBy('pcode','desc')->select('pcode')->first(); |
| 75 | 75 | if(empty($p)){ |
| 76 | 76 | $count = 1000; |
| 77 | - }else{ |
|
| 77 | + } else{ |
|
| 78 | 78 | $count = (int) str_replace($prefix,'',$p['pcode']); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -121,7 +121,9 @@ discard block |
||
| 121 | 121 | public function details($gcode) |
| 122 | 122 | { |
| 123 | 123 | $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first(); |
| 124 | - if(empty($basic_info)) return []; |
|
| 124 | + if(empty($basic_info)) { |
|
| 125 | + return []; |
|
| 126 | + } |
|
| 125 | 127 | $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]); |
| 126 | 128 | $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]); |
| 127 | 129 | $basic_info["create_time_foramt"]=date_format(date_create($basic_info["created_at"]), 'M jS, Y'); |
@@ -169,7 +171,9 @@ discard block |
||
| 169 | 171 | foreach ($user_list as &$u) { |
| 170 | 172 | $u["role_parsed"]=$this->role[$u["role"]]; |
| 171 | 173 | $u["role_color"]=$this->role_color[$u["role"]]; |
| 172 | - if(is_null($u["sub_group"])) $u["sub_group"]="None"; |
|
| 174 | + if(is_null($u["sub_group"])) { |
|
| 175 | + $u["sub_group"]="None"; |
|
| 176 | + } |
|
| 173 | 177 | } |
| 174 | 178 | return $user_list; |
| 175 | 179 | } |
@@ -238,7 +242,7 @@ discard block |
||
| 238 | 242 | ->where('gid',$gid) |
| 239 | 243 | ->distinct() |
| 240 | 244 | ->get()->all(); |
| 241 | - }else{ |
|
| 245 | + } else{ |
|
| 242 | 246 | $tags = DB::table('group_problem_tag') |
| 243 | 247 | ->select('tag') |
| 244 | 248 | ->where('gid', $gid) |
@@ -272,7 +276,7 @@ discard block |
||
| 272 | 276 | foreach($problems as $key => $value){ |
| 273 | 277 | if($contestModel->judgeClearance($value['cid'],$user_id) != 3){ |
| 274 | 278 | unset($problems[$key]); |
| 275 | - }else{ |
|
| 279 | + } else{ |
|
| 276 | 280 | $problems[$key]['tags'] = $this->problemTags($gid,$value['pid']); |
| 277 | 281 | } |
| 278 | 282 | } |
@@ -333,7 +337,9 @@ discard block |
||
| 333 | 337 | public function judgeEmailClearance($gid, $email) |
| 334 | 338 | { |
| 335 | 339 | $user=DB::table("users")->where(["email"=>$email])->first(); |
| 336 | - if(empty($user)) return -4; |
|
| 340 | + if(empty($user)) { |
|
| 341 | + return -4; |
|
| 342 | + } |
|
| 337 | 343 | $ret=DB::table("group_member")->where([ |
| 338 | 344 | "gid"=>$gid, |
| 339 | 345 | "uid"=>$user["id"], |
@@ -467,7 +473,7 @@ discard block |
||
| 467 | 473 | if(!empty($last_cr)){ |
| 468 | 474 | if($cr['solved'] == $last_cr['solved'] && $cr['penalty'] == $last_cr['penalty'] ){ |
| 469 | 475 | $rank = $last_rank; |
| 470 | - }else{ |
|
| 476 | + } else{ |
|
| 471 | 477 | $rank = $index; |
| 472 | 478 | $last_rank = $rank; |
| 473 | 479 | } |
@@ -619,7 +625,7 @@ discard block |
||
| 619 | 625 | 'cid' => $contest['cid'], |
| 620 | 626 | 'name' => $contest['name'] |
| 621 | 627 | ]; |
| 622 | - }else{ |
|
| 628 | + } else{ |
|
| 623 | 629 | $result[] = [ |
| 624 | 630 | 'ret' => 'judging', |
| 625 | 631 | 'cid' => $contest['cid'], |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - }elseif ($config['type'] == 2) { //to a leader that member agree to join the group |
|
| 38 | + } elseif ($config['type'] == 2) { //to a leader that member agree to join the group |
|
| 39 | 39 | $messages = Message::where([ |
| 40 | 40 | 'receiver' => $config['receiver'], |
| 41 | 41 | 'type' => $config['type'], |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | - }elseif ($config['type'] == 3) { //to a person that solution was passed |
|
| 55 | + } elseif ($config['type'] == 3) { //to a person that solution was passed |
|
| 56 | 56 | $message = Message::where([ |
| 57 | 57 | 'receiver' => $config['receiver'], |
| 58 | 58 | 'type' => $config['type'], |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $message->save(); |
| 66 | 66 | return true; |
| 67 | 67 | } |
| 68 | - }elseif ($config['type'] == 4) { //to a person that solution was blocked |
|
| 68 | + } elseif ($config['type'] == 4) { //to a person that solution was blocked |
|
| 69 | 69 | $message = Message::where([ |
| 70 | 70 | 'receiver' => $config['receiver'], |
| 71 | 71 | 'type' => $config['type'], |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if(isset($config['data']) && isset($config['type'])){ |
| 88 | 88 | $message->type = $config['type'] ?? null; |
| 89 | 89 | $message->data = json_encode($config['data']); |
| 90 | - }else{ |
|
| 90 | + } else{ |
|
| 91 | 91 | $message->content = $config['content']; |
| 92 | 92 | } |
| 93 | 93 | /* |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $del_count ++; |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | - }else{ |
|
| 204 | + } else{ |
|
| 205 | 205 | $message = static::find($messages); |
| 206 | 206 | if(!empty($message)){ |
| 207 | 207 | $message->delete(); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $content = substr($content,0,strlen($content)-2); |
| 224 | 224 | $content .= " want to join your group [{$data['group']['name']}]({$data['group']['url']})"; |
| 225 | 225 | return $content; |
| 226 | - }elseif($this->type == 2) { |
|
| 226 | + } elseif($this->type == 2) { |
|
| 227 | 227 | foreach($data['user'] as $user) { |
| 228 | 228 | $content .= "[{$user['name']}]({$user['url']}), "; |
| 229 | 229 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $content .= " have agreed to join your group [{$data['group']['name']}]({$data['group']['url']})"; |
| 232 | 232 | return $content; |
| 233 | 233 | } //todo |
| 234 | - }else{ |
|
| 234 | + } else{ |
|
| 235 | 235 | return $value; |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -9,7 +9,9 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public static function info($ltxsource, $type="png") |
| 11 | 11 | { |
| 12 | - if(!in_array($type,['png','svg'])) return []; |
|
| 12 | + if(!in_array($type,['png','svg'])) { |
|
| 13 | + return []; |
|
| 14 | + } |
|
| 13 | 15 | $url=route("latex.$type", ['ltxsource' => $ltxsource]); |
| 14 | 16 | $image = new Imagick(); |
| 15 | 17 | $image->readImageBlob(Storage::get('latex-svg/'.urlencode($ltxsource).'.svg')); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | 'removed_at' => $ban_time |
| 56 | 56 | ]); |
| 57 | 57 | $this->line("The user <fg=yellow>{$user->name}</> will be banned until <fg=yellow>{$ban_time}</>"); |
| 58 | - }catch(Throwable $e){ |
|
| 58 | + } catch(Throwable $e){ |
|
| 59 | 59 | $this->line("\n <bg=red;fg=white> Exception </> : <fg=yellow>Wrong Time.</>\n"); |
| 60 | 60 | return; |
| 61 | 61 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } |
| 29 | 29 | if(strtolower($request->method()) == 'get'){ |
| 30 | 30 | return response()->redirectToRoute('contest.detail',['cid' => $contest->cid]); |
| 31 | - }else{ |
|
| 31 | + } else{ |
|
| 32 | 32 | return header("HTTP/1.1 403 Forbidden"); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | 'contest' => $contest |
| 33 | 33 | ]); |
| 34 | 34 | return $next($request); |
| 35 | - }else{ |
|
| 35 | + } else{ |
|
| 36 | 36 | return response()->json([ |
| 37 | 37 | 'success' => false, |
| 38 | 38 | 'message' => 'Contest Not Found', |
@@ -44,13 +44,13 @@ discard block |
||
| 44 | 44 | ] |
| 45 | 45 | ]); |
| 46 | 46 | } |
| 47 | - }else if($contest->judgeClearance($request->cid,$user->id) >= $clearance) { |
|
| 47 | + } else if($contest->judgeClearance($request->cid,$user->id) >= $clearance) { |
|
| 48 | 48 | $contest = Contest::find($request->cid); |
| 49 | 49 | $request->merge([ |
| 50 | 50 | 'contest' => $contest |
| 51 | 51 | ]); |
| 52 | 52 | return $next($request); |
| 53 | - }else{ |
|
| 53 | + } else{ |
|
| 54 | 54 | return response()->json([ |
| 55 | 55 | 'success' => false, |
| 56 | 56 | 'message' => 'Permission Denied', |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | if($contest->status_visibility == 1){ |
| 73 | 73 | if(auth()->check()){ |
| 74 | 74 | $builder = $builder->where('uid', auth()->user()->id); |
| 75 | - }else{ |
|
| 75 | + } else{ |
|
| 76 | 76 | $builder = $builder->where('uid', -1); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | if($contest->rule == 2){ |
| 109 | 109 | if($submission->verdict == 'Accepted') { |
| 110 | 110 | $score_parse = 100; |
| 111 | - }else if($submission->verdict == 'Partially Accepted') { |
|
| 111 | + } else if($submission->verdict == 'Partially Accepted') { |
|
| 112 | 112 | $score_parse = round($submission->score / $submission->problem->tot_score * $contest->problems()->where('pid', $submission->problem->pid)->first()->points, 1); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | 'enable' => true, |
| 150 | 150 | 'frozen_length' => $contest->forze_length |
| 151 | 151 | ]; |
| 152 | - }else{ |
|
| 152 | + } else{ |
|
| 153 | 153 | $frozen = [ |
| 154 | 154 | 'enable' => false, |
| 155 | 155 | 'frozen_length' => 0 |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $header['problemsSubHeader'][] = $problem->submissions()->where('submission_date', '<=', $contest->frozen_time)->where('verdict', 'Accepted')->count() |
| 174 | 174 | . ' / ' . $problem->submissions()->where('submission_date', '<=', $contest->frozen_time)->count(); |
| 175 | 175 | } |
| 176 | - }else if($contest->rule == 2){ |
|
| 176 | + } else if($contest->rule == 2){ |
|
| 177 | 177 | $header = [ |
| 178 | 178 | 'rank' => 'Rank', |
| 179 | 179 | 'normal' => [ |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | ]; |
| 222 | 222 | $body[] = $userBody; |
| 223 | 223 | } |
| 224 | - }else if($contest->rule == 2){ |
|
| 224 | + } else if($contest->rule == 2){ |
|
| 225 | 225 | $body = []; |
| 226 | 226 | $lastRank = null; |
| 227 | 227 | $rank = 1; |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | ]; |
| 436 | 436 | try{ |
| 437 | 437 | dispatch(new ProcessSubmission($all_data))->onQueue($problem->oj); |
| 438 | - }catch(\Throwable $e){ |
|
| 438 | + } catch(\Throwable $e){ |
|
| 439 | 439 | return response()->json([ |
| 440 | 440 | 'success' => false, |
| 441 | 441 | 'message' => $e->getMessage(), |