@@ -1,9 +1,9 @@ |
||
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 |
@@ -19,15 +19,15 @@ |
||
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([ |
@@ -18,15 +18,15 @@ |
||
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([ |
@@ -1,9 +1,9 @@ |
||
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 | }); |
@@ -24,21 +24,21 @@ |
||
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 | - foreach(request()->except("_token") as $key=>$val) { |
|
33 | - putSetting( $key, $val); |
|
32 | + foreach (request()->except("_token") as $key=>$val) { |
|
33 | + putSetting($key, $val); |
|
34 | 34 | } |
35 | 35 | |
36 | - if(request("login_background_cover")) { |
|
36 | + if (request("login_background_cover")) { |
|
37 | 37 | putSetting("login_background_cover", "on"); |
38 | 38 | } else { |
39 | 39 | putSetting("login_background_cover", ""); |
40 | 40 | } |
41 | 41 | |
42 | - return cb()->redirectBack("Appearance has been updated!","success"); |
|
42 | + return cb()->redirectBack("Appearance has been updated!", "success"); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -29,25 +29,25 @@ discard block |
||
29 | 29 | "captcha"=>"required|integer" |
30 | 30 | ]); |
31 | 31 | |
32 | - if(Session::get("captcha_result") != request("captcha")) { |
|
32 | + if (Session::get("captcha_result") != request("captcha")) { |
|
33 | 33 | return cb()->redirectBack("The captcha that you input is wrong!"); |
34 | 34 | } |
35 | 35 | |
36 | - if($user = cb()->find("users",["email"=>request("email")])) { |
|
36 | + if ($user = cb()->find("users", ["email"=>request("email")])) { |
|
37 | 37 | return cb()->redirectBack("The email you input has already exists!"); |
38 | 38 | } |
39 | 39 | |
40 | - if(getSetting("register_mail_verification")) { |
|
41 | - Cache::put("register_".$token,[ |
|
40 | + if (getSetting("register_mail_verification")) { |
|
41 | + Cache::put("register_".$token, [ |
|
42 | 42 | "name"=>request("name"), |
43 | 43 | "email"=>request("email"), |
44 | 44 | "password"=>request("password") |
45 | - ],now()->addHours(24)); |
|
45 | + ], now()->addHours(24)); |
|
46 | 46 | |
47 | 47 | $mail = new MailHelper(); |
48 | 48 | $mail->to(request("email")); |
49 | - $mail->sender(getSetting("register_mail_verification_sender","noreply@".$_SERVER['SERVER_NAME']),cb()->getAppName()); |
|
50 | - $mail->content("Verify Your Registration"," |
|
49 | + $mail->sender(getSetting("register_mail_verification_sender", "noreply@".$_SERVER['SERVER_NAME']), cb()->getAppName()); |
|
50 | + $mail->content("Verify Your Registration", " |
|
51 | 51 | Hi ".request("name")."<br/> |
52 | 52 | Thank you for register at ".cb()->getAppName()." to continue your registration, please click on the following link: <br/> |
53 | 53 | <p>$linkToken</p> |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | "cb_roles_id"=> getSetting("register_as_role") |
67 | 67 | ]); |
68 | 68 | |
69 | - return cb()->redirect(cb()->getAdminUrl("login"),"Thank you for register. Now you can login to start your session :)","success"); |
|
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 | |
76 | - return cb()->redirectBack("We've sent you an confirmation email. Please click the link inside the email","success"); |
|
76 | + return cb()->redirectBack("We've sent you an confirmation email. Please click the link inside the email", "success"); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function postContinueRegister($token) { |
80 | - if($token = Cache::get("register_".$token)) { |
|
80 | + if ($token = Cache::get("register_".$token)) { |
|
81 | 81 | DB::table("users") |
82 | 82 | ->insert([ |
83 | 83 | "created_at"=>date("Y-m-d H:i:s"), |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | "cb_roles_id"=> getSetting("register_as_role") |
88 | 88 | ]); |
89 | 89 | |
90 | - return cb()->redirect(cb()->getAdminUrl("login"),"Thank you for register. Now you can login to start your session :)","success"); |
|
90 | + return cb()->redirect(cb()->getAdminUrl("login"), "Thank you for register. Now you can login to start your session :)", "success"); |
|
91 | 91 | } else { |
92 | - return cb()->redirect(cb()->getAdminUrl("login"),"It looks like the URL has been expired!"); |
|
92 | + return cb()->redirect(cb()->getAdminUrl("login"), "It looks like the URL has been expired!"); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 |
@@ -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 |
@@ -28,11 +28,11 @@ |
||
28 | 28 | { |
29 | 29 | $key = md5(request()->ip().request()->userAgent()); |
30 | 30 | |
31 | - if(Cache::has("loginSuspended".$key)) { |
|
31 | + if (Cache::has("loginSuspended".$key)) { |
|
32 | 32 | return true; |
33 | 33 | } |
34 | 34 | |
35 | - if(getSetting("AUTO_SUSPEND_LOGIN") && Cache::get("loginFailed".$key) >= getSetting("AUTO_SUSPEND_LOGIN")) { |
|
35 | + if (getSetting("AUTO_SUSPEND_LOGIN") && Cache::get("loginFailed".$key) >= getSetting("AUTO_SUSPEND_LOGIN")) { |
|
36 | 36 | Cache::put("loginSuspended".$key, true, 30); |
37 | 37 | $this->clearSuspendAttempt(); |
38 | 38 | return true; |
@@ -24,19 +24,19 @@ |
||
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 | - foreach(request()->except("_token") as $key=>$val) { |
|
33 | - putSetting( $key, $val); |
|
32 | + foreach (request()->except("_token") as $key=>$val) { |
|
33 | + putSetting($key, $val); |
|
34 | 34 | } |
35 | 35 | |
36 | - putSetting("enable_register",request("enable_register")); |
|
36 | + putSetting("enable_register", request("enable_register")); |
|
37 | 37 | putSetting("enable_forget", request("enable_forget")); |
38 | 38 | putSetting("register_mail_verification", request("register_mail_verification")); |
39 | 39 | |
40 | - return cb()->redirectBack("Setting has been updated!","success"); |
|
40 | + return cb()->redirectBack("Setting has been updated!", "success"); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | try { |
25 | 25 | cb()->validation(['email'=>'required|email']); |
26 | 26 | |
27 | - if($user = cb()->find("users",["email"=>request("email")])) { |
|
27 | + if ($user = cb()->find("users", ["email"=>request("email")])) { |
|
28 | 28 | $token = Str::random(6); |
29 | 29 | $linkToken = cb()->getAdminUrl("continue-reset/".$token); |
30 | 30 | Cache::put("forget_".$token, $user->id, now()->addHours(12)); |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | |
38 | 38 | $mail = new MailHelper(); |
39 | 39 | $mail->to($user->email); |
40 | - $mail->sender(getSetting("forget_email_sender","noreply@".$_SERVER['SERVER_NAME']),cb()->getAppName()); |
|
41 | - $mail->content("Please Confirm Your Forgot Password"," |
|
40 | + $mail->sender(getSetting("forget_email_sender", "noreply@".$_SERVER['SERVER_NAME']), cb()->getAppName()); |
|
41 | + $mail->content("Please Confirm Your Forgot Password", " |
|
42 | 42 | Hi $user->name,<br/><br> |
43 | 43 | Someone with the detail bellow: <br/> |
44 | 44 | Time = ".now()->format("Y-m-d H:i:s")."<br/> |
@@ -58,28 +58,28 @@ discard block |
||
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); |
65 | 65 | return cb()->redirectBack(cbLang("something_went_wrong")); |
66 | 66 | } |
67 | 67 | |
68 | - return cb()->redirectBack("We've sent you an email instruction. Please follow the instruction inside the email","success"); |
|
68 | + return cb()->redirectBack("We've sent you an email instruction. Please follow the instruction inside the email", "success"); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | public function getContinueReset($token) { |
72 | - if(Cache::has("forget_".$token)) { |
|
72 | + if (Cache::has("forget_".$token)) { |
|
73 | 73 | $id = Cache::get("forget_".$token); |
74 | 74 | $newPassword = Str::random(6); |
75 | 75 | cb()->update("users", $id, ["password"=>Hash::make($newPassword)]); |
76 | 76 | |
77 | - $user = cb()->find("users",$id); |
|
77 | + $user = cb()->find("users", $id); |
|
78 | 78 | |
79 | 79 | $mail = new MailHelper(); |
80 | 80 | $mail->to($user->email); |
81 | - $mail->sender(getSetting("forget_email_sender","noreply@".$_SERVER['SERVER_NAME']),cb()->getAppName()); |
|
82 | - $mail->content("This Is Your New Password"," |
|
81 | + $mail->sender(getSetting("forget_email_sender", "noreply@".$_SERVER['SERVER_NAME']), cb()->getAppName()); |
|
82 | + $mail->content("This Is Your New Password", " |
|
83 | 83 | Hi $user->name,<br/><br> |
84 | 84 | Thank you for confirming the request new password. Here is your new password: <br> |
85 | 85 | <h2>$newPassword</h2> |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | "); |
91 | 91 | $mail->send(); |
92 | 92 | |
93 | - return cb()->redirect(cb()->getAdminUrl("login"),"We've sent you new password email. Please check at your mail inbox or spambox","success"); |
|
93 | + return cb()->redirect(cb()->getAdminUrl("login"), "We've sent you new password email. Please check at your mail inbox or spambox", "success"); |
|
94 | 94 | } else { |
95 | - return cb()->redirect(cb()->getAdminUrl("login"),"It looks like the url has been expired!"); |
|
95 | + return cb()->redirect(cb()->getAdminUrl("login"), "It looks like the url has been expired!"); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 |
@@ -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); |