Passed
Push — master ( 6b3304...34df25 )
by Ferry
03:52
created
src/controllers/scaffolding/traits/ColumnsRegister.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
         $data = new TextModel();
66 66
         $data = $this->setDefaultModelValue($data);
67 67
         $data->setLabel($label);
68
-        $data->setName($this->name($label,$name));
69
-        $data->setField($field_to_save?:$this->name($label, $name));
68
+        $data->setName($this->name($label, $name));
69
+        $data->setField($field_to_save ?: $this->name($label, $name));
70 70
         $data->setOrderByColumn($data->getField());
71 71
         $data->setType("text");
72 72
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
         $data = new CheckboxModel();
83 83
         $data = $this->setDefaultModelValue($data);
84 84
         $data->setLabel($label);
85
-        $data->setName($this->name($label,$name));
86
-        $data->setField($field_to_save?:$this->name($label, $name));
85
+        $data->setName($this->name($label, $name));
86
+        $data->setField($field_to_save ?: $this->name($label, $name));
87 87
         $data->setOrderByColumn($data->getField());
88 88
         $data->setType("checkbox");
89 89
 
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
         $data = new PasswordModel();
100 100
         $data = $this->setDefaultModelValue($data);
101 101
         $data->setLabel($label);
102
-        $data->setName($this->name($label,$name));
103
-        $data->setField($field_to_save?:$this->name($label, $name));
102
+        $data->setName($this->name($label, $name));
103
+        $data->setField($field_to_save ?: $this->name($label, $name));
104 104
         $data->setOrderByColumn($data->getField());
105 105
         $data->setType("password");
106 106
         $data->setShowDetail(false);
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
         $data = new ImageModel();
119 119
         $data = $this->setDefaultModelValue($data);
120 120
         $data->setLabel($label);
121
-        $data->setName($this->name($label,$name));
122
-        $data->setField($field_to_save?:$this->name($label, $name));
121
+        $data->setName($this->name($label, $name));
122
+        $data->setField($field_to_save ?: $this->name($label, $name));
123 123
         $data->setOrderByColumn($data->getField());
124 124
         $data->setType("image");
125 125
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
         $data = new TextAreaModel();
136 136
         $data = $this->setDefaultModelValue($data);
137 137
         $data->setLabel($label);
138
-        $data->setName($this->name($label,$name));
139
-        $data->setField($field_to_save?:$this->name($label, $name));
138
+        $data->setName($this->name($label, $name));
139
+        $data->setField($field_to_save ?: $this->name($label, $name));
140 140
         $data->setOrderByColumn($data->getField());
141 141
         $data->setType("text_area");
142 142
 
@@ -147,20 +147,20 @@  discard block
 block discarded – undo
147 147
 
148 148
     public function addSelectTable($label, $name = null, $selectConfig)
