@@ -19,5 +19,5 @@ |
||
| 19 | 19 | * |
| 20 | 20 | * @var int |
| 21 | 21 | */ |
| 22 | - protected $headers = Request::HEADER_X_FORWARDED_ALL; |
|
| 22 | + protected $headers=Request::HEADER_X_FORWARDED_ALL; |
|
| 23 | 23 | } |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | if (config('app.allow_oauth_temp_account')) { |
| 81 | 81 | try { |
| 82 | 82 | $createdUser=User::create([ |
| 83 | - 'name' => $aauth_user->name."#".substr($aauth_user->id , 0 , 4), |
|
| 83 | + 'name' => $aauth_user->name."#".substr($aauth_user->id, 0, 4), |
|
| 84 | 84 | 'email' => Str::random(16)."@temporary.email", |
| 85 | 85 | 'password' => '', |
| 86 | 86 | 'avatar' => '/static/img/avatar/default.png', |
@@ -296,7 +296,7 @@ |
||
| 296 | 296 | $preQuery=DB::table($this->table)->where('hide', '=', 0); |
| 297 | 297 | if ($filter['oj']) { |
| 298 | 298 | $OJ=OJ::find($filter['oj']); |
| 299 | - if(blank($OJ) || !$OJ->status) { |
|
| 299 | + if (blank($OJ) || !$OJ->status) { |
|
| 300 | 300 | return null; |
| 301 | 301 | } |
| 302 | 302 | $preQuery=$preQuery->where(["OJ"=>$filter['oj']]); |
@@ -299,7 +299,7 @@ |
||
| 299 | 299 | |
| 300 | 300 | public static function getTheme($id) { |
| 301 | 301 | if (!isset(self::$theme[$id])) { |
| 302 | - if(isset(self::$theme[config('app.editor_theme')])){ |
|
| 302 | + if (isset(self::$theme[config('app.editor_theme')])) { |
|
| 303 | 303 | return self::$theme[config('app.editor_theme')]; |
| 304 | 304 | } |
| 305 | 305 | return self::$theme['material-design-darker']; |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | Cache::tags(['bing', 'pic'])->put(date("Y-m-d"), "/static/img/themes/bing/".date("Y-m-d").".jpg"); |
| 126 | 126 | } |
| 127 | 127 | $ret["image"]=Cache::tags(['bing', 'pic'])->get(date("Y-m-d")); |
| 128 | - } catch(Exception $e) { |
|
| 128 | + } catch (Exception $e) { |
|
| 129 | 129 | $ret["image"]="/static/img/themes/material.png"; |
| 130 | 130 | } |
| 131 | 131 | return $ret; |
@@ -148,8 +148,8 @@ |
||
| 148 | 148 | $form->number('order', __('admin.dojos.order'))->default(0)->rules('required'); |
| 149 | 149 | $form->multipleSelect('precondition', __('admin.dojos.precondition'))->options(Dojo::all()->pluck('name', 'id')); |
| 150 | 150 | $form->hasMany('problems', __('admin.dojos.problems'), function(Form\NestedForm $form) { |
| 151 | - $form->select('problem_id', __('admin.dojos.problem'))->options(function ($pid) { |
|
| 152 | - $problem = Problem::find($pid); |
|
| 151 | + $form->select('problem_id', __('admin.dojos.problem'))->options(function($pid) { |
|
| 152 | + $problem=Problem::find($pid); |
|
| 153 | 153 | if ($problem) { |
| 154 | 154 | return [$problem->pid => $problem->readable_name]; |
| 155 | 155 | } |
@@ -139,8 +139,8 @@ |
||
| 139 | 139 | ])->default(1); |
| 140 | 140 | $form->image('img', 'Custom Group Focus Image')->uniqueName()->move("static/img/group"); |
| 141 | 141 | if ($form->isCreating()) { |
| 142 | - $form->select('leader_uid', 'Group Leader')->options(function ($id) { |
|
| 143 | - $user = User::find($id); |
|
| 142 | + $form->select('leader_uid', 'Group Leader')->options(function($id) { |
|
| 143 | + $user=User::find($id); |
|
| 144 | 144 | if ($user) { |
| 145 | 145 | return [$user->id => $user->readable_name]; |
| 146 | 146 | } |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | $form=new Form(new Contest); |
| 138 | 138 | $form->tab('Basic', function(Form $form) { |
| 139 | 139 | $form->select('gid', 'Contest Creator Group')->options(Group::all()->pluck('name', 'gid'))->required(); |
| 140 | - $form->select('assign_uid', 'Contest Assign User')->options(function ($id) { |
|
| 141 | - $user = User::find($id); |
|
| 140 | + $form->select('assign_uid', 'Contest Assign User')->options(function($id) { |
|
| 141 | + $user=User::find($id); |
|
| 142 | 142 | if ($user) { |
| 143 | 143 | return [$user->id => $user->readable_name]; |
| 144 | 144 | } |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | $ncodeArr[$alpha]=$alpha; |
| 211 | 211 | } |
| 212 | 212 | $form->select('ncode', 'Problem Alphabetical Index')->options($ncodeArr)->default("A")->required(); |
| 213 | - $form->select('pid', 'Problem')->options(function ($pid) { |
|
| 214 | - $problem = Problem::find($pid); |
|
| 213 | + $form->select('pid', 'Problem')->options(function($pid) { |
|
| 214 | + $problem=Problem::find($pid); |
|
| 215 | 215 | if ($problem) { |
| 216 | 216 | return [$problem->pid => $problem->readable_name]; |
| 217 | 217 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | public function show($id, Content $content) |
| 45 | 45 | { |
| 46 | 46 | $problem=Problem::findOrFail($id); |
| 47 | - if(!$problem->markdown || $problem->onlinejudge->ocode !== 'noj'){ |
|
| 47 | + if (!$problem->markdown || $problem->onlinejudge->ocode!=='noj') { |
|
| 48 | 48 | return abort('403', 'Problem managed by BABEL cannot be accessed by Admin Portal.'); |
| 49 | 49 | } |
| 50 | 50 | return $content |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function edit($id, Content $content) |
| 64 | 64 | { |
| 65 | 65 | $problem=Problem::findOrFail($id); |
| 66 | - if(!$problem->markdown || $problem->onlinejudge->ocode !== 'noj'){ |
|
| 66 | + if (!$problem->markdown || $problem->onlinejudge->ocode!=='noj') { |
|
| 67 | 67 | return abort('403', 'Problem managed by BABEL cannot be accessed by Admin Portal.'); |
| 68 | 68 | } |
| 69 | 69 | return $content |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $grid->model()->where([ |
| 112 | 112 | 'markdown'=>1, |
| 113 | 113 | 'OJ'=>OJ::where(['ocode'=>'noj'])->first()->oid, |
| 114 | - ])->orderBy('pcode','asc'); |
|
| 114 | + ])->orderBy('pcode', 'asc'); |
|
| 115 | 115 | $grid->column('pid', "ID")->sortable(); |
| 116 | 116 | $grid->column('pcode', "PCode")->editable()->sortable(); |
| 117 | 117 | $grid->title("Title")->editable(); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | 1 => 'YES', |
| 206 | 206 | ])->default(0)->rules('required'); |
| 207 | 207 | $form->clang('spj_src', 'SPJ Source Code'); |
| 208 | - if($form->isCreating()) { |
|
| 208 | + if ($form->isCreating()) { |
|
| 209 | 209 | $form->chunk_file('test_case')->rules('required'); |
| 210 | 210 | } else { |
| 211 | 211 | $form->chunk_file('test_case'); |
@@ -251,13 +251,13 @@ discard block |
||
| 251 | 251 | return $err('The SPJ problem must provide spj_src', 'create problem error'); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - $test_case = null; |
|
| 254 | + $test_case=null; |
|
| 255 | 255 | |
| 256 | - if(!is_null(request()->get('test_case'))) { |
|
| 257 | - $test_case = explode('http://fake.path/',request()->get('test_case'), 2)[1]; |
|
| 256 | + if (!is_null(request()->get('test_case'))) { |
|
| 257 | + $test_case=explode('http://fake.path/', request()->get('test_case'), 2)[1]; |
|
| 258 | 258 | $path=Storage::disk('temp')->path($test_case); |
| 259 | 259 | |
| 260 | - if (pathinfo($path, PATHINFO_EXTENSION) !== 'zip') { |
|
| 260 | + if (pathinfo($path, PATHINFO_EXTENSION)!=='zip') { |
|
| 261 | 261 | return $err('You must upload a zip file iuclude test case info and content.'); |
| 262 | 262 | } |
| 263 | 263 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $files[]=$filename; |
| 282 | 282 | } |
| 283 | 283 | $files_in=array_filter($files, function($filename) { |
| 284 | - return pathinfo($filename, PATHINFO_EXTENSION) == 'in'; |
|
| 284 | + return pathinfo($filename, PATHINFO_EXTENSION)=='in'; |
|
| 285 | 285 | }); |
| 286 | 286 | sort($files_in); |
| 287 | 287 | $testcase_index=1; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $files[]=$filename; |
| 317 | 317 | } |
| 318 | 318 | $files_in=array_filter($files, function($filename) { |
| 319 | - return pathinfo($filename, PATHINFO_EXTENSION) == 'in'; |
|
| 319 | + return pathinfo($filename, PATHINFO_EXTENSION)=='in'; |
|
| 320 | 320 | }); |
| 321 | 321 | sort($files_in); |
| 322 | 322 | $testcase_index=1; |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $form->spj_version="{$form->pcode}#".time(); |
| 377 | 377 | } |
| 378 | 378 | //Set default data |
| 379 | - if($form->isCreating() && empty($test_case)) { |
|
| 379 | + if ($form->isCreating() && empty($test_case)) { |
|
| 380 | 380 | $form->tot_score=0; |
| 381 | 381 | } |
| 382 | 382 | $form->markdown=true; |