@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | "oid"=>$oid, |
60 | 60 | "available"=>1, |
61 | 61 | "status"=>0 |
62 | - ])->orderBy('usage','desc')->get()->first(); |
|
62 | + ])->orderBy('usage', 'desc')->get()->first(); |
|
63 | 63 | |
64 | 64 | return $serverList; |
65 | 65 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $serverList=DB::table("judge_server")->where(["oid"=>$oid])->get()->all(); |
70 | 70 | foreach ($serverList as &$server) { |
71 | - $server["status_parsed"]=is_null($server["status"])?self::$status["-1"]:self::$status[$server["status"]]; |
|
71 | + $server["status_parsed"]=is_null($server["status"]) ?self::$status["-1"] : self::$status[$server["status"]]; |
|
72 | 72 | } |
73 | 73 | return $serverList; |
74 | 74 | } |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -if (! function_exists('babel_path')) { |
|
66 | +if (!function_exists('babel_path')) { |
|
67 | 67 | /** |
68 | 68 | * Get the path to the application folder. |
69 | 69 | * |
70 | 70 | * @param string $path |
71 | 71 | * @return string |
72 | 72 | */ |
73 | - function babel_path($path = '') |
|
73 | + function babel_path($path='') |
|
74 | 74 | { |
75 | 75 | return app('path').DIRECTORY_SEPARATOR.'Babel'.($path ? DIRECTORY_SEPARATOR.$path : $path); |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | -if (! function_exists('glob_recursive')) { |
|
79 | +if (!function_exists('glob_recursive')) { |
|
80 | 80 | /** |
81 | 81 | * Find pathnames matching a pattern recursively. |
82 | 82 | * |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @param int $flags Valid flags: GLOB_MARK |
85 | 85 | * @return array|false an array containing the matched files/directories, an empty array if no file matched or false on error. |
86 | 86 | */ |
87 | - function glob_recursive($pattern, $flags = 0) |
|
87 | + function glob_recursive($pattern, $flags=0) |
|
88 | 88 | { |
89 | - $files = glob($pattern, $flags); |
|
90 | - foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { |
|
91 | - $files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags)); |
|
89 | + $files=glob($pattern, $flags); |
|
90 | + foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { |
|
91 | + $files=array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags)); |
|
92 | 92 | } |
93 | 93 | return $files; |
94 | 94 | } |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | function delFile($dirName) |
123 | 123 | { |
124 | 124 | if (file_exists($dirName) && $handle=opendir($dirName)) { |
125 | - while (false!==($item = readdir($handle))) { |
|
126 | - if ($item!= "." && $item != "..") { |
|
125 | + while (false!==($item=readdir($handle))) { |
|
126 | + if ($item!="." && $item!="..") { |
|
127 | 127 | if (file_exists($dirName.'/'.$item) && is_dir($dirName.'/'.$item)) { |
128 | 128 | delFile($dirName.'/'.$item); |
129 | 129 | } else { |
@@ -141,6 +141,6 @@ discard block |
||
141 | 141 | if (!function_exists('convertMarkdownToHtml')) { |
142 | 142 | function convertMarkdownToHtml($md) |
143 | 143 | { |
144 | - return is_string($md)?Markdown::convertToHtml($md):''; |
|
144 | + return is_string($md) ?Markdown::convertToHtml($md) : ''; |
|
145 | 145 | } |
146 | 146 | } |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | foreach ($trending_groups as &$t) { |
59 | 59 | $t["members"]=$this->countGroupMembers($t["gid"]); |
60 | 60 | } |
61 | - usort($trending_groups, function ($a, $b) { |
|
61 | + usort($trending_groups, function($a, $b) { |
|
62 | 62 | return $b["members"]<=>$a["members"]; |
63 | 63 | }); |
64 | - Cache::tags(['group'])->put('trending', array_slice($trending_groups,0,12), 3600*24); |
|
64 | + Cache::tags(['group'])->put('trending', array_slice($trending_groups, 0, 12), 3600 * 24); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function userGroups($uid) |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | |
102 | 102 | public function changeGroupName($gid, $GroupName) |
103 | 103 | { |
104 | - return DB::table("group")->where('gid',$gid)->update([ |
|
104 | + return DB::table("group")->where('gid', $gid)->update([ |
|
105 | 105 | "name"=>$GroupName |
106 | 106 | ]); |
107 | 107 | } |
108 | 108 | |
109 | - public function changeJoinPolicy($gid, $JoinPolicy){ |
|
110 | - return DB::table("group")->where('gid',$gid)->update([ |
|
109 | + public function changeJoinPolicy($gid, $JoinPolicy) { |
|
110 | + return DB::table("group")->where('gid', $gid)->update([ |
|
111 | 111 | "join_policy"=>$JoinPolicy |
112 | 112 | ]); |
113 | 113 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function details($gcode) |
116 | 116 | { |
117 | 117 | $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first(); |
118 | - if(empty($basic_info)) return []; |
|
118 | + if (empty($basic_info)) return []; |
|
119 | 119 | $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]); |
120 | 120 | $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]); |
121 | 121 | $basic_info["create_time_foramt"]=date_format(date_create($basic_info["create_time"]), 'M jS, Y'); |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | public function userProfile($uid, $gid) |
133 | 133 | { |
134 | 134 | $info=DB::table("group_member") |
135 | - ->join('users','users.id','=','group_member.uid') |
|
135 | + ->join('users', 'users.id', '=', 'group_member.uid') |
|
136 | 136 | ->where(["gid"=>$gid, "uid"=>$uid]) |
137 | 137 | ->where("role", ">", 0) |
138 | - ->select('avatar','describes','email','gid','uid','name','nick_name','professional_rate','role','sub_group') |
|
138 | + ->select('avatar', 'describes', 'email', 'gid', 'uid', 'name', 'nick_name', 'professional_rate', 'role', 'sub_group') |
|
139 | 139 | ->first(); |
140 | 140 | if (!empty($info)) { |
141 | 141 | $info["role_parsed"]=$this->role[$info["role"]]; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | foreach ($user_list as &$u) { |
164 | 164 | $u["role_parsed"]=$this->role[$u["role"]]; |
165 | 165 | $u["role_color"]=$this->role_color[$u["role"]]; |
166 | - if(is_null($u["sub_group"])) $u["sub_group"]="None"; |
|
166 | + if (is_null($u["sub_group"])) $u["sub_group"]="None"; |
|
167 | 167 | } |
168 | 168 | return $user_list; |
169 | 169 | } |
@@ -224,16 +224,16 @@ discard block |
||
224 | 224 | ])->where("role", ">", 0)->count(); |
225 | 225 | } |
226 | 226 | |
227 | - public function problemTags($gid,$pid = -1) |
|
227 | + public function problemTags($gid, $pid=-1) |
|
228 | 228 | { |
229 | - if($pid == -1){ |
|
230 | - $tags = DB::table('group_problem_tag') |
|
229 | + if ($pid==-1) { |
|
230 | + $tags=DB::table('group_problem_tag') |
|
231 | 231 | ->select('tag') |
232 | - ->where('gid',$gid) |
|
232 | + ->where('gid', $gid) |
|
233 | 233 | ->distinct() |
234 | 234 | ->get()->all(); |
235 | - }else{ |
|
236 | - $tags = DB::table('group_problem_tag') |
|
235 | + } else { |
|
236 | + $tags=DB::table('group_problem_tag') |
|
237 | 237 | ->select('tag') |
238 | 238 | ->where('gid', $gid) |
239 | 239 | ->where('pid', $pid) |
@@ -241,10 +241,10 @@ discard block |
||
241 | 241 | ->get()->all(); |
242 | 242 | } |
243 | 243 | |
244 | - $tags_arr = []; |
|
245 | - if(!empty($tags)){ |
|
244 | + $tags_arr=[]; |
|
245 | + if (!empty($tags)) { |
|
246 | 246 | foreach ($tags as $value) { |
247 | - array_push($tags_arr,$value['tag']); |
|
247 | + array_push($tags_arr, $value['tag']); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | return $tags_arr; |
@@ -252,28 +252,28 @@ discard block |
||
252 | 252 | |
253 | 253 | public function problems($gid) |
254 | 254 | { |
255 | - $contestModel = new ContestModel(); |
|
256 | - $problems = DB::table('contest_problem') |
|
257 | - ->join('contest','contest_problem.cid', '=', 'contest.cid') |
|
258 | - ->join('problem','contest_problem.pid', '=', 'problem.pid' ) |
|
255 | + $contestModel=new ContestModel(); |
|
256 | + $problems=DB::table('contest_problem') |
|
257 | + ->join('contest', 'contest_problem.cid', '=', 'contest.cid') |
|
258 | + ->join('problem', 'contest_problem.pid', '=', 'problem.pid') |
|
259 | 259 | ->select('contest_problem.cid as cid', 'problem.pid as pid', 'pcode', 'title') |
260 | - ->where('contest.gid',$gid) |
|
261 | - ->where('contest.practice',1) |
|
262 | - ->orderBy('contest.create_time','desc') |
|
260 | + ->where('contest.gid', $gid) |
|
261 | + ->where('contest.practice', 1) |
|
262 | + ->orderBy('contest.create_time', 'desc') |
|
263 | 263 | ->distinct() |
264 | 264 | ->get()->all(); |
265 | - $user_id = Auth::user()->id; |
|
266 | - foreach($problems as $key => $value){ |
|
267 | - if($contestModel->judgeClearance($value['cid'],$user_id) != 3){ |
|
265 | + $user_id=Auth::user()->id; |
|
266 | + foreach ($problems as $key => $value) { |
|
267 | + if ($contestModel->judgeClearance($value['cid'], $user_id)!=3) { |
|
268 | 268 | unset($problems[$key]); |
269 | - }else{ |
|
270 | - $problems[$key]['tags'] = $this->problemTags($gid,$value['pid']); |
|
269 | + } else { |
|
270 | + $problems[$key]['tags']=$this->problemTags($gid, $value['pid']); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | return $problems; |
274 | 274 | } |
275 | 275 | |
276 | - public function problemAddTag($gid,$pid,$tag) |
|
276 | + public function problemAddTag($gid, $pid, $tag) |
|
277 | 277 | { |
278 | 278 | return DB::table("group_problem_tag")->insert([ |
279 | 279 | "gid"=>$gid, |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | ]); |
283 | 283 | } |
284 | 284 | |
285 | - public function problemRemoveTag($gid,$pid,$tag) |
|
285 | + public function problemRemoveTag($gid, $pid, $tag) |
|
286 | 286 | { |
287 | 287 | return DB::table("group_problem_tag")->where([ |
288 | 288 | "gid"=>$gid, |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | public function judgeEmailClearance($gid, $email) |
328 | 328 | { |
329 | 329 | $user=DB::table("users")->where(["email"=>$email])->first(); |
330 | - if(empty($user)) return -4; |
|
330 | + if (empty($user)) return -4; |
|
331 | 331 | $ret=DB::table("group_member")->where([ |
332 | 332 | "gid"=>$gid, |
333 | 333 | "uid"=>$user["id"], |
@@ -418,20 +418,20 @@ discard block |
||
418 | 418 | |
419 | 419 | public function groupMemberPracticeContestStat($gid) |
420 | 420 | { |
421 | - $contestModel = new ContestModel(); |
|
421 | + $contestModel=new ContestModel(); |
|
422 | 422 | |
423 | - $allPracticeContest = DB::table('contest') |
|
423 | + $allPracticeContest=DB::table('contest') |
|
424 | 424 | ->where([ |
425 | 425 | 'gid' => $gid, |
426 | 426 | 'practice' => 1, |
427 | 427 | ]) |
428 | - ->select('cid','name') |
|
428 | + ->select('cid', 'name') |
|
429 | 429 | ->get()->all(); |
430 | - $user_list = $this->userList($gid); |
|
430 | + $user_list=$this->userList($gid); |
|
431 | 431 | |
432 | - $memberData = []; |
|
432 | + $memberData=[]; |
|
433 | 433 | foreach ($user_list as $u) { |
434 | - $memberData[$u['uid']] = [ |
|
434 | + $memberData[$u['uid']]=[ |
|
435 | 435 | 'name' => $u['name'], |
436 | 436 | 'nick_name' => $u['nick_name'], |
437 | 437 | 'elo' => $u['ranking'], |
@@ -442,61 +442,61 @@ discard block |
||
442 | 442 | ]; |
443 | 443 | } |
444 | 444 | foreach ($allPracticeContest as $c) { |
445 | - $contestRankRaw = $contestModel->contestRank($c['cid']); |
|
446 | - foreach($contestRankRaw as $key => $contestRank){ |
|
447 | - if(isset($contestRank['remote']) && $contestRank['remote']){ |
|
445 | + $contestRankRaw=$contestModel->contestRank($c['cid']); |
|
446 | + foreach ($contestRankRaw as $key => $contestRank) { |
|
447 | + if (isset($contestRank['remote']) && $contestRank['remote']) { |
|
448 | 448 | unset($contestRankRaw[$key]); |
449 | 449 | } |
450 | 450 | } |
451 | - $contestRank = array_values($contestRankRaw); |
|
452 | - $problemsCount = DB::table('contest_problem') |
|
453 | - ->where('cid',$c['cid']) |
|
451 | + $contestRank=array_values($contestRankRaw); |
|
452 | + $problemsCount=DB::table('contest_problem') |
|
453 | + ->where('cid', $c['cid']) |
|
454 | 454 | ->count(); |
455 | - $index = 1; |
|
456 | - $rank = 1; |
|
457 | - $last_cr = []; |
|
458 | - $last_rank = 1; |
|
455 | + $index=1; |
|
456 | + $rank=1; |
|
457 | + $last_cr=[]; |
|
458 | + $last_rank=1; |
|
459 | 459 | foreach ($contestRank as $cr) { |
460 | - $last_rank = $index; |
|
461 | - if(!empty($last_cr)){ |
|
462 | - if($cr['solved'] == $last_cr['solved'] && $cr['penalty'] == $last_cr['penalty'] ){ |
|
463 | - $rank = $last_rank; |
|
464 | - }else{ |
|
465 | - $rank = $index; |
|
466 | - $last_rank = $rank; |
|
460 | + $last_rank=$index; |
|
461 | + if (!empty($last_cr)) { |
|
462 | + if ($cr['solved']==$last_cr['solved'] && $cr['penalty']==$last_cr['penalty']) { |
|
463 | + $rank=$last_rank; |
|
464 | + } else { |
|
465 | + $rank=$index; |
|
466 | + $last_rank=$rank; |
|
467 | 467 | } |
468 | 468 | } |
469 | - if(in_array($cr['uid'],array_keys($memberData))) { |
|
470 | - $memberData[$cr['uid']]['solved_all'] += $cr['solved']; |
|
471 | - $memberData[$cr['uid']]['problem_all'] += $problemsCount; |
|
472 | - $memberData[$cr['uid']]['penalty'] += $cr['penalty']; |
|
473 | - $memberData[$cr['uid']]['contest_detial'][$c['cid']] = [ |
|
469 | + if (in_array($cr['uid'], array_keys($memberData))) { |
|
470 | + $memberData[$cr['uid']]['solved_all']+=$cr['solved']; |
|
471 | + $memberData[$cr['uid']]['problem_all']+=$problemsCount; |
|
472 | + $memberData[$cr['uid']]['penalty']+=$cr['penalty']; |
|
473 | + $memberData[$cr['uid']]['contest_detial'][$c['cid']]=[ |
|
474 | 474 | 'rank' => $rank, |
475 | 475 | 'solved' => $cr['solved'], |
476 | 476 | 'problems' => $problemsCount, |
477 | 477 | 'penalty' => $cr['penalty'] |
478 | 478 | ]; |
479 | 479 | } |
480 | - $last_cr = $cr; |
|
480 | + $last_cr=$cr; |
|
481 | 481 | $index++; |
482 | 482 | } |
483 | 483 | } |
484 | - $new_memberData = []; |
|
484 | + $new_memberData=[]; |
|
485 | 485 | foreach ($memberData as $uid => $data) { |
486 | - $contest_count = 0; |
|
487 | - $rank_sum = 0; |
|
486 | + $contest_count=0; |
|
487 | + $rank_sum=0; |
|
488 | 488 | foreach ($data['contest_detial'] as $cid => $c) { |
489 | - $rank_sum += $c['rank']; |
|
490 | - $contest_count += 1; |
|
489 | + $rank_sum+=$c['rank']; |
|
490 | + $contest_count+=1; |
|
491 | 491 | } |
492 | - $temp = $data; |
|
493 | - $temp['uid'] = $uid; |
|
494 | - if($contest_count != 0){ |
|
495 | - $temp['rank_ave'] = $rank_sum/$contest_count; |
|
492 | + $temp=$data; |
|
493 | + $temp['uid']=$uid; |
|
494 | + if ($contest_count!=0) { |
|
495 | + $temp['rank_ave']=$rank_sum / $contest_count; |
|
496 | 496 | } |
497 | - array_push($new_memberData,$temp); |
|
497 | + array_push($new_memberData, $temp); |
|
498 | 498 | } |
499 | - $ret = [ |
|
499 | + $ret=[ |
|
500 | 500 | 'contest_list' => $allPracticeContest, |
501 | 501 | 'member_data' => $new_memberData |
502 | 502 | ]; |
@@ -505,58 +505,58 @@ discard block |
||
505 | 505 | |
506 | 506 | public function groupMemberPracticeTagStat($gid) |
507 | 507 | { |
508 | - $tags = $this->problemTags($gid); |
|
509 | - $tag_problems = []; |
|
508 | + $tags=$this->problemTags($gid); |
|
509 | + $tag_problems=[]; |
|
510 | 510 | |
511 | - $user_list = $this->userList($gid); |
|
511 | + $user_list=$this->userList($gid); |
|
512 | 512 | foreach ($tags as $tag) { |
513 | - $tag_problems[$tag] = DB::table('problem') |
|
514 | - ->join('group_problem_tag','problem.pid','=','group_problem_tag.pid') |
|
513 | + $tag_problems[$tag]=DB::table('problem') |
|
514 | + ->join('group_problem_tag', 'problem.pid', '=', 'group_problem_tag.pid') |
|
515 | 515 | ->where([ |
516 | 516 | 'group_problem_tag.gid' => $gid, |
517 | 517 | 'tag' => $tag |
518 | 518 | ]) |
519 | - ->select('group_problem_tag.pid as pid','pcode','title') |
|
519 | + ->select('group_problem_tag.pid as pid', 'pcode', 'title') |
|
520 | 520 | ->get()->all(); |
521 | 521 | } |
522 | - $all_problems = []; |
|
522 | + $all_problems=[]; |
|
523 | 523 | foreach ($tag_problems as &$tag_problem_set) { |
524 | 524 | foreach ($tag_problem_set as $problem) { |
525 | - $all_problems[$problem['pid']] = $problem; |
|
525 | + $all_problems[$problem['pid']]=$problem; |
|
526 | 526 | } |
527 | - $tag_problem_set = array_column($tag_problem_set,'pid'); |
|
527 | + $tag_problem_set=array_column($tag_problem_set, 'pid'); |
|
528 | 528 | } |
529 | - $submission_data = DB::table('submission') |
|
530 | - ->whereIn('pid',array_keys($all_problems)) |
|
531 | - ->whereIn('uid',array_column($user_list,'uid')) |
|
532 | - ->where('verdict','Accepted') |
|
533 | - ->select('pid','uid') |
|
529 | + $submission_data=DB::table('submission') |
|
530 | + ->whereIn('pid', array_keys($all_problems)) |
|
531 | + ->whereIn('uid', array_column($user_list, 'uid')) |
|
532 | + ->where('verdict', 'Accepted') |
|
533 | + ->select('pid', 'uid') |
|
534 | 534 | ->get()->all(); |
535 | 535 | |
536 | - $memberData = []; |
|
536 | + $memberData=[]; |
|
537 | 537 | foreach ($user_list as $member) { |
538 | - $completion = []; |
|
539 | - foreach($tag_problems as $tag => $problems) { |
|
540 | - $completion[$tag] = []; |
|
538 | + $completion=[]; |
|
539 | + foreach ($tag_problems as $tag => $problems) { |
|
540 | + $completion[$tag]=[]; |
|
541 | 541 | foreach ($problems as $problem) { |
542 | - $is_accepted = 0; |
|
542 | + $is_accepted=0; |
|
543 | 543 | foreach ($submission_data as $sd) { |
544 | - if($sd['pid'] == $problem && $sd['uid'] == $member['uid']){ |
|
545 | - $is_accepted = 1; |
|
544 | + if ($sd['pid']==$problem && $sd['uid']==$member['uid']) { |
|
545 | + $is_accepted=1; |
|
546 | 546 | break; |
547 | 547 | } |
548 | 548 | } |
549 | - $completion[$tag][$problem] = $is_accepted; |
|
549 | + $completion[$tag][$problem]=$is_accepted; |
|
550 | 550 | } |
551 | 551 | } |
552 | - array_push($memberData,[ |
|
552 | + array_push($memberData, [ |
|
553 | 553 | 'uid' => $member['uid'], |
554 | 554 | 'name' => $member['name'], |
555 | 555 | 'nick_name' => $member['nick_name'], |
556 | 556 | 'completion' => $completion, |
557 | 557 | ]); |
558 | 558 | } |
559 | - $ret = [ |
|
559 | + $ret=[ |
|
560 | 560 | 'all_problems' => $all_problems, |
561 | 561 | 'tag_problems' => $tag_problems, |
562 | 562 | 'member_data' => $memberData |
@@ -566,10 +566,10 @@ discard block |
||
566 | 566 | |
567 | 567 | public function refreshAllElo() |
568 | 568 | { |
569 | - $result = []; |
|
570 | - $gids = DB::table('group')->select('gid','name')->get()->all(); |
|
569 | + $result=[]; |
|
570 | + $gids=DB::table('group')->select('gid', 'name')->get()->all(); |
|
571 | 571 | foreach ($gids as $gid) { |
572 | - $result[$gid['gid']] = [ |
|
572 | + $result[$gid['gid']]=[ |
|
573 | 573 | 'name' => $gid['name'], |
574 | 574 | 'result' => $this->refreshElo($gid['gid']), |
575 | 575 | ]; |
@@ -580,41 +580,41 @@ discard block |
||
580 | 580 | public function refreshElo($gid) |
581 | 581 | { |
582 | 582 | DB::table('group_rated_change_log') |
583 | - ->where('gid',$gid) |
|
583 | + ->where('gid', $gid) |
|
584 | 584 | ->delete(); |
585 | 585 | DB::table('group_member') |
586 | - ->where('gid',$gid) |
|
586 | + ->where('gid', $gid) |
|
587 | 587 | ->update([ |
588 | 588 | 'ranking' => 1500 |
589 | 589 | ]); |
590 | - $contests = DB::table('contest') |
|
590 | + $contests=DB::table('contest') |
|
591 | 591 | ->where([ |
592 | 592 | 'gid' => $gid, |
593 | 593 | 'practice' => 1 |
594 | 594 | ]) |
595 | - ->where('end_time','<',date("Y-m-d H:i:s")) |
|
596 | - ->select('cid','name') |
|
595 | + ->where('end_time', '<', date("Y-m-d H:i:s")) |
|
596 | + ->select('cid', 'name') |
|
597 | 597 | ->orderBy('end_time') |
598 | 598 | ->get()->all(); |
599 | 599 | |
600 | - if(empty($contests)) { |
|
600 | + if (empty($contests)) { |
|
601 | 601 | return []; |
602 | 602 | } |
603 | - $result = []; |
|
604 | - $contestModel = new \App\Models\ContestModel(); |
|
603 | + $result=[]; |
|
604 | + $contestModel=new \App\Models\ContestModel(); |
|
605 | 605 | foreach ($contests as $contest) { |
606 | - $judge_status = $contestModel->judgeOver($contest['cid']); |
|
607 | - if($judge_status['result'] == true){ |
|
608 | - $calc = new GroupRatingCalculator($contest['cid']); |
|
606 | + $judge_status=$contestModel->judgeOver($contest['cid']); |
|
607 | + if ($judge_status['result']==true) { |
|
608 | + $calc=new GroupRatingCalculator($contest['cid']); |
|
609 | 609 | $calc->calculate(); |
610 | 610 | $calc->storage(); |
611 | - $result[] = [ |
|
611 | + $result[]=[ |
|
612 | 612 | 'ret' => 'success', |
613 | 613 | 'cid' => $contest['cid'], |
614 | 614 | 'name' => $contest['name'] |
615 | 615 | ]; |
616 | - }else{ |
|
617 | - $result[] = [ |
|
616 | + } else { |
|
617 | + $result[]=[ |
|
618 | 618 | 'ret' => 'judging', |
619 | 619 | 'cid' => $contest['cid'], |
620 | 620 | 'name' => $contest['name'], |
@@ -626,23 +626,23 @@ discard block |
||
626 | 626 | return $result; |
627 | 627 | } |
628 | 628 | |
629 | - public function getEloChangeLog($gid,$uid) |
|
629 | + public function getEloChangeLog($gid, $uid) |
|
630 | 630 | { |
631 | - $ret = DB::table('group_rated_change_log') |
|
632 | - ->join('contest','group_rated_change_log.cid','=','contest.cid') |
|
631 | + $ret=DB::table('group_rated_change_log') |
|
632 | + ->join('contest', 'group_rated_change_log.cid', '=', 'contest.cid') |
|
633 | 633 | ->where([ |
634 | 634 | 'group_rated_change_log.gid' => $gid, |
635 | 635 | 'group_rated_change_log.uid' => $uid |
636 | 636 | ])->select('group_rated_change_log.cid as cid', 'contest.name as name', 'ranking', 'end_time') |
637 | 637 | ->orderBy('contest.end_time') |
638 | 638 | ->get()->all(); |
639 | - $begin = [ |
|
639 | + $begin=[ |
|
640 | 640 | 'cid' => -1, |
641 | 641 | 'name' => '', |
642 | 642 | 'ranking' => '1500', |
643 | - 'end_time' => date("Y-m-d H:i:s",(strtotime($ret[0]['end_time'] ?? time()) - 3600*24)), |
|
643 | + 'end_time' => date("Y-m-d H:i:s", (strtotime($ret[0]['end_time'] ?? time())-3600 * 24)), |
|
644 | 644 | ]; |
645 | - $ret = array_prepend($ret,$begin); |
|
645 | + $ret=array_prepend($ret, $begin); |
|
646 | 646 | return $ret; |
647 | 647 | } |
648 | 648 | } |
@@ -115,7 +115,9 @@ discard block |
||
115 | 115 | public function details($gcode) |
116 | 116 | { |
117 | 117 | $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first(); |
118 | - if(empty($basic_info)) return []; |
|
118 | + if(empty($basic_info)) { |
|
119 | + return []; |
|
120 | + } |
|
119 | 121 | $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]); |
120 | 122 | $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]); |
121 | 123 | $basic_info["create_time_foramt"]=date_format(date_create($basic_info["create_time"]), 'M jS, Y'); |
@@ -163,7 +165,9 @@ discard block |
||
163 | 165 | foreach ($user_list as &$u) { |
164 | 166 | $u["role_parsed"]=$this->role[$u["role"]]; |
165 | 167 | $u["role_color"]=$this->role_color[$u["role"]]; |
166 | - if(is_null($u["sub_group"])) $u["sub_group"]="None"; |
|
168 | + if(is_null($u["sub_group"])) { |
|
169 | + $u["sub_group"]="None"; |
|
170 | + } |
|
167 | 171 | } |
168 | 172 | return $user_list; |
169 | 173 | } |
@@ -232,7 +236,7 @@ discard block |
||
232 | 236 | ->where('gid',$gid) |
233 | 237 | ->distinct() |
234 | 238 | ->get()->all(); |
235 | - }else{ |
|
239 | + } else{ |
|
236 | 240 | $tags = DB::table('group_problem_tag') |
237 | 241 | ->select('tag') |
238 | 242 | ->where('gid', $gid) |
@@ -266,7 +270,7 @@ discard block |
||
266 | 270 | foreach($problems as $key => $value){ |
267 | 271 | if($contestModel->judgeClearance($value['cid'],$user_id) != 3){ |
268 | 272 | unset($problems[$key]); |
269 | - }else{ |
|
273 | + } else{ |
|
270 | 274 | $problems[$key]['tags'] = $this->problemTags($gid,$value['pid']); |
271 | 275 | } |
272 | 276 | } |
@@ -327,7 +331,9 @@ discard block |
||
327 | 331 | public function judgeEmailClearance($gid, $email) |
328 | 332 | { |
329 | 333 | $user=DB::table("users")->where(["email"=>$email])->first(); |
330 | - if(empty($user)) return -4; |
|
334 | + if(empty($user)) { |
|
335 | + return -4; |
|
336 | + } |
|
331 | 337 | $ret=DB::table("group_member")->where([ |
332 | 338 | "gid"=>$gid, |
333 | 339 | "uid"=>$user["id"], |
@@ -461,7 +467,7 @@ discard block |
||
461 | 467 | if(!empty($last_cr)){ |
462 | 468 | if($cr['solved'] == $last_cr['solved'] && $cr['penalty'] == $last_cr['penalty'] ){ |
463 | 469 | $rank = $last_rank; |
464 | - }else{ |
|
470 | + } else{ |
|
465 | 471 | $rank = $index; |
466 | 472 | $last_rank = $rank; |
467 | 473 | } |
@@ -613,7 +619,7 @@ discard block |
||
613 | 619 | 'cid' => $contest['cid'], |
614 | 620 | 'name' => $contest['name'] |
615 | 621 | ]; |
616 | - }else{ |
|
622 | + } else{ |
|
617 | 623 | $result[] = [ |
618 | 624 | 'ret' => 'judging', |
619 | 625 | 'cid' => $contest['cid'], |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $groupModel=new GroupModel(); |
44 | 44 | $contestModel=new ContestModel(); |
45 | 45 | $basic_info=$groupModel->details($gcode); |
46 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
46 | + if (empty($basic_info)) return Redirect::route('group.index'); |
|
47 | 47 | $my_profile=$groupModel->userProfile(Auth::user()->id, $basic_info["gid"]); |
48 | 48 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
49 | 49 | $member_list=$groupModel->userList($basic_info["gid"]); |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return Response |
88 | 88 | */ |
89 | - public function analysis($gcode){ |
|
90 | - $groupModel = new GroupModel(); |
|
89 | + public function analysis($gcode) { |
|
90 | + $groupModel=new GroupModel(); |
|
91 | 91 | $basic_info=$groupModel->details($gcode); |
92 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
92 | + if (empty($basic_info)) return Redirect::route('group.index'); |
|
93 | 93 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
94 | - if($clearance < 1) return Redirect::route('group.detail',['gcode' => $gcode]); |
|
95 | - $group_info = $groupModel->details($gcode); |
|
94 | + if ($clearance<1) return Redirect::route('group.detail', ['gcode' => $gcode]); |
|
95 | + $group_info=$groupModel->details($gcode); |
|
96 | 96 | return view('group.settings.analysis', [ |
97 | 97 | 'page_title'=>"Group Analysis", |
98 | 98 | 'site_title'=>"NOJ", |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | ]); |
103 | 103 | } |
104 | 104 | |
105 | - public function analysisDownload($gcode,Request $request){ |
|
106 | - $all_data = $request->all(); |
|
107 | - $groupModel = new GroupModel(); |
|
108 | - $group_info = $groupModel->details($gcode); |
|
109 | - $mode = $all_data['mode'] ?? 'contest'; |
|
110 | - if($mode == 'contest'){ |
|
111 | - $data = $groupModel->groupMemberPracticeContestStat($group_info['gid']); |
|
105 | + public function analysisDownload($gcode, Request $request) { |
|
106 | + $all_data=$request->all(); |
|
107 | + $groupModel=new GroupModel(); |
|
108 | + $group_info=$groupModel->details($gcode); |
|
109 | + $mode=$all_data['mode'] ?? 'contest'; |
|
110 | + if ($mode=='contest') { |
|
111 | + $data=$groupModel->groupMemberPracticeContestStat($group_info['gid']); |
|
112 | 112 | return Excel::download( |
113 | 113 | new GroupAnalysisExport( |
114 | 114 | [ |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | 'percent' => $all_data['percent'] ?? false, |
122 | 122 | ] |
123 | 123 | ), |
124 | - $gcode . '_Group_Contest_Analysis.xlsx' |
|
124 | + $gcode.'_Group_Contest_Analysis.xlsx' |
|
125 | 125 | ); |
126 | - }else{ |
|
127 | - $data = $groupModel->groupMemberPracticeTagStat($group_info['gid']); |
|
126 | + } else { |
|
127 | + $data=$groupModel->groupMemberPracticeTagStat($group_info['gid']); |
|
128 | 128 | return Excel::download( |
129 | 129 | new GroupAnalysisExport( |
130 | 130 | [ |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'percent' => $all_data['percent'] ?? false, |
138 | 138 | ] |
139 | 139 | ), |
140 | - $gcode . '_Group_Tag_Analysis.xlsx' |
|
140 | + $gcode.'_Group_Tag_Analysis.xlsx' |
|
141 | 141 | ); |
142 | 142 | } |
143 | 143 | } |
@@ -43,7 +43,9 @@ discard block |
||
43 | 43 | $groupModel=new GroupModel(); |
44 | 44 | $contestModel=new ContestModel(); |
45 | 45 | $basic_info=$groupModel->details($gcode); |
46 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
46 | + if(empty($basic_info)) { |
|
47 | + return Redirect::route('group.index'); |
|
48 | + } |
|
47 | 49 | $my_profile=$groupModel->userProfile(Auth::user()->id, $basic_info["gid"]); |
48 | 50 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
49 | 51 | $member_list=$groupModel->userList($basic_info["gid"]); |
@@ -89,9 +91,13 @@ discard block |
||
89 | 91 | public function analysis($gcode){ |
90 | 92 | $groupModel = new GroupModel(); |
91 | 93 | $basic_info=$groupModel->details($gcode); |
92 | - if(empty($basic_info)) return Redirect::route('group.index'); |
|
94 | + if(empty($basic_info)) { |
|
95 | + return Redirect::route('group.index'); |
|
96 | + } |
|
93 | 97 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
94 | - if($clearance < 1) return Redirect::route('group.detail',['gcode' => $gcode]); |
|
98 | + if($clearance < 1) { |
|
99 | + return Redirect::route('group.detail',['gcode' => $gcode]); |
|
100 | + } |
|
95 | 101 | $group_info = $groupModel->details($gcode); |
96 | 102 | return view('group.settings.analysis', [ |
97 | 103 | 'page_title'=>"Group Analysis", |
@@ -123,7 +129,7 @@ discard block |
||
123 | 129 | ), |
124 | 130 | $gcode . '_Group_Contest_Analysis.xlsx' |
125 | 131 | ); |
126 | - }else{ |
|
132 | + } else{ |
|
127 | 133 | $data = $groupModel->groupMemberPracticeTagStat($group_info['gid']); |
128 | 134 | return Excel::download( |
129 | 135 | new GroupAnalysisExport( |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected function schedule(Schedule $schedule) |
35 | 35 | { |
36 | - $schedule->call(function () { |
|
36 | + $schedule->call(function() { |
|
37 | 37 | $babel=new Babel(); |
38 | 38 | for ($i=1; $i<=12; $i++) { |
39 | 39 | $babel->judge(); |
@@ -42,35 +42,35 @@ discard block |
||
42 | 42 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Judger"); |
43 | 43 | })->everyMinute()->description("Sync Judger"); |
44 | 44 | |
45 | - $schedule->call(function () { |
|
45 | + $schedule->call(function() { |
|
46 | 46 | $rankModel=new RankModel(); |
47 | 47 | $rankModel->rankList(); |
48 | 48 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated Rank"); |
49 | 49 | })->dailyAt('02:00')->description("Update Rank"); |
50 | 50 | |
51 | - $schedule->call(function () { |
|
51 | + $schedule->call(function() { |
|
52 | 52 | $siteMapModel=new SiteMapModel(); |
53 | 53 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated SiteMap"); |
54 | 54 | })->dailyAt('02:00')->description("Update SiteMap"); |
55 | 55 | |
56 | - $schedule->call(function () { |
|
56 | + $schedule->call(function() { |
|
57 | 57 | $groupModel=new GroupModel(); |
58 | 58 | $groupModel->cacheTrendingGroups(); |
59 | 59 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Cached Trending Groups"); |
60 | 60 | })->dailyAt('03:00')->description("Update Trending Groups"); |
61 | 61 | |
62 | 62 | $schedule->call(function() { |
63 | - $groupModel = new GroupModel(); |
|
64 | - $ret = $groupModel->refreshAllElo(); |
|
63 | + $groupModel=new GroupModel(); |
|
64 | + $ret=$groupModel->refreshAllElo(); |
|
65 | 65 | foreach ($ret as $gid => $group) { |
66 | - if(empty($group['result'])){ |
|
66 | + if (empty($group['result'])) { |
|
67 | 67 | Log::channel('group_elo')->info('Refreshed Group Elo (Empty) : ('.$gid.')'.$group['name']); |
68 | - }else{ |
|
68 | + } else { |
|
69 | 69 | Log::channel('group_elo')->info('Refreshing Group Elo: ('.$gid.')'.$group['name']); |
70 | 70 | foreach ($group['result'] as $contest) { |
71 | - if($contest['ret'] == 'success'){ |
|
71 | + if ($contest['ret']=='success') { |
|
72 | 72 | Log::channel('group_elo')->info(' Elo Clac Successfully : ('.$contest['cid'].')'.$contest['name']); |
73 | - }else{ |
|
73 | + } else { |
|
74 | 74 | Log::channel('group_elo')->info(' Elo Clac Faild (Judge Not Over) : ('.$contest['cid'].')'.$contest['name'].' sids:'); |
75 | 75 | foreach ($contest['submissions'] as $sid) { |
76 | 76 | Log::channel('group_elo')->info(' '.$sid['sid']); |
@@ -81,45 +81,45 @@ discard block |
||
81 | 81 | } |
82 | 82 | })->dailyAt('04:00')->description("Update Group Elo"); |
83 | 83 | |
84 | - $schedule->call(function () { |
|
85 | - $contestModel = new ContestModel(); |
|
86 | - $syncList = $contestModel->runningContest(); |
|
84 | + $schedule->call(function() { |
|
85 | + $contestModel=new ContestModel(); |
|
86 | + $syncList=$contestModel->runningContest(); |
|
87 | 87 | foreach ($syncList as $syncContest) { |
88 | 88 | if (!isset($syncContest['vcid'])) { |
89 | 89 | $contestRankRaw=$contestModel->contestRankCache($syncContest['cid']); |
90 | 90 | $cid=$syncContest['cid']; |
91 | 91 | Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw); |
92 | 92 | Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw); |
93 | - continue ; |
|
93 | + continue; |
|
94 | 94 | } |
95 | - $className = "App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. |
|
96 | - $all_data = [ |
|
95 | + $className="App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. |
|
96 | + $all_data=[ |
|
97 | 97 | 'oj'=>"hdu", |
98 | 98 | 'vcid'=>$syncContest['vcid'], |
99 | 99 | 'gid'=>$syncContest['gid'], |
100 | 100 | 'cid'=>$syncContest['cid'], |
101 | 101 | ]; |
102 | - $hduSync = new $className($all_data); |
|
102 | + $hduSync=new $className($all_data); |
|
103 | 103 | $hduSync->crawlRank(); |
104 | 104 | $hduSync->crawlClarification(); |
105 | 105 | } |
106 | 106 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Remote Rank and Clarification"); |
107 | 107 | })->everyMinute()->description("Sync Remote Rank and Clarification"); |
108 | 108 | |
109 | - $schedule->call(function () { |
|
110 | - $contestModel = new ContestModel(); |
|
111 | - $syncList = $contestModel->runningContest(); |
|
109 | + $schedule->call(function() { |
|
110 | + $contestModel=new ContestModel(); |
|
111 | + $syncList=$contestModel->runningContest(); |
|
112 | 112 | foreach ($syncList as $syncContest) { |
113 | 113 | if (isset($syncContest['crawled'])) { |
114 | 114 | if (!$syncContest['crawled']) { |
115 | - $className = "App\\Babel\\Extension\\hdu\\Synchronizer"; |
|
116 | - $all_data = [ |
|
115 | + $className="App\\Babel\\Extension\\hdu\\Synchronizer"; |
|
116 | + $all_data=[ |
|
117 | 117 | 'oj'=>"hdu", |
118 | 118 | 'vcid'=>$syncContest['vcid'], |
119 | 119 | 'gid'=>$syncContest['gid'], |
120 | 120 | 'cid'=>$syncContest['cid'], |
121 | 121 | ]; |
122 | - $hduSync = new $className($all_data); |
|
122 | + $hduSync=new $className($all_data); |
|
123 | 123 | $hduSync->scheduleCrawl(); |
124 | 124 | $contestModel->updateCrawlStatus($syncContest['cid']); |
125 | 125 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | })->everyMinute()->description("Sync Contest Problem"); |
129 | 129 | |
130 | - $schedule->call(function () { |
|
130 | + $schedule->call(function() { |
|
131 | 131 | $oidList=EloquentJudgeServerModel::column('oid'); |
132 | 132 | $babel=new Babel(); |
133 | 133 | foreach ($oidList as $oid) { |
@@ -65,12 +65,12 @@ |
||
65 | 65 | foreach ($ret as $gid => $group) { |
66 | 66 | if(empty($group['result'])){ |
67 | 67 | Log::channel('group_elo')->info('Refreshed Group Elo (Empty) : ('.$gid.')'.$group['name']); |
68 | - }else{ |
|
68 | + } else{ |
|
69 | 69 | Log::channel('group_elo')->info('Refreshing Group Elo: ('.$gid.')'.$group['name']); |
70 | 70 | foreach ($group['result'] as $contest) { |
71 | 71 | if($contest['ret'] == 'success'){ |
72 | 72 | Log::channel('group_elo')->info(' Elo Clac Successfully : ('.$contest['cid'].')'.$contest['name']); |
73 | - }else{ |
|
73 | + } else{ |
|
74 | 74 | Log::channel('group_elo')->info(' Elo Clac Faild (Judge Not Over) : ('.$contest['cid'].')'.$contest['name'].' sids:'); |
75 | 75 | foreach ($contest['submissions'] as $sid) { |
76 | 76 | Log::channel('group_elo')->info(' '.$sid['sid']); |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | |
19 | 19 | public function login($all_data) |
20 | 20 | { |
21 | - if(isset($all_data["url"])) $url = $all_data["url"]; else throw new Exception("url is not exist in all_data"); |
|
22 | - if(isset($all_data["data"])) $data = $all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
23 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
24 | - if(isset($all_data["ret"])) $ret = $all_data["ret"]; else $ret = 'false'; |
|
25 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
21 | + if (isset($all_data["url"])) $url=$all_data["url"]; else throw new Exception("url is not exist in all_data"); |
|
22 | + if (isset($all_data["data"])) $data=$all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
23 | + if (isset($all_data["oj"])) $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
24 | + if (isset($all_data["ret"])) $ret=$all_data["ret"]; else $ret='false'; |
|
25 | + if (isset($all_data["handle"])) $handle=$all_data["handle"]; else $handle="default"; |
|
26 | 26 | |
27 | 27 | $datapost=curl_init(); |
28 | 28 | $headers=array("Expect:"); |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | |
55 | 55 | public function grab_page($all_data) |
56 | 56 | { |
57 | - if(isset($all_data["site"])) $site = $all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
58 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
59 | - if(isset($all_data["headers"])) $headers = $all_data["headers"]; else $headers = []; |
|
60 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
61 | - if(isset($all_data["follow"])) $follow = $all_data["follow"]; else $follow = false; |
|
62 | - if(isset($all_data["vcid"])) $vcid = $all_data["vcid"]."_"; else $vcid = ""; |
|
57 | + if (isset($all_data["site"])) $site=$all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
58 | + if (isset($all_data["oj"])) $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
59 | + if (isset($all_data["headers"])) $headers=$all_data["headers"]; else $headers=[]; |
|
60 | + if (isset($all_data["handle"])) $handle=$all_data["handle"]; else $handle="default"; |
|
61 | + if (isset($all_data["follow"])) $follow=$all_data["follow"]; else $follow=false; |
|
62 | + if (isset($all_data["vcid"])) $vcid=$all_data["vcid"]."_"; else $vcid=""; |
|
63 | 63 | |
64 | 64 | $handle=urlencode($handle); |
65 | 65 | |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | |
87 | 87 | public function post_data($all_data) |
88 | 88 | { |
89 | - if(isset($all_data["site"])) $site = $all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
90 | - if(isset($all_data["data"])) $data = $all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
91 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
92 | - if(isset($all_data["ret"])) $ret = $all_data["ret"]; else $ret = false; |
|
93 | - if(isset($all_data["follow"])) $follow = $all_data["follow"]; else $follow = true; |
|
94 | - if(isset($all_data["returnHeader"])) $returnHeader = $all_data["returnHeader"]; else $returnHeader = true; |
|
95 | - if(isset($all_data["postJson"])) $postJson = $all_data["postJson"]; else $postJson = false; |
|
96 | - if(isset($all_data["extraHeaders"])) $extraHeaders = $all_data["extraHeaders"]; else $extraHeaders = []; |
|
97 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
98 | - if(isset($all_data["vcid"])) $vcid = $all_data["vcid"]."_"; else $vcid = ""; |
|
89 | + if (isset($all_data["site"])) $site=$all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
90 | + if (isset($all_data["data"])) $data=$all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
91 | + if (isset($all_data["oj"])) $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
92 | + if (isset($all_data["ret"])) $ret=$all_data["ret"]; else $ret=false; |
|
93 | + if (isset($all_data["follow"])) $follow=$all_data["follow"]; else $follow=true; |
|
94 | + if (isset($all_data["returnHeader"])) $returnHeader=$all_data["returnHeader"]; else $returnHeader=true; |
|
95 | + if (isset($all_data["postJson"])) $postJson=$all_data["postJson"]; else $postJson=false; |
|
96 | + if (isset($all_data["extraHeaders"])) $extraHeaders=$all_data["extraHeaders"]; else $extraHeaders=[]; |
|
97 | + if (isset($all_data["handle"])) $handle=$all_data["handle"]; else $handle="default"; |
|
98 | + if (isset($all_data["vcid"])) $vcid=$all_data["vcid"]."_"; else $vcid=""; |
|
99 | 99 | |
100 | 100 | $handle=urlencode($handle); |
101 | 101 |
@@ -18,11 +18,31 @@ discard block |
||
18 | 18 | |
19 | 19 | public function login($all_data) |
20 | 20 | { |
21 | - if(isset($all_data["url"])) $url = $all_data["url"]; else throw new Exception("url is not exist in all_data"); |
|
22 | - if(isset($all_data["data"])) $data = $all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
23 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
24 | - if(isset($all_data["ret"])) $ret = $all_data["ret"]; else $ret = 'false'; |
|
25 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
21 | + if(isset($all_data["url"])) { |
|
22 | + $url = $all_data["url"]; |
|
23 | + } else { |
|
24 | + throw new Exception("url is not exist in all_data"); |
|
25 | + } |
|
26 | + if(isset($all_data["data"])) { |
|
27 | + $data = $all_data["data"]; |
|
28 | + } else { |
|
29 | + throw new Exception("data is not exist in all_data"); |
|
30 | + } |
|
31 | + if(isset($all_data["oj"])) { |
|
32 | + $oj = $all_data["oj"]; |
|
33 | + } else { |
|
34 | + throw new Exception("oj is not exist in all_data"); |
|
35 | + } |
|
36 | + if(isset($all_data["ret"])) { |
|
37 | + $ret = $all_data["ret"]; |
|
38 | + } else { |
|
39 | + $ret = 'false'; |
|
40 | + } |
|
41 | + if(isset($all_data["handle"])) { |
|
42 | + $handle = $all_data["handle"]; |
|
43 | + } else { |
|
44 | + $handle = "default"; |
|
45 | + } |
|
26 | 46 | |
27 | 47 | $datapost=curl_init(); |
28 | 48 | $headers=array("Expect:"); |
@@ -54,12 +74,36 @@ discard block |
||
54 | 74 | |
55 | 75 | public function grab_page($all_data) |
56 | 76 | { |
57 | - if(isset($all_data["site"])) $site = $all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
58 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
59 | - if(isset($all_data["headers"])) $headers = $all_data["headers"]; else $headers = []; |
|
60 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
61 | - if(isset($all_data["follow"])) $follow = $all_data["follow"]; else $follow = false; |
|
62 | - if(isset($all_data["vcid"])) $vcid = $all_data["vcid"]."_"; else $vcid = ""; |
|
77 | + if(isset($all_data["site"])) { |
|
78 | + $site = $all_data["site"]; |
|
79 | + } else { |
|
80 | + throw new Exception("site is not exist in all_data"); |
|
81 | + } |
|
82 | + if(isset($all_data["oj"])) { |
|
83 | + $oj = $all_data["oj"]; |
|
84 | + } else { |
|
85 | + throw new Exception("oj is not exist in all_data"); |
|
86 | + } |
|
87 | + if(isset($all_data["headers"])) { |
|
88 | + $headers = $all_data["headers"]; |
|
89 | + } else { |
|
90 | + $headers = []; |
|
91 | + } |
|
92 | + if(isset($all_data["handle"])) { |
|
93 | + $handle = $all_data["handle"]; |
|
94 | + } else { |
|
95 | + $handle = "default"; |
|
96 | + } |
|
97 | + if(isset($all_data["follow"])) { |
|
98 | + $follow = $all_data["follow"]; |
|
99 | + } else { |
|
100 | + $follow = false; |
|
101 | + } |
|
102 | + if(isset($all_data["vcid"])) { |
|
103 | + $vcid = $all_data["vcid"]."_"; |
|
104 | + } else { |
|
105 | + $vcid = ""; |
|
106 | + } |
|
63 | 107 | |
64 | 108 | $handle=urlencode($handle); |
65 | 109 | |
@@ -86,16 +130,56 @@ discard block |
||
86 | 130 | |
87 | 131 | public function post_data($all_data) |
88 | 132 | { |
89 | - if(isset($all_data["site"])) $site = $all_data["site"]; else throw new Exception("site is not exist in all_data"); |
|
90 | - if(isset($all_data["data"])) $data = $all_data["data"]; else throw new Exception("data is not exist in all_data"); |
|
91 | - if(isset($all_data["oj"])) $oj = $all_data["oj"]; else throw new Exception("oj is not exist in all_data"); |
|
92 | - if(isset($all_data["ret"])) $ret = $all_data["ret"]; else $ret = false; |
|
93 | - if(isset($all_data["follow"])) $follow = $all_data["follow"]; else $follow = true; |
|
94 | - if(isset($all_data["returnHeader"])) $returnHeader = $all_data["returnHeader"]; else $returnHeader = true; |
|
95 | - if(isset($all_data["postJson"])) $postJson = $all_data["postJson"]; else $postJson = false; |
|
96 | - if(isset($all_data["extraHeaders"])) $extraHeaders = $all_data["extraHeaders"]; else $extraHeaders = []; |
|
97 | - if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default"; |
|
98 | - if(isset($all_data["vcid"])) $vcid = $all_data["vcid"]."_"; else $vcid = ""; |
|
133 | + if(isset($all_data["site"])) { |
|
134 | + $site = $all_data["site"]; |
|
135 | + } else { |
|
136 | + throw new Exception("site is not exist in all_data"); |
|
137 | + } |
|
138 | + if(isset($all_data["data"])) { |
|
139 | + $data = $all_data["data"]; |
|
140 | + } else { |
|
141 | + throw new Exception("data is not exist in all_data"); |
|
142 | + } |
|
143 | + if(isset($all_data["oj"])) { |
|
144 | + $oj = $all_data["oj"]; |
|
145 | + } else { |
|
146 | + throw new Exception("oj is not exist in all_data"); |
|
147 | + } |
|
148 | + if(isset($all_data["ret"])) { |
|
149 | + $ret = $all_data["ret"]; |
|
150 | + } else { |
|
151 | + $ret = false; |
|
152 | + } |
|
153 | + if(isset($all_data["follow"])) { |
|
154 | + $follow = $all_data["follow"]; |
|
155 | + } else { |
|
156 | + $follow = true; |
|
157 | + } |
|
158 | + if(isset($all_data["returnHeader"])) { |
|
159 | + $returnHeader = $all_data["returnHeader"]; |
|
160 | + } else { |
|
161 | + $returnHeader = true; |
|
162 | + } |
|
163 | + if(isset($all_data["postJson"])) { |
|
164 | + $postJson = $all_data["postJson"]; |
|
165 | + } else { |
|
166 | + $postJson = false; |
|
167 | + } |
|
168 | + if(isset($all_data["extraHeaders"])) { |
|
169 | + $extraHeaders = $all_data["extraHeaders"]; |
|
170 | + } else { |
|
171 | + $extraHeaders = []; |
|
172 | + } |
|
173 | + if(isset($all_data["handle"])) { |
|
174 | + $handle = $all_data["handle"]; |
|
175 | + } else { |
|
176 | + $handle = "default"; |
|
177 | + } |
|
178 | + if(isset($all_data["vcid"])) { |
|
179 | + $vcid = $all_data["vcid"]."_"; |
|
180 | + } else { |
|
181 | + $vcid = ""; |
|
182 | + } |
|
99 | 183 | |
100 | 184 | $handle=urlencode($handle); |
101 | 185 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
38 | 38 | if($clearance == 3){ |
39 | 39 | return Redirect::route('contest.admin', ['cid' => $cid]); |
40 | - }else{ |
|
40 | + } else{ |
|
41 | 41 | return Redirect::route('contest.detail', ['cid' => $cid]); |
42 | 42 | } |
43 | 43 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
84 | 84 | if($clearance == 3){ |
85 | 85 | return Redirect::route('contest.admin', ['cid' => $cid]); |
86 | - }else{ |
|
86 | + } else{ |
|
87 | 87 | return Redirect::route('contest.detail', ['cid' => $cid]); |
88 | 88 | } |
89 | 89 | } |
@@ -116,7 +116,9 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width'); |
119 | - if(empty($editor_left_width)) $editor_left_width='40'; |
|
119 | + if(empty($editor_left_width)) { |
|
120 | + $editor_left_width='40'; |
|
121 | + } |
|
120 | 122 | |
121 | 123 | return view('contest.board.editor', [ |
122 | 124 | 'page_title'=>"Problem Detail", |
@@ -153,7 +155,7 @@ discard block |
||
153 | 155 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
154 | 156 | if($clearance == 3){ |
155 | 157 | return Redirect::route('contest.admin', ['cid' => $cid]); |
156 | - }else{ |
|
158 | + } else{ |
|
157 | 159 | return Redirect::route('contest.detail', ['cid' => $cid]); |
158 | 160 | } |
159 | 161 | } |
@@ -168,10 +170,10 @@ discard block |
||
168 | 170 | if($i != 0) { |
169 | 171 | if($r['score'] == $contestRank[$i-1]['score'] && $r['penalty'] == $contestRank[$i-1]['penalty']){ |
170 | 172 | $r['rank'] = $contestRank[$i-1]['rank']; |
171 | - }else{ |
|
173 | + } else{ |
|
172 | 174 | $r['rank'] = $i + 1; |
173 | 175 | } |
174 | - }else{ |
|
176 | + } else{ |
|
175 | 177 | $r['rank'] = 1; |
176 | 178 | } |
177 | 179 | } |
@@ -212,7 +214,7 @@ discard block |
||
212 | 214 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
213 | 215 | if($clearance == 3){ |
214 | 216 | return Redirect::route('contest.admin', ['cid' => $cid]); |
215 | - }else{ |
|
217 | + } else{ |
|
216 | 218 | return Redirect::route('contest.detail', ['cid' => $cid]); |
217 | 219 | } |
218 | 220 | } |
@@ -250,7 +252,7 @@ discard block |
||
250 | 252 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
251 | 253 | if($clearance == 3){ |
252 | 254 | return Redirect::route('contest.admin', ['cid' => $cid]); |
253 | - }else{ |
|
255 | + } else{ |
|
254 | 256 | return Redirect::route('contest.detail', ['cid' => $cid]); |
255 | 257 | } |
256 | 258 | } |
@@ -285,7 +287,7 @@ discard block |
||
285 | 287 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
286 | 288 | if($clearance == 3){ |
287 | 289 | return Redirect::route('contest.admin', ['cid' => $cid]); |
288 | - }else{ |
|
290 | + } else{ |
|
289 | 291 | return Redirect::route('contest.detail', ['cid' => $cid]); |
290 | 292 | } |
291 | 293 | } |
@@ -310,7 +312,7 @@ discard block |
||
310 | 312 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
311 | 313 | if($clearance == 3){ |
312 | 314 | return Redirect::route('contest.admin', ['cid' => $cid]); |
313 | - }else{ |
|
315 | + } else{ |
|
314 | 316 | return Redirect::route('contest.detail', ['cid' => $cid]); |
315 | 317 | } |
316 | 318 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | $contestModel=new ContestModel(); |
35 | 35 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
36 | 36 | $basicInfo=$contestModel->basic($cid); |
37 | - if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
|
38 | - if($clearance == 3){ |
|
37 | + if (!$clearance || time()<strtotime($basicInfo['begin_time'])) { |
|
38 | + if ($clearance==3) { |
|
39 | 39 | return Redirect::route('contest.admin', ['cid' => $cid]); |
40 | - }else{ |
|
40 | + } else { |
|
41 | 41 | return Redirect::route('contest.detail', ['cid' => $cid]); |
42 | 42 | } |
43 | 43 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | if ($remainingTime<=0) { |
51 | 51 | $remainingTime=0; |
52 | 52 | } |
53 | - if($basicInfo['public'] && !$basicInfo['audit_status']){ |
|
53 | + if ($basicInfo['public'] && !$basicInfo['audit_status']) { |
|
54 | 54 | return Redirect::route('contest.detail', ['cid' => $cid]); |
55 | 55 | } |
56 | 56 | return view('contest.board.challenge', [ |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | $accountModel=new AccountModel(); |
84 | 84 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
85 | 85 | $basicInfo=$contestModel->basic($cid); |
86 | - if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
|
87 | - if($clearance == 3){ |
|
86 | + if (!$clearance || time()<strtotime($basicInfo['begin_time'])) { |
|
87 | + if ($clearance==3) { |
|
88 | 88 | return Redirect::route('contest.admin', ['cid' => $cid]); |
89 | - }else{ |
|
89 | + } else { |
|
90 | 90 | return Redirect::route('contest.detail', ['cid' => $cid]); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | $basicInfo=$contestModel->basic($cid); |
94 | - if($basicInfo['public'] && !$basicInfo['audit_status']){ |
|
94 | + if ($basicInfo['public'] && !$basicInfo['audit_status']) { |
|
95 | 95 | return Redirect::route('contest.detail', ['cid' => $cid]); |
96 | 96 | } |
97 | 97 | $contest_name=$contestModel->contestName($cid); |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | ]; |
123 | 123 | } |
124 | 124 | |
125 | - $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width'); |
|
126 | - if(empty($editor_left_width)) $editor_left_width='40'; |
|
125 | + $editor_left_width=$accountModel->getExtra(Auth::user()->id, 'editor_left_width'); |
|
126 | + if (empty($editor_left_width)) $editor_left_width='40'; |
|
127 | 127 | |
128 | 128 | return view('contest.board.editor', [ |
129 | 129 | 'page_title'=>"Problem Detail", |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | $contestModel=new ContestModel(); |
158 | 158 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
159 | 159 | $basicInfo=$contestModel->basic($cid); |
160 | - if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
|
161 | - if($clearance == 3){ |
|
160 | + if (!$clearance || time()<strtotime($basicInfo['begin_time'])) { |
|
161 | + if ($clearance==3) { |
|
162 | 162 | return Redirect::route('contest.admin', ['cid' => $cid]); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return Redirect::route('contest.detail', ['cid' => $cid]); |
165 | 165 | } |
166 | 166 | } |
167 | 167 | $basicInfo=$contestModel->basic($cid); |
168 | - if($basicInfo['public'] && !$basicInfo['audit_status']){ |
|
168 | + if ($basicInfo['public'] && !$basicInfo['audit_status']) { |
|
169 | 169 | return Redirect::route('contest.detail', ['cid' => $cid]); |
170 | 170 | } |
171 | 171 | $contest_name=$contestModel->contestName($cid); |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | |
177 | 177 | // To determine the ranking |
178 | 178 | foreach ($contestRank as $i => &$r) { |
179 | - if($i != 0) { |
|
180 | - if($r['score'] == $contestRank[$i-1]['score'] && $r['penalty'] == $contestRank[$i-1]['penalty']){ |
|
181 | - $r['rank'] = $contestRank[$i-1]['rank']; |
|
182 | - }else{ |
|
183 | - $r['rank'] = $i + 1; |
|
179 | + if ($i!=0) { |
|
180 | + if ($r['score']==$contestRank[$i-1]['score'] && $r['penalty']==$contestRank[$i-1]['penalty']) { |
|
181 | + $r['rank']=$contestRank[$i-1]['rank']; |
|
182 | + } else { |
|
183 | + $r['rank']=$i+1; |
|
184 | 184 | } |
185 | - }else{ |
|
186 | - $r['rank'] = 1; |
|
185 | + } else { |
|
186 | + $r['rank']=1; |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | $rankFrozen=$contestModel->isFrozen($cid); |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | $contestModel=new ContestModel(); |
221 | 221 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
222 | 222 | $basicInfo=$contestModel->basic($cid); |
223 | - if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
|
224 | - if($clearance == 3){ |
|
223 | + if (!$clearance || time()<strtotime($basicInfo['begin_time'])) { |
|
224 | + if ($clearance==3) { |
|
225 | 225 | return Redirect::route('contest.admin', ['cid' => $cid]); |
226 | - }else{ |
|
226 | + } else { |
|
227 | 227 | return Redirect::route('contest.detail', ['cid' => $cid]); |
228 | 228 | } |
229 | 229 | } |
230 | 230 | $basicInfo=$contestModel->basic($cid); |
231 | - if($basicInfo['public'] && !$basicInfo['audit_status']){ |
|
231 | + if ($basicInfo['public'] && !$basicInfo['audit_status']) { |
|
232 | 232 | return Redirect::route('contest.detail', ['cid' => $cid]); |
233 | 233 | } |
234 | 234 | $contest_name=$contestModel->contestName($cid); |
@@ -262,14 +262,14 @@ discard block |
||
262 | 262 | $contestModel=new ContestModel(); |
263 | 263 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
264 | 264 | $basicInfo=$contestModel->basic($cid); |
265 | - if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
|
266 | - if($clearance == 3){ |
|
265 | + if (!$clearance || time()<strtotime($basicInfo['begin_time'])) { |
|
266 | + if ($clearance==3) { |
|
267 | 267 | return Redirect::route('contest.admin', ['cid' => $cid]); |
268 | - }else{ |
|
268 | + } else { |
|
269 | 269 | return Redirect::route('contest.detail', ['cid' => $cid]); |
270 | 270 | } |
271 | 271 | } |
272 | - if($basicInfo['public'] && !$basicInfo['audit_status']){ |
|
272 | + if ($basicInfo['public'] && !$basicInfo['audit_status']) { |
|
273 | 273 | return Redirect::route('contest.detail', ['cid' => $cid]); |
274 | 274 | } |
275 | 275 | $contest_name=$contestModel->contestName($cid); |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | $contestModel=new ContestModel(); |
301 | 301 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
302 | 302 | $basicInfo=$contestModel->basic($cid); |
303 | - if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
|
304 | - if($clearance == 3){ |
|
303 | + if (!$clearance || time()<strtotime($basicInfo['begin_time'])) { |
|
304 | + if ($clearance==3) { |
|
305 | 305 | return Redirect::route('contest.admin', ['cid' => $cid]); |
306 | - }else{ |
|
306 | + } else { |
|
307 | 307 | return Redirect::route('contest.detail', ['cid' => $cid]); |
308 | 308 | } |
309 | 309 | } |
310 | - if($basicInfo['public'] && !$basicInfo['audit_status']){ |
|
310 | + if ($basicInfo['public'] && !$basicInfo['audit_status']) { |
|
311 | 311 | return Redirect::route('contest.detail', ['cid' => $cid]); |
312 | 312 | } |
313 | 313 | $contest_name=$contestModel->contestName($cid); |
@@ -324,19 +324,19 @@ discard block |
||
324 | 324 | ]); |
325 | 325 | } |
326 | 326 | |
327 | - public function analysis($cid){ |
|
327 | + public function analysis($cid) { |
|
328 | 328 | $contestModel=new ContestModel(); |
329 | 329 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
330 | 330 | $basicInfo=$contestModel->basic($cid); |
331 | - if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
|
332 | - if($clearance == 3){ |
|
331 | + if (!$clearance || time()<strtotime($basicInfo['begin_time'])) { |
|
332 | + if ($clearance==3) { |
|
333 | 333 | return Redirect::route('contest.admin', ['cid' => $cid]); |
334 | - }else{ |
|
334 | + } else { |
|
335 | 335 | return Redirect::route('contest.detail', ['cid' => $cid]); |
336 | 336 | } |
337 | 337 | } |
338 | 338 | $basicInfo=$contestModel->basic($cid); |
339 | - if($basicInfo['public'] && !$basicInfo['audit_status']){ |
|
339 | + if ($basicInfo['public'] && !$basicInfo['audit_status']) { |
|
340 | 340 | return Redirect::route('contest.detail', ['cid' => $cid]); |
341 | 341 | } |
342 | 342 | $contest_name=$contestModel->contestName($cid); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $filter["rated"]=isset($all_data["rated"]) ? $all_data["rated"] : null; |
28 | 28 | $filter["anticheated"]=isset($all_data["anticheated"]) ? $all_data["anticheated"] : null; |
29 | 29 | $filter["practice"]=isset($all_data["practice"]) ? $all_data["practice"] : null; |
30 | - $return_list=$contestModel->list($filter,Auth::check()?Auth::user()->id:0); |
|
30 | + $return_list=$contestModel->list($filter, Auth::check() ?Auth::user()->id : 0); |
|
31 | 31 | $featured=$contestModel->featured(); |
32 | 32 | if (is_null($return_list)) { |
33 | 33 | if (isset($all_data["page"]) && $all_data["page"]>1) { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $contestModel=new ContestModel(); |
67 | 67 | $groupModel=new GroupModel(); |
68 | 68 | $clearance=Auth::check() ? $contestModel->judgeClearance($cid, Auth::user()->id) : 0; |
69 | - $basic = $contestModel->basic($cid); |
|
69 | + $basic=$contestModel->basic($cid); |
|
70 | 70 | if (Auth::check()) { |
71 | 71 | $contest_detail=$contestModel->detail($cid, Auth::user()->id); |
72 | 72 | $registration=$contestModel->registration($cid, Auth::user()->id); |
@@ -76,7 +76,7 @@ |
||
76 | 76 | "spj_version" => null, |
77 | 77 | "spj_config" => null |
78 | 78 | ]; |
79 | - if($probBasic["spj"] && $probBasic["spj_version"]){ |
|
79 | + if ($probBasic["spj"] && $probBasic["spj_version"]) { |
|
80 | 80 | $submit_data["spj_version"]=$probBasic["spj_version"]; |
81 | 81 | $submit_data["spj_config"]=$probBasic["spj_lang"]; |
82 | 82 | } |