@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | { |
21 | 21 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, Trackable; |
22 | 22 | |
23 | - public $tries = 1; |
|
23 | + public $tries=1; |
|
24 | 24 | protected $cid; |
25 | 25 | protected $config; |
26 | 26 | |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | public function __construct($cid, $config) |
34 | 34 | { |
35 | 35 | $this->prepareStatus(); |
36 | - $this->cid = $cid; |
|
37 | - $default = [ |
|
36 | + $this->cid=$cid; |
|
37 | + $default=[ |
|
38 | 38 | 'cover' => false, |
39 | 39 | 'advice' => false, |
40 | 40 | ]; |
41 | - $this->config = array_merge($default, $config); |
|
41 | + $this->config=array_merge($default, $config); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function handle() |
50 | 50 | { |
51 | - $cid = $this->cid; |
|
52 | - $config = $this->config; |
|
53 | - $accessToken = Str::random(32); |
|
51 | + $cid=$this->cid; |
|
52 | + $config=$this->config; |
|
53 | + $accessToken=Str::random(32); |
|
54 | 54 | |
55 | 55 | Cache::tags(['contest', 'pdfViewAccess', $cid])->put($accessToken, $config); |
56 | 56 | |
@@ -58,23 +58,23 @@ discard block |
||
58 | 58 | mkdir(storage_path("app/contest/pdf/"), 0777, true); |
59 | 59 | } |
60 | 60 | |
61 | - $record = Contest::find($cid); |
|
61 | + $record=Contest::find($cid); |
|
62 | 62 | |
63 | - $puppeteer = new Puppeteer; |
|
64 | - $browser = $puppeteer->launch([ |
|
63 | + $puppeteer=new Puppeteer; |
|
64 | + $browser=$puppeteer->launch([ |
|
65 | 65 | 'args' => ['--no-sandbox', '--disable-setuid-sandbox'], |
66 | 66 | ]); |
67 | 67 | |
68 | - $page = $browser->newPage(); |
|
68 | + $page=$browser->newPage(); |
|
69 | 69 | |
70 | - $response = $page->goto(route('contest.board.admin.pdf.view', [ |
|
70 | + $response=$page->goto(route('contest.board.admin.pdf.view', [ |
|
71 | 71 | 'cid' => $cid, |
72 | 72 | 'accessToken' => $accessToken, |
73 | 73 | ]), [ |
74 | 74 | 'waitUntil' => 'networkidle0' |
75 | 75 | ]); |
76 | 76 | |
77 | - if($response->status() != '200') { |
|
77 | + if ($response->status()!='200') { |
|
78 | 78 | throw new Exception('Cannot Access PDF Generated View Stream'); |
79 | 79 | } |
80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | 'timeout' => 120000 |
83 | 83 | ]); |
84 | 84 | |
85 | - if($config['renderer'] == 'blink') { |
|
85 | + if ($config['renderer']=='blink') { |
|
86 | 86 | $page->pdf([ |
87 | 87 | 'format' => 'A4', |
88 | 88 | 'path' => storage_path("app/contest/pdf/$cid.pdf"), |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | - $parsedHTML = $page->content(); |
|
96 | + $parsedHTML=$page->content(); |
|
97 | 97 | |
98 | 98 | $browser->close(); |
99 | 99 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | 'BaseURL' => route('contest.detail', ['cid' => $cid]), |
134 | 134 | ])->save(storage_path("app/contest/pdf/$cid.pdf")); |
135 | 135 | |
136 | - $record->pdf = 1; |
|
136 | + $record->pdf=1; |
|
137 | 137 | $record->save(); |
138 | 138 | } |
139 | 139 |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $all_data=$request->all(); |
89 | 89 | $filter=$all_data['filter']; |
90 | - $filter=Arr::where($filter, function ($value, $key) { |
|
90 | + $filter=Arr::where($filter, function($value, $key) { |
|
91 | 91 | return in_array($value, [ |
92 | 92 | "Judge Error", |
93 | 93 | "System Error", |
@@ -342,14 +342,14 @@ discard block |
||
342 | 342 | "config.formula"=>"required|string", |
343 | 343 | ]); |
344 | 344 | $cid=$request->input('cid'); |
345 | - $renderer = $request->input('config.renderer'); |
|
346 | - $formula = $request->input('config.formula'); |
|
347 | - if($renderer == 'blink') { |
|
348 | - if($formula != 'tex') { |
|
345 | + $renderer=$request->input('config.renderer'); |
|
346 | + $formula=$request->input('config.formula'); |
|
347 | + if ($renderer=='blink') { |
|
348 | + if ($formula!='tex') { |
|
349 | 349 | return ResponseModel::err(4011, 'Illegal Formula Rendering Option.'); |
350 | 350 | } |
351 | - } else if ($renderer == 'cpdf') { |
|
352 | - if($formula != 'svg' && $formula != 'png') { |
|
351 | + } else if ($renderer=='cpdf') { |
|
352 | + if ($formula!='svg' && $formula!='png') { |
|
353 | 353 | return ResponseModel::err(4011, 'Illegal Formula Rendering Option.'); |
354 | 354 | } |
355 | 355 | } else { |
@@ -133,8 +133,8 @@ |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | public function pdfView($cid) { |
136 | - $record = Contest::find($cid); |
|
137 | - $accessConfig = request()->accessConfig; |
|
136 | + $record=Contest::find($cid); |
|
137 | + $accessConfig=request()->accessConfig; |
|
138 | 138 | return view('pdf.contest.main', [ |
139 | 139 | 'conf' => $accessConfig, |
140 | 140 | 'contest' => [ |
@@ -18,11 +18,11 @@ |
||
18 | 18 | public function handle($request, Closure $next) |
19 | 19 | { |
20 | 20 | $contest=Contest::find($request->cid); |
21 | - if(blank($contest)) { |
|
21 | + if (blank($contest)) { |
|
22 | 22 | return abort(403, 'Contest Does Not Exist'); |
23 | 23 | } |
24 | - $accessConfig = Cache::tags(['contest', 'pdfViewAccess', $request->cid])->get($request->accessToken); |
|
25 | - if(blank($accessConfig)) { |
|
24 | + $accessConfig=Cache::tags(['contest', 'pdfViewAccess', $request->cid])->get($request->accessToken); |
|
25 | + if (blank($accessConfig)) { |
|
26 | 26 | return abort(403, 'Access Token Expired'); |
27 | 27 | } |
28 | 28 | Cache::tags(['contest', 'pdfViewAccess', $request->cid])->forget($request->accessToken); |