@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | * |
13 | 13 | * @var string |
14 | 14 | */ |
15 | - protected $signature = 'babel:uninstall {extension : The package name of the extension}'; |
|
15 | + protected $signature='babel:uninstall {extension : The package name of the extension}'; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * The console command description. |
19 | 19 | * |
20 | 20 | * @var string |
21 | 21 | */ |
22 | - protected $description = 'Uninstall a given Babel Extension to NOJ'; |
|
22 | + protected $description='Uninstall a given Babel Extension to NOJ'; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Create a new command instance. |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function handle() |
40 | 40 | { |
41 | - $extension = $this->argument('extension'); |
|
41 | + $extension=$this->argument('extension'); |
|
42 | 42 | $submitter=self::create($extension, $this); |
43 | 43 | if (!is_null($submitter)) { |
44 | 44 | $submitter->uninstall(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } catch (ErrorException $e) { |
57 | 57 | } catch (Exception $e) { |
58 | 58 | } |
59 | - $className = "App\\Babel\\Extension\\$oj\\$installerProvider"; |
|
59 | + $className="App\\Babel\\Extension\\$oj\\$installerProvider"; |
|
60 | 60 | if (class_exists($className)) { |
61 | 61 | return new $className($class); |
62 | 62 | } else { |
@@ -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'); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $contestModel=new ContestModel(); |
28 | 28 | $verified=$contestModel->isVerified($cid); |
29 | 29 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
30 | - if ($clearance <= 2) { |
|
30 | + if ($clearance<=2) { |
|
31 | 31 | return Redirect::route('contest_detail', ['cid' => $cid]); |
32 | 32 | } |
33 | 33 | $contest_name=$contestModel->contestName($cid); |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | $basicInfo=$contestModel->basic($cid); |
37 | 37 | $contest_accounts=$accountModel->getContestAccount($cid); |
38 | 38 | $gcode=$contestModel->gcode($cid); |
39 | - $isEnd = $contestModel->remainingTime($cid) < 0; |
|
40 | - $generatePDFStatus = JobStatus::find(Cache::tags(['contest', 'admin', 'PDFGenerate'])->get($cid, 0)); |
|
41 | - $generatePDFStatus = is_null($generatePDFStatus)?'empty':$generatePDFStatus->status; |
|
42 | - if(in_array($generatePDFStatus,['finished','failed'])){ |
|
39 | + $isEnd=$contestModel->remainingTime($cid)<0; |
|
40 | + $generatePDFStatus=JobStatus::find(Cache::tags(['contest', 'admin', 'PDFGenerate'])->get($cid, 0)); |
|
41 | + $generatePDFStatus=is_null($generatePDFStatus) ? 'empty' : $generatePDFStatus->status; |
|
42 | + if (in_array($generatePDFStatus, ['finished', 'failed'])) { |
|
43 | 43 | Cache::tags(['contest', 'admin', 'PDFGenerate'])->forget($cid); |
44 | 44 | } |
45 | - $anticheatStatus = JobStatus::find(Cache::tags(['contest', 'admin', 'anticheat'])->get($cid, 0)); |
|
46 | - $anticheatProgress = is_null($anticheatStatus)?0:$anticheatStatus->progress_percentage; |
|
47 | - $anticheatStatus = is_null($anticheatStatus)?'empty':$anticheatStatus->status; |
|
48 | - if(Storage::disk('local')->exists("contest/anticheat/$cid/report/report.zip")) { |
|
45 | + $anticheatStatus=JobStatus::find(Cache::tags(['contest', 'admin', 'anticheat'])->get($cid, 0)); |
|
46 | + $anticheatProgress=is_null($anticheatStatus) ? 0 : $anticheatStatus->progress_percentage; |
|
47 | + $anticheatStatus=is_null($anticheatStatus) ? 'empty' : $anticheatStatus->status; |
|
48 | + if (Storage::disk('local')->exists("contest/anticheat/$cid/report/report.zip")) { |
|
49 | 49 | $anticheatStatus='finished'; |
50 | 50 | $anticheatProgress=100; |
51 | 51 | } |
52 | - if(in_array($anticheatStatus, ['finished','failed'])){ |
|
52 | + if (in_array($anticheatStatus, ['finished', 'failed'])) { |
|
53 | 53 | Cache::tags(['contest', 'admin', 'anticheat'])->forget($cid); |
54 | 54 | } |
55 | 55 | return view('contest.board.admin', [ |
@@ -77,45 +77,45 @@ discard block |
||
77 | 77 | { |
78 | 78 | $contestModel=new ContestModel(); |
79 | 79 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
80 | - if ($clearance <= 2) { |
|
80 | + if ($clearance<=2) { |
|
81 | 81 | return Redirect::route('contest_detail', ['cid' => $cid]); |
82 | 82 | } |
83 | 83 | $account=$contestModel->getContestAccount($cid); |
84 | - if($account==null){ |
|
85 | - return ; |
|
86 | - }else{ |
|
84 | + if ($account==null) { |
|
85 | + return; |
|
86 | + } else { |
|
87 | 87 | $AccountExport=new AccountExport($account); |
88 | 88 | $filename="ContestAccount$cid"; |
89 | 89 | return Excel::download($AccountExport, $filename.'.xlsx'); |
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
93 | - public function refreshContestRank($cid){ |
|
93 | + public function refreshContestRank($cid) { |
|
94 | 94 | $contestModel=new ContestModel(); |
95 | 95 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
96 | - if ($clearance <= 2) { |
|
96 | + if ($clearance<=2) { |
|
97 | 97 | return Redirect::route('contest.detail', ['cid' => $cid]); |
98 | 98 | } |
99 | - $contest_eloquent = EloquentContestModel::find($cid); |
|
99 | + $contest_eloquent=EloquentContestModel::find($cid); |
|
100 | 100 | $contestRankRaw=$contest_eloquent->rankRefresh(); |
101 | 101 | Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw); |
102 | 102 | Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw); |
103 | 103 | $end_time=strtotime(DB::table("contest")->where(["cid"=>$cid])->select("end_time")->first()["end_time"]); |
104 | - if(time() > strtotime($end_time)){ |
|
104 | + if (time()>strtotime($end_time)) { |
|
105 | 105 | $contestModel->storeContestRankInMySQL($cid, $contestRankRaw); |
106 | 106 | } |
107 | 107 | $contestModel->deleteZip("contestCodeZip/$cid/"); |
108 | 108 | return Redirect::route('contest.rank', ['cid' => $cid]); |
109 | 109 | } |
110 | 110 | |
111 | - public function scrollBoard($cid){ |
|
111 | + public function scrollBoard($cid) { |
|
112 | 112 | $contestModel=new ContestModel(); |
113 | 113 | $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
114 | - if ($clearance <= 2) { |
|
114 | + if ($clearance<=2) { |
|
115 | 115 | return Redirect::route('contest_detail', ['cid' => $cid]); |
116 | 116 | } |
117 | 117 | $basicInfo=$contestModel->basic($cid); |
118 | - if($basicInfo['froze_length'] == 0){ |
|
118 | + if ($basicInfo['froze_length']==0) { |
|
119 | 119 | return Redirect::route('contest.admin', ['cid' => $cid]); |
120 | 120 | } |
121 | 121 | return view('contest.board.scrollBoard', [ |
@@ -84,9 +84,9 @@ |
||
84 | 84 | $installed_timestamp=intval($info["compiler_timestamp"]); |
85 | 85 | } |
86 | 86 | $latest_timestamp=$installed_timestamp; |
87 | - $ConpilerConfig = glob(babel_path("Extension/$ocode/compiler/*.*")); |
|
87 | + $ConpilerConfig=glob(babel_path("Extension/$ocode/compiler/*.*")); |
|
88 | 88 | foreach ($ConpilerConfig as $file) { |
89 | - if (intval(basename($file)) > $installed_timestamp) { |
|
89 | + if (intval(basename($file))>$installed_timestamp) { |
|
90 | 90 | try { |
91 | 91 | $this->commitCompiler($file, json_decode(file_get_contents($file), true)); |
92 | 92 | $latest_timestamp=intval(basename($file)); |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | |
49 | 49 | $groupModel=new GroupModel(); |
50 | 50 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
51 | - if ($clearance < 2) { |
|
51 | + if ($clearance<2) { |
|
52 | 52 | return ResponseModel::err(7002); |
53 | 53 | } |
54 | - $tags = $groupModel->problemTags($all_data['gid'],$all_data['pid']); |
|
55 | - if(in_array($all_data['tag'],$tags)){ |
|
54 | + $tags=$groupModel->problemTags($all_data['gid'], $all_data['pid']); |
|
55 | + if (in_array($all_data['tag'], $tags)) { |
|
56 | 56 | return ResponseModel::err(7007); |
57 | 57 | } |
58 | 58 | |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | $request->validate([ |
85 | 85 | 'gid' => 'required|string', |
86 | 86 | ]); |
87 | - $gid = $request->input('gid'); |
|
87 | + $gid=$request->input('gid'); |
|
88 | 88 | $groupModel=new GroupModel(); |
89 | - if($groupModel->judgeClearance($gid,Auth::user()->id) < 2) { |
|
89 | + if ($groupModel->judgeClearance($gid, Auth::user()->id)<2) { |
|
90 | 90 | return ResponseModel::err(2001); |
91 | 91 | } |
92 | 92 | $groupModel->refreshElo($gid); |
@@ -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 | } |
@@ -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']); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected function schedule(Schedule $schedule) |
36 | 36 | { |
37 | - $schedule->call(function () { |
|
37 | + $schedule->call(function() { |
|
38 | 38 | $babel=new Babel(); |
39 | 39 | for ($i=1; $i<=12; $i++) { |
40 | 40 | $babel->judge(); |
@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Judger"); |
44 | 44 | })->everyMinute()->description("Sync Judger"); |
45 | 45 | |
46 | - $schedule->call(function () { |
|
46 | + $schedule->call(function() { |
|
47 | 47 | $rankModel=new RankModel(); |
48 | 48 | $rankModel->rankList(); |
49 | 49 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated Rank"); |
50 | 50 | })->dailyAt('02:00')->description("Update Rank"); |
51 | 51 | |
52 | - $schedule->call(function () { |
|
52 | + $schedule->call(function() { |
|
53 | 53 | $siteMapModel=new SiteMapModel(); |
54 | 54 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Updated SiteMap"); |
55 | 55 | })->dailyAt('02:00')->description("Update SiteMap"); |
56 | 56 | |
57 | - $schedule->call(function () { |
|
57 | + $schedule->call(function() { |
|
58 | 58 | $groupModel=new GroupModel(); |
59 | 59 | $groupModel->cacheTrendingGroups(); |
60 | 60 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Cached Trending Groups"); |
61 | 61 | })->dailyAt('03:00')->description("Update Trending Groups"); |
62 | 62 | |
63 | 63 | $schedule->call(function() { |
64 | - $groupModel = new GroupModel(); |
|
65 | - $ret = $groupModel->refreshAllElo(); |
|
64 | + $groupModel=new GroupModel(); |
|
65 | + $ret=$groupModel->refreshAllElo(); |
|
66 | 66 | foreach ($ret as $gid => $group) { |
67 | - if(empty($group['result'])){ |
|
67 | + if (empty($group['result'])) { |
|
68 | 68 | Log::channel('group_elo')->info('Refreshed Group Elo (Empty) : ('.$gid.')'.$group['name']); |
69 | - }else{ |
|
69 | + } else { |
|
70 | 70 | Log::channel('group_elo')->info('Refreshing Group Elo: ('.$gid.')'.$group['name']); |
71 | 71 | foreach ($group['result'] as $contest) { |
72 | - if($contest['ret'] == 'success'){ |
|
72 | + if ($contest['ret']=='success') { |
|
73 | 73 | Log::channel('group_elo')->info(' Elo Clac Successfully : ('.$contest['cid'].')'.$contest['name']); |
74 | - }else{ |
|
74 | + } else { |
|
75 | 75 | Log::channel('group_elo')->info(' Elo Clac Faild (Judge Not Over) : ('.$contest['cid'].')'.$contest['name'].' sids:'); |
76 | 76 | foreach ($contest['submissions'] as $sid) { |
77 | 77 | Log::channel('group_elo')->info(' '.$sid['sid']); |
@@ -82,46 +82,46 @@ discard block |
||
82 | 82 | } |
83 | 83 | })->dailyAt('04:00')->description("Update Group Elo"); |
84 | 84 | |
85 | - $schedule->call(function () { |
|
86 | - $contestModel = new ContestModel(); |
|
87 | - $syncList = $contestModel->runningContest(); |
|
85 | + $schedule->call(function() { |
|
86 | + $contestModel=new ContestModel(); |
|
87 | + $syncList=$contestModel->runningContest(); |
|
88 | 88 | foreach ($syncList as $syncContest) { |
89 | 89 | if (!isset($syncContest['vcid'])) { |
90 | - $contest = EloquentContestModel::find($syncContest['cid']); |
|
91 | - $contestRankRaw = $contest->rankRefresh(); |
|
90 | + $contest=EloquentContestModel::find($syncContest['cid']); |
|
91 | + $contestRankRaw=$contest->rankRefresh(); |
|
92 | 92 | $cid=$syncContest['cid']; |
93 | 93 | Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw); |
94 | 94 | Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw); |
95 | - continue ; |
|
95 | + continue; |
|
96 | 96 | } |
97 | - $className = "App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. |
|
98 | - $all_data = [ |
|
97 | + $className="App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. |
|
98 | + $all_data=[ |
|
99 | 99 | 'oj'=>"hdu", |
100 | 100 | 'vcid'=>$syncContest['vcid'], |
101 | 101 | 'gid'=>$syncContest['gid'], |
102 | 102 | 'cid'=>$syncContest['cid'], |
103 | 103 | ]; |
104 | - $hduSync = new $className($all_data); |
|
104 | + $hduSync=new $className($all_data); |
|
105 | 105 | $hduSync->crawlRank(); |
106 | 106 | $hduSync->crawlClarification(); |
107 | 107 | } |
108 | 108 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Remote Rank and Clarification"); |
109 | 109 | })->everyMinute()->description("Sync Remote Rank and Clarification"); |
110 | 110 | |
111 | - $schedule->call(function () { |
|
112 | - $contestModel = new ContestModel(); |
|
113 | - $syncList = $contestModel->runningContest(); |
|
111 | + $schedule->call(function() { |
|
112 | + $contestModel=new ContestModel(); |
|
113 | + $syncList=$contestModel->runningContest(); |
|
114 | 114 | foreach ($syncList as $syncContest) { |
115 | 115 | if (isset($syncContest['crawled'])) { |
116 | 116 | if (!$syncContest['crawled']) { |
117 | - $className = "App\\Babel\\Extension\\hdu\\Synchronizer"; |
|
118 | - $all_data = [ |
|
117 | + $className="App\\Babel\\Extension\\hdu\\Synchronizer"; |
|
118 | + $all_data=[ |
|
119 | 119 | 'oj'=>"hdu", |
120 | 120 | 'vcid'=>$syncContest['vcid'], |
121 | 121 | 'gid'=>$syncContest['gid'], |
122 | 122 | 'cid'=>$syncContest['cid'], |
123 | 123 | ]; |
124 | - $hduSync = new $className($all_data); |
|
124 | + $hduSync=new $className($all_data); |
|
125 | 125 | $hduSync->scheduleCrawl(); |
126 | 126 | $contestModel->updateCrawlStatus($syncContest['cid']); |
127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | } |
130 | 130 | })->everyMinute()->description("Sync Contest Problem"); |
131 | 131 | |
132 | - $schedule->call(function () { |
|
132 | + $schedule->call(function() { |
|
133 | 133 | $oidList=EloquentJudgeServerModel::column('oid'); |
134 | 134 | $babel=new Babel(); |
135 | 135 | foreach ($oidList as $oid) { |
@@ -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 |
@@ -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); |
@@ -64,7 +64,7 @@ |
||
64 | 64 | } |
65 | 65 | public function getLanguageConfigByLanguage($language, $spj=false) |
66 | 66 | { |
67 | - return $this->getLanguageConfigByKey($language.($spj?'_lang_spj_config':'_lang_config')); |
|
67 | + return $this->getLanguageConfigByKey($language.($spj ? '_lang_spj_config' : '_lang_config')); |
|
68 | 68 | } |
69 | 69 | public function getLanguageConfigByKey($key) |
70 | 70 | { |