149 149
     {
150
-        if(isset($selectConfig['table']) && isset($selectConfig['value_option']) && isset($selectConfig['display_option'])) {
150
+        if (isset($selectConfig['table']) && isset($selectConfig['value_option']) && isset($selectConfig['display_option'])) {
151 151
             $this->index++;
152 152
 
153 153
             $data = new SelectTableModel();
154 154
             $data = $this->setDefaultModelValue($data);
155 155
             $data->setLabel($label);
156
-            $data->setName($this->name($label,$name));
156
+            $data->setName($this->name($label, $name));
157 157
             $data->setField($this->name($label, $name));
158 158
             $data->setType("select_table");
159 159
             $data->setOrderByColumn($selectConfig['table'].".".$selectConfig["display_option"]);
160 160
             columnSingleton()->setColumn($this->index, $data);
161 161
 
162 162
             $selectTable = new SelectTable($this->index);
163
-            $selectTable->optionsFromTable($selectConfig['table'],$selectConfig['value_option'],$selectConfig['display_option'],@$selectConfig['sql_condition']);
163
+            $selectTable->optionsFromTable($selectConfig['table'], $selectConfig['value_option'], $selectConfig['display_option'], @$selectConfig['sql_condition']);
164 164
 
165 165
             return $selectTable;
166 166
         } else {
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
         $data = new SelectOptionModel();
176 176
         $data = $this->setDefaultModelValue($data);
177 177
         $data->setLabel($label);
178
-        $data->setName($this->name($label,$name));
178
+        $data->setName($this->name($label, $name));
179 179
         $data->setField($this->name($label, $name));
180 180
         $data->setOrderByColumn($data->getField());
181 181
         $data->setType("select_option");
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
         $selectOption = new SelectOption($this->index);
186 186
 
187
-        if($options) {
187
+        if ($options) {
188 188
             $selectOption->options($options);
189 189
         }
190 190
 
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
         $data = new SelectQueryModel();
205 205
         $data = $this->setDefaultModelValue($data);
206 206
         $data->setLabel($label);
207
-        $data->setName($this->name($label,$name));
207
+        $data->setName($this->name($label, $name));
208 208
         $data->setField($this->name($label, $name));
209 209
         $data->setOrderByColumn($data->getField());
210 210
         $data->setType("select_query");
211 211
 
212 212
         columnSingleton()->setColumn($this->index, $data);
213 213
 
214
-        $selectQuery =new SelectQuery($this->index);
214
+        $selectQuery = new SelectQuery($this->index);
215 215
 
216
-        if($query) {
216
+        if ($query) {
217 217
             $selectQuery->optionsFromQuery($query);
218 218
         }
219 219
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
         $data = new CustomModel();
229 229
         $data = $this->setDefaultModelValue($data);
230 230
         $data->setLabel($label);
231
-        $data->setName($this->name($label,$name));
232
-        $data->setField($field_to_save?:$this->name($label, $name));
231
+        $data->setName($this->name($label, $name));
232
+        $data->setField($field_to_save ?: $this->name($label, $name));
233 233
         $data->setOrderByColumn($data->getField());
234 234
         $data->setType("custom");
235 235
 
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
         $data = new DateModel();
246 246
         $data = $this->setDefaultModelValue($data);
247 247
         $data->setLabel($label);
248
-        $data->setName($this->name($label,$name));
249
-        $data->setField($field_to_save?:$this->name($label, $name));
248
+        $data->setName($this->name($label, $name));
249
+        $data->setField($field_to_save ?: $this->name($label, $name));
250 250
         $data->setOrderByColumn($data->getField());
251 251
         $data->setType("date");
252 252
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
         $data = new DatetimeModel();
263 263
         $data = $this->setDefaultModelValue($data);
264 264
         $data->setLabel($label);
265
-        $data->setName($this->name($label,$name));
266
-        $data->setField($field_to_save?:$this->name($label, $name));
265
+        $data->setName($this->name($label, $name));
266
+        $data->setField($field_to_save ?: $this->name($label, $name));
267 267
         $data->setOrderByColumn($data->getField());
268 268
         $data->setType("datetime");
269 269
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
         $data = new EmailModel();
280 280
         $data = $this->setDefaultModelValue($data);
281 281
         $data->setLabel($label);
282
-        $data->setName($this->name($label,$name));
283
-        $data->setField($field_to_save?:$this->name($label, $name));
282
+        $data->setName($this->name($label, $name));
283
+        $data->setField($field_to_save ?: $this->name($label, $name));
284 284
         $data->setOrderByColumn($data->getField());
285 285
         $data->setType("email");
286 286
 
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
         $data = new FileModel();
297 297
         $data = $this->setDefaultModelValue($data);
298 298
         $data->setLabel($label);
299
-        $data->setName($this->name($label,$name));
300
-        $data->setField($field_to_save?:$this->name($label, $name));
299
+        $data->setName($this->name($label, $name));
300
+        $data->setField($field_to_save ?: $this->name($label, $name));
301 301
         $data->setOrderByColumn($data->getField());
302 302
         $data->setType("file");
303 303
 
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
         $data = new HiddenModel();
315 315
         $data = $this->setDefaultModelValue($data);
316 316
         $data->setLabel($label);
317
-        $data->setName($this->name($label,$name));
318
-        $data->setField($field_to_save?:$this->name($label, $name));
317
+        $data->setName($this->name($label, $name));
318
+        $data->setField($field_to_save ?: $this->name($label, $name));
319 319
         $data->setOrderByColumn($data->getField());
320 320
         $data->setType("hidden");
321 321
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
         $data = new NumberModel();
332 332
         $data = $this->setDefaultModelValue($data);
333 333
         $data->setLabel($label);
334
-        $data->setName($this->name($label,$name));
335
-        $data->setField($field_to_save?:$this->name($label, $name));
334
+        $data->setName($this->name($label, $name));
335
+        $data->setField($field_to_save ?: $this->name($label, $name));
336 336
         $data->setOrderByColumn($data->getField());
337 337
         $data->setType("number");
338 338
 
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
         $data = new MoneyModel();
349 349
         $data = $this->setDefaultModelValue($data);
350 350
         $data->setLabel($label);
351
-        $data->setName($this->name($label,$name));
352
-        $data->setField($field_to_save?:$this->name($label, $name));
351
+        $data->setName($this->name($label, $name));
352
+        $data->setField($field_to_save ?: $this->name($label, $name));
353 353
         $data->setOrderByColumn($data->getField());
354 354
         $data->setType("money");
355 355
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
         $data = new RadioModel();
366 366
         $data = $this->setDefaultModelValue($data);
367 367
         $data->setLabel($label);
368
-        $data->setName($this->name($label,$name));
369
-        $data->setField($field_to_save?:$this->name($label, $name));
368
+        $data->setName($this->name($label, $name));
369
+        $data->setField($field_to_save ?: $this->name($label, $name));
370 370
         $data->setOrderByColumn($data->getField());
371 371
         $data->setType("radio");
372 372
 
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
         $data = new WysiwygModel();
383 383
         $data = $this->setDefaultModelValue($data);
384 384
         $data->setLabel($label);
385
-        $data->setName($this->name($label,$name));
386
-        $data->setField($field_to_save?:$this->name($label, $name));
385
+        $data->setName($this->name($label, $name));
386
+        $data->setField($field_to_save ?: $this->name($label, $name));
387 387
         $data->setOrderByColumn($data->getField());
388 388
         $data->setType("wysiwyg");
389 389
 
Please login to merge, or discard this patch.
src/controllers/DeveloperSecurityController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  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()
31 31
     {
32
-        if(!isConfigCached()) {
32
+        if (!isConfigCached()) {
33 33
             setEnvironmentValue([
34 34
                 "APP_DEBUG"=>request("APP_DEBUG")
35 35
             ]);
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
         putSetting("AUTO_REDIRECT_TO_LOGIN", request("AUTO_REDIRECT_TO_LOGIN"));
42 42
         putSetting("LOGIN_NOTIFICATION", request("LOGIN_NOTIFICATION"));
43 43
 
44
-        if(request("htaccess_ServerSignature")) {
44
+        if (request("htaccess_ServerSignature")) {
45 45
             putHtaccess("ServerSignature Off");
46 46
         }
47 47
 
48
-        if(request("htaccess_IndexIgnore")) {
48
+        if (request("htaccess_IndexIgnore")) {
49 49
             putHtaccess("IndexIgnore *");
50 50
         }
51 51
 
52
-        if(request("htaccess_dotAccess")) {
52
+        if (request("htaccess_dotAccess")) {
53 53
 putHtaccess("
54 54
 <FilesMatch \"^\.\">
55 55
 Order allow,deny
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 </FilesMatch>");
58 58
         }
59 59
 
60
-        if(request("htaccess_preventVendor")) {
60
+        if (request("htaccess_preventVendor")) {
61 61
             putHtaccess("RewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]");
62 62
         }
63 63
 
64 64
 
65
-        return cb()->redirectBack("Security has been updated!","success");
65
+        return cb()->redirectBack("Security has been updated!", "success");
66 66
     }
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
src/CRUDBoosterServiceProvider.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
         // Register views
27 27
         $this->loadViewsFrom(__DIR__.'/views', 'crudbooster');
28 28
         $this->loadViewsFrom(__DIR__.'/types', 'types');
29
-        $this->loadTranslationsFrom(__DIR__."/localization","cb");
29
+        $this->loadTranslationsFrom(__DIR__."/localization", "cb");
30 30
 
31 31
         // Publish the files
32
-        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')],'cb_config');
33
-        $this->publishes([__DIR__.'/database' => base_path('database')],'cb_migration');
34
-        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')],'cb_hook');
35
-        $this->publishes([__DIR__ . '/assets' =>public_path('cb_asset')],'cb_asset');
32
+        $this->publishes([__DIR__.'/configs/crudbooster.php' => config_path('crudbooster.php')], 'cb_config');
33
+        $this->publishes([__DIR__.'/database' => base_path('database')], 'cb_migration');
34
+        $this->publishes([__DIR__.'/templates/CBHook.stub'=> app_path('Http/CBHook.php')], 'cb_hook');
35
+        $this->publishes([__DIR__.'/assets' =>public_path('cb_asset')], 'cb_asset');
36 36
 
37 37
         // Override Local FileSystem
38 38
         Config::set("filesystems.disks.local.root", cbConfig("LOCAL_FILESYSTEM_PATH", public_path("storage")));
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         require __DIR__.'/helpers/Helper.php';
55 55
 
56 56
         // Singletons
57
-        $this->app->singleton('crudbooster', function ()
57
+        $this->app->singleton('crudbooster', function()
58 58
         {
59 59
             return true;
60 60
         });
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         }
78 78
 
79 79
         // Merging configuration
80
-        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php','crudbooster');
80
+        $this->mergeConfigFrom(__DIR__.'/configs/crudbooster.php', 'crudbooster');
81 81
 
82 82
         // Register additional library
83 83
         $this->app->register('Intervention\Image\ImageServiceProvider');
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 
89 89
     private function registerPlugin()
90 90
     {
91
-        if(file_exists(app_path("CBPlugins"))) {
91
+        if (file_exists(app_path("CBPlugins"))) {
92 92
             $views = scandir(app_path("CBPlugins"));
93
-            foreach($views as $view) {
94
-                if($view != "." && $view != "..") {
93
+            foreach ($views as $view) {
94
+                if ($view != "." && $view != "..") {
95 95
                     $basename = basename($view);
96 96
                     // register view
97
-                    $this->loadViewsFrom(app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Views"),$basename);
97
+                    $this->loadViewsFrom(app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Views"), $basename);
98 98
                     // register route
99 99
                     require app_path("CBPlugins".DIRECTORY_SEPARATOR.$basename.DIRECTORY_SEPARATOR."Routes".DIRECTORY_SEPARATOR."Route.php");
100 100
                 }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     private function registerTypeRoutes() {
108 108
         $routes = rglob(__DIR__.DIRECTORY_SEPARATOR."types".DIRECTORY_SEPARATOR."Route.php");
109
-        foreach($routes as $route) {
109
+        foreach ($routes as $route) {
110 110
             require $route;
111 111
         }
112 112
     }
Please login to merge, or discard this patch.
src/controllers/DeveloperPluginStoreController.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 
29 29
     public function getIndex() {
30 30
 
31
-        if(request("refresh")) {
32
-            $this->fetchPluginData(false );
33
-            return cb()->redirectBack("Plugin list has been refreshed!","success");
31
+        if (request("refresh")) {
32
+            $this->fetchPluginData(false);
33
+            return cb()->redirectBack("Plugin list has been refreshed!", "success");
34 34
         }
35 35
 
36 36
         $data = [];
37 37
         $data['result'] = $this->fetchPluginData();
38
-        return view($this->view.'.index',$data);
38
+        return view($this->view.'.index', $data);
39 39
     }
40 40
 
41 41
     public function postLoginAccount() {
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
         ]);
51 51
         $response = $curl->send();
52 52
 
53
-        if($respArray = json_decode($response, true)) {
54
-            if($respArray['status'] && isset($respArray['token'])) {
53
+        if ($respArray = json_decode($response, true)) {
54
+            if ($respArray['status'] && isset($respArray['token'])) {
55 55
                 session(['account_token'=>$respArray['token']]);
56 56
             }
57
-            return response()->make($response,200,["Content-Type"=>"application/json"]);
57
+            return response()->make($response, 200, ["Content-Type"=>"application/json"]);
58 58
         } else {
59
-            return response()->json(['status'=>false,'message'=>'failed']);
59
+            return response()->json(['status'=>false, 'message'=>'failed']);
60 60
         }
61 61
     }
62 62
 
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
         ]);
74 74
         $response = $curl->send();
75 75
 
76
-        if($respArray = json_decode($response, true)) {
77
-            if($respArray['status']) {
76
+        if ($respArray = json_decode($response, true)) {
77
+            if ($respArray['status']) {
78 78
                 $form = base64_decode($respArray['payment']);
79
-                return response()->json(['status'=>true,'form'=>$form]);
79
+                return response()->json(['status'=>true, 'form'=>$form]);
80 80
             } else {
81 81
                 return response()->json($respArray);
82 82
             }
83 83
         } else {
84
-            return response()->json(['status'=>false,'message'=>'failed','raw'=>$response]);
84
+            return response()->json(['status'=>false, 'message'=>'failed', 'raw'=>$response]);
85 85
         }
86 86
     }
87 87
 
@@ -89,28 +89,28 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $pluginData = $this->fetchPluginData();
91 91
 
92
-        if(isset($pluginData[$key])) {
93
-            if(file_exists(app_path("CBPlugins/".$key))) {
92
+        if (isset($pluginData[$key])) {
93
+            if (file_exists(app_path("CBPlugins/".$key))) {
94 94
                 rrmdir(app_path("CBPlugins/".$key));
95 95
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
96
-            }else{
97
-                return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
96
+            } else {
97
+                return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin is not found']);
98 98
             }
99
-        }else {
100
-            return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
99
+        } else {
100
+            return response()->json(['status'=>false, 'message'=>'Failed to uninstall, plugin key is not found']);
101 101
         }
102 102
     }
103 103
 
104
-    private function recursiveCopy($src,$dst) {
104
+    private function recursiveCopy($src, $dst) {
105 105
         $dir = opendir($src);
106 106
         @mkdir($dst);
107
-        while(false !== ( $file = readdir($dir)) ) {
108
-            if (( $file != '.' ) && ( $file != '..' )) {
109
-                if ( is_dir($src . '/' . $file) ) {
110
-                    $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file);
107
+        while (false !== ($file = readdir($dir))) {
108
+            if (($file != '.') && ($file != '..')) {
109
+                if (is_dir($src.'/'.$file)) {
110
+                    $this->recursiveCopy($src.'/'.$file, $dst.'/'.$file);
111 111
                 }
112 112
                 else {
113
-                    copy($src . '/' . $file,$dst . '/' . $file);
113
+                    copy($src.'/'.$file, $dst.'/'.$file);
114 114
                 }
115 115
             }
116 116
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $pluginData = $this->fetchPluginData();
123 123
 
124 124
         try {
125
-            if(isset($pluginData[$key])) {
125
+            if (isset($pluginData[$key])) {
126 126
                 $plugin = $pluginData[$key];
127 127
 
128 128
                 // Create temp file of zip plugin
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
                     fclose($temp);
141 141
 
142 142
                     // Rename
143
-                    if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
143
+                    if (file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
144 144
                     rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
145 145
 
146 146
                     // Read Plugin JSON
147 147
                     $pluginJson = json_decode(file_get_contents(app_path("CBPlugins/".$key."/plugin.json")), true);
148 148
 
149 149
                     // Check if has asset
150
-                    if($pluginJson && $pluginJson['asset']) {
150
+                    if ($pluginJson && $pluginJson['asset']) {
151 151
                         // Check destination folder is ready
152
-                        if(file_exists(public_path("cb_asset/".$key))) {
152
+                        if (file_exists(public_path("cb_asset/".$key))) {
153 153
                             rrmdir(public_path("cb_asset/".$key));
154 154
                         }
155 155
 
@@ -160,22 +160,22 @@  discard block
 block discarded – undo
160 160
                         $this->recursiveCopy(app_path("CBPlugins/".$key."/".$pluginJson['asset']), public_path("cb_asset/".$key));
161 161
                     }
162 162
 
163
-                    return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']);
163
+                    return response()->json(['status'=>true, 'message'=>'Install / update plugin has been succesfull!']);
164 164
 
165 165
                 } else {
166
-                    return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]);
166
+                    return response()->json(['status'=>false, 'message'=>"Failed to install/update, can't open the plugin archive"]);
167 167
                 }
168
-            }else{
169
-                return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
168
+            } else {
169
+                return response()->json(['status'=>false, 'message'=>'Failed to install/update, plugin key is not found']);
170 170
             }
171 171
         } catch (\Exception $e) {
172
-            return response()->json(['status'=>false,'message'=>'Something went wrong!']);
172
+            return response()->json(['status'=>false, 'message'=>'Something went wrong!']);
173 173
         }
174 174
     }
175 175
 
176 176
     private function fetchPluginData($cache = true)
177 177
     {
178
-        if($cache === true && $data = Cache::get("plugin_store_data")) {
178
+        if ($cache === true && $data = Cache::get("plugin_store_data")) {
179 179
             return $data;
180 180
         }
181 181
 
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
             $context = stream_context_create($opts);
193 193
             $data = file_get_contents(base64_decode("aHR0cDovL2NydWRib29zdGVyLmNvbS9hcGkvcGx1Z2luP2FjY2Vzc190b2tlbj1iVmMvWm5wWU5TWnJNVlpZT0hFNVUydHFjU1U9"), false, $context);
194 194
 
195
-            if($data) {
195
+            if ($data) {
196 196
                 $data = json_decode($data, true);
197
-                if($data['status']==true) {
197
+                if ($data['status'] == true) {
198 198
 
199
-                    foreach($data['data'] as $item) {
199
+                    foreach ($data['data'] as $item) {
200 200
                         $key = $item['key'];
201
-                        $result[ $key ] = $item;
201
+                        $result[$key] = $item;
202 202
                     }
203 203
 
204 204
                     $result = collect($result)->sortBy("name")->all();
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
             if(file_exists(app_path("CBPlugins/".$key))) {
94 94
                 rrmdir(app_path("CBPlugins/".$key));
95 95
                 return response()->json(['status'=>true, 'message'=>'Plugin has been uninstalled!']);
96
-            }else{
96
+            } else{
97 97
                 return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin is not found']);
98 98
             }
99
-        }else {
99
+        } else {
100 100
             return response()->json(['status'=>false,'message'=>'Failed to uninstall, plugin key is not found']);
101 101
         }
102 102
     }
@@ -108,8 +108,7 @@  discard block
 block discarded – undo
108 108
             if (( $file != '.' ) && ( $file != '..' )) {
109 109
                 if ( is_dir($src . '/' . $file) ) {
110 110
                     $this->recursiveCopy($src . '/' . $file,$dst . '/' . $file);
111
-                }
112
-                else {
111
+                } else {
113 112
                     copy($src . '/' . $file,$dst . '/' . $file);
114 113
                 }
115 114
             }
@@ -140,7 +139,9 @@  discard block
 block discarded – undo
140 139
                     fclose($temp);
141 140
 
142 141
                     // Rename
143
-                    if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key));
142
+                    if(file_exists(app_path("CBPlugins/".$key))) {
143
+                        rrmdir(app_path("CBPlugins/".$key));
144
+                    }
144 145
                     rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key));
145 146
 
146 147
                     // Read Plugin JSON
@@ -165,7 +166,7 @@  discard block
 block discarded – undo
165 166
                 } else {
166 167
                     return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]);
167 168
                 }
168
-            }else{
169
+            } else{
169 170
                 return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']);
170 171
             }
171 172
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
src/configs/crudbooster.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
     /*
21 21
      * For security reason we have limit the upload file formats bellow
22 22
      */
23
-    'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif','pdf','xls','xlsx','doc','docx','txt','zip','rar','rtf'],
23
+    'UPLOAD_FILE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt', 'zip', 'rar', 'rtf'],
24 24
 
25
-    'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg','jpeg','png','gif'],
25
+    'UPLOAD_IMAGE_EXTENSION_ALLOWED' => ['jpg', 'jpeg', 'png', 'gif'],
26 26
 
27 27
     /*
28 28
      * Override Local FileSystem From Storage To Another
@@ -58,5 +58,5 @@  discard block
 block discarded – undo
58 58
      * You can define in this array what the tables you want to include in "php artisan crudbooster:data_migration"
59 59
      * The default is all cb_ prefix will be include in data migration
60 60
      */
61
-    'ADDITIONAL_DATA_MIGRATION'=>['users','migrations']
61
+    'ADDITIONAL_DATA_MIGRATION'=>['users', 'migrations']
62 62
 ];
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/DeveloperThemesController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,21 +20,21 @@
 block discarded – undo
20 20
         $themes = (new Plugin())->getAllThemes();
21 21
         $data = [];
22 22
         $data['result'] = $themes;
23
-        return view($this->view.".index",$data);
23
+        return view($this->view.".index", $data);
24 24
     }
25 25
 
26 26
     public function getActiveTheme($theme_path) {
27 27
         $theme_path = base64_decode($theme_path);
28 28
         putSetting("theme_path", $theme_path);
29
-        return cb()->redirectBack("Theme has been activated!","success");
29
+        return cb()->redirectBack("Theme has been activated!", "success");
30 30
     }
31 31
 
32 32
     public function postSaveConfig() {
33 33
 
34
-        foreach(request()->except("_token") as $key=>$val) {
35
-            putSetting( $key,  $val);
34
+        foreach (request()->except("_token") as $key=>$val) {
35
+            putSetting($key, $val);
36 36
         }
37 37
 
38
-        return cb()->redirectBack("Theme config has been saved!","success");
38
+        return cb()->redirectBack("Theme config has been saved!", "success");
39 39
     }
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
src/middlewares/CBBackend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
      */
19 19
     public function handle($request, Closure $next)
20 20
     {
21
-        if(auth()->guest()) {
22
-            return cb()->redirect(cb()->getLoginUrl("login"),cbLang('please_login_for_first'),'warning');
21
+        if (auth()->guest()) {
22
+            return cb()->redirect(cb()->getLoginUrl("login"), cbLang('please_login_for_first'), 'warning');
23 23
         }
24 24
 
25 25
         (new CBHook())->beforeBackendMiddleware($request);
Please login to merge, or discard this patch.
src/helpers/SidebarMenus.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     private function assignToModel($menu) {
24 24
         $model = new SidebarModel();
25 25
         $model->setId($menu->id);
26
-        if($menu->type == "url") {
26
+        if ($menu->type == "url") {
27 27
             $model->setUrl($menu->path);
28 28
             $model->setIcon($menu->icon);
29 29
             $model->setName($menu->name);
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
             $model->setBasepath(config('crudbooster.ADMIN_PATH').'/'.basename($model->getUrl()));
47 47
         }
48 48
 
49
-        if(request()->is($model->getBasepath()."*")) {
49
+        if (request()->is($model->getBasepath()."*")) {
50 50
             $model->setIsActive(true);
51
-        }else{
51
+        } else {
52 52
             $model->setIsActive(false);
53 53
         }
54 54
 
@@ -57,22 +57,22 @@  discard block
 block discarded – undo
57 57
 
58 58
     private function loadData($parent_id = null) {
59 59
         $menus = DB::table("cb_menus");
60
-        if($parent_id) {
61
-            $menus->where("parent_cb_menus_id",$parent_id);
62
-        }else{
60
+        if ($parent_id) {
61
+            $menus->where("parent_cb_menus_id", $parent_id);
62
+        } else {
63 63
             $menus->whereNull("parent_cb_menus_id");
64 64
         }
65
-        return $menus->orderBy("sort_number","asc")->get();
65
+        return $menus->orderBy("sort_number", "asc")->get();
66 66
     }
67 67
 
68 68
     private function rolePrivilege($cb_roles_id, $cb_menus_id) {
69
-        return cb()->find("cb_role_privileges",['cb_roles_id'=>$cb_roles_id,'cb_menus_id'=>$cb_menus_id]);
69
+        return cb()->find("cb_role_privileges", ['cb_roles_id'=>$cb_roles_id, 'cb_menus_id'=>$cb_menus_id]);
70 70
     }
71 71
 
72
-    private function checkPrivilege($roles_id,$menu) {
73
-        if($roles_id) {
72
+    private function checkPrivilege($roles_id, $menu) {
73
+        if ($roles_id) {
74 74
             $privilege = $this->rolePrivilege($roles_id, $menu->id);
75
-            if($privilege && !$privilege->can_browse) {
75
+            if ($privilege && !$privilege->can_browse) {
76 76
                 return false;
77 77
             }
78 78
         }
@@ -81,30 +81,30 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
     public function all($withPrivilege = true) {
84
-        $roles_id = ($withPrivilege)?cb()->session()->roleId():null;
84
+        $roles_id = ($withPrivilege) ?cb()->session()->roleId() : null;
85 85
         $idHash = "menuUser".$roles_id.auth()->id();
86
-        if($menu = CacheHelper::getItemInGroup($idHash,"sidebar_menu")) return $menu;
86
+        if ($menu = CacheHelper::getItemInGroup($idHash, "sidebar_menu")) return $menu;
87 87
 
88 88
         $menus = $this->loadData();
89 89
         $result = [];
90
-        foreach($menus as $menu) {
90
+        foreach ($menus as $menu) {
91 91
 
92
-            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue;
92
+            if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue;
93 93
 
94 94
             $sidebarModel = $this->assignToModel($menu);
95
-            if($menus2 = $this->loadData($menu->id)) {
95
+            if ($menus2 = $this->loadData($menu->id)) {
96 96
                 $sub1 = [];
97 97
                 foreach ($menus2 as $menu2) {
98 98
 
99
-                    if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue;
99
+                    if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue;
100 100
 
101 101
                     $sidebarModel2 = $this->assignToModel($menu2);
102 102
 
103
-                    if($menus3 = $this->loadData($menu2->id)) {
103
+                    if ($menus3 = $this->loadData($menu2->id)) {
104 104
                         $sub2 = [];
105 105
                         foreach ($menus3 as $menu3) {
106 106
 
107
-                            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue;
107
+                            if ($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue;
108 108
 
109 109
                             $sidebarModel3 = $this->assignToModel($menu3);
110 110
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             $result[] = $sidebarModel;
120 120
         }
121 121
 
122
-        CacheHelper::putInGroup($idHash, $result,"sidebar_menu", 3600);
122
+        CacheHelper::putInGroup($idHash, $result, "sidebar_menu", 3600);
123 123
         return $result;
124 124
     }
125 125
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
             $model->setIcon($menu->icon);
29 29
             $model->setName($menu->name);
30 30
             $model->setBasepath(basename($model->getUrl()));
31
-        }elseif ($menu->type == "module") {
31
+        } elseif ($menu->type == "module") {
32 32
             $module = cb()->find("cb_modules", $menu->cb_modules_id);
33 33
             $className = '\App\Http\Controllers\\'.$module->controller;
34 34
             $controllerClass = new $className();
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $model->setIcon($module->icon);
39 39
             $model->setName($module->name);
40 40
             $model->setBasepath(config('crudbooster.ADMIN_PATH').'/'.basename($model->getUrl()));
41
-        }elseif ($menu->type == "path") {
41
+        } elseif ($menu->type == "path") {
42 42
             $model->setUrl(cb()->getAdminUrl($menu->path));
43 43
             $model->setPermalink($menu->path);
44 44
             $model->setIcon($menu->icon);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
         if(request()->is($model->getBasepath()."*")) {
50 50
             $model->setIsActive(true);
51
-        }else{
51
+        } else{
52 52
             $model->setIsActive(false);
53 53
         }
54 54
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $menus = DB::table("cb_menus");
60 60
         if($parent_id) {
61 61
             $menus->where("parent_cb_menus_id",$parent_id);
62
-        }else{
62
+        } else{
63 63
             $menus->whereNull("parent_cb_menus_id");
64 64
         }
65 65
         return $menus->orderBy("sort_number","asc")->get();
@@ -83,20 +83,26 @@  discard block
 block discarded – undo
83 83
     public function all($withPrivilege = true) {
84 84
         $roles_id = ($withPrivilege)?cb()->session()->roleId():null;
85 85
         $idHash = "menuUser".$roles_id.auth()->id();
86
-        if($menu = CacheHelper::getItemInGroup($idHash,"sidebar_menu")) return $menu;
86
+        if($menu = CacheHelper::getItemInGroup($idHash,"sidebar_menu")) {
87
+            return $menu;
88
+        }
87 89
 
88 90
         $menus = $this->loadData();
89 91
         $result = [];
90 92
         foreach($menus as $menu) {
91 93
 
92
-            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) continue;
94
+            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu)) {
95
+                continue;
96
+            }
93 97
 
94 98
             $sidebarModel = $this->assignToModel($menu);
95 99
             if($menus2 = $this->loadData($menu->id)) {
96 100
                 $sub1 = [];
97 101
                 foreach ($menus2 as $menu2) {
98 102
 
99
-                    if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) continue;
103
+                    if($withPrivilege && !$this->checkPrivilege($roles_id, $menu2)) {
104
+                        continue;
105
+                    }
100 106
 
101 107
                     $sidebarModel2 = $this->assignToModel($menu2);
102 108
 
@@ -104,7 +110,9 @@  discard block
 block discarded – undo
104 110
                         $sub2 = [];
105 111
                         foreach ($menus3 as $menu3) {
106 112
 
107
-                            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) continue;
113
+                            if($withPrivilege && !$this->checkPrivilege($roles_id, $menu3)) {
114
+                                continue;
115
+                            }
108 116
 
109 117
                             $sidebarModel3 = $this->assignToModel($menu3);
110 118
 
Please login to merge, or discard this patch.