@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | if ($this->confirm('Do you have setting the database configuration at .env ?')) { |
41 | 41 | |
42 | - if (! file_exists(public_path('vendor')) ) { |
|
42 | + if (!file_exists(public_path('vendor'))) { |
|
43 | 43 | mkdir(public_path('vendor')); |
44 | 44 | } |
45 | 45 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /* |
53 | 53 | * Create CBPlugins |
54 | 54 | */ |
55 | - if(!file_exists(app_path("CBPlugins"))) { |
|
55 | + if (!file_exists(app_path("CBPlugins"))) { |
|
56 | 56 | mkdir(app_path("CBPlugins")); |
57 | 57 | } |
58 | 58 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | * We need it to change default laravel local filesystem from storage to public |
62 | 62 | * We won't use symlink because of a security issue in many server |
63 | 63 | */ |
64 | - if(!file_exists(public_path("storage"))) { |
|
64 | + if (!file_exists(public_path("storage"))) { |
|
65 | 65 | $this->info("Create storage directory on /public"); |
66 | 66 | mkdir(public_path("storage")); |
67 | - file_put_contents(public_path("storage/.gitignore"),"!.gitignore"); |
|
68 | - file_put_contents(public_path("storage/index.html")," "); |
|
67 | + file_put_contents(public_path("storage/.gitignore"), "!.gitignore"); |
|
68 | + file_put_contents(public_path("storage/index.html"), " "); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /* |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * Disable php execution on /vendor/* |
75 | 75 | */ |
76 | 76 | $this->info("Tweak some security for your laravel"); |
77 | - file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
|
78 | - file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
|
77 | + file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND); |
|
78 | + file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | $this->info('Dumping the autoloaded files and reloading all new files...'); |
@@ -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 | } |
@@ -1,59 +1,59 @@ discard block |
||
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("themes","\crocodicstudio\crudbooster\controllers\DeveloperThemesController"); |
|
15 | - cb()->routeController("appearance","\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController"); |
|
16 | - cb()->routeController("miscellaneous","\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController"); |
|
17 | - cb()->routePost("skip-tutorial","DeveloperDashboardController@postSkipTutorial"); |
|
18 | - 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("themes", "\crocodicstudio\crudbooster\controllers\DeveloperThemesController"); |
|
15 | + cb()->routeController("appearance", "\crocodicstudio\crudbooster\controllers\DeveloperAppearanceController"); |
|
16 | + cb()->routeController("miscellaneous", "\crocodicstudio\crudbooster\controllers\DeveloperMiscellaneousController"); |
|
17 | + cb()->routePost("skip-tutorial", "DeveloperDashboardController@postSkipTutorial"); |
|
18 | + cb()->routeGet("/", "DeveloperDashboardController@getIndex"); |
|
19 | 19 | }); |
20 | 20 | |
21 | 21 | // Developer Auth Middleware |
22 | 22 | Route::group(['middleware' => ['web'], |
23 | 23 | 'prefix'=>"developer/".getSetting('developer_path'), |
24 | - 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () { |
|
25 | - cb()->routePost("login","AdminAuthController@postLoginDeveloper"); |
|
26 | - cb()->routeGet("login","AdminAuthController@getLoginDeveloper"); |
|
27 | - cb()->routeGet("logout","AdminAuthController@getLogoutDeveloper"); |
|
24 | + 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() { |
|
25 | + cb()->routePost("login", "AdminAuthController@postLoginDeveloper"); |
|
26 | + cb()->routeGet("login", "AdminAuthController@getLoginDeveloper"); |
|
27 | + cb()->routeGet("logout", "AdminAuthController@getLogoutDeveloper"); |
|
28 | 28 | }); |
29 | 29 | |
30 | 30 | // Routing without any middleware |
31 | -Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function () { |
|
32 | - if(getSetting("AUTO_REDIRECT_TO_LOGIN")) { |
|
33 | - cb()->routeGet("/","AdminAuthController@getRedirectToLogin"); |
|
31 | +Route::group(['middleware' => ['web'], 'namespace' => '\crocodicstudio\crudbooster\controllers'], function() { |
|
32 | + if (getSetting("AUTO_REDIRECT_TO_LOGIN")) { |
|
33 | + cb()->routeGet("/", "AdminAuthController@getRedirectToLogin"); |
|
34 | 34 | } |
35 | 35 | }); |
36 | 36 | |
37 | 37 | // Routing without any middleware with admin prefix |
38 | -Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function () { |
|
38 | +Route::group(['middleware' => ['web'], 'prefix' => cb()->getAdminPath(), 'namespace' => 'crocodicstudio\crudbooster\controllers'], function() { |
|
39 | 39 | cb()->routeGet('logout', "AdminAuthController@getLogout"); |
40 | 40 | |
41 | - if(!getSetting("DISABLE_LOGIN")) { |
|
41 | + if (!getSetting("DISABLE_LOGIN")) { |
|
42 | 42 | cb()->routePost('login', "AdminAuthController@postLogin"); |
43 | 43 | cb()->routeGet('login', "AdminAuthController@getLogin"); |
44 | 44 | } |
45 | 45 | |
46 | - if(getSetting("enable_forget")) { |
|
47 | - cb()->routePost("forget","AdminAuthController@postForget"); |
|
46 | + if (getSetting("enable_forget")) { |
|
47 | + cb()->routePost("forget", "AdminAuthController@postForget"); |
|
48 | 48 | } |
49 | 49 | |
50 | - if(getSetting("enable_register")) { |
|
51 | - cb()->routePost("register","AdminAuthController@postRegister"); |
|
50 | + if (getSetting("enable_register")) { |
|
51 | + cb()->routePost("register", "AdminAuthController@postRegister"); |
|
52 | 52 | } |
53 | 53 | }); |
54 | 54 | |
55 | 55 | // Routing package controllers |
56 | -cb()->routeGroupBackend(function () { |
|
56 | +cb()->routeGroupBackend(function() { |
|
57 | 57 | cb()->routeController('profile', '\crocodicstudio\crudbooster\controllers\AdminProfileController'); |
58 | 58 | }); |
59 | 59 | |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | 'middleware' => ['web', \crocodicstudio\crudbooster\middlewares\CBBackend::class], |
63 | 63 | 'prefix' => cb()->getAdminPath(), |
64 | 64 | 'namespace' => 'App\Http\Controllers', |
65 | -], function () { |
|
65 | +], function() { |
|
66 | 66 | |
67 | 67 | if (Request::is(cb()->getAdminPath())) { |
68 | - if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
|
68 | + if ($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
|
69 | 69 | cb()->routeGet("/", $dashboard); |
70 | - }else{ |
|
70 | + } else { |
|
71 | 71 | cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex"); |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | $controllers = glob(app_path('Http/Controllers/Admin*Controller.php')); |
76 | 76 | |
77 | - foreach($controllers as $controller) { |
|
77 | + foreach ($controllers as $controller) { |
|
78 | 78 | $controllerName = basename($controller); |
79 | - $controllerName = rtrim($controllerName,".php"); |
|
79 | + $controllerName = rtrim($controllerName, ".php"); |
|
80 | 80 | $className = '\App\Http\Controllers\\'.$controllerName; |
81 | 81 | $controllerClass = new $className(); |
82 | - if(method_exists($controllerClass, 'cbInit')) { |
|
82 | + if (method_exists($controllerClass, 'cbInit')) { |
|
83 | 83 | cb()->routeController($controllerClass->getData('permalink'), $controllerName); |
84 | 84 | } |
85 | 85 | } |
@@ -25,7 +25,7 @@ discard block |
||
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 |
||
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); |
@@ -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 |