@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | protected function mapWebRoutes() |
53 | 53 | { |
54 | 54 | Route::middleware('web') |
55 | - ->namespace($this->namespace) |
|
56 | - ->group(base_path('routes/web.php')); |
|
55 | + ->namespace($this->namespace) |
|
56 | + ->group(base_path('routes/web.php')); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | protected function mapApiRoutes() |
67 | 67 | { |
68 | 68 | Route::prefix('api') |
69 | - ->middleware('api') |
|
70 | - ->namespace($this->namespace) |
|
71 | - ->group(base_path('routes/api.php')); |
|
69 | + ->middleware('api') |
|
70 | + ->namespace($this->namespace) |
|
71 | + ->group(base_path('routes/api.php')); |
|
72 | 72 | } |
73 | 73 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $statusCode=200; |
15 | 15 | } |
16 | 16 | $output=[ |
17 | - 'ret' => $statusCode, |
|
17 | + 'ret' => $statusCode, |
|
18 | 18 | 'desc' => is_null($desc) ? self::desc($statusCode) : $desc, |
19 | 19 | 'data' => $data |
20 | 20 | ]; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $statusCode=1000; |
28 | 28 | } |
29 | 29 | $output=[ |
30 | - 'ret' => $statusCode, |
|
30 | + 'ret' => $statusCode, |
|
31 | 31 | 'desc' => is_null($desc) ? self::desc($statusCode) : $desc, |
32 | 32 | 'data' => $data |
33 | 33 | ]; |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | '451' => "Unavailable For Legal Reasons", |
45 | 45 | |
46 | 46 | '1000' => "Unspecified Response", /** Under normal condictions those errors shouldn't been displayed to end users |
47 | - * unless they attempt to do so, some submissions should be intercepted |
|
48 | - * by the frontend before the request sended |
|
49 | - */ |
|
47 | + * unless they attempt to do so, some submissions should be intercepted |
|
48 | + * by the frontend before the request sended |
|
49 | + */ |
|
50 | 50 | '1001' => "Internal Sever Error", |
51 | 51 | '1002' => "Service Currently Unavailable", |
52 | 52 | '1003' => "Missing Params", |
@@ -265,7 +265,7 @@ |
||
265 | 265 | $query=$query->where(["practice"=>$filter['practice']]); |
266 | 266 | } |
267 | 267 | $query->where('public', 1) |
268 | - ->where('audit_status', 1); |
|
268 | + ->where('audit_status', 1); |
|
269 | 269 | } |
270 | 270 | ) |
271 | 271 | ->orWhere( |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $paginator=$paginator->where(["practice"=>$filter['practice']]); |
229 | 229 | } |
230 | 230 | $paginator=$paginator ->paginate(10); |
231 | - }elseif ($filter['public']=='0') { |
|
231 | + } elseif ($filter['public']=='0') { |
|
232 | 232 | $paginator=DB::table('group_member') |
233 | 233 | ->groupBy('contest.cid') |
234 | 234 | ->select('contest.*') |
@@ -1563,8 +1563,7 @@ discard block |
||
1563 | 1563 | if (time()>$chache['end_time']) { |
1564 | 1564 | $this->storeContestRankInMySQL($cid, $ret); |
1565 | 1565 | } |
1566 | - } |
|
1567 | - else { |
|
1566 | + } else { |
|
1568 | 1567 | $ret=[]; |
1569 | 1568 | $chache=[]; |
1570 | 1569 | $chache['contest_info']=DB::table("contest")->where("cid", $cid)->first(); |
@@ -1663,8 +1662,9 @@ discard block |
||
1663 | 1662 | { |
1664 | 1663 | $id=count($ret); |
1665 | 1664 | foreach ($ret as $key => $r) { |
1666 | - if ($r['uid']==$uid) |
|
1667 | - $id=$key; |
|
1665 | + if ($r['uid']==$uid) { |
|
1666 | + $id=$key; |
|
1667 | + } |
|
1668 | 1668 | } |
1669 | 1669 | if ($contest_info["rule"]==1) { |
1670 | 1670 | // ACM/ICPC Mode |
@@ -1828,8 +1828,7 @@ discard block |
||
1828 | 1828 | return DB::table("contest_clarification")->where('ccid', '=', $ccid)->update([ |
1829 | 1829 | "public"=>1 |
1830 | 1830 | ]); |
1831 | - } |
|
1832 | - else |
|
1831 | + } else |
|
1833 | 1832 | { |
1834 | 1833 | return DB::table("contest_clarification")->where('ccid', '=', $ccid)->update([ |
1835 | 1834 | "public"=>0 |
@@ -2004,12 +2003,10 @@ discard block |
||
2004 | 2003 | $zipFile |
2005 | 2004 | ->saveAsFile(base_path('storage/app/private/'.$path.$cid.".zip")); // save the archive to a file |
2006 | 2005 | //->extractTo(base_path('storage/app/private/'.$path)); // extract files to the specified directory |
2007 | - } |
|
2008 | - catch (\PhpZip\Exception\ZipException $e) { |
|
2006 | + } catch (\PhpZip\Exception\ZipException $e) { |
|
2009 | 2007 | // handle exception |
2010 | 2008 | Log::debug($e); |
2011 | - } |
|
2012 | - finally { |
|
2009 | + } finally { |
|
2013 | 2010 | $zipFile->close(); |
2014 | 2011 | } |
2015 | 2012 | } |
@@ -150,10 +150,10 @@ |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
153 | - * Show the Problem Discussion Page. |
|
154 | - * |
|
155 | - * @return Response |
|
156 | - */ |
|
153 | + * Show the Problem Discussion Page. |
|
154 | + * |
|
155 | + * @return Response |
|
156 | + */ |
|
157 | 157 | public function discussion($pcode) |
158 | 158 | { |
159 | 159 | //TODO |
@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | $cid=$this->cid; |
58 | 58 | $contest=EloquentContestModel::find($cid); |
59 | 59 | |
60 | - if (!$contest->isJudgingComplete()) throw new Exception('Judging Incompleted'); |
|
60 | + if (!$contest->isJudgingComplete()) { |
|
61 | + throw new Exception('Judging Incompleted'); |
|
62 | + } |
|
61 | 63 | |
62 | 64 | $acceptedSubmissions=$contest->submissions->whereIn('verdict', [ |
63 | 65 | 'Accepted', |
@@ -79,8 +81,11 @@ discard block |
||
79 | 81 | $lang=$this->supportLang[$lang]; |
80 | 82 | $ext=$lang; |
81 | 83 | Storage::put("contest/anticheat/$cid/raw/$prob/$lang/[$submission->uid][$submission->sid].$ext", $submission->solution); |
82 | - if (!isset($probLangs[$prob][$lang])) $probLangs[$prob][$lang]=1; |
|
83 | - else $probLangs[$prob][$lang]++; |
|
84 | + if (!isset($probLangs[$prob][$lang])) { |
|
85 | + $probLangs[$prob][$lang]=1; |
|
86 | + } else { |
|
87 | + $probLangs[$prob][$lang]++; |
|
88 | + } |
|
84 | 89 | $totProb++; |
85 | 90 | } |
86 | 91 | } |
@@ -148,13 +153,19 @@ discard block |
||
148 | 153 | private function afterWork($cid, $prob, $lang, $rawContent) |
149 | 154 | { |
150 | 155 | foreach (preg_split('~[\r\n]+~', $rawContent) as $line) { |
151 | - if (blank($line) or ctype_space($line)) continue; |
|
156 | + if (blank($line) or ctype_space($line)) { |
|
157 | + continue; |
|
158 | + } |
|
152 | 159 | // [3057][64659].c++ consists for 100 % of [3057][64679].c++ material |
153 | 160 | $line=explode('%', $line); |
154 | - if (!isset($line[1])) continue; |
|
161 | + if (!isset($line[1])) { |
|
162 | + continue; |
|
163 | + } |
|
155 | 164 | [$uid1, $sid1, $percentage]=sscanf($line[0], "[%d][%d].$lang consists for %d "); |
156 | 165 | [$uid2, $sid2]=sscanf($line[1], " of [%d][%d].$lang material"); |
157 | - if ($uid1==$uid2) continue; |
|
166 | + if ($uid1==$uid2) { |
|
167 | + continue; |
|
168 | + } |
|
158 | 169 | $username1=User::find($uid1)->name; |
159 | 170 | $username2=User::find($uid2)->name; |
160 | 171 | $this->retArr[]=[ |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | - * @return array |
|
33 | - */ |
|
32 | + * @return array |
|
33 | + */ |
|
34 | 34 | public function registerEvents(): array |
35 | 35 | { |
36 | 36 | return [ |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * @return \Illuminate\Support\Collection |
|
51 | - */ |
|
50 | + * @return \Illuminate\Support\Collection |
|
51 | + */ |
|
52 | 52 | public function collection() |
53 | 53 | { |
54 | 54 | $maxium=$this->config['maxium'] ?? false; |
@@ -96,7 +96,9 @@ |
||
96 | 96 | $groupModel=new GroupModel(); |
97 | 97 | $basic_info=$groupModel->details($gcode); |
98 | 98 | $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id); |
99 | - if ($clearance<1) return Redirect::route('group.detail', ['gcode' => $gcode]); |
|
99 | + if ($clearance<1) { |
|
100 | + return Redirect::route('group.detail', ['gcode' => $gcode]); |
|
101 | + } |
|
100 | 102 | $group_info=$groupModel->details($gcode); |
101 | 103 | return view('group.settings.analysis', [ |
102 | 104 | 'page_title'=>"Group Analysis", |
@@ -184,9 +184,13 @@ |
||
184 | 184 | $all_data=$request->all(); |
185 | 185 | |
186 | 186 | $groupModel=new OutdatedGroupModel(); |
187 | - if ($all_data["gcode"]=="create") return ResponseModel::err(7005); |
|
187 | + if ($all_data["gcode"]=="create") { |
|
188 | + return ResponseModel::err(7005); |
|
189 | + } |
|
188 | 190 | $is_group=$groupModel->isGroup($all_data["gcode"]); |
189 | - if ($is_group) return ResponseModel::err(7006); |
|
191 | + if ($is_group) { |
|
192 | + return ResponseModel::err(7006); |
|
193 | + } |
|
190 | 194 | |
191 | 195 | $allow_extension=['jpg', 'png', 'jpeg', 'gif', 'bmp']; |
192 | 196 | if (!empty($request->file('img')) && $request->file('img')->isValid()) { |
@@ -247,11 +247,17 @@ |
||
247 | 247 | |
248 | 248 | $groupModel=new GroupModel(); |
249 | 249 | $is_user=$groupModel->isUser($all_data["email"]); |
250 | - if (!$is_user) return ResponseModel::err(2006); |
|
250 | + if (!$is_user) { |
|
251 | + return ResponseModel::err(2006); |
|
252 | + } |
|
251 | 253 | $clearance=$groupModel->judgeClearance($all_data["gid"], Auth::user()->id); |
252 | - if ($clearance<2) return ResponseModel::err(7002); |
|
254 | + if ($clearance<2) { |
|
255 | + return ResponseModel::err(7002); |
|
256 | + } |
|
253 | 257 | $targetClearance=$groupModel->judgeEmailClearance($all_data["gid"], $all_data["email"]); |
254 | - if ($targetClearance!=-3) return ResponseModel::err(7003); |
|
258 | + if ($targetClearance!=-3) { |
|
259 | + return ResponseModel::err(7003); |
|
260 | + } |
|
255 | 261 | $groupModel->inviteMember($all_data["gid"], $all_data["email"]); |
256 | 262 | $basic=$groupModel->basic($all_data['gid']); |
257 | 263 | $url=route('group.detail', ['gcode' => $basic['gcode']]); |