Passed
Push — master ( f5f59c...7a263d )
by Ferry
04:39
created
src/routes.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,50 +1,50 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Developer Backend Middleware
4
-Route::group(['middleware' => ['web',\crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
4
+Route::group(['middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBDeveloper::class],
5 5
     'prefix'=>"developer/".getSetting('developer_path'),
6
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
6
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
7 7
     cb()->routeController("modules", "\crocodicstudio\crudbooster\controllers\DeveloperModulesController");
8 8
     cb()->routeController("menus", "\crocodicstudio\crudbooster\controllers\DeveloperMenusController");
9
-    cb()->routeController("roles","\crocodicstudio\crudbooster\controllers\DeveloperRolesController");
10
-    cb()->routeController("users","\crocodicstudio\crudbooster\controllers\DeveloperUsersController");
11
-    cb()->routeController("plugins","\crocodicstudio\crudbooster\controllers\DeveloperPluginStoreController");
12
-    cb()->routeController("mail","\crocodicstudio\crudbooster\controllers\DeveloperMailController");
13
-    cb()->routeController("security","\crocodicstudio\crudbooster\controllers\DeveloperSecurityController");
14
-    cb()->routeController("appearance","\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
15
-    cb()->routeController("miscellaneous","\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
16
-    cb()->routePost("skip-tutorial","DeveloperDashboardController@postSkipTutorial");
17
-    cb()->routeGet("/","DeveloperDashboardController@getIndex");
9
+    cb()->routeController("roles", "\crocodicstudio\crudbooster\controllers\DeveloperRolesController");
10
+    cb()->routeController("users", "\crocodicstudio\crudbooster\controllers\DeveloperUsersController");
11
+    cb()->routeController("plugins", "\crocodicstudio\crudbooster\controllers\DeveloperPluginStoreController");
12
+    cb()->routeController("mail", "\crocodicstudio\crudbooster\controllers\DeveloperMailController");
13
+    cb()->routeController("security", "\crocodicstudio\crudbooster\controllers\DeveloperSecurityController");
14
+    cb()->routeController("appearance", "\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController");
15
+    cb()->routeController("miscellaneous", "\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController");
16
+    cb()->routePost("skip-tutorial", "DeveloperDashboardController@postSkipTutorial");
17
+    cb()->routeGet("/", "DeveloperDashboardController@getIndex");
18 18
 });
19 19
 
20 20
 // Developer Auth Middleware
21 21
 Route::group(['middleware' => ['web'],
22 22
     'prefix'=>"developer/".getSetting('developer_path'),
23
-    'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
24
-    cb()->routePost("login","AdminAuthController@postLoginDeveloper");
25
-    cb()->routeGet("login","AdminAuthController@getLoginDeveloper");
26
-    cb()->routeGet("logout","AdminAuthController@getLogoutDeveloper");
23
+    'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
24
+    cb()->routePost("login", "AdminAuthController@postLoginDeveloper");
25
+    cb()->routeGet("login", "AdminAuthController@getLoginDeveloper");
26
+    cb()->routeGet("logout", "AdminAuthController@getLogoutDeveloper");
27 27
 });
28 28
 
29 29
 // Routing without any middleware
30
-Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function () {
31
-    if(getSetting("AUTO_REDIRECT_TO_LOGIN")) {
32
-        cb()->routeGet("/","AdminAuthController@getRedirectToLogin");
30
+Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function() {
31
+    if (getSetting("AUTO_REDIRECT_TO_LOGIN")) {
32
+        cb()->routeGet("/", "AdminAuthController@getRedirectToLogin");
33 33
     }
34 34
 });
35 35
 
36 36
 // Routing without any middleware with admin prefix
37
-Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () {
37
+Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() {
38 38
     cb()->routeGet('logout', "AdminAuthController@getLogout");
39 39
 
40
-    if(!getSetting("DISABLE_LOGIN")) {
40
+    if (!getSetting("DISABLE_LOGIN")) {
41 41
         cb()->routePost('login', "AdminAuthController@postLogin");
42 42
         cb()->routeGet('login', "AdminAuthController@getLogin");
43 43
     }
44 44
 });
45 45
 
46 46
 // Routing package controllers
47
-cb()->routeGroupBackend(function () {
47
+cb()->routeGroupBackend(function() {
48 48
     cb()->routeController('profile', '\crocodicstudio\crudbooster\controllers\AdminProfileController');
49 49
 });
50 50
 
@@ -53,24 +53,24 @@  discard block
 block discarded – undo
53 53
     'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class],
54 54
     'prefix' => cb()->getAdminPath(),
55 55
     'namespace' => 'App\Http\Controllers',
56
-], function () {
56
+], function() {
57 57
 
58 58
     if (Request::is(cb()->getAdminPath())) {
59
-        if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
59
+        if ($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
60 60
             cb()->routeGet("/", $dashboard);
61
-        }else{
61
+        } else {
62 62
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
63 63
         }
64 64
     }
65 65
 
66 66
     $controllers = glob(app_path('Http/Controllers/Admin*Controller.php'));
67 67
 
68
-    foreach($controllers as $controller) {
68
+    foreach ($controllers as $controller) {
69 69
         $controllerName = basename($controller);
70
-        $controllerName = rtrim($controllerName,".php");
70
+        $controllerName = rtrim($controllerName, ".php");
71 71
         $className = '\App\Http\Controllers\\'.$controllerName;
72 72
         $controllerClass = new $className();
73
-        if(method_exists($controllerClass, 'cbInit')) {
73
+        if (method_exists($controllerClass, 'cbInit')) {
74 74
             cb()->routeController($controllerClass->getData('permalink'), $controllerName);
75 75
         }
76 76
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     if (Request::is(cb()->getAdminPath())) {
59 59
         if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) {
60 60
             cb()->routeGet("/", $dashboard);
61
-        }else{
61
+        } else{
62 62
             cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex");
63 63
         }
64 64
     }
Please login to merge, or discard this patch.
src/helpers/CB.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     }
25 25
 
26 26
     public function getRoleByName($roleName) {
27
-        return $this->find("cb_roles",['name'=>$roleName]);
27
+        return $this->find("cb_roles", ['name'=>$roleName]);
28 28
     }
29 29
 
30 30
     public function fcm() {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     }
41 41
 
42 42
     public function getDeveloperUrl($path = null) {
43
-        $path = ($path)?"/".trim($path,"/"):null;
43
+        $path = ($path) ? "/".trim($path, "/") : null;
44 44
         return url("developer/".getSetting("developer_path")).$path;
45 45
     }
46 46
 
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
     }
58 58
 
59 59
     public function getAdminPath() {
60
-        return getSetting("ADMIN_PATH","admin");
60
+        return getSetting("ADMIN_PATH", "admin");
61 61
     }
62 62
 
63 63
     public function getAdminUrl($path = null) {
64
-        $path = ($path)?"/".trim($path,"/"):null;
64
+        $path = ($path) ? "/".trim($path, "/") : null;
65 65
         return url($this->getAdminPath()).$path;
66 66
     }
67 67
 
68 68
     public function getAppName() {
69
-        return getSetting("APP_NAME", env("APP_NAME","CRUDBOOSTER"));
69
+        return getSetting("APP_NAME", env("APP_NAME", "CRUDBOOSTER"));
70 70
     }
71 71
 
72 72
     /**
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function uploadFileProcess($filename, $extension, $file, $encrypt = true, $resize_width = null, $resize_height = null)
82 82
     {
83
-        if(in_array($extension,cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
83
+        if (in_array($extension, cbConfig("UPLOAD_FILE_EXTENSION_ALLOWED"))) {
84 84
             $file_path = cbConfig("UPLOAD_PATH_FORMAT");
85
-            $file_path = str_replace("{Y}",date('Y'), $file_path);
85
+            $file_path = str_replace("{Y}", date('Y'), $file_path);
86 86
             $file_path = str_replace("{m}", date('m'), $file_path);
87 87
             $file_path = str_replace("{d}", date("d"), $file_path);
88 88
 
89 89
             //Create Directory Base On Template
90 90
             Storage::makeDirectory($file_path);
91
-            Storage::put($file_path."/index.html","&nbsp;","public");
92
-            Storage::put($file_path."/.gitignore","!.gitignore","public");
91
+            Storage::put($file_path."/index.html", "&nbsp;", "public");
92
+            Storage::put($file_path."/.gitignore", "!.gitignore", "public");
93 93
 
94 94
             if ($encrypt == true) {
95 95
                 $filename = md5(strRandom(5)).'.'.$extension;
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
                 $filename = slug($filename, '_').'.'.$extension;
98 98
             }
99 99
 
100
-            if($resize_width || $resize_height) {
100
+            if ($resize_width || $resize_height) {
101 101
                 $this->resizeImage($file, $file_path.'/'.$filename, $resize_width, $resize_height);
102 102
                 return $file_path.'/'.$filename;
103
-            }else{
103
+            } else {
104 104
                 if (Storage::putFileAs($file_path, $file, $filename, 'public')) {
105 105
                     return $file_path.'/'.$filename;
106 106
                 } else {
107 107
                     throw new \Exception("Something went wrong, file can't upload!");
108 108
                 }
109 109
             }
110
-        }else{
110
+        } else {
111 111
             throw new \Exception("The file format is not allowed!");
112 112
         }
113 113
     }
@@ -123,16 +123,16 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $fileData = base64_decode($base64_value);
125 125
         $mime_type = finfo_buffer(finfo_open(), $fileData, FILEINFO_MIME_TYPE);
126
-        if($mime_type) {
127
-            if($mime_type = explode('/', $mime_type)) {
126
+        if ($mime_type) {
127
+            if ($mime_type = explode('/', $mime_type)) {
128 128
                 $ext = $mime_type[1];
129
-                if($filename && $ext) {
129
+                if ($filename && $ext) {
130 130
                     return $this->uploadFileProcess($filename, $ext, $fileData, $encrypt, $resize_width, $resize_height);
131 131
                 }
132
-            }else {
132
+            } else {
133 133
                 throw new \Exception("Mime type not found");
134 134
             }
135
-        }else{
135
+        } else {
136 136
             throw new \Exception("Mime type not found");
137 137
         }
138 138
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             $filename = $file->getClientOriginalName();
153 153
             $ext = strtolower($file->getClientOriginalExtension());
154 154
 
155
-            if($filename && $ext) {
155
+            if ($filename && $ext) {
156 156
                 return $this->uploadFileProcess($filename, $ext, $file, $encrypt, $resize_width, $resize_height);
157 157
             }
158 158
 
@@ -187,29 +187,29 @@  discard block
 block discarded – undo
187 187
             if ($resize_width && $resize_height) {
188 188
                 $img->fit($resize_width, $resize_height);
189 189
 
190
-            } elseif ($resize_width && ! $resize_height) {
190
+            } elseif ($resize_width && !$resize_height) {
191 191
 
192
-                $img->resize($resize_width, null, function ($constraint) {
192
+                $img->resize($resize_width, null, function($constraint) {
193 193
                     $constraint->aspectRatio();
194 194
                 });
195 195
 
196
-            } elseif (! $resize_width && $resize_height) {
196
+            } elseif (!$resize_width && $resize_height) {
197 197
 
198
-                $img->resize(null, $resize_height, function ($constraint) {
198
+                $img->resize(null, $resize_height, function($constraint) {
199 199
                     $constraint->aspectRatio();
200 200
                 });
201 201
 
202 202
             } else {
203 203
 
204 204
                 if ($img->width() > cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES")) {
205
-                    $img->resize(cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES"), null, function ($constraint) {
205
+                    $img->resize(cbConfig("DEFAULT_IMAGE_MAX_WIDTH_RES"), null, function($constraint) {
206 206
                         $constraint->aspectRatio();
207 207
                     });
208 208
                 }
209 209
             }
210 210
 
211 211
             Storage::put($fullFilePath, $img, 'public');
212
-        }else{
212
+        } else {
213 213
             throw new \Exception("The file format is not allowed!");
214 214
         }
215 215
     }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         $validator = Validator::make($input_arr, $rules, $messages);
323 323
         if ($validator->fails()) {
324 324
             $message = $validator->errors()->all();
325
-            throw new CBValidationException(implode("; ",$message));
325
+            throw new CBValidationException(implode("; ", $message));
326 326
         }
327 327
     }
328 328
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     public function findPrimaryKey($table)
335 335
     {
336 336
         $pk = DB::getDoctrineSchemaManager()->listTableDetails($table)->getPrimaryKey();
337
-        if(!$pk) {
337
+        if (!$pk) {
338 338
             return null;
339 339
         }
340 340
         return $pk->getColumns()[0];
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             $string_parameters_array = explode('&', $string_parameters);
384 384
             foreach ($string_parameters_array as $s) {
385 385
                 $part = explode('=', $s);
386
-                if(isset($part[0]) && isset($part[1])) {
386
+                if (isset($part[0]) && isset($part[1])) {
387 387
                     $name = htmlspecialchars(urldecode($part[0]));
388 388
                     $name = strip_tags($name);
389 389
                     $value = htmlspecialchars(urldecode($part[1]));
@@ -400,16 +400,16 @@  discard block
 block discarded – undo
400 400
 
401 401
 
402 402
     public function routeGet($prefix, $controller) {
403
-        $alias = str_replace("@"," ", $controller);
403
+        $alias = str_replace("@", " ", $controller);
404 404
         $alias = ucwords($alias);
405
-        $alias = str_replace(" ","",$alias);
405
+        $alias = str_replace(" ", "", $alias);
406 406
         Route::get($prefix, ['uses' => $controller, 'as' => $alias]);
407 407
     }
408 408
 
409 409
     public function routePost($prefix, $controller) {
410
-        $alias = str_replace("@"," ", $controller);
410
+        $alias = str_replace("@", " ", $controller);
411 411
         $alias = ucwords($alias);
412
-        $alias = str_replace(" ","",$alias);
412
+        $alias = str_replace(" ", "", $alias);
413 413
         Route::post($prefix, ['uses' => $controller, 'as' => $alias]);
414 414
     }
415 415
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 
443 443
         $prefix = trim($prefix, '/').'/';
444 444
 
445
-        if(substr($controller,0,1) != "\\") {
445
+        if (substr($controller, 0, 1) != "\\") {
446 446
             $controller = "\App\Http\Controllers\\".$controller;
447 447
         }
448 448
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
             if($resize_width || $resize_height) {
101 101
                 $this->resizeImage($file, $file_path.'/'.$filename, $resize_width, $resize_height);
102 102
                 return $file_path.'/'.$filename;
103
-            }else{
103
+            } else{
104 104
                 if (Storage::putFileAs($file_path, $file, $filename, 'public')) {
105 105
                     return $file_path.'/'.$filename;
106 106
                 } else {
107 107
                     throw new \Exception("Something went wrong, file can't upload!");
108 108
                 }
109 109
             }
110
-        }else{
110
+        } else{
111 111
             throw new \Exception("The file format is not allowed!");
112 112
         }
113 113
     }
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
                 if($filename && $ext) {
130 130
                     return $this->uploadFileProcess($filename, $ext, $fileData, $encrypt, $resize_width, $resize_height);
131 131
                 }
132
-            }else {
132
+            } else {
133 133
                 throw new \Exception("Mime type not found");
134 134
             }
135
-        }else{
135
+        } else{
136 136
             throw new \Exception("Mime type not found");
137 137
         }
138 138
     }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             }
210 210
 
211 211
             Storage::put($fullFilePath, $img, 'public');
212
-        }else{
212
+        } else{
213 213
             throw new \Exception("The file format is not allowed!");
214 214
         }
215 215
     }
Please login to merge, or discard this patch.
src/helpers/HTMLHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $data['name'] = $name;
26 26
         $data['label'] = $label;
27 27
         $data['required'] = $required;
28
-        $data['encrypt'] = isset($options['encrypt'])?$options['encrypt']:true;
28
+        $data['encrypt'] = isset($options['encrypt']) ? $options['encrypt'] : true;
29 29
         return view("crudbooster::html_helper.file_uploader.index", $data);
30 30
     }
31 31
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $data['name'] = $name;
43 43
         $data['label'] = $label;
44 44
         $data['required'] = $required;
45
-        $data['encrypt'] = isset($options['encrypt'])?$options['encrypt']:true;
45
+        $data['encrypt'] = isset($options['encrypt']) ? $options['encrypt'] : true;
46 46
         @$data['resizeWidth'] = $options['resize_width'];
47 47
         @$data['resizeHeight'] = $options['resize_height'];
48 48
         return view("crudbooster::html_helper.image_uploader.index", $data);
Please login to merge, or discard this patch.
src/types/file/Route.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-cb()->routeGroupBackend(function () {
4
-    cb()->routePost("upload-file",'\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
3
+cb()->routeGroupBackend(function() {
4
+    cb()->routePost("upload-file", '\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
5 5
 });
6 6
 
7
-cb()->routeGroupDeveloper(function () {
8
-    cb()->routePost("upload-file",'\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
7
+cb()->routeGroupDeveloper(function() {
8
+    cb()->routePost("upload-file", '\crocodicstudio\crudbooster\types\file\FileController@postUploadFile');
9 9
 });
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
src/types/file/FileController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@
 block discarded – undo
19 19
         try {
20 20
 
21 21
             cb()->validation([
22
-                'userfile' => 'required|mimes:' . implode(",",config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED'))
22
+                'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_FILE_EXTENSION_ALLOWED'))
23 23
             ]);
24 24
 
25 25
             $file = cb()->uploadFile('userfile', request("encrypt"));
26 26
 
27 27
         } catch (CBValidationException $e) {
28
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
28
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
29 29
         } catch (\Exception $e) {
30
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
30
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
31 31
         }
32 32
 
33 33
         return response()->json([
Please login to merge, or discard this patch.
src/types/image/ImageController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@
 block discarded – undo
18 18
         try {
19 19
 
20 20
             cb()->validation([
21
-                'userfile' => 'required|mimes:' . implode(",",config('crudbooster.UPLOAD_IMAGE_EXTENSION_ALLOWED'))
21
+                'userfile' => 'required|mimes:'.implode(",", config('crudbooster.UPLOAD_IMAGE_EXTENSION_ALLOWED'))
22 22
             ]);
23 23
 
24
-            $file = cb()->uploadFile('userfile', request("encrypt")?true:false, request("resize_width"), request("resize_height"));
24
+            $file = cb()->uploadFile('userfile', request("encrypt") ?true:false, request("resize_width"), request("resize_height"));
25 25
 
26 26
         } catch (CBValidationException $e) {
27
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
27
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
28 28
         } catch (\Exception $e) {
29
-            return response()->json(['status'=>false,'message'=>$e->getMessage()]);
29
+            return response()->json(['status'=>false, 'message'=>$e->getMessage()]);
30 30
         }
31 31
 
32 32
         return response()->json([
Please login to merge, or discard this patch.
src/types/image/Route.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-cb()->routeGroupBackend(function () {
4
-    cb()->routePost("upload-image",'\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
3
+cb()->routeGroupBackend(function() {
4
+    cb()->routePost("upload-image", '\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
5 5
 });
6 6
 
7
-cb()->routeGroupDeveloper(function () {
8
-    cb()->routePost("upload-image",'\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
7
+cb()->routeGroupDeveloper(function() {
8
+    cb()->routePost("upload-image", '\crocodicstudio\crudbooster\types\image\ImageController@postUploadImage');
9 9
 });
Please login to merge, or discard this patch.
src/controllers/DeveloperSecurityController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function getIndex() {
26 26
         $data = [];
27
-        return view($this->view.".index",$data);
27
+        return view($this->view.".index", $data);
28 28
     }
29 29
 
30 30
     public function postSave()
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
         putSetting("AUTO_SUSPEND_LOGIN", request("AUTO_SUSPEND_LOGIN"));
39 39
         putSetting("AUTO_REDIRECT_TO_LOGIN", request("AUTO_REDIRECT_TO_LOGIN"));
40 40
 
41
-        if(request("htaccess_ServerSignature")) {
41
+        if (request("htaccess_ServerSignature")) {
42 42
             putHtaccess("ServerSignature Off");
43 43
         }
44 44
 
45
-        if(request("htaccess_IndexIgnore")) {
45
+        if (request("htaccess_IndexIgnore")) {
46 46
             putHtaccess("IndexIgnore *");
47 47
         }
48 48
 
49
-        if(request("htaccess_dotAccess")) {
49
+        if (request("htaccess_dotAccess")) {
50 50
 putHtaccess("
51 51
 <FilesMatch \"^\.\">
52 52
 Order allow,deny
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 </FilesMatch>");
55 55
         }
56 56
 
57
-        if(request("htaccess_preventVendor")) {
57
+        if (request("htaccess_preventVendor")) {
58 58
             putHtaccess("RewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]");
59 59
         }
60 60
 
61 61
 
62
-        return cb()->redirectBack("Security has been updated!","success");
62
+        return cb()->redirectBack("Security has been updated!", "success");
63 63
     }
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/AdminAuthController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
     {
19 19
         $key = md5(request()->ip().request()->userAgent());
20 20
 
21
-        if(Cache::has("loginSuspended".$key)) {
21
+        if (Cache::has("loginSuspended".$key)) {
22 22
             return true;
23 23
         }
24 24
 
25
-        if(getSetting("AUTO_SUSPEND_LOGIN") && Cache::get("loginFailed".$key) >= getSetting("AUTO_SUSPEND_LOGIN")) {
25
+        if (getSetting("AUTO_SUSPEND_LOGIN") && Cache::get("loginFailed".$key) >= getSetting("AUTO_SUSPEND_LOGIN")) {
26 26
             Cache::put("loginSuspended".$key, true, 30);
27 27
             Cache::forget("loginFailed".$key);
28 28
             return true;
@@ -37,33 +37,33 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function getLogin()
39 39
     {
40
-        if(!auth()->guest()) return redirect(cb()->getAdminUrl());
40
+        if (!auth()->guest()) return redirect(cb()->getAdminUrl());
41 41
 
42 42
         cbHook()->hookGetLogin();
43 43
 
44
-        return view( str_replace(".blade.php", "", getSetting('login_page_view','crudbooster::login')) );
44
+        return view(str_replace(".blade.php", "", getSetting('login_page_view', 'crudbooster::login')));
45 45
     }
46 46
 
47 47
     public function postLogin()
48 48
     {
49
-        try{
50
-            if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
49
+        try {
50
+            if ($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended"));
51 51
 
52 52
             cb()->validation([
53 53
                 'email'=>'required|email',
54 54
                 'password'=>'required'
55 55
             ]);
56 56
 
57
-            $credential = request()->only(['email','password']);
57
+            $credential = request()->only(['email', 'password']);
58 58
             if (auth()->attempt($credential)) {
59 59
                 cbHook()->hookPostLogin();
60 60
                 return redirect(cb()->getAdminUrl());
61 61
             } else {
62 62
                 $this->incrementFailedLogin();
63
-                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']);
63
+                return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'), 'message_type'=>'warning']);
64 64
             }
65
-        }catch (CBValidationException $e) {
66
-            return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning');
65
+        } catch (CBValidationException $e) {
66
+            return cb()->redirect(cb()->getAdminUrl("login"), $e->getMessage(), 'warning');
67 67
         }
68 68
     }
69 69
 
Please login to merge, or discard this patch.