@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $all_data=$request->all(); |
| 38 | 38 | |
| 39 | - if(($all_data['public'] ?? 0) && ($all_data['practice'] ?? 0)){ |
|
| 39 | + if (($all_data['public'] ?? 0) && ($all_data['practice'] ?? 0)) { |
|
| 40 | 40 | return ResponseModel::err(4007); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return ResponseModel::err(1003); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $cid = $contestModel->arrangeContest($all_data["gid"], [ |
|
| 70 | + $cid=$contestModel->arrangeContest($all_data["gid"], [ |
|
| 71 | 71 | "assign_uid"=>Auth::user()->id, |
| 72 | 72 | "name"=>$all_data["name"], |
| 73 | 73 | "description"=>$all_data["description"], |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | "public"=>$all_data["public"] ?? 0, |
| 78 | 78 | ], $problemSet); |
| 79 | 79 | |
| 80 | - return ResponseModel::success(200,'Successful!',$cid); |
|
| 80 | + return ResponseModel::success(200, 'Successful!', $cid); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function changeGroupName(Request $request) |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $groupModel=new GroupModel(); |
| 93 | 93 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 94 | - if ($clearance < 2){ |
|
| 94 | + if ($clearance<2) { |
|
| 95 | 95 | return ResponseModel::err(2001); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $groupModel=new GroupModel(); |
| 112 | 112 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 113 | - if ($clearance < 2){ |
|
| 113 | + if ($clearance<2) { |
|
| 114 | 114 | return ResponseModel::err(2001); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ($all_data["join_policy"] < 1 || $all_data["join_policy"] > 3){ |
|
| 117 | + if ($all_data["join_policy"]<1 || $all_data["join_policy"]>3) { |
|
| 118 | 118 | return ResponseModel::err(1007); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | 'gid' => 'required|integer', |
| 129 | 129 | ]); |
| 130 | 130 | |
| 131 | - $all_data = $request->all(); |
|
| 131 | + $all_data=$request->all(); |
|
| 132 | 132 | |
| 133 | 133 | if (!empty($request->file('img')) && $request->file('img')->isValid()) { |
| 134 | 134 | $extension=$request->file('img')->extension(); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $groupModel=new GroupModel(); |
| 142 | 142 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 143 | - if ($clearance < 2){ |
|
| 143 | + if ($clearance<2) { |
|
| 144 | 144 | return ResponseModel::err(2001); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -178,18 +178,18 @@ discard block |
||
| 178 | 178 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 179 | 179 | $target_clearance=$groupModel->judgeClearance($all_data["gid"], $all_data['uid']); |
| 180 | 180 | |
| 181 | - if($target_clearance == -3){ |
|
| 181 | + if ($target_clearance==-3) { |
|
| 182 | 182 | return ResponseModel::err(7004); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if($target_clearance >= $clearance || $clearance < 2 || $all_data['permission'] >= $clearance){ |
|
| 185 | + if ($target_clearance>=$clearance || $clearance<2 || $all_data['permission']>=$clearance) { |
|
| 186 | 186 | return ResponseModel::err(2001); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $groupModel->changeClearance($all_data['uid'], $all_data["gid"], $all_data['permission']); |
| 190 | 190 | |
| 191 | - $result_info = $groupModel->userProfile($all_data['uid'],$all_data["gid"]); |
|
| 192 | - return ResponseModel::success(200,null,$result_info); |
|
| 191 | + $result_info=$groupModel->userProfile($all_data['uid'], $all_data["gid"]); |
|
| 192 | + return ResponseModel::success(200, null, $result_info); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | public function generateContestAccount(Request $request) |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 270 | 270 | $targetClearance=$groupModel->judgeClearance($all_data["gid"], $all_data["uid"]); |
| 271 | 271 | if ($clearance>1) { |
| 272 | - if($targetClearance!=0) { |
|
| 272 | + if ($targetClearance!=0) { |
|
| 273 | 273 | return ResponseModel::err(7003); |
| 274 | 274 | } |
| 275 | 275 | $groupModel->changeClearance($all_data["uid"], $all_data["gid"], 1); |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | $groupModel=new GroupModel(); |
| 310 | 310 | $is_user=$groupModel->isUser($all_data["email"]); |
| 311 | - if(!$is_user) return ResponseModel::err(2006); |
|
| 311 | + if (!$is_user) return ResponseModel::err(2006); |
|
| 312 | 312 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 313 | - if($clearance<2) return ResponseModel::err(7002); |
|
| 313 | + if ($clearance<2) return ResponseModel::err(7002); |
|
| 314 | 314 | $targetClearance=$groupModel->judgeEmailClearance($all_data["gid"], $all_data["email"]); |
| 315 | - if($targetClearance!=-3) return ResponseModel::err(7003); |
|
| 315 | + if ($targetClearance!=-3) return ResponseModel::err(7003); |
|
| 316 | 316 | $groupModel->inviteMember($all_data["gid"], $all_data["email"]); |
| 317 | 317 | return ResponseModel::success(200); |
| 318 | 318 | } |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | $all_data=$request->all(); |
| 331 | 331 | |
| 332 | 332 | $groupModel=new GroupModel(); |
| 333 | - if($all_data["gcode"]=="create") return ResponseModel::err(7005); |
|
| 333 | + if ($all_data["gcode"]=="create") return ResponseModel::err(7005); |
|
| 334 | 334 | $is_group=$groupModel->isGroup($all_data["gcode"]); |
| 335 | - if($is_group) return ResponseModel::err(7006); |
|
| 335 | + if ($is_group) return ResponseModel::err(7006); |
|
| 336 | 336 | |
| 337 | 337 | $allow_extension=['jpg', 'png', 'jpeg', 'gif', 'bmp']; |
| 338 | 338 | if (!empty($request->file('img')) && $request->file('img')->isValid()) { |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | |
| 383 | 383 | $groupModel=new GroupModel(); |
| 384 | 384 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 385 | - if ($clearance < 2){ |
|
| 385 | + if ($clearance<2) { |
|
| 386 | 386 | return ResponseModel::err(2001); |
| 387 | 387 | } |
| 388 | 388 | $groupModel->createNotice($all_data["gid"], Auth::user()->id, $all_data["title"], $all_data["content"]); |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | $groupModel=new GroupModel(); |
| 403 | 403 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 404 | - if ($clearance < 2) { |
|
| 404 | + if ($clearance<2) { |
|
| 405 | 405 | return ResponseModel::err(7002); |
| 406 | 406 | } |
| 407 | - $tags = $groupModel->problemTags($all_data['gid'],$all_data['pid']); |
|
| 408 | - if(in_array($all_data['tag'],$tags)){ |
|
| 407 | + $tags=$groupModel->problemTags($all_data['gid'], $all_data['pid']); |
|
| 408 | + if (in_array($all_data['tag'], $tags)) { |
|
| 409 | 409 | return ResponseModel::err(7007); |
| 410 | 410 | } |
| 411 | 411 | |
@@ -443,20 +443,20 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | $groupModel=new GroupModel(); |
| 445 | 445 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
| 446 | - if ($clearance > 0) { |
|
| 447 | - switch($all_data['mode']){ |
|
| 446 | + if ($clearance>0) { |
|
| 447 | + switch ($all_data['mode']) { |
|
| 448 | 448 | case 'contest': |
| 449 | - $ret = $groupModel->groupMemberPracticeContestStat($all_data["gid"]); |
|
| 449 | + $ret=$groupModel->groupMemberPracticeContestStat($all_data["gid"]); |
|
| 450 | 450 | break; |
| 451 | 451 | case 'tag': |
| 452 | - $ret = $groupModel->groupMemberPracticeTagStat($all_data["gid"]); |
|
| 452 | + $ret=$groupModel->groupMemberPracticeTagStat($all_data["gid"]); |
|
| 453 | 453 | break; |
| 454 | 454 | default: |
| 455 | 455 | return ResponseModel::err(1007); |
| 456 | 456 | break; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - return ResponseModel::success(200,null,$ret); |
|
| 459 | + return ResponseModel::success(200, null, $ret); |
|
| 460 | 460 | } |
| 461 | 461 | return ResponseModel::err(7002); |
| 462 | 462 | } |
@@ -466,9 +466,9 @@ discard block |
||
| 466 | 466 | $request->validate([ |
| 467 | 467 | 'gid' => 'required|string', |
| 468 | 468 | ]); |
| 469 | - $gid = $request->input('gid'); |
|
| 469 | + $gid=$request->input('gid'); |
|
| 470 | 470 | $groupModel=new GroupModel(); |
| 471 | - if($groupModel->judgeClearance($gid,Auth::user()->id) < 2) { |
|
| 471 | + if ($groupModel->judgeClearance($gid, Auth::user()->id)<2) { |
|
| 472 | 472 | return ResponseModel::err(2001); |
| 473 | 473 | } |
| 474 | 474 | $groupModel->refreshElo($gid); |
@@ -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,62 +42,62 @@ 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 | - $schedule->call(function () { |
|
| 63 | - $contestModel = new ContestModel(); |
|
| 64 | - $syncList = $contestModel->runningContest(); |
|
| 62 | + $schedule->call(function() { |
|
| 63 | + $contestModel=new ContestModel(); |
|
| 64 | + $syncList=$contestModel->runningContest(); |
|
| 65 | 65 | foreach ($syncList as $syncContest) { |
| 66 | 66 | if (!isset($syncContest['vcid'])) { |
| 67 | 67 | $contestRankRaw=$contestModel->contestRankCache($syncContest['cid']); |
| 68 | 68 | $cid=$syncContest['cid']; |
| 69 | 69 | Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw); |
| 70 | 70 | Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw); |
| 71 | - continue ; |
|
| 71 | + continue; |
|
| 72 | 72 | } |
| 73 | - $className = "App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. |
|
| 74 | - $all_data = [ |
|
| 73 | + $className="App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. |
|
| 74 | + $all_data=[ |
|
| 75 | 75 | 'oj'=>"hdu", |
| 76 | 76 | 'vcid'=>$syncContest['vcid'], |
| 77 | 77 | 'gid'=>$syncContest['gid'], |
| 78 | 78 | 'cid'=>$syncContest['cid'], |
| 79 | 79 | ]; |
| 80 | - $hduSync = new $className($all_data); |
|
| 80 | + $hduSync=new $className($all_data); |
|
| 81 | 81 | $hduSync->crawlRank(); |
| 82 | 82 | $hduSync->crawlClarification(); |
| 83 | 83 | } |
| 84 | 84 | // file_put_contents(storage_path('app/task-schedule.output'),"Successfully Synced Remote Rank and Clarification"); |
| 85 | 85 | })->everyMinute()->description("Sync Remote Rank and Clarification"); |
| 86 | 86 | |
| 87 | - $schedule->call(function () { |
|
| 88 | - $contestModel = new ContestModel(); |
|
| 89 | - $syncList = $contestModel->runningContest(); |
|
| 87 | + $schedule->call(function() { |
|
| 88 | + $contestModel=new ContestModel(); |
|
| 89 | + $syncList=$contestModel->runningContest(); |
|
| 90 | 90 | foreach ($syncList as $syncContest) { |
| 91 | 91 | if (isset($syncContest['crawled'])) { |
| 92 | 92 | if (!$syncContest['crawled']) { |
| 93 | - $className = "App\\Babel\\Extension\\hdu\\Synchronizer"; |
|
| 94 | - $all_data = [ |
|
| 93 | + $className="App\\Babel\\Extension\\hdu\\Synchronizer"; |
|
| 94 | + $all_data=[ |
|
| 95 | 95 | 'oj'=>"hdu", |
| 96 | 96 | 'vcid'=>$syncContest['vcid'], |
| 97 | 97 | 'gid'=>$syncContest['gid'], |
| 98 | 98 | 'cid'=>$syncContest['cid'], |
| 99 | 99 | ]; |
| 100 | - $hduSync = new $className($all_data); |
|
| 100 | + $hduSync=new $className($all_data); |
|
| 101 | 101 | $hduSync->scheduleCrawl(); |
| 102 | 102 | $contestModel->updateCrawlStatus($syncContest['cid']); |
| 103 | 103 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | })->everyMinute()->description("Sync Contest Problem"); |
| 107 | 107 | |
| 108 | - $schedule->call(function () { |
|
| 108 | + $schedule->call(function() { |
|
| 109 | 109 | $oidList=EloquentJudgeServerModel::column('oid'); |
| 110 | 110 | $babel=new Babel(); |
| 111 | 111 | foreach ($oidList as $oid) { |
@@ -17,14 +17,14 @@ |
||
| 17 | 17 | * |
| 18 | 18 | * @var string |
| 19 | 19 | */ |
| 20 | - protected $signature = 'manage:resetpass {--uid=: the user you want to reset} {--digit=: the number of the password, should be larger than 8}'; |
|
| 20 | + protected $signature='manage:resetpass {--uid=: the user you want to reset} {--digit=: the number of the password, should be larger than 8}'; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * The console command description. |
| 24 | 24 | * |
| 25 | 25 | * @var string |
| 26 | 26 | */ |
| 27 | - protected $description = 'Reset user passwords of NOJ'; |
|
| 27 | + protected $description='Reset user passwords of NOJ'; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Create a new command instance. |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @var string |
| 16 | 16 | */ |
| 17 | - protected $signature = 'babel:install {extension : The package name of the extension} {--ignore-platform-reqs : Ignore the Platform Requirements when install}'; |
|
| 17 | + protected $signature='babel:install {extension : The package name of the extension} {--ignore-platform-reqs : Ignore the Platform Requirements when install}'; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * The console command description. |
| 21 | 21 | * |
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - protected $description = 'Install a given Babel Extension to NOJ'; |
|
| 24 | + protected $description='Install a given Babel Extension to NOJ'; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Create a new command instance. |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function handle() |
| 42 | 42 | { |
| 43 | - $extension = $this->argument('extension'); |
|
| 44 | - $ignoreReqs = $this->option('ignore-platform-reqs'); |
|
| 45 | - $output = new BufferedOutput(); |
|
| 43 | + $extension=$this->argument('extension'); |
|
| 44 | + $ignoreReqs=$this->option('ignore-platform-reqs'); |
|
| 45 | + $output=new BufferedOutput(); |
|
| 46 | 46 | $installerProvider="Installer"; |
| 47 | 47 | try { |
| 48 | 48 | $BabelConfig=json_decode(file_get_contents(babel_path("Extension/$extension/babel.json")), true); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | public static function create($oj, $installerProvider, $class) |
| 71 | 71 | { |
| 72 | - $className = "App\\Babel\\Extension\\$oj\\$installerProvider"; |
|
| 72 | + $className="App\\Babel\\Extension\\$oj\\$installerProvider"; |
|
| 73 | 73 | if (class_exists($className)) { |
| 74 | 74 | return new $className($class); |
| 75 | 75 | } else { |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @var string |
| 16 | 16 | */ |
| 17 | - protected $signature = 'babel:syncpro {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid= : The holding group} {--cid= : The contest in NOJ}'; |
|
| 17 | + protected $signature='babel:syncpro {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid= : The holding group} {--cid= : The contest in NOJ}'; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * The console command description. |
| 21 | 21 | * |
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - protected $description = 'Crawl contests for a given Babel Extension to NOJ'; |
|
| 24 | + protected $description='Crawl contests for a given Babel Extension to NOJ'; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Create a new command instance. |
@@ -40,18 +40,18 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function handle() |
| 42 | 42 | { |
| 43 | - $extension = $this->argument('extension'); |
|
| 44 | - $vcid = $this->option('vcid'); |
|
| 45 | - $gid = $this->option('gid'); |
|
| 46 | - $cid = $this->option('cid'); |
|
| 47 | - $className = "App\\Babel\\Extension\\$extension\\Synchronizer"; |
|
| 48 | - $all_data = [ |
|
| 43 | + $extension=$this->argument('extension'); |
|
| 44 | + $vcid=$this->option('vcid'); |
|
| 45 | + $gid=$this->option('gid'); |
|
| 46 | + $cid=$this->option('cid'); |
|
| 47 | + $className="App\\Babel\\Extension\\$extension\\Synchronizer"; |
|
| 48 | + $all_data=[ |
|
| 49 | 49 | 'oj'=>$extension, |
| 50 | 50 | 'vcid'=>$vcid, |
| 51 | 51 | 'gid'=>$gid, |
| 52 | 52 | 'cid'=>$cid, |
| 53 | 53 | ]; |
| 54 | - $Sync = new $className($all_data); |
|
| 54 | + $Sync=new $className($all_data); |
|
| 55 | 55 | $Sync->scheduleCrawl(); |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @var string |
| 16 | 16 | */ |
| 17 | - protected $signature = 'babel:update {extension : The package name of the extension}'; |
|
| 17 | + protected $signature='babel:update {extension : The package name of the extension}'; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * The console command description. |
| 21 | 21 | * |
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - protected $description = 'Update a given Babel Extension to NOJ'; |
|
| 24 | + protected $description='Update a given Babel Extension to NOJ'; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Create a new command instance. |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function handle() |
| 42 | 42 | { |
| 43 | - $extension = $this->argument('extension'); |
|
| 44 | - $output = new BufferedOutput(); |
|
| 43 | + $extension=$this->argument('extension'); |
|
| 44 | + $output=new BufferedOutput(); |
|
| 45 | 45 | $this->line("Updating <fg=green>$extension</>"); |
| 46 | 46 | try { |
| 47 | 47 | $BabelConfig=json_decode(file_get_contents(babel_path("Extension/$extension/babel.json")), true); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | if (!is_dir($dir)) { |
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | - $it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS); |
|
| 94 | - $files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); |
|
| 93 | + $it=new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS); |
|
| 94 | + $files=new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); |
|
| 95 | 95 | foreach ($files as $file) { |
| 96 | 96 | if ($file->isDir()) { |
| 97 | 97 | rmdir($file->getRealPath()); |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @var string |
| 16 | 16 | */ |
| 17 | - protected $signature = 'babel:require {extension : The package name of the extension} {--exception}'; |
|
| 17 | + protected $signature='babel:require {extension : The package name of the extension} {--exception}'; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * The console command description. |
| 21 | 21 | * |
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - protected $description = 'Download a given Babel Extension to NOJ'; |
|
| 24 | + protected $description='Download a given Babel Extension to NOJ'; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Create a new command instance. |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function handle() |
| 42 | 42 | { |
| 43 | - $extension = $this->argument('extension'); |
|
| 44 | - $exception = $this->option('exception'); |
|
| 45 | - $output = new BufferedOutput(); |
|
| 43 | + $extension=$this->argument('extension'); |
|
| 44 | + $exception=$this->option('exception'); |
|
| 45 | + $output=new BufferedOutput(); |
|
| 46 | 46 | if (is_dir(babel_path("Extension/$extension/"))) { |
| 47 | 47 | if (!$exception) { |
| 48 | 48 | $this->line("\n <bg=red;fg=white> Exception </> : <fg=yellow>An extension named <fg=green>$extension</> already took place, did you mean <fg=green>php artisan bable:update $extension</>?</>\n"); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | mkdir(babel_path("Tmp/$extension/")); |
| 75 | 75 | } |
| 76 | 76 | try { |
| 77 | - $zipFile = new ZipFile(); |
|
| 77 | + $zipFile=new ZipFile(); |
|
| 78 | 78 | $zipFile->openFile(babel_path("Tmp/$filename"))->extractTo(babel_path("Tmp/$extension/"))->close(); |
| 79 | 79 | $babelPath=glob_recursive(babel_path("Tmp/$extension/babel.json")); |
| 80 | 80 | if (empty($babelPath)) { |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | if (!is_dir($dir)) { |
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | - $it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS); |
|
| 127 | - $files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); |
|
| 126 | + $it=new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS); |
|
| 127 | + $files=new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); |
|
| 128 | 128 | foreach ($files as $file) { |
| 129 | 129 | if ($file->isDir()) { |
| 130 | 130 | rmdir($file->getRealPath()); |
@@ -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 { |
@@ -20,22 +20,22 @@ discard block |
||
| 20 | 20 | 'cid' => 'required|integer', |
| 21 | 21 | 'uid' => 'required|integer' |
| 22 | 22 | ]); |
| 23 | - $cid = $request->input('cid'); |
|
| 24 | - $uid = $request->input('uid'); |
|
| 23 | + $cid=$request->input('cid'); |
|
| 24 | + $uid=$request->input('uid'); |
|
| 25 | 25 | |
| 26 | - $groupModel = new GroupModel(); |
|
| 27 | - $contestModel = new ContestModel(); |
|
| 26 | + $groupModel=new GroupModel(); |
|
| 27 | + $contestModel=new ContestModel(); |
|
| 28 | 28 | |
| 29 | - $contest_info = $contestModel->basic($cid); |
|
| 30 | - if($contestModel->judgeClearance($cid,Auth::user()->id) != 3){ |
|
| 29 | + $contest_info=$contestModel->basic($cid); |
|
| 30 | + if ($contestModel->judgeClearance($cid, Auth::user()->id)!=3) { |
|
| 31 | 31 | return ResponseModel::err(2001); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if($groupModel->judgeClearance($contest_info['gid'],$uid) < 2){ |
|
| 34 | + if ($groupModel->judgeClearance($contest_info['gid'], $uid)<2) { |
|
| 35 | 35 | return ResponseModel::err(7004); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $contestModel->assignMember($cid,$uid); |
|
| 38 | + $contestModel->assignMember($cid, $uid); |
|
| 39 | 39 | return ResponseModel::success(200); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -44,30 +44,30 @@ discard block |
||
| 44 | 44 | $request->validate([ |
| 45 | 45 | 'cid' => 'required|integer', |
| 46 | 46 | ]); |
| 47 | - $cid = $request->input('cid'); |
|
| 47 | + $cid=$request->input('cid'); |
|
| 48 | 48 | |
| 49 | - $contestModel = new ContestModel(); |
|
| 50 | - $groupModel = new GroupModel(); |
|
| 49 | + $contestModel=new ContestModel(); |
|
| 50 | + $groupModel=new GroupModel(); |
|
| 51 | 51 | |
| 52 | - $contest_problems = $contestModel->problems($cid); |
|
| 53 | - $contest_detail = $contestModel->basic($cid); |
|
| 54 | - $contest_detail['problems'] = $contest_problems; |
|
| 55 | - $assign_uid = $contest_detail['assign_uid']; |
|
| 56 | - $clearance = $contestModel->judgeClearance($cid,Auth::user()->id); |
|
| 57 | - if($clearance != 3){ |
|
| 52 | + $contest_problems=$contestModel->problems($cid); |
|
| 53 | + $contest_detail=$contestModel->basic($cid); |
|
| 54 | + $contest_detail['problems']=$contest_problems; |
|
| 55 | + $assign_uid=$contest_detail['assign_uid']; |
|
| 56 | + $clearance=$contestModel->judgeClearance($cid, Auth::user()->id); |
|
| 57 | + if ($clearance!=3) { |
|
| 58 | 58 | return ResponseModel::err(2001); |
| 59 | 59 | } |
| 60 | - if($assign_uid != 0){ |
|
| 61 | - $assignee = $groupModel->userProfile($assign_uid,$contest_detail['gid']); |
|
| 62 | - }else{ |
|
| 63 | - $assignee = null; |
|
| 60 | + if ($assign_uid!=0) { |
|
| 61 | + $assignee=$groupModel->userProfile($assign_uid, $contest_detail['gid']); |
|
| 62 | + } else { |
|
| 63 | + $assignee=null; |
|
| 64 | 64 | } |
| 65 | - $ret = [ |
|
| 65 | + $ret=[ |
|
| 66 | 66 | 'contest_info' => $contest_detail, |
| 67 | 67 | 'assignee' => $assignee, |
| 68 | - 'is_admin' => $clearance == 3, |
|
| 68 | + 'is_admin' => $clearance==3, |
|
| 69 | 69 | ]; |
| 70 | - return ResponseModel::success(200,null,$ret); |
|
| 70 | + return ResponseModel::success(200, null, $ret); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function rejudge(Request $request) |
@@ -101,15 +101,15 @@ discard block |
||
| 101 | 101 | 'end_time' => 'required|date|after:begin_time', |
| 102 | 102 | 'description' => 'string' |
| 103 | 103 | ]); |
| 104 | - $all_data = $request->all(); |
|
| 105 | - $cid = $all_data['cid']; |
|
| 104 | + $all_data=$request->all(); |
|
| 105 | + $cid=$all_data['cid']; |
|
| 106 | 106 | |
| 107 | - $contestModel = new ContestModel(); |
|
| 108 | - if($contestModel->judgeClearance($all_data['cid'],Auth::user()->id) != 3){ |
|
| 107 | + $contestModel=new ContestModel(); |
|
| 108 | + if ($contestModel->judgeClearance($all_data['cid'], Auth::user()->id)!=3) { |
|
| 109 | 109 | return ResponseModel::err(2001); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if($contestModel->remainingTime($cid) > 0){ |
|
| 112 | + if ($contestModel->remainingTime($cid)>0) { |
|
| 113 | 113 | $problems=explode(",", $all_data["problems"]); |
| 114 | 114 | if (count($problems)>26) { |
| 115 | 115 | return ResponseModel::err(4002); |
@@ -126,32 +126,32 @@ discard block |
||
| 126 | 126 | ]; |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | - $allow_update = ['name','description','begin_time','end_time']; |
|
| 129 | + $allow_update=['name', 'description', 'begin_time', 'end_time']; |
|
| 130 | 130 | |
| 131 | - foreach($all_data as $key => $value){ |
|
| 132 | - if(!in_array($key,$allow_update)){ |
|
| 131 | + foreach ($all_data as $key => $value) { |
|
| 132 | + if (!in_array($key, $allow_update)) { |
|
| 133 | 133 | unset($all_data[$key]); |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | - $contestModel->contestUpdate($cid,$all_data,$problemSet); |
|
| 136 | + $contestModel->contestUpdate($cid, $all_data, $problemSet); |
|
| 137 | 137 | return ResponseModel::success(200); |
| 138 | - }else{ |
|
| 139 | - $allow_update = ['name','description']; |
|
| 138 | + } else { |
|
| 139 | + $allow_update=['name', 'description']; |
|
| 140 | 140 | |
| 141 | - foreach($all_data as $key => $value){ |
|
| 142 | - if(!in_array($key,$allow_update)){ |
|
| 141 | + foreach ($all_data as $key => $value) { |
|
| 142 | + if (!in_array($key, $allow_update)) { |
|
| 143 | 143 | unset($all_data[$key]); |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | - $contestModel->contestUpdate($cid,$all_data,false); |
|
| 147 | - return ResponseModel::success(200,' |
|
| 146 | + $contestModel->contestUpdate($cid, $all_data, false); |
|
| 147 | + return ResponseModel::success(200, ' |
|
| 148 | 148 | Successful! However, only the name and description of the match can be changed for the match that has been finished. |
| 149 | 149 | '); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - public function issueAnnouncement(Request $request){ |
|
| 154 | + public function issueAnnouncement(Request $request) { |
|
| 155 | 155 | $request->validate([ |
| 156 | 156 | 'cid' => 'required|integer', |
| 157 | 157 | 'title' => 'required|string|max:250', |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function replyClarification(Request $request){ |
|
| 174 | + public function replyClarification(Request $request) { |
|
| 175 | 175 | $request->validate([ |
| 176 | 176 | 'cid' => 'required|integer', |
| 177 | 177 | 'ccid' => 'required|integer', |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - public function setClarificationPublic(Request $request){ |
|
| 194 | + public function setClarificationPublic(Request $request) { |
|
| 195 | 195 | $request->validate([ |
| 196 | 196 | 'cid' => 'required|integer', |
| 197 | 197 | 'ccid' => 'required|integer', |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $groupModel=new GroupModel(); |
| 225 | 225 | $contestModel=new ContestModel(); |
| 226 | 226 | $verified=$contestModel->isVerified($all_data["cid"]); |
| 227 | - if(!$verified){ |
|
| 227 | + if (!$verified) { |
|
| 228 | 228 | return ResponseModel::err(2001); |
| 229 | 229 | } |
| 230 | 230 | $gid=$contestModel->gid($all_data["cid"]); |