@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | //writing database |
| 39 | 39 | $this->transactionDB(); |
| 40 | 40 | |
| 41 | - }catch(Throwable $e){ |
|
| 41 | + } catch(Throwable $e){ |
|
| 42 | 42 | if ($e->getMessage()!==""){ |
| 43 | 43 | $this->command->line("\n <bg=red;fg=white> {$e->getMessage()} </>\n"); |
| 44 | 44 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | DB::commit(); |
| 222 | 222 | |
| 223 | - }catch(Throwable $e){ |
|
| 223 | + } catch(Throwable $e){ |
|
| 224 | 224 | DB::rollback(); |
| 225 | 225 | if ($e->getMessage()!=="") { |
| 226 | 226 | $this->command->line("\n <bg=red;fg=white> {$e->getMessage()} </>\n"); |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | $account=$contestModel->getContestAccount($cid); |
| 59 | 59 | if($account==null){ |
| 60 | 60 | return ; |
| 61 | - }else{ |
|
| 61 | + } else{ |
|
| 62 | 62 | $AccountExport=new AccountExport($account); |
| 63 | 63 | $filename="ContestAccount$cid"; |
| 64 | 64 | return Excel::download($AccountExport, $filename.'.xlsx'); |
@@ -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,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 | |
@@ -446,7 +446,9 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | if (!empty($data["sample"])) { |
| 448 | 448 | foreach ($data["sample"] as $d) { |
| 449 | - if(!isset($d['sample_note'])) $d['sample_note']=null; |
|
| 449 | + if(!isset($d['sample_note'])) { |
|
| 450 | + $d['sample_note']=null; |
|
| 451 | + } |
|
| 450 | 452 | DB::table("problem_sample")->insert([ |
| 451 | 453 | 'pid'=>$pid, |
| 452 | 454 | 'sample_input'=>$d['sample_input'], |
@@ -492,7 +494,9 @@ discard block |
||
| 492 | 494 | |
| 493 | 495 | if (!empty($data["sample"])) { |
| 494 | 496 | foreach ($data["sample"] as $d) { |
| 495 | - if(!isset($d['sample_note'])) $d['sample_note']=null; |
|
| 497 | + if(!isset($d['sample_note'])) { |
|
| 498 | + $d['sample_note']=null; |
|
| 499 | + } |
|
| 496 | 500 | DB::table("problem_sample")->insert([ |
| 497 | 501 | 'pid'=>$pid, |
| 498 | 502 | 'sample_input'=>$d['sample_input'], |
@@ -679,7 +683,7 @@ discard block |
||
| 679 | 683 | $top=DB::table('problem_discussion_comment')->where('pdcid','=',$reply_id)->get()->first()['reply_id']; |
| 680 | 684 | if(isset($top)){ |
| 681 | 685 | return $this->replyParent($reply_id); |
| 682 | - }else{ |
|
| 686 | + } else{ |
|
| 683 | 687 | return $reply_id; |
| 684 | 688 | } |
| 685 | 689 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $temp["settings"]=false; |
| 69 | 69 | $temp["available"]=$installedConfig->status; |
| 70 | 70 | } |
| 71 | - }catch (Throwable $e){ |
|
| 71 | + } catch (Throwable $e){ |
|
| 72 | 72 | continue; |
| 73 | 73 | } |
| 74 | 74 | $ret[]=$temp; |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | $ret=[]; |
| 82 | 82 | $marketspaceRaw=self::getRemote(); |
| 83 | - if(empty($marketspaceRaw)) return []; |
|
| 83 | + if(empty($marketspaceRaw)) { |
|
| 84 | + return []; |
|
| 85 | + } |
|
| 84 | 86 | foreach($marketspaceRaw["packages"] as $extension){ |
| 85 | 87 | $temp=[ |
| 86 | 88 | "details"=>$extension, |
@@ -94,7 +96,7 @@ discard block |
||
| 94 | 96 | try { |
| 95 | 97 | try { |
| 96 | 98 | $BabelConfig=json_decode(file_get_contents(babel_path("Extension/{$extension['code']}/babel.json")), true); |
| 97 | - }catch (Throwable $e){ |
|
| 99 | + } catch (Throwable $e){ |
|
| 98 | 100 | $BabelConfig=[]; |
| 99 | 101 | } |
| 100 | 102 | if (!empty($BabelConfig)) { |
@@ -120,7 +122,7 @@ discard block |
||
| 120 | 122 | $temp["available"]=$installedConfig->status; |
| 121 | 123 | } |
| 122 | 124 | } |
| 123 | - }catch (Throwable $e){ |
|
| 125 | + } catch (Throwable $e){ |
|
| 124 | 126 | continue; |
| 125 | 127 | } |
| 126 | 128 | $ret[]=$temp; |
@@ -136,7 +138,9 @@ discard block |
||
| 136 | 138 | foreach($dirs as $d){ |
| 137 | 139 | $extension=basename($d); |
| 138 | 140 | $BabelConfig=json_decode(file_get_contents(babel_path("Extension/$extension/babel.json")), true); |
| 139 | - if($extension==$BabelConfig["code"]) $ret[]=$BabelConfig; |
|
| 141 | + if($extension==$BabelConfig["code"]) { |
|
| 142 | + $ret[]=$BabelConfig; |
|
| 143 | + } |
|
| 140 | 144 | } |
| 141 | 145 | return $ret; |
| 142 | 146 | } |
@@ -145,7 +149,7 @@ discard block |
||
| 145 | 149 | { |
| 146 | 150 | try { |
| 147 | 151 | return json_decode(file_get_contents(config('babel.mirror')."/babel.json"), true); |
| 148 | - }catch(Throwable $e){ |
|
| 152 | + } catch(Throwable $e){ |
|
| 149 | 153 | return []; |
| 150 | 154 | } |
| 151 | 155 | } |
@@ -153,10 +157,14 @@ discard block |
||
| 153 | 157 | public static function remoteDetail($code) |
| 154 | 158 | { |
| 155 | 159 | $babelConfig=self::getRemote(); |
| 156 | - if(empty($babelConfig)) return []; |
|
| 160 | + if(empty($babelConfig)) { |
|
| 161 | + return []; |
|
| 162 | + } |
|
| 157 | 163 | $babelConfigPackages=$babelConfig["packages"]; |
| 158 | 164 | foreach($babelConfigPackages as $package) { |
| 159 | - if($package["code"]==$code) return $package; |
|
| 165 | + if($package["code"]==$code) { |
|
| 166 | + return $package; |
|
| 167 | + } |
|
| 160 | 168 | } |
| 161 | 169 | return []; |
| 162 | 170 | } |
@@ -245,11 +245,17 @@ |
||
| 245 | 245 | |
| 246 | 246 | $groupModel=new GroupModel(); |
| 247 | 247 | $is_user=$groupModel->isUser($all_data["email"]); |
| 248 | - if(!$is_user) return ResponseModel::err(2006); |
|
| 248 | + if(!$is_user) { |
|
| 249 | + return ResponseModel::err(2006); |
|
| 250 | + } |
|
| 249 | 251 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 250 | - if($clearance<2) return ResponseModel::err(7002); |
|
| 252 | + if($clearance<2) { |
|
| 253 | + return ResponseModel::err(7002); |
|
| 254 | + } |
|
| 251 | 255 | $targetClearance=$groupModel->judgeEmailClearance($all_data["gid"], $all_data["email"]); |
| 252 | - if($targetClearance!=-3) return ResponseModel::err(7003); |
|
| 256 | + if($targetClearance!=-3) { |
|
| 257 | + return ResponseModel::err(7003); |
|
| 258 | + } |
|
| 253 | 259 | $groupModel->inviteMember($all_data["gid"], $all_data["email"]); |
| 254 | 260 | $basic = $groupModel->basic($all_data['gid']); |
| 255 | 261 | $url = route('group.detail',['gcode' => $basic['gcode']]); |
@@ -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 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
| 87 | 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 | } |
@@ -123,7 +123,9 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width'); |
| 126 | - if(empty($editor_left_width)) $editor_left_width='40'; |
|
| 126 | + if(empty($editor_left_width)) { |
|
| 127 | + $editor_left_width='40'; |
|
| 128 | + } |
|
| 127 | 129 | |
| 128 | 130 | return view('contest.board.editor', [ |
| 129 | 131 | 'page_title'=>"Problem Detail", |
@@ -160,7 +162,7 @@ discard block |
||
| 160 | 162 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
| 161 | 163 | if($clearance == 3){ |
| 162 | 164 | return Redirect::route('contest.admin', ['cid' => $cid]); |
| 163 | - }else{ |
|
| 165 | + } else{ |
|
| 164 | 166 | return Redirect::route('contest.detail', ['cid' => $cid]); |
| 165 | 167 | } |
| 166 | 168 | } |
@@ -179,10 +181,10 @@ discard block |
||
| 179 | 181 | if($i != 0) { |
| 180 | 182 | if($r['score'] == $contestRank[$i-1]['score'] && ($contest_rule == 1 ? ($r['penalty'] == $contestRank[$i-1]['penalty']) : 1) ){ |
| 181 | 183 | $r['rank'] = $contestRank[$i-1]['rank']; |
| 182 | - }else{ |
|
| 184 | + } else{ |
|
| 183 | 185 | $r['rank'] = $i + 1; |
| 184 | 186 | } |
| 185 | - }else{ |
|
| 187 | + } else{ |
|
| 186 | 188 | $r['rank'] = 1; |
| 187 | 189 | } |
| 188 | 190 | } |
@@ -223,7 +225,7 @@ discard block |
||
| 223 | 225 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
| 224 | 226 | if($clearance == 3){ |
| 225 | 227 | return Redirect::route('contest.admin', ['cid' => $cid]); |
| 226 | - }else{ |
|
| 228 | + } else{ |
|
| 227 | 229 | return Redirect::route('contest.detail', ['cid' => $cid]); |
| 228 | 230 | } |
| 229 | 231 | } |
@@ -265,7 +267,7 @@ discard block |
||
| 265 | 267 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
| 266 | 268 | if($clearance == 3){ |
| 267 | 269 | return Redirect::route('contest.admin', ['cid' => $cid]); |
| 268 | - }else{ |
|
| 270 | + } else{ |
|
| 269 | 271 | return Redirect::route('contest.detail', ['cid' => $cid]); |
| 270 | 272 | } |
| 271 | 273 | } |
@@ -303,7 +305,7 @@ discard block |
||
| 303 | 305 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
| 304 | 306 | if($clearance == 3){ |
| 305 | 307 | return Redirect::route('contest.admin', ['cid' => $cid]); |
| 306 | - }else{ |
|
| 308 | + } else{ |
|
| 307 | 309 | return Redirect::route('contest.detail', ['cid' => $cid]); |
| 308 | 310 | } |
| 309 | 311 | } |
@@ -331,7 +333,7 @@ discard block |
||
| 331 | 333 | if (!$clearance || time() < strtotime($basicInfo['begin_time'])) { |
| 332 | 334 | if($clearance == 3){ |
| 333 | 335 | return Redirect::route('contest.admin', ['cid' => $cid]); |
| 334 | - }else{ |
|
| 336 | + } else{ |
|
| 335 | 337 | return Redirect::route('contest.detail', ['cid' => $cid]); |
| 336 | 338 | } |
| 337 | 339 | } |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | $users->add($user); |
| 29 | 29 | } |
| 30 | 30 | return $users->unique(); |
| 31 | - }else{ |
|
| 31 | + } else{ |
|
| 32 | 32 | $this->load('submissions.user'); |
| 33 | 33 | if($ignore_frozen){ |
| 34 | 34 | $frozen_time = $this->frozen_time; |
| 35 | 35 | $submissions = $this->submissions()->where('submission_date','<',$frozen_time)->get(); |
| 36 | - }else{ |
|
| 36 | + } else{ |
|
| 37 | 37 | $submissions = $this->submissions; |
| 38 | 38 | } |
| 39 | 39 | $users = new EloquentCollection; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | }); |
| 103 | 103 | Cache::tags(['contest', 'rank'])->put($this->cid, $ret, 60); |
| 104 | 104 | return $ret; |
| 105 | - }else{ |
|
| 105 | + } else{ |
|
| 106 | 106 | // IO Mode |
| 107 | 107 | $c = new OutdatedContestModel(); |
| 108 | 108 | return $c->contestRankCache($this->cid); |