Passed
Push — master ( ab441b...e12848 )
by John
05:27 queued 10s
created
app/Http/Controllers/Group/AdminController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     public function settings($gcode)
23 23
     {
24
-        return Redirect::route('group.settings.general', ['gcode' => $gcode]);;
24
+        return Redirect::route('group.settings.general', ['gcode' => $gcode]); ;
25 25
     }
26 26
 
27 27
     /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function settingsReturn($gcode)
33 33
     {
34
-        return Redirect::route('group.detail', ['gcode' => $gcode]);;
34
+        return Redirect::route('group.detail', ['gcode' => $gcode]); ;
35 35
     }
36 36
 
37 37
     /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return Response
62 62
      */
63
-    public function problems($gcode){
64
-        $groupModel = new GroupModel();
65
-        $group_info = $groupModel->details($gcode);
66
-        $problems = $groupModel->problems($group_info['gid']);
63
+    public function problems($gcode) {
64
+        $groupModel=new GroupModel();
65
+        $group_info=$groupModel->details($gcode);
66
+        $problems=$groupModel->problems($group_info['gid']);
67 67
         $basic_info=$groupModel->details($gcode);
68 68
         return view('group.settings.problems', [
69 69
             'page_title'=>"Group Problems",
Please login to merge, or discard this patch.
app/Http/Middleware/User/Banned.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,25 +17,25 @@
 block discarded – undo
17 17
     public function handle($request, Closure $next)
18 18
     {
19 19
         //check login
20
-        if(!Auth::check()){
20
+        if (!Auth::check()) {
21 21
             return $next($request);
22 22
         }
23
-        $user = Auth::user();
24
-        $banned = $user->banneds()->orderBy('removed_at', 'desc')->first();
23
+        $user=Auth::user();
24
+        $banned=$user->banneds()->orderBy('removed_at', 'desc')->first();
25 25
         //check if there are any banned records
26
-        if(empty($banned)) {
26
+        if (empty($banned)) {
27 27
             return $next($request);
28 28
         }
29 29
         //check the time of the last record
30
-        if(strtotime($banned->removed_at) <= time()){
30
+        if (strtotime($banned->removed_at)<=time()) {
31 31
             return $next($request);
32 32
         }
33 33
         //return error page
34
-        if($request->method() == 'GET'){
35
-            return response()->view('errors.451',[
34
+        if ($request->method()=='GET') {
35
+            return response()->view('errors.451', [
36 36
                 'description' => "Your account is currently blocked and will remain so until {$banned->removed_at}. Here's why: {$banned->reason}",
37 37
             ]);
38
-        }else{
38
+        } else {
39 39
             return response()->json([
40 40
                 'ret' => 451,
41 41
                 'desc' => 'Unavailable For Legal Reasons',
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
             return response()->view('errors.451',[
36 36
                 'description' => "Your account is currently blocked and will remain so until {$banned->removed_at}. Here's why: {$banned->reason}",
37 37
             ]);
38
-        }else{
38
+        } else{
39 39
             return response()->json([
40 40
                 'ret' => 451,
41 41
                 'desc' => 'Unavailable For Legal Reasons',
Please login to merge, or discard this patch.
app/Http/Middleware/Group/Banned.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@
 block discarded – undo
17 17
      */
18 18
     public function handle($request, Closure $next)
19 19
     {
20
-        $gcode = $request->gcode;
21
-        $group = Group::where('gcode',$gcode)->first();
22
-        $banneds = $group->banneds()->where('removed_at','>',date('Y-m-d H:i:s'))->first();
23
-        $user = Auth::user();
24
-        if(!empty($banneds) && $user->id != $group->leader->id) {
25
-            return response()->view('errors.451',[
20
+        $gcode=$request->gcode;
21
+        $group=Group::where('gcode', $gcode)->first();
22
+        $banneds=$group->banneds()->where('removed_at', '>', date('Y-m-d H:i:s'))->first();
23
+        $user=Auth::user();
24
+        if (!empty($banneds) && $user->id!=$group->leader->id) {
25
+            return response()->view('errors.451', [
26 26
                 'description' => 'This group is currently banned. Please contact the group administrator.'
27 27
             ]);
28 28
         }
Please login to merge, or discard this patch.
app/Http/Middleware/Group/Exists.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@
 block discarded – undo
16 16
      */
17 17
     public function handle($request, Closure $next)
18 18
     {
19
-        $gcode = $request->gcode;
20
-        $group = Group::where('gcode',$gcode)->first();
21
-        if(!empty($group)){
19
+        $gcode=$request->gcode;
20
+        $group=Group::where('gcode', $gcode)->first();
21
+        if (!empty($group)) {
22 22
             return $next($request);
23
-        }else{
23
+        } else {
24 24
             return redirect('/group');
25 25
         }
26 26
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
         $group = Group::where('gcode',$gcode)->first();
21 21
         if(!empty($group)){
22 22
             return $next($request);
23
-        }else{
23
+        } else{
24 24
             return redirect('/group');
25 25
         }
26 26
 
Please login to merge, or discard this patch.
app/Admin/Controllers/AbuseController.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @var string
25 25
      */
26
-    protected $title = 'Abuses';
26
+    protected $title='Abuses';
27 27
 
28 28
     /**
29 29
      * Make a grid builder.
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     protected function grid()
34 34
     {
35
-        $grid = new Grid(new Abuse);
35
+        $grid=new Grid(new Abuse);
36 36
 
37 37
         $grid->column('id', __('Id'));
38 38
         $grid->column('title', __('Title'));
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function detail($id)
60 60
     {
61
-        $show = new Show(Abuse::findOrFail($id));
61
+        $show=new Show(Abuse::findOrFail($id));
62 62
 
63 63
         $show->field('id', __('Id'));
64 64
         $show->field('title', __('Title'));
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     protected function form()
83 83
     {
84
-        $form = new Form(new Abuse);
84
+        $form=new Form(new Abuse);
85 85
 
86 86
         $form->text('title', __('Title'));
87 87
         $form->number('cause', __('Cause'));
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 
93 93
         $form->ignore(['created_at']);
94 94
 
95
-        $form->saving(function (Form $form) {
96
-            $abuse = $form->model();
95
+        $form->saving(function(Form $form) {
96
+            $abuse=$form->model();
97 97
             //get gategory and subject id
98
-            $regex = '/^([A-Za-z]+) #(\d+)/';
99
-            $matches = [];
100
-            preg_match($regex,$abuse->title,$matches);
101
-            $category = array_search(strtolower($matches[1]),Abuse::$supportCategory);
102
-            $subject_id = (int)$matches[2];
103
-            switch($abuse->category) {
98
+            $regex='/^([A-Za-z]+) #(\d+)/';
99
+            $matches=[];
100
+            preg_match($regex, $abuse->title, $matches);
101
+            $category=array_search(strtolower($matches[1]), Abuse::$supportCategory);
102
+            $subject_id=(int) $matches[2];
103
+            switch ($abuse->category) {
104 104
                 case 0:
105
-                    $gid = $subject_id;
106
-                    $group = Group::find($gid);
107
-                    if(empty($group)) {
108
-                        return ;
105
+                    $gid=$subject_id;
106
+                    $group=Group::find($gid);
107
+                    if (empty($group)) {
108
+                        return;
109 109
                     }
110
-                    if($form->audit) {
111
-                        $ban_time = request()->created_at;
110
+                    if ($form->audit) {
111
+                        $ban_time=request()->created_at;
112 112
                         sendMessage([
113 113
                             'sender'    => 1,
114 114
                             'receiver'  => $abuse->user_id,
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
                             'reason'     => $abuse->supplement,
129 129
                             'removed_at' => $ban_time
130 130
                         ]);
131
-                        return ;
132
-                    }else{
131
+                        return;
132
+                    } else {
133 133
                         sendMessage([
134 134
                             'sender'    => 1,
135 135
                             'receiver'  => $abuse->user_id,
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
                             'content'   => "Hi, Dear **{$abuse->user->name}**,\n\n We have checked your Abuse report about group **[{$group->name}]({$group->link})**.\n\n However, we regret to say that the information you submitted is not sufficient for us to take action.\n\n Of course, we will continue to follow up the investigation.\n\n Thank you for your contribution to our community environment.\n\n Sincerely, NOJ"
138 138
                         ]);
139 139
                         $abuse->delete();
140
-                        return ;
140
+                        return;
141 141
                     }
142 142
                     return;
143 143
                 case 1:
144
-                    $ban_time = request()->created_at;
144
+                    $ban_time=request()->created_at;
145 145
                     UserBanned::create([
146 146
                         'abuse_id'   => $abuse->id,
147 147
                         'user_id'    => $subject_id,
@@ -170,15 +170,15 @@  discard block
 block discarded – undo
170 170
 
171 171
     protected function check_form()
172 172
     {
173
-        $form = new Form(new Abuse);
174
-        $form->display('id',__('Abuse id'));
173
+        $form=new Form(new Abuse);
174
+        $form->display('id', __('Abuse id'));
175 175
         $form->display('title', __('Title'));
176 176
         $form->display('cause', __('Cause'));
177 177
         $form->display('supplement', __('Supplement'));
178 178
         $form->display('link', __('Group Link'));
179 179
         $form->display('user_id', __('Submitter'));
180
-        $form->radio('audit','result')->options(['0' => 'Reject', '1'=> 'Pass']);
181
-        $form->datetime('created_at','ban until');
180
+        $form->radio('audit', 'result')->options(['0' => 'Reject', '1'=> 'Pass']);
181
+        $form->datetime('created_at', 'ban until');
182 182
 
183 183
         return $form;
184 184
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
                             'removed_at' => $ban_time
130 130
                         ]);
131 131
                         return ;
132
-                    }else{
132
+                    } else{
133 133
                         sendMessage([
134 134
                             'sender'    => 1,
135 135
                             'receiver'  => $abuse->user_id,
Please login to merge, or discard this patch.
app/Admin/Controllers/ProblemController.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -142,19 +142,19 @@  discard block
 block discarded – undo
142 142
      *
143 143
      * @return Form
144 144
      */
145
-    protected function form($create = false)
145
+    protected function form($create=false)
146 146
     {
147 147
         $form=new Form(new EloquentProblemModel);
148 148
         $form->model()->makeVisible('password');
149
-        $form->tab('Basic', function(Form $form){
149
+        $form->tab('Basic', function(Form $form) {
150 150
             $form->text('pid')->readonly();
151 151
             $form->text('pcode')->rules('required');
152 152
             $form->text('title')->rules('required');
153 153
             $form->text('time_limit')->rules('required');
154 154
             $form->text('memory_limit')->rules('required');
155 155
             $form->textarea('description')->rows(5);
156
-            $form->textarea('input','Sample Input')->rows(3);
157
-            $form->textarea('output','Sample Output')->rows(3);
156
+            $form->textarea('input', 'Sample Input')->rows(3);
157
+            $form->textarea('output', 'Sample Output')->rows(3);
158 158
             $form->textarea('note')->rows(2);
159 159
             $form->display('OJ');
160 160
             $form->display('update_date');
@@ -170,64 +170,64 @@  discard block
 block discarded – undo
170 170
             $form->file('test_case');
171 171
             $form->ignore(['test_case']);
172 172
         });
173
-        if($create){
174
-            $form->tools(function (Form\Tools $tools) {
173
+        if ($create) {
174
+            $form->tools(function(Form\Tools $tools) {
175 175
                 $tools->add('<a href="/'.config('admin.route.prefix').'/problems/import" class="btn btn-sm btn-success" style="margin-right:1rem"><i class="MDI file-powerpoint-box"></i>&nbsp;&nbsp;Import from file</a>');
176 176
             });
177 177
         }
178
-        $form->saving(function (Form $form){
179
-            $err = function ($msg) {
180
-                $error = new MessageBag([
178
+        $form->saving(function(Form $form) {
179
+            $err=function($msg) {
180
+                $error=new MessageBag([
181 181
                     'title'   => 'Test case file parse faild.',
182 182
                     'message' => $msg,
183 183
                 ]);
184 184
                 return back()->with(compact('error'));
185 185
             };
186
-            $pcode = $form->pcode;
187
-            $p = EloquentProblemModel::where('pcode',$pcode)->first();
188
-            $pid = $form->pid ?? null;
189
-            if(!empty($p) && $p->pid != $pid){
190
-                $error = new MessageBag([
186
+            $pcode=$form->pcode;
187
+            $p=EloquentProblemModel::where('pcode', $pcode)->first();
188
+            $pid=$form->pid ?? null;
189
+            if (!empty($p) && $p->pid!=$pid) {
190
+                $error=new MessageBag([
191 191
                     'title'   => 'Error occur.',
192 192
                     'message' => 'Pcode has been token',
193 193
                 ]);
194 194
                 return back()->with(compact('error'));
195 195
             }
196
-            $test_case = \request()->file('test_case');
197
-            if(!empty($test_case)){
198
-                if($test_case->extension() != 'zip'){
196
+            $test_case=\request()->file('test_case');
197
+            if (!empty($test_case)) {
198
+                if ($test_case->extension()!='zip') {
199 199
                     $err('You must upload a zip file iuclude test case info and content.');
200 200
                 }
201
-                $path = $test_case->path();
202
-                $zip = new ZipArchive;
203
-                if($zip->open($path) !== true) {
201
+                $path=$test_case->path();
202
+                $zip=new ZipArchive;
203
+                if ($zip->open($path)!==true) {
204 204
                     $err('You must upload a zip file without encrypt and can open successfully.');
205 205
                 };
206
-                if(($zip->getFromName('info')) === false){
206
+                if (($zip->getFromName('info'))===false) {
207 207
                     $err('The zip files must include a file named info including info of test cases, and the format can see ZsgsDesign/NOJ wiki.');
208 208
                 };
209
-                $test_case_info = json_decode($zip->getFromName('info'),true);
210
-                $test_cases = $test_case_info['test_cases'];
211
-                foreach($test_cases as $index => $case) {
212
-                    if(!isset($case['input_name']) || !isset($case['output_name'])) {
209
+                $test_case_info=json_decode($zip->getFromName('info'), true);
210
+                $test_cases=$test_case_info['test_cases'];
211
+                foreach ($test_cases as $index => $case) {
212
+                    if (!isset($case['input_name']) || !isset($case['output_name'])) {
213 213
                         $err("Test case index {$index}: configuration missing input/output files name.");
214 214
                     }
215
-                    if($zip->getFromName($case['input_name']) === false || $zip->getFromName($case['output_name']) === false ) {
215
+                    if ($zip->getFromName($case['input_name'])===false || $zip->getFromName($case['output_name'])===false) {
216 216
                         $err("Test case index {$index}: missing input/output files that record in the configuration.");
217 217
                     }
218 218
                 }
219
-                if(!empty($form->pid)){
220
-                    $problem = EloquentProblemModel::find($form->pid);
221
-                    if(!empty($problem)){
222
-                        $pcode = $problem->pcode;
223
-                    }else{
224
-                        $pcode = $form->pcode;
219
+                if (!empty($form->pid)) {
220
+                    $problem=EloquentProblemModel::find($form->pid);
221
+                    if (!empty($problem)) {
222
+                        $pcode=$problem->pcode;
223
+                    } else {
224
+                        $pcode=$form->pcode;
225 225
                     }
226
-                }else{
227
-                    $pcode = $form->pcode;
226
+                } else {
227
+                    $pcode=$form->pcode;
228 228
                 }
229 229
 
230
-                if(Storage::exists(base_path().'/storage/test_case/'.$pcode)){
230
+                if (Storage::exists(base_path().'/storage/test_case/'.$pcode)) {
231 231
                     Storage::deleteDirectory(base_path().'/storage/test_case/'.$pcode);
232 232
                 }
233 233
                 Storage::makeDirectory(base_path().'/storage/test_case/'.$pcode);
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -220,10 +220,10 @@
 block discarded – undo
220 220
                     $problem = EloquentProblemModel::find($form->pid);
221 221
                     if(!empty($problem)){
222 222
                         $pcode = $problem->pcode;
223
-                    }else{
223
+                    } else{
224 224
                         $pcode = $form->pcode;
225 225
                     }
226
-                }else{
226
+                } else{
227 227
                     $pcode = $form->pcode;
228 228
                 }
229 229
 
Please login to merge, or discard this patch.
app/Admin/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     $router->resource('groups', GroupController::class);
21 21
     $router->resource('abuses', AbuseController::class);
22 22
 
23
-    Route::group(['prefix' => 'babel'], function (Router $router) {
23
+    Route::group(['prefix' => 'babel'], function(Router $router) {
24 24
         $router->get('/', 'BabelController@index')->name('admin.babel.index');
25 25
         $router->get('installed', 'BabelController@installed')->name('admin.babel.installed');
26 26
         $router->get('marketspace', 'BabelController@marketspace')->name('admin.babel.marketspace');
Please login to merge, or discard this patch.
app/Admin/Forms/ImportPOEM.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      *
18 18
      * @var string
19 19
      */
20
-    public $title = 'Import';
20
+    public $title='Import';
21 21
 
22 22
     /**
23 23
      * Handle the form request.
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function handle(Request $request)
30 30
     {
31
-        $err = function ($msg) {
32
-            $error = new MessageBag([
31
+        $err=function($msg) {
32
+            $error=new MessageBag([
33 33
                 'title'   => 'POEM parse failed.',
34 34
                 'message' => $msg,
35 35
             ]);
36 36
             return back()->with(compact('error'));
37 37
         };
38
-        $success_message = '';
38
+        $success_message='';
39 39
 
40
-        $file = $request->file('Files');
41
-        if(!$file->isValid()){
40
+        $file=$request->file('Files');
41
+        if (!$file->isValid()) {
42 42
             $err('Invalid POEM files');
43 43
         }
44 44
 
45
-        $path      = $file->getRealPath();
46
-        $poetryRaw = file_get_contents($path);
47
-        $parser    = new POEMParser();
48
-        $poem      = $parser->parse($poetryRaw);
49
-        if(empty($poem)){
45
+        $path=$file->getRealPath();
46
+        $poetryRaw=file_get_contents($path);
47
+        $parser=new POEMParser();
48
+        $poem=$parser->parse($poetryRaw);
49
+        if (empty($poem)) {
50 50
             $err('Malformed POEM files');
51 51
         }
52 52
 
53
-        $success_message .= "
53
+        $success_message.="
54 54
             POEM standard : {$poem['standard']} <br />
55 55
             generator : {$poem['generator']} <br />
56 56
             url : {$poem['url']} <br />
@@ -58,31 +58,31 @@  discard block
 block discarded – undo
58 58
             problems: <br />
59 59
         ";
60 60
 
61
-        $memory_unit = [
61
+        $memory_unit=[
62 62
             'kb' => 1,
63 63
             'mb' => 1024,
64
-            'gb' => 1024*1024
64
+            'gb' => 1024 * 1024
65 65
         ];
66
-        $time_unit = [
66
+        $time_unit=[
67 67
             'ms' => 1,
68 68
             's' => 1000,
69 69
             'm' => 60000,
70 70
             'h' => 3600000
71 71
         ];
72 72
 
73
-        $prefix = 'NOJ';
74
-        $p = ProblemModel::where('pcode','like',$prefix.'%')->orderBy('pcode','desc')->select('pcode')->first();
75
-        if(empty($p)){
76
-            $count = 1000;
77
-        }else{
78
-            $count = (int) str_replace($prefix,'',$p['pcode']);
73
+        $prefix='NOJ';
74
+        $p=ProblemModel::where('pcode', 'like', $prefix.'%')->orderBy('pcode', 'desc')->select('pcode')->first();
75
+        if (empty($p)) {
76
+            $count=1000;
77
+        } else {
78
+            $count=(int) str_replace($prefix, '', $p['pcode']);
79 79
         }
80 80
 
81 81
         foreach ($poem['problems'] as $problem) {
82 82
             //insert problem
83
-            $title = $problem['title'];
84
-            $pro = [
85
-                'pcode'        => $prefix . (++$count),
83
+            $title=$problem['title'];
84
+            $pro=[
85
+                'pcode'        => $prefix.(++$count),
86 86
                 'solved_count' => 0,
87 87
                 'difficulty'   => -1,
88 88
                 'file'         => 0,
@@ -101,49 +101,49 @@  discard block
 block discarded – undo
101 101
                 'force_raw'    => $problem['extra']['forceRaw'],
102 102
                 'partial'      => $problem['extra']['partial']
103 103
             ];
104
-            $pid = ProblemModel::insertGetId($pro);
104
+            $pid=ProblemModel::insertGetId($pro);
105 105
 
106 106
             //migrate sample
107
-            $sample_count = 0;
108
-            foreach($problem['sample'] as $sample){
109
-                $sam = [
107
+            $sample_count=0;
108
+            foreach ($problem['sample'] as $sample) {
109
+                $sam=[
110 110
                     'pid'           => $pid,
111 111
                     'sample_input'  => $sample['input'],
112 112
                     'sample_output' => $sample['output'],
113 113
                 ];
114
-                $psid = DB::table('problem_sample')->insert($sam);
115
-                $sample_count += 1;
114
+                $psid=DB::table('problem_sample')->insert($sam);
115
+                $sample_count+=1;
116 116
             }
117 117
 
118 118
             //create test case file
119
-            if(Storage::exists(storage_path().'/test_case/'.$pro['pcode'])){
119
+            if (Storage::exists(storage_path().'/test_case/'.$pro['pcode'])) {
120 120
                 Storage::deleteDirectory(storage_path().'/test_case/'.$pro['pcode']);
121 121
             }
122 122
             Storage::makeDirectory(storage_path().'/test_case/'.$pro['pcode']);
123
-            $test_case_count = 0;
124
-            $test_case_info = [
123
+            $test_case_count=0;
124
+            $test_case_info=[
125 125
                 'spj'        => false,
126 126
                 'test_cases' => []
127 127
             ];
128
-            foreach($problem['testCases'] as $test_case){
129
-                $test_case_count += 1;
130
-                $test_case_arr = [
128
+            foreach ($problem['testCases'] as $test_case) {
129
+                $test_case_count+=1;
130
+                $test_case_arr=[
131 131
                     'input_name'  => "data{$test_case_count}.in",
132 132
                     'output_name' => "data{$test_case_count}.out",
133 133
                     'input_size'  => strlen($test_case['input']),
134 134
                     'output_size' => strlen($test_case['output']),
135 135
                     'stripped_output_md5' => md5(trim($test_case['output']))
136 136
                 ];
137
-                array_push($test_case_info['test_cases'],$test_case_arr);
137
+                array_push($test_case_info['test_cases'], $test_case_arr);
138 138
                 Storage::disk('test_case')->put('/'.$pro['pcode'].'/'.$test_case_arr['input_name'], $test_case['input']);
139 139
                 Storage::disk('test_case')->put('/'.$pro['pcode'].'/'.$test_case_arr['output_name'], $test_case['output']);
140 140
             }
141 141
             Storage::disk('test_case')->put('/'.$pro['pcode'].'/info', json_encode($test_case_info));
142 142
 
143 143
             //migrate solutions
144
-            $solution_count = 0;
145
-            foreach($problem['solution'] as $solution) {
146
-                $s = [
144
+            $solution_count=0;
145
+            foreach ($problem['solution'] as $solution) {
146
+                $s=[
147 147
                     'uid' => 1,
148 148
                     'pid' => $pid,
149 149
                     'content' => '``` '.$solution['source'],
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
                     'created_at' => date('Y-m-d H:i:s')
153 153
                 ];
154 154
                 DB::table('problem_solution')->insert($s);
155
-                $solution_count += 1;
155
+                $solution_count+=1;
156 156
             }
157 157
 
158
-            $success_message .= '&nbsp;&nbsp;&nbsp;&nbsp;'.
158
+            $success_message.='&nbsp;&nbsp;&nbsp;&nbsp;'.
159 159
                 $pro['pcode'].': "
160 160
                 '.$title.'" with
161 161
                 '.$sample_count.' samples,
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                 '.$solution_count.' solutions
164 164
                 <br />';
165 165
         }
166
-        admin_success('Import successfully',$success_message);
166
+        admin_success('Import successfully', $success_message);
167 167
         return back();
168 168
     }
169 169
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
         $p = ProblemModel::where('pcode','like',$prefix.'%')->orderBy('pcode','desc')->select('pcode')->first();
75 75
         if(empty($p)){
76 76
             $count = 1000;
77
-        }else{
77
+        } else{
78 78
             $count = (int) str_replace($prefix,'',$p['pcode']);
79 79
         }
80 80
 
Please login to merge, or discard this patch.
app/Models/GroupModel.php 2 patches
Spacing   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
         foreach ($trending_groups as &$t) {
59 59
             $t["members"]=$this->countGroupMembers($t["gid"]);
60 60
         }
61
-        usort($trending_groups, function ($a, $b) {
61
+        usort($trending_groups, function($a, $b) {
62 62
             return $b["members"]<=>$a["members"];
63 63
         });
64
-        Cache::tags(['group'])->put('trending', array_slice($trending_groups,0,12), 3600*24);
64
+        Cache::tags(['group'])->put('trending', array_slice($trending_groups, 0, 12), 3600 * 24);
65 65
     }
66 66
 
67 67
     public function userGroups($uid)
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 
102 102
     public function changeGroupName($gid, $GroupName)
103 103
     {
104
-        return DB::table("group")->where('gid',$gid)->update([
104
+        return DB::table("group")->where('gid', $gid)->update([
105 105
             "name"=>$GroupName
106 106
         ]);
107 107
     }
108 108
 
109
-    public function changeJoinPolicy($gid, $JoinPolicy){
110
-        return DB::table("group")->where('gid',$gid)->update([
109
+    public function changeJoinPolicy($gid, $JoinPolicy) {
110
+        return DB::table("group")->where('gid', $gid)->update([
111 111
             "join_policy"=>$JoinPolicy
112 112
         ]);
113 113
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     public function details($gcode)
122 122
     {
123 123
         $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first();
124
-        if(empty($basic_info)) return [];
124
+        if (empty($basic_info)) return [];
125 125
         $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]);
126 126
         $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]);
127 127
         $basic_info["create_time_foramt"]=date_format(date_create($basic_info["created_at"]), 'M jS, Y');
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
     public function userProfile($uid, $gid)
139 139
     {
140 140
         $info=DB::table("group_member")
141
-        ->join('users','users.id','=','group_member.uid')
141
+        ->join('users', 'users.id', '=', 'group_member.uid')
142 142
         ->where(["gid"=>$gid, "uid"=>$uid])
143 143
         ->where("role", ">", 0)
144
-        ->select('avatar','describes','email','gid','uid','name','nick_name','professional_rate','role','sub_group')
144
+        ->select('avatar', 'describes', 'email', 'gid', 'uid', 'name', 'nick_name', 'professional_rate', 'role', 'sub_group')
145 145
         ->first();
146 146
         if (!empty($info)) {
147 147
             $info["role_parsed"]=$this->role[$info["role"]];
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         foreach ($user_list as &$u) {
170 170
             $u["role_parsed"]=$this->role[$u["role"]];
171 171
             $u["role_color"]=$this->role_color[$u["role"]];
172
-            if(is_null($u["sub_group"])) $u["sub_group"]="None";
172
+            if (is_null($u["sub_group"])) $u["sub_group"]="None";
173 173
         }
174 174
         return $user_list;
175 175
     }
@@ -230,16 +230,16 @@  discard block
 block discarded – undo
230 230
         ])->where("role", ">", 0)->count();
231 231
     }
232 232
 
233
-    public function problemTags($gid,$pid = -1)
233
+    public function problemTags($gid, $pid=-1)
234 234
     {
235
-        if($pid == -1){
236
-            $tags =  DB::table('group_problem_tag')
235
+        if ($pid==-1) {
236
+            $tags=DB::table('group_problem_tag')
237 237
             ->select('tag')
238
-            ->where('gid',$gid)
238
+            ->where('gid', $gid)
239 239
             ->distinct()
240 240
             ->get()->all();
241
-        }else{
242
-            $tags =  DB::table('group_problem_tag')
241
+        } else {
242
+            $tags=DB::table('group_problem_tag')
243 243
             ->select('tag')
244 244
             ->where('gid', $gid)
245 245
             ->where('pid', $pid)
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
             ->get()->all();
248 248
         }
249 249
 
250
-        $tags_arr = [];
251
-        if(!empty($tags)){
250
+        $tags_arr=[];
251
+        if (!empty($tags)) {
252 252
             foreach ($tags as $value) {
253
-                array_push($tags_arr,$value['tag']);
253
+                array_push($tags_arr, $value['tag']);
254 254
             }
255 255
         }
256 256
         return $tags_arr;
@@ -258,28 +258,28 @@  discard block
 block discarded – undo
258 258
 
259 259
     public function problems($gid)
260 260
     {
261
-        $contestModel = new ContestModel();
262
-        $problems = DB::table('contest_problem')
263
-        ->join('contest','contest_problem.cid', '=', 'contest.cid')
264
-        ->join('problem','contest_problem.pid', '=', 'problem.pid' )
261
+        $contestModel=new ContestModel();
262
+        $problems=DB::table('contest_problem')
263
+        ->join('contest', 'contest_problem.cid', '=', 'contest.cid')
264
+        ->join('problem', 'contest_problem.pid', '=', 'problem.pid')
265 265
         ->select('contest_problem.cid as cid', 'problem.pid as pid', 'pcode', 'title')
266
-        ->where('contest.gid',$gid)
267
-        ->where('contest.practice',1)
268
-        ->orderBy('contest.created_at','desc')
266
+        ->where('contest.gid', $gid)
267
+        ->where('contest.practice', 1)
268
+        ->orderBy('contest.created_at', 'desc')
269 269
         ->distinct()
270 270
         ->get()->all();
271
-        $user_id = Auth::user()->id;
272
-        foreach($problems as $key => $value){
273
-            if($contestModel->judgeClearance($value['cid'],$user_id) != 3){
271
+        $user_id=Auth::user()->id;
272
+        foreach ($problems as $key => $value) {
273
+            if ($contestModel->judgeClearance($value['cid'], $user_id)!=3) {
274 274
                 unset($problems[$key]);
275
-            }else{
276
-                $problems[$key]['tags'] = $this->problemTags($gid,$value['pid']);
275
+            } else {
276
+                $problems[$key]['tags']=$this->problemTags($gid, $value['pid']);
277 277
             }
278 278
         }
279 279
         return $problems;
280 280
     }
281 281
 
282
-    public function problemAddTag($gid,$pid,$tag)
282
+    public function problemAddTag($gid, $pid, $tag)
283 283
     {
284 284
         return DB::table("group_problem_tag")->insert([
285 285
             "gid"=>$gid,
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         ]);
289 289
     }
290 290
 
291
-    public function problemRemoveTag($gid,$pid,$tag)
291
+    public function problemRemoveTag($gid, $pid, $tag)
292 292
     {
293 293
         return DB::table("group_problem_tag")->where([
294 294
             "gid"=>$gid,
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     public function judgeEmailClearance($gid, $email)
334 334
     {
335 335
         $user=DB::table("users")->where(["email"=>$email])->first();
336
-        if(empty($user)) return -4;
336
+        if (empty($user)) return -4;
337 337
         $ret=DB::table("group_member")->where([
338 338
             "gid"=>$gid,
339 339
             "uid"=>$user["id"],
@@ -424,20 +424,20 @@  discard block
 block discarded – undo
424 424
 
425 425
     public function groupMemberPracticeContestStat($gid)
426 426
     {
427
-        $contestModel = new ContestModel();
427
+        $contestModel=new ContestModel();
428 428
 
429
-        $allPracticeContest = DB::table('contest')
429
+        $allPracticeContest=DB::table('contest')
430 430
             ->where([
431 431
                 'gid' => $gid,
432 432
                 'practice' => 1,
433 433
             ])
434
-            ->select('cid','name')
434
+            ->select('cid', 'name')
435 435
             ->get()->all();
436
-        $user_list = $this->userList($gid);
436
+        $user_list=$this->userList($gid);
437 437
 
438
-        $memberData = [];
438
+        $memberData=[];
439 439
         foreach ($user_list as $u) {
440
-            $memberData[$u['uid']] = [
440
+            $memberData[$u['uid']]=[
441 441
                 'name' => $u['name'],
442 442
                 'nick_name' => $u['nick_name'],
443 443
                 'elo' => $u['ranking'],
@@ -448,61 +448,61 @@  discard block
 block discarded – undo
448 448
             ];
449 449
         }
450 450
         foreach ($allPracticeContest as $c) {
451
-            $contestRankRaw = $contestModel->contestRank($c['cid']);
452
-            foreach($contestRankRaw as $key => $contestRank){
453
-                if(isset($contestRank['remote']) && $contestRank['remote']){
451
+            $contestRankRaw=$contestModel->contestRank($c['cid']);
452
+            foreach ($contestRankRaw as $key => $contestRank) {
453
+                if (isset($contestRank['remote']) && $contestRank['remote']) {
454 454
                     unset($contestRankRaw[$key]);
455 455
                 }
456 456
             }
457
-            $contestRank = array_values($contestRankRaw);
458
-            $problemsCount = DB::table('contest_problem')
459
-                ->where('cid',$c['cid'])
457
+            $contestRank=array_values($contestRankRaw);
458
+            $problemsCount=DB::table('contest_problem')
459
+                ->where('cid', $c['cid'])
460 460
                 ->count();
461
-            $index = 1;
462
-            $rank = 1;
463
-            $last_cr = [];
464
-            $last_rank = 1;
461
+            $index=1;
462
+            $rank=1;
463
+            $last_cr=[];
464
+            $last_rank=1;
465 465
             foreach ($contestRank as $cr) {
466
-                $last_rank = $index;
467
-                if(!empty($last_cr)){
468
-                    if($cr['solved'] == $last_cr['solved'] && $cr['penalty'] == $last_cr['penalty'] ){
469
-                        $rank = $last_rank;
470
-                    }else{
471
-                        $rank = $index;
472
-                        $last_rank = $rank;
466
+                $last_rank=$index;
467
+                if (!empty($last_cr)) {
468
+                    if ($cr['solved']==$last_cr['solved'] && $cr['penalty']==$last_cr['penalty']) {
469
+                        $rank=$last_rank;
470
+                    } else {
471
+                        $rank=$index;
472
+                        $last_rank=$rank;
473 473
                     }
474 474
                 }
475
-                if(in_array($cr['uid'],array_keys($memberData))) {
476
-                    $memberData[$cr['uid']]['solved_all'] += $cr['solved'];
477
-                    $memberData[$cr['uid']]['problem_all'] += $problemsCount;
478
-                    $memberData[$cr['uid']]['penalty'] += $cr['penalty'];
479
-                    $memberData[$cr['uid']]['contest_detial'][$c['cid']] = [
475
+                if (in_array($cr['uid'], array_keys($memberData))) {
476
+                    $memberData[$cr['uid']]['solved_all']+=$cr['solved'];
477
+                    $memberData[$cr['uid']]['problem_all']+=$problemsCount;
478
+                    $memberData[$cr['uid']]['penalty']+=$cr['penalty'];
479
+                    $memberData[$cr['uid']]['contest_detial'][$c['cid']]=[
480 480
                         'rank' => $rank,
481 481
                         'solved' => $cr['solved'],
482 482
                         'problems' => $problemsCount,
483 483
                         'penalty' => $cr['penalty']
484 484
                     ];
485 485
                 }
486
-                $last_cr = $cr;
486
+                $last_cr=$cr;
487 487
                 $index++;
488 488
             }
489 489
         }
490
-        $new_memberData = [];
490
+        $new_memberData=[];
491 491
         foreach ($memberData as $uid => $data) {
492
-            $contest_count = 0;
493
-            $rank_sum = 0;
492
+            $contest_count=0;
493
+            $rank_sum=0;
494 494
             foreach ($data['contest_detial'] as $cid => $c) {
495
-                $rank_sum += $c['rank'];
496
-                $contest_count += 1;
495
+                $rank_sum+=$c['rank'];
496
+                $contest_count+=1;
497 497
             }
498
-            $temp = $data;
499
-            $temp['uid'] = $uid;
500
-            if($contest_count != 0){
501
-                $temp['rank_ave'] = $rank_sum/$contest_count;
498
+            $temp=$data;
499
+            $temp['uid']=$uid;
500
+            if ($contest_count!=0) {
501
+                $temp['rank_ave']=$rank_sum / $contest_count;
502 502
             }
503
-            array_push($new_memberData,$temp);
503
+            array_push($new_memberData, $temp);
504 504
         }
505
-        $ret = [
505
+        $ret=[
506 506
             'contest_list' => $allPracticeContest,
507 507
             'member_data' => $new_memberData
508 508
         ];
@@ -511,58 +511,58 @@  discard block
 block discarded – undo
511 511
 
512 512
     public function groupMemberPracticeTagStat($gid)
513 513
     {
514
-        $tags = $this->problemTags($gid);
515
-        $tag_problems = [];
514
+        $tags=$this->problemTags($gid);
515
+        $tag_problems=[];
516 516
 
517
-        $user_list = $this->userList($gid);
517
+        $user_list=$this->userList($gid);
518 518
         foreach ($tags as $tag) {
519
-            $tag_problems[$tag] = DB::table('problem')
520
-                ->join('group_problem_tag','problem.pid','=','group_problem_tag.pid')
519
+            $tag_problems[$tag]=DB::table('problem')
520
+                ->join('group_problem_tag', 'problem.pid', '=', 'group_problem_tag.pid')
521 521
                 ->where([
522 522
                     'group_problem_tag.gid' => $gid,
523 523
                     'tag' => $tag
524 524
                 ])
525
-                ->select('group_problem_tag.pid as pid','pcode','title')
525
+                ->select('group_problem_tag.pid as pid', 'pcode', 'title')
526 526
                 ->get()->all();
527 527
         }
528
-        $all_problems = [];
528
+        $all_problems=[];
529 529
         foreach ($tag_problems as &$tag_problem_set) {
530 530
             foreach ($tag_problem_set as $problem) {
531
-                $all_problems[$problem['pid']] = $problem;
531
+                $all_problems[$problem['pid']]=$problem;
532 532
             }
533
-            $tag_problem_set = array_column($tag_problem_set,'pid');
533
+            $tag_problem_set=array_column($tag_problem_set, 'pid');
534 534
         }
535
-        $submission_data =  DB::table('submission')
536
-            ->whereIn('pid',array_keys($all_problems))
537
-            ->whereIn('uid',array_column($user_list,'uid'))
538
-            ->where('verdict','Accepted')
539
-            ->select('pid','uid')
535
+        $submission_data=DB::table('submission')
536
+            ->whereIn('pid', array_keys($all_problems))
537
+            ->whereIn('uid', array_column($user_list, 'uid'))
538
+            ->where('verdict', 'Accepted')
539
+            ->select('pid', 'uid')
540 540
             ->get()->all();
541 541
 
542
-        $memberData = [];
542
+        $memberData=[];
543 543
         foreach ($user_list as $member) {
544
-            $completion = [];
545
-            foreach($tag_problems as $tag => $problems) {
546
-                $completion[$tag] = [];
544
+            $completion=[];
545
+            foreach ($tag_problems as $tag => $problems) {
546
+                $completion[$tag]=[];
547 547
                 foreach ($problems as $problem) {
548
-                    $is_accepted = 0;
548
+                    $is_accepted=0;
549 549
                     foreach ($submission_data as $sd) {
550
-                        if($sd['pid'] == $problem && $sd['uid'] == $member['uid']){
551
-                            $is_accepted = 1;
550
+                        if ($sd['pid']==$problem && $sd['uid']==$member['uid']) {
551
+                            $is_accepted=1;
552 552
                             break;
553 553
                         }
554 554
                     }
555
-                    $completion[$tag][$problem] = $is_accepted;
555
+                    $completion[$tag][$problem]=$is_accepted;
556 556
                 }
557 557
             }
558
-            array_push($memberData,[
558
+            array_push($memberData, [
559 559
                 'uid' => $member['uid'],
560 560
                 'name' => $member['name'],
561 561
                 'nick_name' => $member['nick_name'],
562 562
                 'completion' => $completion,
563 563
             ]);
564 564
         }
565
-        $ret = [
565
+        $ret=[
566 566
             'all_problems' => $all_problems,
567 567
             'tag_problems' => $tag_problems,
568 568
             'member_data' => $memberData
@@ -572,10 +572,10 @@  discard block
 block discarded – undo
572 572
 
573 573
     public function refreshAllElo()
574 574
     {
575
-        $result = [];
576
-        $gids = DB::table('group')->select('gid','name')->get()->all();
575
+        $result=[];
576
+        $gids=DB::table('group')->select('gid', 'name')->get()->all();
577 577
         foreach ($gids as $gid) {
578
-            $result[$gid['gid']] = [
578
+            $result[$gid['gid']]=[
579 579
                 'name' => $gid['name'],
580 580
                 'result' => $this->refreshElo($gid['gid']),
581 581
             ];
@@ -586,41 +586,41 @@  discard block
 block discarded – undo
586 586
     public function refreshElo($gid)
587 587
     {
588 588
         DB::table('group_rated_change_log')
589
-            ->where('gid',$gid)
589
+            ->where('gid', $gid)
590 590
             ->delete();
591 591
         DB::table('group_member')
592
-            ->where('gid',$gid)
592
+            ->where('gid', $gid)
593 593
             ->update([
594 594
                 'ranking' => 1500
595 595
             ]);
596
-        $contests = DB::table('contest')
596
+        $contests=DB::table('contest')
597 597
             ->where([
598 598
                 'gid' => $gid,
599 599
                 'practice' => 1
600 600
             ])
601
-            ->where('end_time','<',date("Y-m-d H:i:s"))
602
-            ->select('cid','name')
601
+            ->where('end_time', '<', date("Y-m-d H:i:s"))
602
+            ->select('cid', 'name')
603 603
             ->orderBy('end_time')
604 604
             ->get()->all();
605 605
 
606
-        if(empty($contests)) {
606
+        if (empty($contests)) {
607 607
             return [];
608 608
         }
609
-        $result = [];
610
-        $contestModel = new ContestModel();
609
+        $result=[];
610
+        $contestModel=new ContestModel();
611 611
         foreach ($contests as $contest) {
612
-            $judge_status = $contestModel->judgeOver($contest['cid']);
613
-            if($judge_status['result'] == true){
614
-                $calc = new GroupRatingCalculator($contest['cid']);
612
+            $judge_status=$contestModel->judgeOver($contest['cid']);
613
+            if ($judge_status['result']==true) {
614
+                $calc=new GroupRatingCalculator($contest['cid']);
615 615
                 $calc->calculate();
616 616
                 $calc->storage();
617
-                $result[] = [
617
+                $result[]=[
618 618
                     'ret' => 'success',
619 619
                     'cid' => $contest['cid'],
620 620
                     'name' => $contest['name']
621 621
                 ];
622
-            }else{
623
-                $result[] = [
622
+            } else {
623
+                $result[]=[
624 624
                     'ret' => 'judging',
625 625
                     'cid' => $contest['cid'],
626 626
                     'name' => $contest['name'],
@@ -632,23 +632,23 @@  discard block
 block discarded – undo
632 632
         return $result;
633 633
     }
634 634
 
635
-    public function getEloChangeLog($gid,$uid)
635
+    public function getEloChangeLog($gid, $uid)
636 636
     {
637
-        $ret = DB::table('group_rated_change_log')
638
-            ->join('contest','group_rated_change_log.cid','=','contest.cid')
637
+        $ret=DB::table('group_rated_change_log')
638
+            ->join('contest', 'group_rated_change_log.cid', '=', 'contest.cid')
639 639
             ->where([
640 640
                 'group_rated_change_log.gid' => $gid,
641 641
                 'group_rated_change_log.uid' => $uid
642 642
             ])->select('group_rated_change_log.cid as cid', 'contest.name as name', 'ranking', 'end_time')
643 643
             ->orderBy('contest.end_time')
644 644
             ->get()->all();
645
-            $begin = [
645
+            $begin=[
646 646
                 'cid' => -1,
647 647
                 'name' => '',
648 648
                 'ranking' => '1500',
649
-                'end_time' => date("Y-m-d H:i:s",(strtotime($ret[0]['end_time'] ?? time())  - 3600*24)),
649
+                'end_time' => date("Y-m-d H:i:s", (strtotime($ret[0]['end_time'] ?? time())-3600 * 24)),
650 650
             ];
651
-            $ret = array_prepend($ret,$begin);
651
+            $ret=array_prepend($ret, $begin);
652 652
         return $ret;
653 653
     }
654 654
 }
Please login to merge, or discard this patch.
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -121,7 +121,9 @@  discard block
 block discarded – undo
121 121
     public function details($gcode)
122 122
     {
123 123
         $basic_info=DB::table($this->tableName)->where(["gcode"=>$gcode])->first();
124
-        if(empty($basic_info)) return [];
124
+        if(empty($basic_info)) {
125
+            return [];
126
+        }
125 127
         $basic_info["members"]=$this->countGroupMembers($basic_info["gid"]);
126 128
         $basic_info["tags"]=$this->getGroupTags($basic_info["gid"]);
127 129
         $basic_info["create_time_foramt"]=date_format(date_create($basic_info["created_at"]), 'M jS, Y');
@@ -169,7 +171,9 @@  discard block
 block discarded – undo
169 171
         foreach ($user_list as &$u) {
170 172
             $u["role_parsed"]=$this->role[$u["role"]];
171 173
             $u["role_color"]=$this->role_color[$u["role"]];
172
-            if(is_null($u["sub_group"])) $u["sub_group"]="None";
174
+            if(is_null($u["sub_group"])) {
175
+                $u["sub_group"]="None";
176
+            }
173 177
         }
174 178
         return $user_list;
175 179
     }
@@ -238,7 +242,7 @@  discard block
 block discarded – undo
238 242
             ->where('gid',$gid)
239 243
             ->distinct()
240 244
             ->get()->all();
241
-        }else{
245
+        } else{
242 246
             $tags =  DB::table('group_problem_tag')
243 247
             ->select('tag')
244 248
             ->where('gid', $gid)
@@ -272,7 +276,7 @@  discard block
 block discarded – undo
272 276
         foreach($problems as $key => $value){
273 277
             if($contestModel->judgeClearance($value['cid'],$user_id) != 3){
274 278
                 unset($problems[$key]);
275
-            }else{
279
+            } else{
276 280
                 $problems[$key]['tags'] = $this->problemTags($gid,$value['pid']);
277 281
             }
278 282
         }
@@ -333,7 +337,9 @@  discard block
 block discarded – undo
333 337
     public function judgeEmailClearance($gid, $email)
334 338
     {
335 339
         $user=DB::table("users")->where(["email"=>$email])->first();
336
-        if(empty($user)) return -4;
340
+        if(empty($user)) {
341
+            return -4;
342
+        }
337 343
         $ret=DB::table("group_member")->where([
338 344
             "gid"=>$gid,
339 345
             "uid"=>$user["id"],
@@ -467,7 +473,7 @@  discard block
 block discarded – undo
467 473
                 if(!empty($last_cr)){
468 474
                     if($cr['solved'] == $last_cr['solved'] && $cr['penalty'] == $last_cr['penalty'] ){
469 475
                         $rank = $last_rank;
470
-                    }else{
476
+                    } else{
471 477
                         $rank = $index;
472 478
                         $last_rank = $rank;
473 479
                     }
@@ -619,7 +625,7 @@  discard block
 block discarded – undo
619 625
                     'cid' => $contest['cid'],
620 626
                     'name' => $contest['name']
621 627
                 ];
622
-            }else{
628
+            } else{
623 629
                 $result[] = [
624 630
                     'ret' => 'judging',
625 631
                     'cid' => $contest['cid'],
Please login to merge, or discard this patch.