@@ -34,7 +34,7 @@ |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | DB::table("users")->where("id", auth()->id())->update($data); |
37 | - }catch (\Exception $e) { |
|
37 | + } catch (\Exception $e) { |
|
38 | 38 | Log::error($e); |
39 | 39 | return cb()->redirectBack(cbLang("something_went_wrong"),"warning"); |
40 | 40 | } |
@@ -32,11 +32,11 @@ |
||
32 | 32 | |
33 | 33 | return redirect(cb()->getDeveloperUrl()); |
34 | 34 | |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | return cb()->redirectBack( cbLang("password_and_username_is_wrong")); |
37 | 37 | } |
38 | 38 | |
39 | - }catch (CBValidationException $e) { |
|
39 | + } catch (CBValidationException $e) { |
|
40 | 40 | return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
41 | 41 | } |
42 | 42 | } |
@@ -33,7 +33,9 @@ discard block |
||
33 | 33 | |
34 | 34 | public function getLogin() |
35 | 35 | { |
36 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
36 | + if(!auth()->guest()) { |
|
37 | + return redirect(cb()->getAdminUrl()); |
|
38 | + } |
|
37 | 39 | |
38 | 40 | cbHook()->hookGetLogin(); |
39 | 41 | |
@@ -43,7 +45,9 @@ discard block |
||
43 | 45 | public function postLogin() |
44 | 46 | { |
45 | 47 | try{ |
46 | - if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
48 | + if($this->isSuspendedLogin()) { |
|
49 | + throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
50 | + } |
|
47 | 51 | |
48 | 52 | cb()->validation([ |
49 | 53 | 'email'=>'required|email', |
@@ -58,7 +62,7 @@ discard block |
||
58 | 62 | $this->incrementFailedLogin(); |
59 | 63 | return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']); |
60 | 64 | } |
61 | - }catch (CBValidationException $e) { |
|
65 | + } catch (CBValidationException $e) { |
|
62 | 66 | return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
63 | 67 | } |
64 | 68 | } |
@@ -93,10 +93,10 @@ discard block |
||
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 | } |
@@ -123,7 +123,9 @@ discard block |
||
123 | 123 | fclose($temp); |
124 | 124 | |
125 | 125 | // Rename |
126 | - if(file_exists(app_path("CBPlugins/".$key))) rrmdir(app_path("CBPlugins/".$key)); |
|
126 | + if(file_exists(app_path("CBPlugins/".$key))) { |
|
127 | + rrmdir(app_path("CBPlugins/".$key)); |
|
128 | + } |
|
127 | 129 | rename(app_path("CBPlugins/".$dirName), app_path("CBPlugins/".$key)); |
128 | 130 | |
129 | 131 | return response()->json(['status'=>true,'message'=>'Install / update plugin has been succesfull!']); |
@@ -131,7 +133,7 @@ discard block |
||
131 | 133 | } else { |
132 | 134 | return response()->json(['status'=>false,'message'=>"Failed to install/update, can't open the plugin archive"]); |
133 | 135 | } |
134 | - }else{ |
|
136 | + } else{ |
|
135 | 137 | return response()->json(['status'=>false,'message'=>'Failed to install/update, plugin key is not found']); |
136 | 138 | } |
137 | 139 | } |
@@ -48,7 +48,9 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | $str = substr($str, 0, -1); |
51 | - if (!file_put_contents($envFile, $str)) return false; |
|
51 | + if (!file_put_contents($envFile, $str)) { |
|
52 | + return false; |
|
53 | + } |
|
52 | 54 | return true; |
53 | 55 | } |
54 | 56 | } |
@@ -251,7 +253,7 @@ discard block |
||
251 | 253 | $settings = file_get_contents(storage_path('.cbconfig')); |
252 | 254 | $settings = decrypt($settings); |
253 | 255 | $settings = unserialize($settings); |
254 | - }else{ |
|
256 | + } else{ |
|
255 | 257 | $settings = []; |
256 | 258 | } |
257 | 259 | |
@@ -276,14 +278,14 @@ discard block |
||
276 | 278 | $settings = file_get_contents(storage_path('.cbconfig')); |
277 | 279 | $settings = decrypt($settings); |
278 | 280 | $settings = unserialize($settings); |
279 | - }else{ |
|
281 | + } else{ |
|
280 | 282 | $settings = []; |
281 | 283 | } |
282 | 284 | |
283 | 285 | if(isset($settings[$key])) { |
284 | 286 | \Illuminate\Support\Facades\Cache::forever("setting_".$key, $settings[$key]); |
285 | 287 | return $settings[$key]?:$default; |
286 | - }else{ |
|
288 | + } else{ |
|
287 | 289 | return $default; |
288 | 290 | } |
289 | 291 | } |
@@ -369,7 +371,7 @@ discard block |
||
369 | 371 | $url = request($name); |
370 | 372 | if(filter_var($url, FILTER_VALIDATE_URL)) { |
371 | 373 | return $url; |
372 | - }else{ |
|
374 | + } else{ |
|
373 | 375 | return request()->url(); |
374 | 376 | } |
375 | 377 | } |
@@ -381,14 +383,14 @@ discard block |
||
381 | 383 | $response = request($name); |
382 | 384 | if(is_string($response)) { |
383 | 385 | $response = sanitizeXSS($response); |
384 | - }elseif (is_array($response)) { |
|
386 | + } elseif (is_array($response)) { |
|
385 | 387 | array_walk_recursive($response, function(&$response) { |
386 | 388 | $response = sanitizeXSS($response); |
387 | 389 | }); |
388 | 390 | } |
389 | 391 | |
390 | 392 | return $response; |
391 | - }else{ |
|
393 | + } else{ |
|
392 | 394 | return Request::get($name); |
393 | 395 | } |
394 | 396 | } |
@@ -398,11 +400,13 @@ discard block |
||
398 | 400 | function min_var_export($input) { |
399 | 401 | if(is_array($input)) { |
400 | 402 | $buffer = []; |
401 | - foreach($input as $key => $value) |
|
402 | - $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
403 | + foreach($input as $key => $value) { |
|
404 | + $buffer[] = var_export($key, true)."=>".min_var_export($value); |
|
405 | + } |
|
403 | 406 | return "[".implode(",",$buffer)."]"; |
404 | - } else |
|
405 | - return var_export($input, true); |
|
407 | + } else { |
|
408 | + return var_export($input, true); |
|
409 | + } |
|
406 | 410 | } |
407 | 411 | } |
408 | 412 | |
@@ -415,10 +419,11 @@ discard block |
||
415 | 419 | $objects = scandir($dir); |
416 | 420 | foreach ($objects as $object) { |
417 | 421 | if ($object != "." && $object != "..") { |
418 | - if (is_dir($dir."/".$object)) |
|
419 | - rrmdir($dir."/".$object); |
|
420 | - else |
|
421 | - unlink($dir."/".$object); |
|
422 | + if (is_dir($dir."/".$object)) { |
|
423 | + rrmdir($dir."/".$object); |
|
424 | + } else { |
|
425 | + unlink($dir."/".$object); |
|
426 | + } |
|
422 | 427 | } |
423 | 428 | } |
424 | 429 | rmdir($dir); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | if($err) { |
51 | 51 | return $err; |
52 | - }else { |
|
52 | + } else { |
|
53 | 53 | return $response; |
54 | 54 | } |
55 | 55 | } |
@@ -58,7 +58,7 @@ |
||
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 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | return cb()->redirect(cb()->getAdminUrl("login"),"Thank you for register. Now you can login to start your session :)","success"); |
70 | 70 | } |
71 | 71 | |
72 | - }catch (CBValidationException $e) { |
|
72 | + } catch (CBValidationException $e) { |
|
73 | 73 | return cb()->redirectBack($e->getMessage()); |
74 | 74 | } |
75 | 75 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | return cb()->redirectBack("Your email is not registered"); |
59 | 59 | } |
60 | 60 | |
61 | - }catch (CBValidationException $e) { |
|
61 | + } catch (CBValidationException $e) { |
|
62 | 62 | return cb()->redirectBack($e->getMessage()); |
63 | 63 | } catch (\Exception $e) { |
64 | 64 | Log::error($e); |