Passed
Push — master ( 5abd12...d648c0 )
by John
04:51
created
app/Babel/Submit/Curl.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 
19 19
     public function login($all_data)
20 20
     {
21
-        if(isset($all_data["url"]))    $url = $all_data["url"];       else throw new Exception("url is not exist in all_data");
22
-        if(isset($all_data["data"]))   $data = $all_data["data"];     else throw new Exception("data is not exist in all_data");
23
-        if(isset($all_data["oj"]))     $oj = $all_data["oj"];         else throw new Exception("oj is not exist in all_data");
24
-        if(isset($all_data["ret"]))    $ret = $all_data["ret"];       else $ret = 'false';
25
-        if(isset($all_data["handle"])) $handle = $all_data["handle"]; else $handle = "default";
21
+        if (isset($all_data["url"]))    $url=$all_data["url"]; else throw new Exception("url is not exist in all_data");
22
+        if (isset($all_data["data"]))   $data=$all_data["data"]; else throw new Exception("data is not exist in all_data");
23
+        if (isset($all_data["oj"]))     $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data");
24
+        if (isset($all_data["ret"]))    $ret=$all_data["ret"]; else $ret='false';
25
+        if (isset($all_data["handle"])) $handle=$all_data["handle"]; else $handle="default";
26 26
 
27 27
         $datapost=curl_init();
28 28
         $headers=array("Expect:");
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function grab_page($all_data)
56 56
     {
57
-        if(isset($all_data["site"]))    $site = $all_data["site"];          else throw new Exception("site is not exist in all_data");
58
-        if(isset($all_data["oj"]))      $oj = $all_data["oj"];              else throw new Exception("oj is not exist in all_data");
59
-        if(isset($all_data["headers"])) $headers = $all_data["headers"];    else $headers = [];
60
-        if(isset($all_data["handle"]))  $handle = $all_data["handle"];      else $handle = "default";
61
-        if(isset($all_data["follow"]))  $follow = $all_data["follow"];      else $follow = false;
62
-        if(isset($all_data["vcid"]))  $vcid = $all_data["vcid"]."_";      else $vcid = "";
57
+        if (isset($all_data["site"]))    $site=$all_data["site"]; else throw new Exception("site is not exist in all_data");
58
+        if (isset($all_data["oj"]))      $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data");
59
+        if (isset($all_data["headers"])) $headers=$all_data["headers"]; else $headers=[];
60
+        if (isset($all_data["handle"]))  $handle=$all_data["handle"]; else $handle="default";
61
+        if (isset($all_data["follow"]))  $follow=$all_data["follow"]; else $follow=false;
62
+        if (isset($all_data["vcid"]))  $vcid=$all_data["vcid"]."_"; else $vcid="";
63 63
 
64 64
         $handle=urlencode($handle);
65 65
 
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 
87 87
     public function post_data($all_data)
88 88
     {
89
-        if(isset($all_data["site"]))         $site = $all_data["site"];                 else throw new Exception("site is not exist in all_data");
90
-        if(isset($all_data["data"]))         $data = $all_data["data"];                 else throw new Exception("data is not exist in all_data");
91
-        if(isset($all_data["oj"]))           $oj = $all_data["oj"];                     else throw new Exception("oj is not exist in all_data");
92
-        if(isset($all_data["ret"]))          $ret = $all_data["ret"];                   else $ret = false;
93
-        if(isset($all_data["follow"]))       $follow = $all_data["follow"];             else $follow = true;
94
-        if(isset($all_data["returnHeader"])) $returnHeader = $all_data["returnHeader"]; else $returnHeader = true;
95
-        if(isset($all_data["postJson"]))     $postJson = $all_data["postJson"];         else $postJson = false;
96
-        if(isset($all_data["extraHeaders"])) $extraHeaders = $all_data["extraHeaders"]; else $extraHeaders = [];
97
-        if(isset($all_data["handle"]))       $handle = $all_data["handle"];             else $handle = "default";
98
-        if(isset($all_data["vcid"]))  $vcid = $all_data["vcid"]."_";      else $vcid = "";
89
+        if (isset($all_data["site"]))         $site=$all_data["site"]; else throw new Exception("site is not exist in all_data");
90
+        if (isset($all_data["data"]))         $data=$all_data["data"]; else throw new Exception("data is not exist in all_data");
91
+        if (isset($all_data["oj"]))           $oj=$all_data["oj"]; else throw new Exception("oj is not exist in all_data");
92
+        if (isset($all_data["ret"]))          $ret=$all_data["ret"]; else $ret=false;
93
+        if (isset($all_data["follow"]))       $follow=$all_data["follow"]; else $follow=true;
94
+        if (isset($all_data["returnHeader"])) $returnHeader=$all_data["returnHeader"]; else $returnHeader=true;
95
+        if (isset($all_data["postJson"]))     $postJson=$all_data["postJson"]; else $postJson=false;
96
+        if (isset($all_data["extraHeaders"])) $extraHeaders=$all_data["extraHeaders"]; else $extraHeaders=[];
97
+        if (isset($all_data["handle"]))       $handle=$all_data["handle"]; else $handle="default";
98
+        if (isset($all_data["vcid"]))  $vcid=$all_data["vcid"]."_"; else $vcid="";
99 99
 
100 100
         $handle=urlencode($handle);
101 101
 
Please login to merge, or discard this patch.
app/Http/Controllers/Contest/AdminController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         $contestModel=new ContestModel();
25 25
         $verified=$contestModel->isVerified($cid);
26 26
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
27
-        if ($clearance <= 2) {
27
+        if ($clearance<=2) {
28 28
             return Redirect::route('contest_detail', ['cid' => $cid]);
29 29
         }
30 30
         $contest_name=$contestModel->contestName($cid);
@@ -52,30 +52,30 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $contestModel=new ContestModel();
54 54
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
55
-        if ($clearance <= 2) {
55
+        if ($clearance<=2) {
56 56
             return Redirect::route('contest_detail', ['cid' => $cid]);
57 57
         }
58 58
         $account=$contestModel->getContestAccount($cid);
59
-        if($account==null){
60
-            return ;
61
-        }else{
59
+        if ($account==null) {
60
+            return;
61
+        } else {
62 62
             $AccountExport=new AccountExport($account);
63 63
             $filename="ContestAccount$cid";
64 64
             return Excel::download($AccountExport, $filename.'.xlsx');
65 65
         }
66 66
     }
67 67
 
68
-    public function refreshContestRank($cid){
68
+    public function refreshContestRank($cid) {
69 69
         $contestModel=new ContestModel();
70 70
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
71
-        if ($clearance <= 2) {
71
+        if ($clearance<=2) {
72 72
             return Redirect::route('contest.detail', ['cid' => $cid]);
73 73
         }
74 74
         $contestRankRaw=$contestModel->contestRankCache($cid);
75 75
         Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw);
76 76
         Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw);
77 77
         $end_time=strtotime(DB::table("contest")->where(["cid"=>$cid])->select("end_time")->first()["end_time"]);
78
-        if(time() > strtotime($end_time)){
78
+        if (time()>strtotime($end_time)) {
79 79
             $contestModel->storeContestRankInMySQL($cid, $contestRankRaw);
80 80
         }
81 81
         return Redirect::route('contest.rank', ['cid' => $cid]);
Please login to merge, or discard this patch.
app/Http/Controllers/Contest/IndexController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $filter["rated"]=isset($all_data["rated"]) ? $all_data["rated"] : null;
28 28
         $filter["anticheated"]=isset($all_data["anticheated"]) ? $all_data["anticheated"] : null;
29 29
         $filter["practice"]=isset($all_data["practice"]) ? $all_data["practice"] : null;
30
-        $return_list=$contestModel->list($filter,Auth::check()?Auth::user()->id:0);
30
+        $return_list=$contestModel->list($filter, Auth::check() ?Auth::user()->id : 0);
31 31
         $featured=$contestModel->featured();
32 32
         if (is_null($return_list)) {
33 33
             if (isset($all_data["page"]) && $all_data["page"]>1) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $contestModel=new ContestModel();
67 67
         $groupModel=new GroupModel();
68 68
         $clearance=Auth::check() ? $contestModel->judgeClearance($cid, Auth::user()->id) : 0;
69
-        $basic = $contestModel->basic($cid);
69
+        $basic=$contestModel->basic($cid);
70 70
         if (Auth::check()) {
71 71
             $contest_detail=$contestModel->detail($cid, Auth::user()->id);
72 72
             $registration=$contestModel->registration($cid, Auth::user()->id);
Please login to merge, or discard this patch.
app/Http/Controllers/Contest/BoardController.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
         $contestModel=new ContestModel();
35 35
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
36 36
         $basicInfo=$contestModel->basic($cid);
37
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
38
-            if($clearance == 3){
37
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
38
+            if ($clearance==3) {
39 39
                 return Redirect::route('contest.admin', ['cid' => $cid]);
40
-            }else{
40
+            } else {
41 41
                 return Redirect::route('contest.detail', ['cid' => $cid]);
42 42
             }
43 43
         }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         if ($remainingTime<=0) {
51 51
             $remainingTime=0;
52 52
         }
53
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
53
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
54 54
             return Redirect::route('contest.detail', ['cid' => $cid]);
55 55
         }
56 56
         return view('contest.board.challenge', [
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
         $accountModel=new AccountModel();
84 84
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
85 85
         $basicInfo=$contestModel->basic($cid);
86
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
87
-            if($clearance == 3){
86
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
87
+            if ($clearance==3) {
88 88
                 return Redirect::route('contest.admin', ['cid' => $cid]);
89
-            }else{
89
+            } else {
90 90
                 return Redirect::route('contest.detail', ['cid' => $cid]);
91 91
             }
92 92
         }
93 93
         $basicInfo=$contestModel->basic($cid);
94
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
94
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
95 95
             return Redirect::route('contest.detail', ['cid' => $cid]);
96 96
         }
97 97
         $contest_name=$contestModel->contestName($cid);
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
             ];
123 123
         }
124 124
 
125
-        $editor_left_width = $accountModel->getExtra(Auth::user()->id, 'editor_left_width');
126
-        if(empty($editor_left_width)) $editor_left_width='40';
125
+        $editor_left_width=$accountModel->getExtra(Auth::user()->id, 'editor_left_width');
126
+        if (empty($editor_left_width)) $editor_left_width='40';
127 127
 
128 128
         return view('contest.board.editor', [
129 129
             'page_title'=>"Problem Detail",
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
         $contestModel=new ContestModel();
158 158
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
159 159
         $basicInfo=$contestModel->basic($cid);
160
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
161
-            if($clearance == 3){
160
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
161
+            if ($clearance==3) {
162 162
                 return Redirect::route('contest.admin', ['cid' => $cid]);
163
-            }else{
163
+            } else {
164 164
                 return Redirect::route('contest.detail', ['cid' => $cid]);
165 165
             }
166 166
         }
167 167
         $basicInfo=$contestModel->basic($cid);
168
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
168
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
169 169
             return Redirect::route('contest.detail', ['cid' => $cid]);
170 170
         }
171 171
         $contest_name=$contestModel->contestName($cid);
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 
177 177
         // To determine the ranking
178 178
         foreach ($contestRank as $i => &$r) {
179
-            if($i != 0) {
180
-                if($r['score'] == $contestRank[$i-1]['score'] && $r['penalty'] == $contestRank[$i-1]['penalty']){
181
-                    $r['rank'] = $contestRank[$i-1]['rank'];
182
-                }else{
183
-                    $r['rank'] = $i + 1;
179
+            if ($i!=0) {
180
+                if ($r['score']==$contestRank[$i-1]['score'] && $r['penalty']==$contestRank[$i-1]['penalty']) {
181
+                    $r['rank']=$contestRank[$i-1]['rank'];
182
+                } else {
183
+                    $r['rank']=$i+1;
184 184
                 }
185
-            }else{
186
-                $r['rank'] = 1;
185
+            } else {
186
+                $r['rank']=1;
187 187
             }
188 188
         }
189 189
         $rankFrozen=$contestModel->isFrozen($cid);
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
         $contestModel=new ContestModel();
221 221
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
222 222
         $basicInfo=$contestModel->basic($cid);
223
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
224
-            if($clearance == 3){
223
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
224
+            if ($clearance==3) {
225 225
                 return Redirect::route('contest.admin', ['cid' => $cid]);
226
-            }else{
226
+            } else {
227 227
                 return Redirect::route('contest.detail', ['cid' => $cid]);
228 228
             }
229 229
         }
230 230
         $basicInfo=$contestModel->basic($cid);
231
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
231
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
232 232
             return Redirect::route('contest.detail', ['cid' => $cid]);
233 233
         }
234 234
         $contest_name=$contestModel->contestName($cid);
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
         $contestModel=new ContestModel();
263 263
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
264 264
         $basicInfo=$contestModel->basic($cid);
265
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
266
-            if($clearance == 3){
265
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
266
+            if ($clearance==3) {
267 267
                 return Redirect::route('contest.admin', ['cid' => $cid]);
268
-            }else{
268
+            } else {
269 269
                 return Redirect::route('contest.detail', ['cid' => $cid]);
270 270
             }
271 271
         }
272
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
272
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
273 273
             return Redirect::route('contest.detail', ['cid' => $cid]);
274 274
         }
275 275
         $contest_name=$contestModel->contestName($cid);
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
         $contestModel=new ContestModel();
301 301
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
302 302
         $basicInfo=$contestModel->basic($cid);
303
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
304
-            if($clearance == 3){
303
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
304
+            if ($clearance==3) {
305 305
                 return Redirect::route('contest.admin', ['cid' => $cid]);
306
-            }else{
306
+            } else {
307 307
                 return Redirect::route('contest.detail', ['cid' => $cid]);
308 308
             }
309 309
         }
310
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
310
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
311 311
             return Redirect::route('contest.detail', ['cid' => $cid]);
312 312
         }
313 313
         $contest_name=$contestModel->contestName($cid);
@@ -324,19 +324,19 @@  discard block
 block discarded – undo
324 324
         ]);
325 325
     }
326 326
 
327
-    public function analysis($cid){
327
+    public function analysis($cid) {
328 328
         $contestModel=new ContestModel();
329 329
         $clearance=$contestModel->judgeClearance($cid, Auth::user()->id);
330 330
         $basicInfo=$contestModel->basic($cid);
331
-        if (!$clearance || time() < strtotime($basicInfo['begin_time'])) {
332
-            if($clearance == 3){
331
+        if (!$clearance || time()<strtotime($basicInfo['begin_time'])) {
332
+            if ($clearance==3) {
333 333
                 return Redirect::route('contest.admin', ['cid' => $cid]);
334
-            }else{
334
+            } else {
335 335
                 return Redirect::route('contest.detail', ['cid' => $cid]);
336 336
             }
337 337
         }
338 338
         $basicInfo=$contestModel->basic($cid);
339
-        if($basicInfo['public'] && !$basicInfo['audit_status']){
339
+        if ($basicInfo['public'] && !$basicInfo['audit_status']) {
340 340
             return Redirect::route('contest.detail', ['cid' => $cid]);
341 341
         }
342 342
         $contest_name=$contestModel->contestName($cid);
Please login to merge, or discard this patch.
app/Babel/Extension/noj/Submitter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
             "spj_version" => null,
77 77
             "spj_config" => null
78 78
         ];
79
-        if($probBasic["spj"] && $probBasic["spj_version"]){
79
+        if ($probBasic["spj"] && $probBasic["spj_version"]) {
80 80
             $submit_data["spj_version"]=$probBasic["spj_version"];
81 81
             $submit_data["spj_config"]=$probBasic["spj_lang"];
82 82
         }
Please login to merge, or discard this patch.
app/Http/Controllers/OAuth/GithubController.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -13,18 +13,18 @@  discard block
 block discarded – undo
13 13
 {
14 14
     public function redirectTo()
15 15
     {
16
-        $accountModel = new AccountModel();
16
+        $accountModel=new AccountModel();
17 17
         $info=$accountModel->detail(Auth::user()->id);
18
-        if(Auth::check() && $info['contest_account']){
18
+        if (Auth::check() && $info['contest_account']) {
19 19
             return redirect('/account/settings');
20 20
         }
21
-        if(Auth::check() && $accountModel->getExtra(Auth::user()->id ,'github_id')){
22
-            return view('oauth.index',[
21
+        if (Auth::check() && $accountModel->getExtra(Auth::user()->id, 'github_id')) {
22
+            return view('oauth.index', [
23 23
                 'page_title'=>"OAuth",
24 24
                 'site_title'=>config("app.name"),
25 25
                 'navigation'=>"OAuth",
26 26
                 'platform' => 'Github',
27
-                'display_html' => 'You\'re already tied to the github account : <span class="text-info">'.$accountModel->getExtra(Auth::user()->id ,'github_email').'</span><br />
27
+                'display_html' => 'You\'re already tied to the github account : <span class="text-info">'.$accountModel->getExtra(Auth::user()->id, 'github_email').'</span><br />
28 28
                 You can choose to unbind or go back to the homepage',
29 29
                 'buttons' => [
30 30
                     [
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function handleCallback()
46 46
     {
47
-        try{
48
-            $github_user = Socialite::driver('github')->user();
49
-        }catch(\Laravel\Socialite\Two\InvalidStateException $e){
47
+        try {
48
+            $github_user=Socialite::driver('github')->user();
49
+        } catch (\Laravel\Socialite\Two\InvalidStateException $e) {
50 50
             return redirect('/');
51 51
         }
52 52
 
53
-        $accountModel = new AccountModel();
54
-        if(Auth::check()){
55
-            $user_id = Auth::user()->id;
56
-            $ret = $accountModel->findExtra('github_id',$github_user->id);
57
-            if(!empty($ret) && $ret['uid'] != $user_id){
58
-                $user = UserModel::find($ret['uid']);
59
-                return view('oauth.index',[
53
+        $accountModel=new AccountModel();
54
+        if (Auth::check()) {
55
+            $user_id=Auth::user()->id;
56
+            $ret=$accountModel->findExtra('github_id', $github_user->id);
57
+            if (!empty($ret) && $ret['uid']!=$user_id) {
58
+                $user=UserModel::find($ret['uid']);
59
+                return view('oauth.index', [
60 60
                     'page_title'=>"OAuth",
61 61
                     'site_title'=>config("app.name"),
62 62
                     'navigation'=>"OAuth",
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
                     ]
72 72
                 ]);
73 73
             }
74
-            $accountModel->setExtra($user_id,'github_id',$github_user->id);
75
-            $accountModel->setExtra($user_id,'github_email',$github_user->email);
76
-            $accountModel->setExtra($user_id,'github_nickname',$github_user->nickname);
77
-            $accountModel->setExtra($user_id,'github_homepage',($github_user->user)['html_url']);
78
-            $accountModel->setExtra($user_id,'github_token',$github_user->token,101);
79
-            return view('oauth.index',[
74
+            $accountModel->setExtra($user_id, 'github_id', $github_user->id);
75
+            $accountModel->setExtra($user_id, 'github_email', $github_user->email);
76
+            $accountModel->setExtra($user_id, 'github_nickname', $github_user->nickname);
77
+            $accountModel->setExtra($user_id, 'github_homepage', ($github_user->user)['html_url']);
78
+            $accountModel->setExtra($user_id, 'github_token', $github_user->token, 101);
79
+            return view('oauth.index', [
80 80
                 'page_title'=>"OAuth",
81 81
                 'site_title'=>config("app.name"),
82 82
                 'navigation'=>"OAuth",
83 83
                 'platform' => 'Github',
84
-                'display_html' => 'You have successfully tied up the github account : <span class="text-info">'.$accountModel->getExtra(Auth::user()->id ,'github_email').'</span><br />
84
+                'display_html' => 'You have successfully tied up the github account : <span class="text-info">'.$accountModel->getExtra(Auth::user()->id, 'github_email').'</span><br />
85 85
                 You can log in to '.config("app.name").' later using this account',
86 86
                 'buttons' => [
87 87
                     [
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
                     ],
91 91
                 ]
92 92
             ]);
93
-        }else{
94
-            $ret = $accountModel->findExtra('github_id',$github_user->id);
95
-            if(!empty($ret)){
93
+        } else {
94
+            $ret=$accountModel->findExtra('github_id', $github_user->id);
95
+            if (!empty($ret)) {
96 96
                 Auth::loginUsingId($ret['uid']);
97
-                $user_id = Auth::user()->id;
98
-                $accountModel->setExtra($user_id,'github_email',$github_user->email);
99
-                $accountModel->setExtra($user_id,'github_nickname',$github_user->nickname);
100
-                $accountModel->setExtra($user_id,'github_homepage',($github_user->user)['html_url']);
101
-                $accountModel->setExtra($user_id,'github_token',$github_user->token,101);
97
+                $user_id=Auth::user()->id;
98
+                $accountModel->setExtra($user_id, 'github_email', $github_user->email);
99
+                $accountModel->setExtra($user_id, 'github_nickname', $github_user->nickname);
100
+                $accountModel->setExtra($user_id, 'github_homepage', ($github_user->user)['html_url']);
101
+                $accountModel->setExtra($user_id, 'github_token', $github_user->token, 101);
102 102
                 return redirect('/');
103
-            }else{
104
-                return view('oauth.index',[
103
+            } else {
104
+                return view('oauth.index', [
105 105
                     'page_title'=>"OAuth",
106 106
                     'site_title'=>config("app.name"),
107 107
                     'navigation'=>"OAuth",
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
 
125 125
     public function unbind()
126 126
     {
127
-        $accountModel = new AccountModel();
128
-        if($accountModel->getExtra(Auth::user()->id ,'github_id')){
129
-            return view('oauth.index',[
127
+        $accountModel=new AccountModel();
128
+        if ($accountModel->getExtra(Auth::user()->id, 'github_id')) {
129
+            return view('oauth.index', [
130 130
                 'page_title'=>"OAuth",
131 131
                 'site_title'=>config("app.name"),
132 132
                 'navigation'=>"OAuth",
133 133
                 'platform' => 'Github',
134 134
                 'display_html' => 'You are trying to unbind the following two : <br />
135 135
                 Your '.config("app.name").' account : <span class="text-info">'.Auth::user()->email.'</span><br />
136
-                This Github account : <span class="text-info">'.$accountModel->getExtra(Auth::user()->id ,'github_email').'</span><br />
136
+                This Github account : <span class="text-info">'.$accountModel->getExtra(Auth::user()->id, 'github_email').'</span><br />
137 137
                 Make your decision carefully, although you can later establish the binding again',
138 138
                 'buttons' => [
139 139
                     [
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
                     ],
148 148
                 ]
149 149
             ]);
150
-        }else{
151
-            return view('oauth.index',[
150
+        } else {
151
+            return view('oauth.index', [
152 152
                 'page_title'=>"OAuth",
153 153
                 'site_title'=>config("app.name"),
154 154
                 'navigation'=>"OAuth",
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
 
167 167
     public function confirmUnbind()
168 168
     {
169
-        $accountModel = new AccountModel();
170
-        $user_id = Auth::user()->id;
171
-        if($accountModel->getExtra($user_id ,'github_id')){
172
-            $accountModel->setExtra($user_id,'github_id',null);
173
-            $accountModel->setExtra($user_id,'github_email',null);
174
-            $accountModel->setExtra($user_id,'github_nickname',null);
175
-            $accountModel->setExtra($user_id,'github_homepage',null);
176
-            $accountModel->setExtra($user_id,'github_token',null);
177
-            return view('oauth.index',[
169
+        $accountModel=new AccountModel();
170
+        $user_id=Auth::user()->id;
171
+        if ($accountModel->getExtra($user_id, 'github_id')) {
172
+            $accountModel->setExtra($user_id, 'github_id', null);
173
+            $accountModel->setExtra($user_id, 'github_email', null);
174
+            $accountModel->setExtra($user_id, 'github_nickname', null);
175
+            $accountModel->setExtra($user_id, 'github_homepage', null);
176
+            $accountModel->setExtra($user_id, 'github_token', null);
177
+            return view('oauth.index', [
178 178
                 'page_title'=>"OAuth",
179 179
                 'site_title'=>config("app.name"),
180 180
                 'navigation'=>"OAuth",
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
                     ],
188 188
                 ]
189 189
             ]);
190
-        }else{
191
-            return view('oauth.index',[
190
+        } else {
191
+            return view('oauth.index', [
192 192
                 'page_title'=>"OAuth",
193 193
                 'site_title'=>config("app.name"),
194 194
                 'navigation'=>"OAuth",
Please login to merge, or discard this patch.
app/Babel/Extension/noj/JudgeClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     }
65 65
     public function getLanguageConfigByLanguage($language, $spj=false)
66 66
     {
67
-        return $this->getLanguageConfigByKey($language.($spj?'_lang_spj_config':'_lang_config'));
67
+        return $this->getLanguageConfigByKey($language.($spj ? '_lang_spj_config' : '_lang_config'));
68 68
     }
69 69
     public function getLanguageConfigByKey($key)
70 70
     {
Please login to merge, or discard this patch.
app/Models/ProblemModel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 
179 179
     private function inteliAudit($uid, $content)
180 180
     {
181
-        if (strpos($content, '```')!==false){
181
+        if (strpos($content, '```')!==false) {
182 182
             $userSolutionHistory=DB::table("problem_solution")->where(['uid'=>$uid])->orderByDesc('updated_at')->first();
183
-            if (!empty($userSolutionHistory) && $userSolutionHistory["audit"]==1){
183
+            if (!empty($userSolutionHistory) && $userSolutionHistory["audit"]==1) {
184 184
                 return 1;
185 185
             }
186 186
         }
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
     {
277 277
         // $prob_list = DB::table($this->table)->select("pid","pcode","title")->get()->all(); // return a array
278 278
         $submissionModel=new SubmissionModel();
279
-        $preQuery=DB::table($this->table)->where('hide','=',0);
279
+        $preQuery=DB::table($this->table)->where('hide', '=', 0);
280 280
         if ($filter['oj']) {
281 281
             $preQuery=$preQuery->where(["OJ"=>$filter['oj']]);
282 282
         }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
         if (!empty($data["sample"])) {
432 432
             foreach ($data["sample"] as $d) {
433
-                if(!isset($d['sample_note'])) $d['sample_note']=null;
433
+                if (!isset($d['sample_note'])) $d['sample_note']=null;
434 434
                 DB::table("problem_sample")->insert([
435 435
                     'pid'=>$pid,
436 436
                     'sample_input'=>$d['sample_input'],
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 
477 477
         if (!empty($data["sample"])) {
478 478
             foreach ($data["sample"] as $d) {
479
-                if(!isset($d['sample_note'])) $d['sample_note']=null;
479
+                if (!isset($d['sample_note'])) $d['sample_note']=null;
480 480
                 DB::table("problem_sample")->insert([
481 481
                     'pid'=>$pid,
482 482
                     'sample_input'=>$d['sample_input'],
@@ -491,6 +491,6 @@  discard block
 block discarded – undo
491 491
 
492 492
     public function isHidden($pid)
493 493
     {
494
-        return DB::table('problem')->where('pid','=',$pid)->get()->first()['hide'];
494
+        return DB::table('problem')->where('pid', '=', $pid)->get()->first()['hide'];
495 495
     }
496 496
 }
Please login to merge, or discard this patch.
app/Models/Search/ProblemSearchModel.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@
 block discarded – undo
13 13
 
14 14
     public function search($key)
15 15
     {
16
-        $result = [];
17
-        if(strlen($key) >= 2){
18
-            $ret = self::where('pcode', $key)
19
-                ->orWhereRaw('MATCH(`title`) AGAINST (? IN BOOLEAN MODE)',[$key])
16
+        $result=[];
17
+        if (strlen($key)>=2) {
18
+            $ret=self::where('pcode', $key)
19
+                ->orWhereRaw('MATCH(`title`) AGAINST (? IN BOOLEAN MODE)', [$key])
20 20
                 ->select('pcode', 'title')
21 21
                 ->limit(120)
22 22
                 ->get()->all();
23
-            if(!empty($ret)){
24
-                $result += $ret;
23
+            if (!empty($ret)) {
24
+                $result+=$ret;
25 25
             }
26 26
         }
27
-        $problemModel = new ProblemModel();
27
+        $problemModel=new ProblemModel();
28 28
         foreach ($result as $p_index => $p) {
29
-            if($problemModel->isBlocked($p['pid']) || $problemModel->isHidden($p["pid"])){
29
+            if ($problemModel->isBlocked($p['pid']) || $problemModel->isHidden($p["pid"])) {
30 30
                 unset($result[$p_index]);
31 31
             }
32 32
         }
Please login to merge, or discard this patch.