@@ -1,53 +1,53 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Facades\User; |
|
6 | -use Illuminate\Http\Request; |
|
7 | -use Illuminate\Http\Response; |
|
8 | -use Illuminate\Support\Facades\Config; |
|
9 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Facades\User; |
|
6 | + use Illuminate\Http\Request; |
|
7 | + use Illuminate\Http\Response; |
|
8 | + use Illuminate\Support\Facades\Config; |
|
9 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Class ClientController. |
13 | 13 | */ |
14 | -class ClientController extends BaseController |
|
15 | -{ |
|
16 | - /** |
|
14 | + class ClientController extends BaseController |
|
15 | + { |
|
16 | + /** |
|
17 | 17 | * Returns the Client URL. |
18 | 18 | * |
19 | 19 | * @param Request $request |
20 | 20 | * |
21 | 21 | * @return Response |
22 | 22 | */ |
23 | - public function getUrl(Request $request) |
|
24 | - { |
|
25 | - $hotelUrl = Config::get('chocolatey.hotelUrl'); |
|
23 | + public function getUrl(Request $request) |
|
24 | + { |
|
25 | + $hotelUrl = Config::get('chocolatey.hotelUrl'); |
|
26 | 26 | |
27 | - return response()->json(['clienturl' => "{$hotelUrl}/client/habbo-client"], 200, [], JSON_UNESCAPED_SLASHES); |
|
28 | - } |
|
27 | + return response()->json(['clienturl' => "{$hotelUrl}/client/habbo-client"], 200, [], JSON_UNESCAPED_SLASHES); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
30 | + /** |
|
31 | 31 | * Get Client View. |
32 | 32 | * |
33 | 33 | * @return Response |
34 | 34 | */ |
35 | - public function showClient(): Response |
|
36 | - { |
|
37 | - User::updateSession(['auth_ticket' => ($userToken = uniqid('HabboWEB', true))]); |
|
35 | + public function showClient(): Response |
|
36 | + { |
|
37 | + User::updateSession(['auth_ticket' => ($userToken = uniqid('HabboWEB', true))]); |
|
38 | 38 | |
39 | - return response(view('habbo-web-pages.habbo-client', ['token' => $userToken, 'newUser' => in_array('NEW_USER', User::getUser()->traits)])); |
|
40 | - } |
|
39 | + return response(view('habbo-web-pages.habbo-client', ['token' => $userToken, 'newUser' => in_array('NEW_USER', User::getUser()->traits)])); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
42 | + /** |
|
43 | 43 | * Get HabboWEB Ads Interstitial. |
44 | 44 | * |
45 | 45 | * @param string $interstitialType |
46 | 46 | * |
47 | 47 | * @return Response |
48 | 48 | */ |
49 | - public function getInterstitial(string $interstitialType): Response |
|
50 | - { |
|
51 | - return response(view('habbo-web-ads.interstitial')); |
|
52 | - } |
|
49 | + public function getInterstitial(string $interstitialType): Response |
|
50 | + { |
|
51 | + return response(view('habbo-web-ads.interstitial')); |
|
52 | + } |
|
53 | 53 | } |
@@ -65,7 +65,7 @@ |
||
65 | 65 | /** |
66 | 66 | * Check if a Key exists in the Session. |
67 | 67 | * |
68 | - * @param mixed $key |
|
68 | + * @param string $key |
|
69 | 69 | * |
70 | 70 | * @return bool |
71 | 71 | */ |
@@ -1,41 +1,41 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Helpers; |
|
3 | + namespace App\Helpers; |
|
4 | 4 | |
5 | -use App\Singleton; |
|
5 | + use App\Singleton; |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Class Session. |
9 | 9 | */ |
10 | -final class Session extends Singleton |
|
11 | -{ |
|
12 | - /** |
|
10 | + final class Session extends Singleton |
|
11 | + { |
|
12 | + /** |
|
13 | 13 | * Rename the Session ID. |
14 | 14 | * |
15 | 15 | * @param string $name |
16 | 16 | */ |
17 | - public function rename($name) |
|
18 | - { |
|
19 | - session_name($name); |
|
20 | - } |
|
17 | + public function rename($name) |
|
18 | + { |
|
19 | + session_name($name); |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
22 | + /** |
|
23 | 23 | * Start Session Handler. |
24 | 24 | */ |
25 | - public function start() |
|
26 | - { |
|
27 | - @session_start(); |
|
28 | - } |
|
25 | + public function start() |
|
26 | + { |
|
27 | + @session_start(); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
30 | + /** |
|
31 | 31 | * Stop Session Handler. |
32 | 32 | */ |
33 | - public function destroy() |
|
34 | - { |
|
35 | - @session_destroy(); |
|
36 | - } |
|
33 | + public function destroy() |
|
34 | + { |
|
35 | + @session_destroy(); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
38 | + /** |
|
39 | 39 | * Store a Variable in the Session. |
40 | 40 | * |
41 | 41 | * @param string $key |
@@ -43,46 +43,46 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return mixed |
45 | 45 | */ |
46 | - public function set($key, $value) |
|
47 | - { |
|
48 | - $_SESSION[$key] = $value; |
|
46 | + public function set($key, $value) |
|
47 | + { |
|
48 | + $_SESSION[$key] = $value; |
|
49 | 49 | |
50 | - return $value; |
|
51 | - } |
|
50 | + return $value; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
53 | + /** |
|
54 | 54 | * Get a Attribute Value from Session. |
55 | 55 | * |
56 | 56 | * @param string $key |
57 | 57 | * |
58 | 58 | * @return mixed |
59 | 59 | */ |
60 | - public function get($key) |
|
61 | - { |
|
62 | - return $this->has($key) ? $_SESSION[$key] : null; |
|
63 | - } |
|
60 | + public function get($key) |
|
61 | + { |
|
62 | + return $this->has($key) ? $_SESSION[$key] : null; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
65 | + /** |
|
66 | 66 | * Check if a Key exists in the Session. |
67 | 67 | * |
68 | 68 | * @param mixed $key |
69 | 69 | * |
70 | 70 | * @return bool |
71 | 71 | */ |
72 | - public function has($key) |
|
73 | - { |
|
74 | - return array_key_exists($key, $_SESSION); |
|
75 | - } |
|
72 | + public function has($key) |
|
73 | + { |
|
74 | + return array_key_exists($key, $_SESSION); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
77 | + /** |
|
78 | 78 | * Erase a Attribute from Session. |
79 | 79 | * |
80 | 80 | * @param string $key |
81 | 81 | */ |
82 | - public function erase($key) |
|
83 | - { |
|
84 | - $_SESSION[$key] = null; |
|
82 | + public function erase($key) |
|
83 | + { |
|
84 | + $_SESSION[$key] = null; |
|
85 | 85 | |
86 | - unset($_SESSION[$key]); |
|
87 | - } |
|
86 | + unset($_SESSION[$key]); |
|
87 | + } |
|
88 | 88 | } |
@@ -1,17 +1,17 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Models\Room; |
|
6 | -use Illuminate\Http\JsonResponse; |
|
7 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Models\Room; |
|
6 | + use Illuminate\Http\JsonResponse; |
|
7 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class RoomsController. |
11 | 11 | */ |
12 | -class RoomsController extends BaseController |
|
13 | -{ |
|
14 | - /** |
|
12 | + class RoomsController extends BaseController |
|
13 | + { |
|
14 | + /** |
|
15 | 15 | * Get LeaderBoard Data. |
16 | 16 | * |
17 | 17 | * @TODO: Make Possible Filter with all the Possible Criteria |
@@ -22,26 +22,26 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return JsonResponse |
24 | 24 | */ |
25 | - public function getLeader($countryId, $roomRange, $roomInterval): JsonResponse |
|
26 | - { |
|
27 | - $leaderRank = 1; |
|
25 | + public function getLeader($countryId, $roomRange, $roomInterval): JsonResponse |
|
26 | + { |
|
27 | + $leaderRank = 1; |
|
28 | 28 | |
29 | - foreach (($leaderBoard = Room::where('state', '!=', 'invisible')->orderBy('score', 'DESC')->orderBy('users', 'DESC')->limit(50)->get()) as $room) { |
|
30 | - $room->leaderboardRank = $leaderRank++; |
|
31 | - } |
|
29 | + foreach (($leaderBoard = Room::where('state', '!=', 'invisible')->orderBy('score', 'DESC')->orderBy('users', 'DESC')->limit(50)->get()) as $room) { |
|
30 | + $room->leaderboardRank = $leaderRank++; |
|
31 | + } |
|
32 | 32 | |
33 | - return response()->json($leaderBoard, 200, [], JSON_UNESCAPED_SLASHES); |
|
34 | - } |
|
33 | + return response()->json($leaderBoard, 200, [], JSON_UNESCAPED_SLASHES); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
36 | + /** |
|
37 | 37 | * Get a specific Room Data. |
38 | 38 | * |
39 | 39 | * @param int $roomId |
40 | 40 | * |
41 | 41 | * @return JsonResponse |
42 | 42 | */ |
43 | - public function getRoom($roomId): JsonResponse |
|
44 | - { |
|
45 | - return response()->json(Room::find($roomId) ?? ['error' => 'not-found'], 200, [], JSON_UNESCAPED_SLASHES); |
|
46 | - } |
|
43 | + public function getRoom($roomId): JsonResponse |
|
44 | + { |
|
45 | + return response()->json(Room::find($roomId) ?? ['error' => 'not-found'], 200, [], JSON_UNESCAPED_SLASHES); |
|
46 | + } |
|
47 | 47 | } |
@@ -1,68 +1,68 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Facades\User as UserFacade; |
|
6 | -use App\Models\ChocolateyId; |
|
7 | -use App\Models\User; |
|
8 | -use Facebook\Facebook; |
|
9 | -use Facebook\GraphNodes\GraphUser; |
|
10 | -use Illuminate\Http\JsonResponse; |
|
11 | -use Illuminate\Http\Request; |
|
12 | -use Illuminate\Support\Facades\Config; |
|
13 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Facades\User as UserFacade; |
|
6 | + use App\Models\ChocolateyId; |
|
7 | + use App\Models\User; |
|
8 | + use Facebook\Facebook; |
|
9 | + use Facebook\GraphNodes\GraphUser; |
|
10 | + use Illuminate\Http\JsonResponse; |
|
11 | + use Illuminate\Http\Request; |
|
12 | + use Illuminate\Support\Facades\Config; |
|
13 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class LoginController. |
17 | 17 | */ |
18 | -class LoginController extends BaseController |
|
19 | -{ |
|
20 | - /** |
|
18 | + class LoginController extends BaseController |
|
19 | + { |
|
20 | + /** |
|
21 | 21 | * Handles the Response of the Login Attempt. |
22 | 22 | * |
23 | 23 | * @param Request $request |
24 | 24 | * |
25 | 25 | * @return JsonResponse |
26 | 26 | */ |
27 | - public function login(Request $request): JsonResponse |
|
28 | - { |
|
29 | - if (UserFacade::loginUser($request) !== null) { |
|
30 | - if (UserFacade::getUser()->isBanned) { |
|
31 | - return $this->sendBanMessage($request); |
|
32 | - } |
|
27 | + public function login(Request $request): JsonResponse |
|
28 | + { |
|
29 | + if (UserFacade::loginUser($request) !== null) { |
|
30 | + if (UserFacade::getUser()->isBanned) { |
|
31 | + return $this->sendBanMessage($request); |
|
32 | + } |
|
33 | 33 | |
34 | - return response()->json(UserFacade::updateSession(['last_login' => time(), 'ip_current' => $request->ip()])); |
|
35 | - } |
|
34 | + return response()->json(UserFacade::updateSession(['last_login' => time(), 'ip_current' => $request->ip()])); |
|
35 | + } |
|
36 | 36 | |
37 | - //return response()->json(['message' => 'login.staff_login_not_allowed', 'captcha' => false], 401); // Example for Non Allowance of Staffs |
|
38 | - return response()->json(['message' => 'login.invalid_password', 'captcha' => false], 401); |
|
39 | - } |
|
37 | + //return response()->json(['message' => 'login.staff_login_not_allowed', 'captcha' => false], 401); // Example for Non Allowance of Staffs |
|
38 | + return response()->json(['message' => 'login.invalid_password', 'captcha' => false], 401); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
41 | + /** |
|
42 | 42 | * Return the Ban Message. |
43 | 43 | * |
44 | 44 | * @return JsonResponse |
45 | 45 | */ |
46 | - protected function sendBanMessage(): JsonResponse |
|
47 | - { |
|
48 | - return response()->json(['message' => 'login.user_banned', |
|
49 | - 'expiryTime' => UserFacade::getUser()->banDetails->ban_expire, |
|
50 | - 'reason' => UserFacade::getUser()->banDetails->ban_reason, ], 401); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
46 | + protected function sendBanMessage(): JsonResponse |
|
47 | + { |
|
48 | + return response()->json(['message' => 'login.user_banned', |
|
49 | + 'expiryTime' => UserFacade::getUser()->banDetails->ban_expire, |
|
50 | + 'reason' => UserFacade::getUser()->banDetails->ban_reason, ], 401); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | 54 | * Destroys the User Session. |
55 | 55 | * |
56 | 56 | * @return JsonResponse |
57 | 57 | */ |
58 | - public function logout(): JsonResponse |
|
59 | - { |
|
60 | - UserFacade::eraseSession(); |
|
58 | + public function logout(): JsonResponse |
|
59 | + { |
|
60 | + UserFacade::eraseSession(); |
|
61 | 61 | |
62 | - return response()->json(null); |
|
63 | - } |
|
62 | + return response()->json(null); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
65 | + /** |
|
66 | 66 | * Register an User on the Database |
67 | 67 | * and do the Login of the User. |
68 | 68 | * |
@@ -70,58 +70,58 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return JsonResponse |
72 | 72 | */ |
73 | - public function register(Request $request): JsonResponse |
|
74 | - { |
|
75 | - if (ChocolateyId::where('mail', $request->json()->get('email'))->count() > 0) { |
|
76 | - return response()->json(['error' => 'registration_email_in_use'], 409); |
|
77 | - } |
|
73 | + public function register(Request $request): JsonResponse |
|
74 | + { |
|
75 | + if (ChocolateyId::where('mail', $request->json()->get('email'))->count() > 0) { |
|
76 | + return response()->json(['error' => 'registration_email_in_use'], 409); |
|
77 | + } |
|
78 | 78 | |
79 | - $dateOfBirth = strtotime("{$request->json()->get('birthdate')['day']}/{$request->json()->get('birthdate')['month']}/{$request->json()->get('birthdate')['year']}"); |
|
79 | + $dateOfBirth = strtotime("{$request->json()->get('birthdate')['day']}/{$request->json()->get('birthdate')['month']}/{$request->json()->get('birthdate')['year']}"); |
|
80 | 80 | |
81 | - (new AccountController())->createUser($request, $request->json()->all(), true); |
|
81 | + (new AccountController())->createUser($request, $request->json()->all(), true); |
|
82 | 82 | |
83 | - (new ChocolateyId())->store($request->json()->get('email'), $request->json()->get('password')); |
|
83 | + (new ChocolateyId())->store($request->json()->get('email'), $request->json()->get('password')); |
|
84 | 84 | |
85 | - UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'account_day_of_birth' => $dateOfBirth]); |
|
85 | + UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'account_day_of_birth' => $dateOfBirth]); |
|
86 | 86 | |
87 | - return response()->json(UserFacade::getUser()); |
|
88 | - } |
|
87 | + return response()->json(UserFacade::getUser()); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
90 | + /** |
|
91 | 91 | * Create or Login a Facebook User. |
92 | 92 | * |
93 | 93 | * @param Request $request |
94 | 94 | * |
95 | 95 | * @return JsonResponse |
96 | 96 | */ |
97 | - public function facebook(Request $request): JsonResponse |
|
98 | - { |
|
99 | - $fbUser = $this->fbAuth($request); |
|
97 | + public function facebook(Request $request): JsonResponse |
|
98 | + { |
|
99 | + $fbUser = $this->fbAuth($request); |
|
100 | 100 | |
101 | - if (User::query()->where('real_name', $fbUser->getId())->count() > 0) { |
|
102 | - return response()->json(UserFacade::setSession(User::where('real_name', $fbUser->getId())->first())); |
|
103 | - } |
|
101 | + if (User::query()->where('real_name', $fbUser->getId())->count() > 0) { |
|
102 | + return response()->json(UserFacade::setSession(User::where('real_name', $fbUser->getId())->first())); |
|
103 | + } |
|
104 | 104 | |
105 | - (new AccountController())->createUser($request, ['email' => $fbUser->getEmail()], true); |
|
105 | + (new AccountController())->createUser($request, ['email' => $fbUser->getEmail()], true); |
|
106 | 106 | |
107 | - UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'real_name' => $fbUser->getId()]); |
|
107 | + UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'real_name' => $fbUser->getId()]); |
|
108 | 108 | |
109 | - return response()->json(UserFacade::getUser()); |
|
110 | - } |
|
109 | + return response()->json(UserFacade::getUser()); |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
112 | + /** |
|
113 | 113 | * Do Facebook Authentication. |
114 | 114 | * |
115 | 115 | * @param Request $request |
116 | 116 | * |
117 | 117 | * @return GraphUser |
118 | 118 | */ |
119 | - protected function fbAuth(Request $request): GraphUser |
|
120 | - { |
|
121 | - $facebook = new Facebook(['app_id' => Config::get('chocolatey.facebook.app.key'), 'app_secret' => Config::get('chocolatey.facebook.app.secret')]); |
|
119 | + protected function fbAuth(Request $request): GraphUser |
|
120 | + { |
|
121 | + $facebook = new Facebook(['app_id' => Config::get('chocolatey.facebook.app.key'), 'app_secret' => Config::get('chocolatey.facebook.app.secret')]); |
|
122 | 122 | |
123 | - $facebook->setDefaultAccessToken($request->json()->get('accessToken')); |
|
123 | + $facebook->setDefaultAccessToken($request->json()->get('accessToken')); |
|
124 | 124 | |
125 | - return $facebook->get('/me?fields=id,name,email')->getGraphUser(); |
|
126 | - } |
|
125 | + return $facebook->get('/me?fields=id,name,email')->getGraphUser(); |
|
126 | + } |
|
127 | 127 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | - Mail::send($view, $configuration, function ($message) use ($configuration) { |
|
27 | + Mail::send($view, $configuration, function($message) use ($configuration) { |
|
28 | 28 | $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
29 | 29 | $message->to($configuration['email'])->subject($configuration['subject']); |
30 | 30 | }); |
@@ -1,36 +1,36 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Models\Mail as MailModel; |
|
6 | -use Illuminate\Support\Facades\Config; |
|
7 | -use Illuminate\Support\Facades\Mail; |
|
8 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Models\Mail as MailModel; |
|
6 | + use Illuminate\Support\Facades\Config; |
|
7 | + use Illuminate\Support\Facades\Mail; |
|
8 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Class MailController. |
12 | 12 | */ |
13 | -class MailController extends BaseController |
|
14 | -{ |
|
15 | - /** |
|
13 | + class MailController extends BaseController |
|
14 | + { |
|
15 | + /** |
|
16 | 16 | * Send an Email. |
17 | 17 | * |
18 | 18 | * @param array $configuration |
19 | 19 | * @param string $view |
20 | 20 | */ |
21 | - public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail') |
|
22 | - { |
|
23 | - if (!Config::get('mail.enable')) { |
|
24 | - return; |
|
25 | - } |
|
21 | + public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail') |
|
22 | + { |
|
23 | + if (!Config::get('mail.enable')) { |
|
24 | + return; |
|
25 | + } |
|
26 | 26 | |
27 | - Mail::send($view, $configuration, function ($message) use ($configuration) { |
|
28 | - $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
|
29 | - $message->to($configuration['email'])->subject($configuration['subject']); |
|
30 | - }); |
|
31 | - } |
|
27 | + Mail::send($view, $configuration, function ($message) use ($configuration) { |
|
28 | + $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
|
29 | + $message->to($configuration['email'])->subject($configuration['subject']); |
|
30 | + }); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * Prepare the E-Mail. |
35 | 35 | * |
36 | 36 | * @param string $email |
@@ -38,28 +38,28 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - public function prepare(string $email, string $url): string |
|
42 | - { |
|
43 | - (new MailModel())->store($token = uniqid('HabboMail', true), $url, $email)->save(); |
|
41 | + public function prepare(string $email, string $url): string |
|
42 | + { |
|
43 | + (new MailModel())->store($token = uniqid('HabboMail', true), $url, $email)->save(); |
|
44 | 44 | |
45 | - return $token; |
|
46 | - } |
|
45 | + return $token; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
48 | + /** |
|
49 | 49 | * Get E-Mail by Controller. |
50 | 50 | * |
51 | 51 | * @param string $token |
52 | 52 | * |
53 | 53 | * @return object |
54 | 54 | */ |
55 | - public function getMail(string $token) |
|
56 | - { |
|
57 | - $mailRequest = MailModel::where('token', $token)->where('used', '0')->first(); |
|
55 | + public function getMail(string $token) |
|
56 | + { |
|
57 | + $mailRequest = MailModel::where('token', $token)->where('used', '0')->first(); |
|
58 | 58 | |
59 | - if ($mailRequest !== null) { |
|
60 | - $mailRequest->update(['used' => '1']); |
|
61 | - } |
|
59 | + if ($mailRequest !== null) { |
|
60 | + $mailRequest->update(['used' => '1']); |
|
61 | + } |
|
62 | 62 | |
63 | - return $mailRequest; |
|
64 | - } |
|
63 | + return $mailRequest; |
|
64 | + } |
|
65 | 65 | } |
@@ -1,105 +1,105 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Console\Commands; |
|
3 | + namespace App\Console\Commands; |
|
4 | 4 | |
5 | -use Illuminate\Console\Command; |
|
6 | -use Illuminate\Support\Facades\Storage; |
|
7 | -use PDO; |
|
5 | + use Illuminate\Console\Command; |
|
6 | + use Illuminate\Support\Facades\Storage; |
|
7 | + use PDO; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Class Setup. |
11 | 11 | */ |
12 | -class Setup extends Command |
|
13 | -{ |
|
14 | - /** |
|
12 | + class Setup extends Command |
|
13 | + { |
|
14 | + /** |
|
15 | 15 | * The name and signature of the console command. |
16 | 16 | * |
17 | 17 | * @var string |
18 | 18 | */ |
19 | - protected $signature = 'choco:setup'; |
|
19 | + protected $signature = 'choco:setup'; |
|
20 | 20 | |
21 | - /** |
|
21 | + /** |
|
22 | 22 | * The console command description. |
23 | 23 | * |
24 | 24 | * @var string |
25 | 25 | */ |
26 | - protected $description = 'Guide you through the process of configuring your copy of Chocolatey'; |
|
26 | + protected $description = 'Guide you through the process of configuring your copy of Chocolatey'; |
|
27 | 27 | |
28 | - /** |
|
28 | + /** |
|
29 | 29 | * Create a new command instance. |
30 | 30 | */ |
31 | - public function __construct() |
|
32 | - { |
|
33 | - parent::__construct(); |
|
34 | - } |
|
31 | + public function __construct() |
|
32 | + { |
|
33 | + parent::__construct(); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
36 | + /** |
|
37 | 37 | * Execute the console command. |
38 | 38 | * |
39 | 39 | * @return mixed |
40 | 40 | */ |
41 | - public function handle() |
|
42 | - { |
|
43 | - $this->comment('Welcome to the Chocolatey Housekeeping setup command'); |
|
44 | - $this->comment('This little command will guide you through the configuration of your copy of Espreso and will prompt you to create the first Super User'); |
|
41 | + public function handle() |
|
42 | + { |
|
43 | + $this->comment('Welcome to the Chocolatey Housekeeping setup command'); |
|
44 | + $this->comment('This little command will guide you through the configuration of your copy of Espreso and will prompt you to create the first Super User'); |
|
45 | 45 | |
46 | - if ($this->confirm('Do you want to continue the setup process?')) { |
|
47 | - $this->comment('First step - SETUP DATABASE'); |
|
46 | + if ($this->confirm('Do you want to continue the setup process?')) { |
|
47 | + $this->comment('First step - SETUP DATABASE'); |
|
48 | 48 | |
49 | - $DB_HOST = $this->ask('Database host? Can take the form of an IP address, FQDN, host alias...'); |
|
50 | - $DB_PORT = $this->ask('MySQL server port? If you don\'t know, type 3306', 3306); |
|
51 | - $DB_USER = $this->ask('Database user?'); |
|
52 | - $DB_PASS = $this->ask('Database password?'); |
|
53 | - $DB_NAME = $this->ask('Database name?'); |
|
49 | + $DB_HOST = $this->ask('Database host? Can take the form of an IP address, FQDN, host alias...'); |
|
50 | + $DB_PORT = $this->ask('MySQL server port? If you don\'t know, type 3306', 3306); |
|
51 | + $DB_USER = $this->ask('Database user?'); |
|
52 | + $DB_PASS = $this->ask('Database password?'); |
|
53 | + $DB_NAME = $this->ask('Database name?'); |
|
54 | 54 | |
55 | - try { |
|
56 | - (new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASS)); |
|
57 | - } catch (\PDOException $e) { |
|
58 | - $this->error('[ERROR] An error occured while configuring the database:'); |
|
59 | - $this->error($e->getMessage()); |
|
60 | - exit(); |
|
61 | - } |
|
55 | + try { |
|
56 | + (new PDO("mysql:host=$DB_HOST;dbname=$DB_NAME", $DB_USER, $DB_PASS)); |
|
57 | + } catch (\PDOException $e) { |
|
58 | + $this->error('[ERROR] An error occured while configuring the database:'); |
|
59 | + $this->error($e->getMessage()); |
|
60 | + exit(); |
|
61 | + } |
|
62 | 62 | |
63 | - $this->comment('[SUCCESS] Database connection has been established successfully...'); |
|
63 | + $this->comment('[SUCCESS] Database connection has been established successfully...'); |
|
64 | 64 | |
65 | - $this->comment('[INFO] Creating new .env file in Chocolatey storage...'); |
|
65 | + $this->comment('[INFO] Creating new .env file in Chocolatey storage...'); |
|
66 | 66 | |
67 | - Storage::delete('.env'); |
|
68 | - Storage::put('.env', 'APP_ENV=production'); |
|
67 | + Storage::delete('.env'); |
|
68 | + Storage::put('.env', 'APP_ENV=production'); |
|
69 | 69 | |
70 | - $this->comment('[INFO] Generating Chocolatey encryption key for password hashing...'); |
|
71 | - Storage::append('.env', 'APP_KEY='.bin2hex(openssl_random_pseudo_bytes(20))); |
|
70 | + $this->comment('[INFO] Generating Chocolatey encryption key for password hashing...'); |
|
71 | + Storage::append('.env', 'APP_KEY='.bin2hex(openssl_random_pseudo_bytes(20))); |
|
72 | 72 | |
73 | - $this->comment('[INFO] Setting Chocolatey debug mode to false...'); |
|
74 | - Storage::append('.env', 'APP_DEBUG=false'); |
|
73 | + $this->comment('[INFO] Setting Chocolatey debug mode to false...'); |
|
74 | + Storage::append('.env', 'APP_DEBUG=false'); |
|
75 | 75 | |
76 | - $this->comment('[INFO] Setting Espreso logging level to debug...'); |
|
77 | - Storage::append('.env', 'APP_LOG_LEVEL=debug'); |
|
76 | + $this->comment('[INFO] Setting Espreso logging level to debug...'); |
|
77 | + Storage::append('.env', 'APP_LOG_LEVEL=debug'); |
|
78 | 78 | |
79 | - $this->comment('[DATABASE] Setting database driver to mysql...'); |
|
80 | - Storage::append('.env', 'DB_CONNECTION=mysql'); |
|
79 | + $this->comment('[DATABASE] Setting database driver to mysql...'); |
|
80 | + Storage::append('.env', 'DB_CONNECTION=mysql'); |
|
81 | 81 | |
82 | - $this->comment('[INFO] Appending all database credentials to .env file...'); |
|
83 | - Storage::append('.env', 'DB_HOST='.$DB_HOST); |
|
84 | - Storage::append('.env', 'DB_PORT='.$DB_PORT); |
|
85 | - Storage::append('.env', 'DB_DATABASE='.$DB_NAME); |
|
86 | - Storage::append('.env', 'DB_USERNAME='.$DB_USER); |
|
87 | - Storage::append('.env', 'DB_PASSWORD='.$DB_PASS); |
|
88 | - Storage::append('.env', ''); |
|
82 | + $this->comment('[INFO] Appending all database credentials to .env file...'); |
|
83 | + Storage::append('.env', 'DB_HOST='.$DB_HOST); |
|
84 | + Storage::append('.env', 'DB_PORT='.$DB_PORT); |
|
85 | + Storage::append('.env', 'DB_DATABASE='.$DB_NAME); |
|
86 | + Storage::append('.env', 'DB_USERNAME='.$DB_USER); |
|
87 | + Storage::append('.env', 'DB_PASSWORD='.$DB_PASS); |
|
88 | + Storage::append('.env', ''); |
|
89 | 89 | |
90 | - $this->comment('[DRIVERS] Setting broadcast to log...'); |
|
91 | - Storage::append('.env', 'BROADCAST_DRIVER=log'); |
|
90 | + $this->comment('[DRIVERS] Setting broadcast to log...'); |
|
91 | + Storage::append('.env', 'BROADCAST_DRIVER=log'); |
|
92 | 92 | |
93 | - $this->comment('[DRIVERS] Setting cache to file...'); |
|
94 | - Storage::append('.env', 'CACHE_DRIVER=file'); |
|
93 | + $this->comment('[DRIVERS] Setting cache to file...'); |
|
94 | + Storage::append('.env', 'CACHE_DRIVER=file'); |
|
95 | 95 | |
96 | - $this->comment('[DRIVERS] Setting session to file...'); |
|
97 | - Storage::append('.env', 'SESSION_DRIVER=file'); |
|
96 | + $this->comment('[DRIVERS] Setting session to file...'); |
|
97 | + Storage::append('.env', 'SESSION_DRIVER=file'); |
|
98 | 98 | |
99 | - $this->comment('[DRIVERS] Setting queueing to sync...'); |
|
100 | - Storage::append('.env', 'QUEUE_DRIVER=sync'); |
|
101 | - } |
|
99 | + $this->comment('[DRIVERS] Setting queueing to sync...'); |
|
100 | + Storage::append('.env', 'QUEUE_DRIVER=sync'); |
|
101 | + } |
|
102 | 102 | |
103 | - return true; |
|
104 | - } |
|
103 | + return true; |
|
104 | + } |
|
105 | 105 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | Storage::put('.env', 'APP_ENV=production'); |
69 | 69 | |
70 | 70 | $this->comment('[INFO] Generating Chocolatey encryption key for password hashing...'); |
71 | - Storage::append('.env', 'APP_KEY='.bin2hex(openssl_random_pseudo_bytes(20))); |
|
71 | + Storage::append('.env', 'APP_KEY=' . bin2hex(openssl_random_pseudo_bytes(20))); |
|
72 | 72 | |
73 | 73 | $this->comment('[INFO] Setting Chocolatey debug mode to false...'); |
74 | 74 | Storage::append('.env', 'APP_DEBUG=false'); |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | Storage::append('.env', 'DB_CONNECTION=mysql'); |
81 | 81 | |
82 | 82 | $this->comment('[INFO] Appending all database credentials to .env file...'); |
83 | - Storage::append('.env', 'DB_HOST='.$DB_HOST); |
|
84 | - Storage::append('.env', 'DB_PORT='.$DB_PORT); |
|
85 | - Storage::append('.env', 'DB_DATABASE='.$DB_NAME); |
|
86 | - Storage::append('.env', 'DB_USERNAME='.$DB_USER); |
|
87 | - Storage::append('.env', 'DB_PASSWORD='.$DB_PASS); |
|
83 | + Storage::append('.env', 'DB_HOST=' . $DB_HOST); |
|
84 | + Storage::append('.env', 'DB_PORT=' . $DB_PORT); |
|
85 | + Storage::append('.env', 'DB_DATABASE=' . $DB_NAME); |
|
86 | + Storage::append('.env', 'DB_USERNAME=' . $DB_USER); |
|
87 | + Storage::append('.env', 'DB_PASSWORD=' . $DB_PASS); |
|
88 | 88 | Storage::append('.env', ''); |
89 | 89 | |
90 | 90 | $this->comment('[DRIVERS] Setting broadcast to log...'); |
@@ -1,32 +1,32 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Console; |
|
3 | + namespace App\Console; |
|
4 | 4 | |
5 | -use Illuminate\Console\Scheduling\Schedule; |
|
6 | -use Laravel\Lumen\Console\Kernel as ConsoleKernel; |
|
5 | + use Illuminate\Console\Scheduling\Schedule; |
|
6 | + use Laravel\Lumen\Console\Kernel as ConsoleKernel; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Class Kernel. |
10 | 10 | */ |
11 | -class Kernel extends ConsoleKernel |
|
12 | -{ |
|
13 | - /** |
|
11 | + class Kernel extends ConsoleKernel |
|
12 | + { |
|
13 | + /** |
|
14 | 14 | * The Artisan commands provided by your application. |
15 | 15 | * |
16 | 16 | * @var array |
17 | 17 | */ |
18 | - protected $commands = [ |
|
19 | - Commands\Setup::class, |
|
20 | - ]; |
|
18 | + protected $commands = [ |
|
19 | + Commands\Setup::class, |
|
20 | + ]; |
|
21 | 21 | |
22 | - /** |
|
22 | + /** |
|
23 | 23 | * Define the application's command schedule. |
24 | 24 | * |
25 | 25 | * @param \Illuminate\Console\Scheduling\Schedule $schedule |
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - protected function schedule(Schedule $schedule) |
|
30 | - { |
|
31 | - } |
|
29 | + protected function schedule(Schedule $schedule) |
|
30 | + { |
|
31 | + } |
|
32 | 32 | } |