@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
79 | 79 | ]); |
80 | 80 | |
81 | - foreach ((array) $request->json()->all() as $setting => $value) { |
|
81 | + foreach ((array)$request->json()->all() as $setting => $value) { |
|
82 | 82 | UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
83 | 83 | } |
84 | 84 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
146 | 146 | |
147 | - Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
147 | + Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to ' . Config::get('chocolatey.hotelName')]); |
|
148 | 148 | |
149 | 149 | return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
150 | 150 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | { |
163 | 163 | $partialName = explode(' ', (new Alliteration())->getName()); |
164 | 164 | |
165 | - return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
165 | + return strtolower($partialName[0] . strstr($userMail, '@', true) . $partialName[1]); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
212 | 212 | |
213 | 213 | Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
214 | - 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
214 | + 'url' => "/activate/{$token}", 'subject' => 'Welcome to ' . Config::get('chocolatey.hotelName'), |
|
215 | 215 | ]); |
216 | 216 | |
217 | 217 | return response(null); |
@@ -1,41 +1,41 @@ discard block |
||
1 | -<?php |
|
2 | - |
|
3 | -namespace App\Http\Controllers; |
|
4 | - |
|
5 | -use App\Facades\Mail; |
|
6 | -use App\Facades\User as UserFacade; |
|
7 | -use App\Facades\Validation; |
|
8 | -use App\Models\ChocolateyId; |
|
9 | -use App\Models\User; |
|
10 | -use App\Models\UserPreferences; |
|
11 | -use App\Models\UserSettings; |
|
12 | -use Illuminate\Http\JsonResponse; |
|
13 | -use Illuminate\Http\Request; |
|
14 | -use Illuminate\Http\Response; |
|
15 | -use Illuminate\Support\Facades\Config; |
|
16 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
17 | -use Nubs\RandomNameGenerator\Alliteration; |
|
1 | + <?php |
|
2 | + |
|
3 | + namespace App\Http\Controllers; |
|
4 | + |
|
5 | + use App\Facades\Mail; |
|
6 | + use App\Facades\User as UserFacade; |
|
7 | + use App\Facades\Validation; |
|
8 | + use App\Models\ChocolateyId; |
|
9 | + use App\Models\User; |
|
10 | + use App\Models\UserPreferences; |
|
11 | + use App\Models\UserSettings; |
|
12 | + use Illuminate\Http\JsonResponse; |
|
13 | + use Illuminate\Http\Request; |
|
14 | + use Illuminate\Http\Response; |
|
15 | + use Illuminate\Support\Facades\Config; |
|
16 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
17 | + use Nubs\RandomNameGenerator\Alliteration; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Class AccountController. |
21 | 21 | */ |
22 | -class AccountController extends BaseController |
|
23 | -{ |
|
24 | - /** |
|
22 | + class AccountController extends BaseController |
|
23 | + { |
|
24 | + /** |
|
25 | 25 | * Save User Look. |
26 | 26 | * |
27 | 27 | * @param Request $request |
28 | 28 | * |
29 | 29 | * @return JsonResponse |
30 | 30 | */ |
31 | - public function saveLook(Request $request): JsonResponse |
|
32 | - { |
|
33 | - UserFacade::updateSession(['look' => $request->json()->get('figure'), 'gender' => $request->json()->get('gender')]); |
|
31 | + public function saveLook(Request $request): JsonResponse |
|
32 | + { |
|
33 | + UserFacade::updateSession(['look' => $request->json()->get('figure'), 'gender' => $request->json()->get('gender')]); |
|
34 | 34 | |
35 | - return response()->json(UserFacade::getUser()); |
|
36 | - } |
|
35 | + return response()->json(UserFacade::getUser()); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
38 | + /** |
|
39 | 39 | * Get User Non Read Messenger Discussions. |
40 | 40 | * |
41 | 41 | * @TODO: Code Integration with HabboMessenger |
@@ -43,59 +43,59 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return JsonResponse |
45 | 45 | */ |
46 | - public function getDiscussions(): JsonResponse |
|
47 | - { |
|
48 | - return response()->json([]); |
|
49 | - } |
|
46 | + public function getDiscussions(): JsonResponse |
|
47 | + { |
|
48 | + return response()->json([]); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
51 | + /** |
|
52 | 52 | * Get User Preferences. |
53 | 53 | * |
54 | 54 | * @return JsonResponse |
55 | 55 | */ |
56 | - public function getPreferences(): JsonResponse |
|
57 | - { |
|
58 | - $userPreferences = UserPreferences::firstOrCreate(['user_id' => UserFacade::getUser()->uniqueId]); |
|
56 | + public function getPreferences(): JsonResponse |
|
57 | + { |
|
58 | + $userPreferences = UserPreferences::firstOrCreate(['user_id' => UserFacade::getUser()->uniqueId]); |
|
59 | 59 | |
60 | - foreach ($userPreferences->getAttributes() as $attributeName => $attributeValue) { |
|
61 | - $userPreferences->{$attributeName} = $attributeValue == 1; |
|
62 | - } |
|
60 | + foreach ($userPreferences->getAttributes() as $attributeName => $attributeValue) { |
|
61 | + $userPreferences->{$attributeName} = $attributeValue == 1; |
|
62 | + } |
|
63 | 63 | |
64 | - return response()->json($userPreferences); |
|
65 | - } |
|
64 | + return response()->json($userPreferences); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
67 | + /** |
|
68 | 68 | * Save New User Preferences. |
69 | 69 | * |
70 | 70 | * @param Request $request |
71 | 71 | * |
72 | 72 | * @return Response |
73 | 73 | */ |
74 | - public function savePreferences(Request $request): Response |
|
75 | - { |
|
76 | - UserSettings::updateOrCreate(['user_id' => UserFacade::getUser()->uniqueId], [ |
|
77 | - 'block_following' => $request->json()->get('friendCanFollow') == false ? '1' : '0', |
|
78 | - 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
|
79 | - ]); |
|
74 | + public function savePreferences(Request $request): Response |
|
75 | + { |
|
76 | + UserSettings::updateOrCreate(['user_id' => UserFacade::getUser()->uniqueId], [ |
|
77 | + 'block_following' => $request->json()->get('friendCanFollow') == false ? '1' : '0', |
|
78 | + 'block_friendrequests' => $request->json()->get('friendRequestEnabled') == false ? '1' : '0', |
|
79 | + ]); |
|
80 | 80 | |
81 | - foreach ((array) $request->json()->all() as $setting => $value) { |
|
82 | - UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
|
83 | - } |
|
81 | + foreach ((array) $request->json()->all() as $setting => $value) { |
|
82 | + UserPreferences::find(UserFacade::getUser()->uniqueId)->update([$setting => $value == true ? '1' : '0']); |
|
83 | + } |
|
84 | 84 | |
85 | - return response(null); |
|
86 | - } |
|
85 | + return response(null); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
88 | + /** |
|
89 | 89 | * Get All E-Mail Accounts. |
90 | 90 | * |
91 | 91 | * @return JsonResponse |
92 | 92 | */ |
93 | - public function getAvatars(): JsonResponse |
|
94 | - { |
|
95 | - return response()->json(UserFacade::getUser()->getChocolateyId()->relatedAccounts); |
|
96 | - } |
|
93 | + public function getAvatars(): JsonResponse |
|
94 | + { |
|
95 | + return response()->json(UserFacade::getUser()->getChocolateyId()->relatedAccounts); |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
98 | + /** |
|
99 | 99 | * Check if an Username is available |
100 | 100 | * for a new Avatar Account. |
101 | 101 | * |
@@ -103,33 +103,33 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return JsonResponse |
105 | 105 | */ |
106 | - public function checkName(Request $request): JsonResponse |
|
107 | - { |
|
108 | - return response()->json(['isAvailable' => (User::where('username', $request->input('name'))->count() == 0 |
|
109 | - && Validation::filterUserName($request->input('name')) && !UserFacade::getUser()->isStaff)]); |
|
110 | - } |
|
106 | + public function checkName(Request $request): JsonResponse |
|
107 | + { |
|
108 | + return response()->json(['isAvailable' => (User::where('username', $request->input('name'))->count() == 0 |
|
109 | + && Validation::filterUserName($request->input('name')) && !UserFacade::getUser()->isStaff)]); |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
112 | + /** |
|
113 | 113 | * Create a New User Avatar. |
114 | 114 | * |
115 | 115 | * @param Request $request |
116 | 116 | * |
117 | 117 | * @return JsonResponse |
118 | 118 | */ |
119 | - public function createAvatar(Request $request): JsonResponse |
|
120 | - { |
|
121 | - if (User::where('username', $request->json()->get('name'))->count() == 0 && Validation::filterUserName($request->json()->get('name'))) { |
|
122 | - $user = $this->createUser($request, ['username' => $request->json()->get('name'), 'email' => UserFacade::getUser()->email]); |
|
119 | + public function createAvatar(Request $request): JsonResponse |
|
120 | + { |
|
121 | + if (User::where('username', $request->json()->get('name'))->count() == 0 && Validation::filterUserName($request->json()->get('name'))) { |
|
122 | + $user = $this->createUser($request, ['username' => $request->json()->get('name'), 'email' => UserFacade::getUser()->email]); |
|
123 | 123 | |
124 | - ChocolateyId::find(UserFacade::getUser()->email)->update(['last_logged_id' => $user->uniqueId]); |
|
124 | + ChocolateyId::find(UserFacade::getUser()->email)->update(['last_logged_id' => $user->uniqueId]); |
|
125 | 125 | |
126 | - return response()->json(''); |
|
127 | - } |
|
126 | + return response()->json(''); |
|
127 | + } |
|
128 | 128 | |
129 | - return response()->json(''); |
|
130 | - } |
|
129 | + return response()->json(''); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
132 | + /** |
|
133 | 133 | * Create a New User. |
134 | 134 | * |
135 | 135 | * @param Request $request |
@@ -138,18 +138,18 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return User |
140 | 140 | */ |
141 | - public function createUser(Request $request, array $userInfo, bool $newUser = false): User |
|
142 | - { |
|
143 | - $userName = $newUser ? $this->uniqueName($userInfo['email']) : $userInfo['username']; |
|
141 | + public function createUser(Request $request, array $userInfo, bool $newUser = false): User |
|
142 | + { |
|
143 | + $userName = $newUser ? $this->uniqueName($userInfo['email']) : $userInfo['username']; |
|
144 | 144 | |
145 | - $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
|
145 | + $token = Mail::store($userInfo['email'], 'public/registration/activate'); |
|
146 | 146 | |
147 | - Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
147 | + Mail::send(['email' => $userInfo['email'], 'name' => $userName, 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName')]); |
|
148 | 148 | |
149 | - return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
|
150 | - } |
|
149 | + return UserFacade::setSession((new User())->store($userName, $userInfo['email'], $request->ip(), $newUser)); |
|
150 | + } |
|
151 | 151 | |
152 | - /** |
|
152 | + /** |
|
153 | 153 | * Create Random Unique Username. |
154 | 154 | * |
155 | 155 | * @WARNING: Doesn't create Like Habbo Way |
@@ -158,62 +158,62 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - protected function uniqueName(string $userMail): string |
|
162 | - { |
|
163 | - $partialName = explode(' ', (new Alliteration())->getName()); |
|
161 | + protected function uniqueName(string $userMail): string |
|
162 | + { |
|
163 | + $partialName = explode(' ', (new Alliteration())->getName()); |
|
164 | 164 | |
165 | - return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
166 | - } |
|
165 | + return strtolower($partialName[0].strstr($userMail, '@', true).$partialName[1]); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
168 | + /** |
|
169 | 169 | * Change Logged In User. |
170 | 170 | * |
171 | 171 | * @param Request $request |
172 | 172 | */ |
173 | - public function selectAvatar(Request $request) |
|
174 | - { |
|
175 | - UserFacade::getUser()->getChocolateyId()->update(['last_logged_id' => $request->json()->get('uniqueId')]); |
|
173 | + public function selectAvatar(Request $request) |
|
174 | + { |
|
175 | + UserFacade::getUser()->getChocolateyId()->update(['last_logged_id' => $request->json()->get('uniqueId')]); |
|
176 | 176 | |
177 | - UserFacade::setSession(User::find($request->json()->get('uniqueId'))); |
|
178 | - } |
|
177 | + UserFacade::setSession(User::find($request->json()->get('uniqueId'))); |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
180 | + /** |
|
181 | 181 | * Send User Forgot E-Mail. |
182 | 182 | * |
183 | 183 | * @param Request $request |
184 | 184 | * |
185 | 185 | * @return JsonResponse |
186 | 186 | */ |
187 | - public function forgotPassword(Request $request): JsonResponse |
|
188 | - { |
|
189 | - if (($user = User::where('mail', $request->json()->get('email'))->first()) == null) { |
|
190 | - return response()->json(['email' => $request->json()->get('email')]); |
|
191 | - } |
|
187 | + public function forgotPassword(Request $request): JsonResponse |
|
188 | + { |
|
189 | + if (($user = User::where('mail', $request->json()->get('email'))->first()) == null) { |
|
190 | + return response()->json(['email' => $request->json()->get('email')]); |
|
191 | + } |
|
192 | 192 | |
193 | - $token = Mail::store($user->email, 'public/forgotPassword'); |
|
193 | + $token = Mail::store($user->email, 'public/forgotPassword'); |
|
194 | 194 | |
195 | - Mail::send(['name' => $user->name, 'email' => $user->email, 'subject' => 'Password reset confirmation', |
|
196 | - 'url' => "/reset-password/{$token}", |
|
197 | - ], 'habbo-web-mail.password-reset'); |
|
195 | + Mail::send(['name' => $user->name, 'email' => $user->email, 'subject' => 'Password reset confirmation', |
|
196 | + 'url' => "/reset-password/{$token}", |
|
197 | + ], 'habbo-web-mail.password-reset'); |
|
198 | 198 | |
199 | - return response()->json(['email' => $user->email]); |
|
200 | - } |
|
199 | + return response()->json(['email' => $user->email]); |
|
200 | + } |
|
201 | 201 | |
202 | - /** |
|
202 | + /** |
|
203 | 203 | * Send an Account Confirmation E-Mail. |
204 | 204 | * |
205 | 205 | * @param Request $request |
206 | 206 | * |
207 | 207 | * @return Response |
208 | 208 | */ |
209 | - public function verifyAccount(Request $request): Response |
|
210 | - { |
|
211 | - $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
|
209 | + public function verifyAccount(Request $request): Response |
|
210 | + { |
|
211 | + $token = Mail::store(UserFacade::getUser()->email, 'public/registration/activate'); |
|
212 | 212 | |
213 | - Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
|
214 | - 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
215 | - ]); |
|
213 | + Mail::send(['name' => UserFacade::getUser()->name, 'email' => $request->user()->email, |
|
214 | + 'url' => "/activate/{$token}", 'subject' => 'Welcome to '.Config::get('chocolatey.hotelName'), |
|
215 | + ]); |
|
216 | 216 | |
217 | - return response(null); |
|
218 | - } |
|
217 | + return response(null); |
|
218 | + } |
|
219 | 219 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getIdAttribute(): string |
56 | 56 | { |
57 | - return (string) $this->attributes['id']; |
|
57 | + return (string)$this->attributes['id']; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function getLikesAttribute(): array |
108 | 108 | { |
109 | - return array_map(function (array $item) { |
|
109 | + return array_map(function(array $item) { |
|
110 | 110 | return $item['username']; |
111 | 111 | }, PhotoLike::query()->select('username')->where('photo_id', $this->attributes['id'])->get(['username'])->toArray()); |
112 | 112 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public function checkWords(string $needle): bool |
48 | 48 | { |
49 | - return count(array_filter(Config::get('chocolatey.invalid'), function ($illegal) use ($needle) { |
|
49 | + return count(array_filter(Config::get('chocolatey.invalid'), function($illegal) use ($needle) { |
|
50 | 50 | return stripos($needle, $illegal) !== false; |
51 | 51 | })) == 0; |
52 | 52 | } |
@@ -1,34 +1,34 @@ 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\Photo; |
|
7 | -use App\Models\PhotoLike; |
|
8 | -use App\Models\PhotoReport; |
|
9 | -use Illuminate\Http\JsonResponse; |
|
10 | -use Illuminate\Http\Request; |
|
11 | -use Illuminate\Http\Response; |
|
12 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Facades\User as UserFacade; |
|
6 | + use App\Models\Photo; |
|
7 | + use App\Models\PhotoLike; |
|
8 | + use App\Models\PhotoReport; |
|
9 | + use Illuminate\Http\JsonResponse; |
|
10 | + use Illuminate\Http\Request; |
|
11 | + use Illuminate\Http\Response; |
|
12 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Class PhotosController. |
16 | 16 | */ |
17 | -class PhotosController extends BaseController |
|
18 | -{ |
|
19 | - /** |
|
17 | + class PhotosController extends BaseController |
|
18 | + { |
|
19 | + /** |
|
20 | 20 | * Render a set of Public HabboWEB Photos. |
21 | 21 | * |
22 | 22 | * @TODO: Exclude Approved Reported Photos from the List |
23 | 23 | * |
24 | 24 | * @return JsonResponse |
25 | 25 | */ |
26 | - public function show(): JsonResponse |
|
27 | - { |
|
28 | - return response()->json(Photo::all(), 200, [], JSON_UNESCAPED_SLASHES); |
|
29 | - } |
|
26 | + public function show(): JsonResponse |
|
27 | + { |
|
28 | + return response()->json(Photo::all(), 200, [], JSON_UNESCAPED_SLASHES); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
31 | + /** |
|
32 | 32 | * Register a Report of a Photo |
33 | 33 | * Observation.: We will not create a limit of max reports. |
34 | 34 | * Since it's a retro we don't really care about reports. |
@@ -40,66 +40,66 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return Response |
42 | 42 | */ |
43 | - public function report(Request $request, int $photoId): Response |
|
44 | - { |
|
45 | - (new PhotoReport())->store($photoId, $request->json()->get('reason'), UserFacade::getUser()->uniqueId); |
|
43 | + public function report(Request $request, int $photoId): Response |
|
44 | + { |
|
45 | + (new PhotoReport())->store($photoId, $request->json()->get('reason'), UserFacade::getUser()->uniqueId); |
|
46 | 46 | |
47 | - return response(null); |
|
48 | - } |
|
47 | + return response(null); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
50 | + /** |
|
51 | 51 | * Like a Photo. |
52 | 52 | * |
53 | 53 | * @param int $photoId |
54 | 54 | * |
55 | 55 | * @return Response |
56 | 56 | */ |
57 | - public function likePhoto(int $photoId): Response |
|
58 | - { |
|
59 | - if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() > 0) { |
|
60 | - return response(null); |
|
61 | - } |
|
57 | + public function likePhoto(int $photoId): Response |
|
58 | + { |
|
59 | + if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() > 0) { |
|
60 | + return response(null); |
|
61 | + } |
|
62 | 62 | |
63 | - (new PhotoLike())->store($photoId, UserFacade::getUser()->name); |
|
63 | + (new PhotoLike())->store($photoId, UserFacade::getUser()->name); |
|
64 | 64 | |
65 | - return response(null); |
|
66 | - } |
|
65 | + return response(null); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
68 | + /** |
|
69 | 69 | * Unlike a Photo. |
70 | 70 | * |
71 | 71 | * @param int $photoId |
72 | 72 | * |
73 | 73 | * @return Response |
74 | 74 | */ |
75 | - public function unlikePhoto(int $photoId): Response |
|
76 | - { |
|
77 | - if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() == 0) { |
|
78 | - return response(null); |
|
79 | - } |
|
75 | + public function unlikePhoto(int $photoId): Response |
|
76 | + { |
|
77 | + if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() == 0) { |
|
78 | + return response(null); |
|
79 | + } |
|
80 | 80 | |
81 | - PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->delete(); |
|
81 | + PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->delete(); |
|
82 | 82 | |
83 | - return response(null); |
|
84 | - } |
|
83 | + return response(null); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
86 | + /** |
|
87 | 87 | * Delete a Photo. |
88 | 88 | * |
89 | 89 | * @param int $photoId |
90 | 90 | * |
91 | 91 | * @return Response |
92 | 92 | */ |
93 | - public function delete(int $photoId): Response |
|
94 | - { |
|
95 | - $photo = Photo::find($photoId); |
|
93 | + public function delete(int $photoId): Response |
|
94 | + { |
|
95 | + $photo = Photo::find($photoId); |
|
96 | 96 | |
97 | - if ($photo == null || $photo->creator_id != UserFacade::getUser()->uniqueId) { |
|
98 | - return response(null, 401); |
|
99 | - } |
|
97 | + if ($photo == null || $photo->creator_id != UserFacade::getUser()->uniqueId) { |
|
98 | + return response(null, 401); |
|
99 | + } |
|
100 | 100 | |
101 | - $photo->delete(); |
|
101 | + $photo->delete(); |
|
102 | 102 | |
103 | - return response(null); |
|
104 | - } |
|
103 | + return response(null); |
|
104 | + } |
|
105 | 105 | } |
@@ -1,65 +1,65 @@ discard block |
||
1 | -<?php |
|
2 | - |
|
3 | -namespace App\Http\Controllers; |
|
4 | - |
|
5 | -use App\Facades\Mail; |
|
6 | -use App\Facades\User as UserFacade; |
|
7 | -use App\Models\Country; |
|
8 | -use App\Models\PaymentCheckout; |
|
9 | -use App\Models\Purse; |
|
10 | -use App\Models\ShopHistory; |
|
11 | -use App\Models\ShopInventory; |
|
12 | -use App\Models\ShopItem; |
|
13 | -use App\Models\Voucher; |
|
14 | -use Illuminate\Http\JsonResponse; |
|
15 | -use Illuminate\Http\RedirectResponse; |
|
16 | -use Illuminate\Http\Request; |
|
17 | -use Illuminate\Http\Response; |
|
18 | -use Laravel\Lumen\Http\Redirector; |
|
19 | -use Laravel\Lumen\Http\ResponseFactory; |
|
20 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
1 | + <?php |
|
2 | + |
|
3 | + namespace App\Http\Controllers; |
|
4 | + |
|
5 | + use App\Facades\Mail; |
|
6 | + use App\Facades\User as UserFacade; |
|
7 | + use App\Models\Country; |
|
8 | + use App\Models\PaymentCheckout; |
|
9 | + use App\Models\Purse; |
|
10 | + use App\Models\ShopHistory; |
|
11 | + use App\Models\ShopInventory; |
|
12 | + use App\Models\ShopItem; |
|
13 | + use App\Models\Voucher; |
|
14 | + use Illuminate\Http\JsonResponse; |
|
15 | + use Illuminate\Http\RedirectResponse; |
|
16 | + use Illuminate\Http\Request; |
|
17 | + use Illuminate\Http\Response; |
|
18 | + use Laravel\Lumen\Http\Redirector; |
|
19 | + use Laravel\Lumen\Http\ResponseFactory; |
|
20 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Class ShopController. |
24 | 24 | */ |
25 | -class ShopController extends BaseController |
|
26 | -{ |
|
27 | - /** |
|
25 | + class ShopController extends BaseController |
|
26 | + { |
|
27 | + /** |
|
28 | 28 | * List all Shop Countries. |
29 | 29 | * |
30 | 30 | * @return JsonResponse |
31 | 31 | */ |
32 | - public function listCountries(): JsonResponse |
|
33 | - { |
|
34 | - return response()->json(Country::all()); |
|
35 | - } |
|
32 | + public function listCountries(): JsonResponse |
|
33 | + { |
|
34 | + return response()->json(Country::all()); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
37 | + /** |
|
38 | 38 | * Get the Shop Inventory of a Country. |
39 | 39 | * |
40 | 40 | * @param string $countryCode |
41 | 41 | * |
42 | 42 | * @return JsonResponse |
43 | 43 | */ |
44 | - public function getInventory(string $countryCode): JsonResponse |
|
45 | - { |
|
46 | - return response()->json(new ShopInventory(Country::where('countryCode', $countryCode)->first()), |
|
47 | - 200, [], JSON_UNESCAPED_SLASHES); |
|
48 | - } |
|
44 | + public function getInventory(string $countryCode): JsonResponse |
|
45 | + { |
|
46 | + return response()->json(new ShopInventory(Country::where('countryCode', $countryCode)->first()), |
|
47 | + 200, [], JSON_UNESCAPED_SLASHES); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
50 | + /** |
|
51 | 51 | * Get User Purse. |
52 | 52 | * |
53 | 53 | * @param Request $request |
54 | 54 | * |
55 | 55 | * @return JsonResponse |
56 | 56 | */ |
57 | - public function getPurse(Request $request): JsonResponse |
|
58 | - { |
|
59 | - return response()->json(new Purse(UserFacade::getUser()->uniqueId)); |
|
60 | - } |
|
57 | + public function getPurse(Request $request): JsonResponse |
|
58 | + { |
|
59 | + return response()->json(new Purse(UserFacade::getUser()->uniqueId)); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
62 | + /** |
|
63 | 63 | * Proceed Payment Checkout. |
64 | 64 | * |
65 | 65 | * @param string $paymentCategory |
@@ -69,23 +69,23 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return RedirectResponse|Response|Redirector|ResponseFactory |
71 | 71 | */ |
72 | - public function proceed(string $paymentCategory, int $countryCode, int $shopItem, int $paymentMethod) |
|
73 | - { |
|
74 | - $paymentCheckout = PaymentCheckout::where('category', $paymentCategory)->where('country', $countryCode) |
|
75 | - ->where('item', $shopItem)->where('method', $paymentMethod)->first(); |
|
72 | + public function proceed(string $paymentCategory, int $countryCode, int $shopItem, int $paymentMethod) |
|
73 | + { |
|
74 | + $paymentCheckout = PaymentCheckout::where('category', $paymentCategory)->where('country', $countryCode) |
|
75 | + ->where('item', $shopItem)->where('method', $paymentMethod)->first(); |
|
76 | 76 | |
77 | - if ($paymentCheckout == null) { |
|
78 | - return response(view('habbo-web-payments.failed-payment'), 400); |
|
79 | - } |
|
77 | + if ($paymentCheckout == null) { |
|
78 | + return response(view('habbo-web-payments.failed-payment'), 400); |
|
79 | + } |
|
80 | 80 | |
81 | - if ((strtotime($paymentCheckout->generated_at) + 172800) < time()) { |
|
82 | - return response(view('habbo-web-payments.canceled-payment'), 400); |
|
83 | - } |
|
81 | + if ((strtotime($paymentCheckout->generated_at) + 172800) < time()) { |
|
82 | + return response(view('habbo-web-payments.canceled-payment'), 400); |
|
83 | + } |
|
84 | 84 | |
85 | - return response(view('habbo-web-payments.proceed', ['payment' => $paymentCheckout])); |
|
86 | - } |
|
85 | + return response(view('habbo-web-payments.proceed', ['payment' => $paymentCheckout])); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
88 | + /** |
|
89 | 89 | * Success Payment Checkout. |
90 | 90 | * |
91 | 91 | * @TODO: Code Business Logic |
@@ -98,27 +98,27 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @return RedirectResponse|Response|Redirector|ResponseFactory |
100 | 100 | */ |
101 | - public function success(Request $request, string $paymentCategory, int $countryCode, int $shopItem, int $paymentMethod) |
|
102 | - { |
|
103 | - $paymentCheckout = PaymentCheckout::where('category', $paymentCategory)->where('country', $countryCode) |
|
104 | - ->where('item', $shopItem)->where('method', $paymentMethod)->first(); |
|
101 | + public function success(Request $request, string $paymentCategory, int $countryCode, int $shopItem, int $paymentMethod) |
|
102 | + { |
|
103 | + $paymentCheckout = PaymentCheckout::where('category', $paymentCategory)->where('country', $countryCode) |
|
104 | + ->where('item', $shopItem)->where('method', $paymentMethod)->first(); |
|
105 | 105 | |
106 | - if ($paymentCheckout == null) { |
|
107 | - return response(view('habbo-web-payments.canceled-payment'), 500); |
|
108 | - } |
|
106 | + if ($paymentCheckout == null) { |
|
107 | + return response(view('habbo-web-payments.canceled-payment'), 500); |
|
108 | + } |
|
109 | 109 | |
110 | - $purchaseItem = (new ShopHistory())->store($paymentMethod, UserFacade::getUser()->uniqueId, $shopItem); |
|
110 | + $purchaseItem = (new ShopHistory())->store($paymentMethod, UserFacade::getUser()->uniqueId, $shopItem); |
|
111 | 111 | |
112 | - Mail::send(['email' => UserFacade::getUser()->email, 'purchaseId' => $purchaseItem->transactionId, |
|
113 | - 'product' => ShopItem::find($shopItem), 'subject' => 'Purchase completed', |
|
114 | - ], 'habbo-web-mail.purchase-confirmation'); |
|
112 | + Mail::send(['email' => UserFacade::getUser()->email, 'purchaseId' => $purchaseItem->transactionId, |
|
113 | + 'product' => ShopItem::find($shopItem), 'subject' => 'Purchase completed', |
|
114 | + ], 'habbo-web-mail.purchase-confirmation'); |
|
115 | 115 | |
116 | - $paymentCheckout->delete(); |
|
116 | + $paymentCheckout->delete(); |
|
117 | 117 | |
118 | - return response(view('habbo-web-payments.success-payment', ['checkoutId' => $purchaseItem->transactionId]), 200); |
|
119 | - } |
|
118 | + return response(view('habbo-web-payments.success-payment', ['checkoutId' => $purchaseItem->transactionId]), 200); |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
121 | + /** |
|
122 | 122 | * Get User Purchase History. |
123 | 123 | * |
124 | 124 | * @TODO: User Purchase History will be coded on the Future |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return JsonResponse |
129 | 129 | */ |
130 | - public function getHistory(): JsonResponse |
|
131 | - { |
|
132 | - return response()->json(ShopHistory::where('user_id', UserFacade::getUser()->uniqueId)->get()); |
|
133 | - } |
|
130 | + public function getHistory(): JsonResponse |
|
131 | + { |
|
132 | + return response()->json(ShopHistory::where('user_id', UserFacade::getUser()->uniqueId)->get()); |
|
133 | + } |
|
134 | 134 | |
135 | - /** |
|
135 | + /** |
|
136 | 136 | * Redeem Voucher. |
137 | 137 | * |
138 | 138 | * @TODO: Need to Test if really works |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return JsonResponse |
143 | 143 | */ |
144 | - public function redeem(Request $request): JsonResponse |
|
145 | - { |
|
146 | - if (($voucher = Voucher::where('code', $request->json()->get('voucherCode'))->first()) == null) { |
|
147 | - return response()->json(null, 404); |
|
148 | - } |
|
144 | + public function redeem(Request $request): JsonResponse |
|
145 | + { |
|
146 | + if (($voucher = Voucher::where('code', $request->json()->get('voucherCode'))->first()) == null) { |
|
147 | + return response()->json(null, 404); |
|
148 | + } |
|
149 | 149 | |
150 | - UserFacade::getUser()->increment('credits', $voucher->credits); |
|
151 | - UserFacade::getUser()->increment('pixels', $voucher->points); |
|
150 | + UserFacade::getUser()->increment('credits', $voucher->credits); |
|
151 | + UserFacade::getUser()->increment('pixels', $voucher->points); |
|
152 | 152 | |
153 | - $voucher->delete(); |
|
153 | + $voucher->delete(); |
|
154 | 154 | |
155 | - return response()->json(null, 204); |
|
156 | - } |
|
155 | + return response()->json(null, 204); |
|
156 | + } |
|
157 | 157 | } |
@@ -1,106 +1,106 @@ |
||
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\Photo; |
|
7 | -use App\Models\User; |
|
8 | -use App\Models\UserBadge; |
|
9 | -use App\Models\UserPreferences; |
|
10 | -use App\Models\UserProfile; |
|
11 | -use Illuminate\Http\JsonResponse; |
|
12 | -use Illuminate\Http\Request; |
|
13 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Facades\User as UserFacade; |
|
6 | + use App\Models\Photo; |
|
7 | + use App\Models\User; |
|
8 | + use App\Models\UserBadge; |
|
9 | + use App\Models\UserPreferences; |
|
10 | + use App\Models\UserProfile; |
|
11 | + use Illuminate\Http\JsonResponse; |
|
12 | + use Illuminate\Http\Request; |
|
13 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class ProfileController. |
17 | 17 | */ |
18 | -class ProfileController extends BaseController |
|
19 | -{ |
|
20 | - /** |
|
18 | + class ProfileController extends BaseController |
|
19 | + { |
|
20 | + /** |
|
21 | 21 | * Get Public User Data. |
22 | 22 | * |
23 | 23 | * @param Request $request |
24 | 24 | * |
25 | 25 | * @return JsonResponse |
26 | 26 | */ |
27 | - public function getPublicData(Request $request): JsonResponse |
|
28 | - { |
|
29 | - $userData = User::where('username', $request->input('name'))->first(); |
|
27 | + public function getPublicData(Request $request): JsonResponse |
|
28 | + { |
|
29 | + $userData = User::where('username', $request->input('name'))->first(); |
|
30 | 30 | |
31 | - if ($userData == null || $userData->isBanned) { |
|
32 | - return response()->json(null, 404); |
|
33 | - } |
|
31 | + if ($userData == null || $userData->isBanned) { |
|
32 | + return response()->json(null, 404); |
|
33 | + } |
|
34 | 34 | |
35 | - $userPreferences = UserPreferences::find($userData->uniqueId); |
|
35 | + $userPreferences = UserPreferences::find($userData->uniqueId); |
|
36 | 36 | |
37 | - $userData->selectedBadges = UserBadge::where('user_id', $userData->uniqueId)->where('slot_id', '>', 0)->orderBy('slot_id', 'ASC')->get() ?? []; |
|
38 | - $userData->profileVisible = $userPreferences == null ? true : $userPreferences->profileVisible == '1'; |
|
37 | + $userData->selectedBadges = UserBadge::where('user_id', $userData->uniqueId)->where('slot_id', '>', 0)->orderBy('slot_id', 'ASC')->get() ?? []; |
|
38 | + $userData->profileVisible = $userPreferences == null ? true : $userPreferences->profileVisible == '1'; |
|
39 | 39 | |
40 | - return response()->json($userData); |
|
41 | - } |
|
40 | + return response()->json($userData); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
43 | + /** |
|
44 | 44 | * Get Public User Profile. |
45 | 45 | * |
46 | 46 | * @param int $userId |
47 | 47 | * |
48 | 48 | * @return JsonResponse |
49 | 49 | */ |
50 | - public function getPublicProfile($userId): JsonResponse |
|
51 | - { |
|
52 | - $userData = User::find($userId); |
|
50 | + public function getPublicProfile($userId): JsonResponse |
|
51 | + { |
|
52 | + $userData = User::find($userId); |
|
53 | 53 | |
54 | - if ($userData == null || $userData->isBanned) { |
|
55 | - return response()->json(null, 404); |
|
56 | - } |
|
54 | + if ($userData == null || $userData->isBanned) { |
|
55 | + return response()->json(null, 404); |
|
56 | + } |
|
57 | 57 | |
58 | - $userPreferences = UserPreferences::find($userData->uniqueId); |
|
58 | + $userPreferences = UserPreferences::find($userData->uniqueId); |
|
59 | 59 | |
60 | - if ($userPreferences != null && $userPreferences->profileVisible == '0') { |
|
61 | - return response()->json(null, 404); |
|
62 | - } |
|
60 | + if ($userPreferences != null && $userPreferences->profileVisible == '0') { |
|
61 | + return response()->json(null, 404); |
|
62 | + } |
|
63 | 63 | |
64 | - return response()->json(new UserProfile($userData)); |
|
65 | - } |
|
64 | + return response()->json(new UserProfile($userData)); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
67 | + /** |
|
68 | 68 | * Get Private User Profile. |
69 | 69 | * |
70 | 70 | * @return JsonResponse |
71 | 71 | */ |
72 | - public function getProfile(): JsonResponse |
|
73 | - { |
|
74 | - return response()->json(new UserProfile(UserFacade::getUser())); |
|
75 | - } |
|
72 | + public function getProfile(): JsonResponse |
|
73 | + { |
|
74 | + return response()->json(new UserProfile(UserFacade::getUser())); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
77 | + /** |
|
78 | 78 | * Get User Stories. |
79 | 79 | * |
80 | 80 | * @TODO: Implement Habbo Stories |
81 | 81 | * |
82 | 82 | * @return JsonResponse |
83 | 83 | */ |
84 | - public function getStories(): JsonResponse |
|
85 | - { |
|
86 | - return response()->json([]); |
|
87 | - } |
|
84 | + public function getStories(): JsonResponse |
|
85 | + { |
|
86 | + return response()->json([]); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
89 | + /** |
|
90 | 90 | * Get User Photos. |
91 | 91 | * |
92 | 92 | * @param int $userId |
93 | 93 | * |
94 | 94 | * @return JsonResponse |
95 | 95 | */ |
96 | - public function getPhotos(int $userId): JsonResponse |
|
97 | - { |
|
98 | - if (Photo::where('creator_id', $userId)->count() == 0) { |
|
99 | - return response()->json([]); |
|
100 | - } |
|
96 | + public function getPhotos(int $userId): JsonResponse |
|
97 | + { |
|
98 | + if (Photo::where('creator_id', $userId)->count() == 0) { |
|
99 | + return response()->json([]); |
|
100 | + } |
|
101 | 101 | |
102 | - $userPhotos = Photo::where('creator_id', $userId)->get(); |
|
102 | + $userPhotos = Photo::where('creator_id', $userId)->get(); |
|
103 | 103 | |
104 | - return response()->json($userPhotos); |
|
105 | - } |
|
104 | + return response()->json($userPhotos); |
|
105 | + } |
|
106 | 106 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail') |
29 | 29 | { |
30 | 30 | if (Config::get('mail.enable')) { |
31 | - MailFacade::send($view, $configuration, function ($message) use ($configuration) { |
|
31 | + MailFacade::send($view, $configuration, function($message) use ($configuration) { |
|
32 | 32 | $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
33 | 33 | $message->to($configuration['email'])->subject($configuration['subject']); |
34 | 34 | }); |
@@ -1,73 +1,73 @@ |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use App\Facades\Nux; |
|
6 | -use App\Facades\User as UserFacade; |
|
7 | -use App\Facades\Validation; |
|
8 | -use App\Models\NuxValidation; |
|
9 | -use App\Models\User; |
|
10 | -use Illuminate\Http\JsonResponse; |
|
11 | -use Illuminate\Http\Request; |
|
12 | -use Illuminate\Http\Response; |
|
13 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use App\Facades\Nux; |
|
6 | + use App\Facades\User as UserFacade; |
|
7 | + use App\Facades\Validation; |
|
8 | + use App\Models\NuxValidation; |
|
9 | + use App\Models\User; |
|
10 | + use Illuminate\Http\JsonResponse; |
|
11 | + use Illuminate\Http\Request; |
|
12 | + use Illuminate\Http\Response; |
|
13 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class NuxController. |
17 | 17 | */ |
18 | -class NuxController extends BaseController |
|
19 | -{ |
|
20 | - /** |
|
18 | + class NuxController extends BaseController |
|
19 | + { |
|
20 | + /** |
|
21 | 21 | * Check an User Name. |
22 | 22 | * |
23 | 23 | * @param Request $request |
24 | 24 | * |
25 | 25 | * @return JsonResponse |
26 | 26 | */ |
27 | - public function checkName(Request $request): JsonResponse |
|
28 | - { |
|
29 | - if (User::where('username', $request->json()->get('name'))->where('id', '<>', UserFacade::getUser()->uniqueId)->count() > 0) { |
|
30 | - return response()->json(new NuxValidation('NAME_IN_USE')); |
|
31 | - } |
|
27 | + public function checkName(Request $request): JsonResponse |
|
28 | + { |
|
29 | + if (User::where('username', $request->json()->get('name'))->where('id', '<>', UserFacade::getUser()->uniqueId)->count() > 0) { |
|
30 | + return response()->json(new NuxValidation('NAME_IN_USE')); |
|
31 | + } |
|
32 | 32 | |
33 | - if (!Validation::filterUserName($request->json()->get('name'))) { |
|
34 | - return response()->json(new NuxValidation('INVALID_NAME', ['resultType' => 'VALIDATION_ERROR_ILLEGAL_WORDS'])); |
|
35 | - } |
|
33 | + if (!Validation::filterUserName($request->json()->get('name'))) { |
|
34 | + return response()->json(new NuxValidation('INVALID_NAME', ['resultType' => 'VALIDATION_ERROR_ILLEGAL_WORDS'])); |
|
35 | + } |
|
36 | 36 | |
37 | - return response()->json(new NuxValidation()); |
|
38 | - } |
|
37 | + return response()->json(new NuxValidation()); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
40 | + /** |
|
41 | 41 | * Select an User Name. |
42 | 42 | * |
43 | 43 | * @param Request $request |
44 | 44 | * |
45 | 45 | * @return JsonResponse |
46 | 46 | */ |
47 | - public function selectName(Request $request): JsonResponse |
|
48 | - { |
|
49 | - UserFacade::updateSession(['username' => $request->json()->get('name')]); |
|
47 | + public function selectName(Request $request): JsonResponse |
|
48 | + { |
|
49 | + UserFacade::updateSession(['username' => $request->json()->get('name')]); |
|
50 | 50 | |
51 | - return response()->json(new NuxValidation()); |
|
52 | - } |
|
51 | + return response()->json(new NuxValidation()); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
54 | + /** |
|
55 | 55 | * Select a Room. |
56 | 56 | * |
57 | 57 | * @param Request $request |
58 | 58 | * |
59 | 59 | * @return Response |
60 | 60 | */ |
61 | - public function selectRoom(Request $request): Response |
|
62 | - { |
|
63 | - if (!in_array($request->json()->get('roomIndex'), [1, 2, 3])) { |
|
64 | - return response('', 400); |
|
65 | - } |
|
61 | + public function selectRoom(Request $request): Response |
|
62 | + { |
|
63 | + if (!in_array($request->json()->get('roomIndex'), [1, 2, 3])) { |
|
64 | + return response('', 400); |
|
65 | + } |
|
66 | 66 | |
67 | - Nux::generateRoom($request); |
|
67 | + Nux::generateRoom($request); |
|
68 | 68 | |
69 | - UserFacade::getUser()->traits = ['USER']; |
|
69 | + UserFacade::getUser()->traits = ['USER']; |
|
70 | 70 | |
71 | - return response(null, 200); |
|
72 | - } |
|
71 | + return response(null, 200); |
|
72 | + } |
|
73 | 73 | } |
@@ -1,16 +1,16 @@ discard block |
||
1 | -<?php |
|
1 | + <?php |
|
2 | 2 | |
3 | -namespace App\Http\Controllers; |
|
3 | + namespace App\Http\Controllers; |
|
4 | 4 | |
5 | -use Illuminate\Http\Response; |
|
6 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
5 | + use Illuminate\Http\Response; |
|
6 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Class PageController. |
10 | 10 | */ |
11 | -class PageController extends BaseController |
|
12 | -{ |
|
13 | - /** |
|
11 | + class PageController extends BaseController |
|
12 | + { |
|
13 | + /** |
|
14 | 14 | * Render a HabboWEB Page. |
15 | 15 | * |
16 | 16 | * @param string $pageCategory |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return Response |
20 | 20 | */ |
21 | - public function show(string $pageCategory, string $pageFile): Response |
|
22 | - { |
|
23 | - $pageArray = explode('.', $pageFile); |
|
21 | + public function show(string $pageCategory, string $pageFile): Response |
|
22 | + { |
|
23 | + $pageArray = explode('.', $pageFile); |
|
24 | 24 | |
25 | - return response(view("habbo-web-pages.{$pageCategory}.{$pageArray[0]}")); |
|
26 | - } |
|
25 | + return response(view("habbo-web-pages.{$pageCategory}.{$pageArray[0]}")); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
28 | + /** |
|
29 | 29 | * Render a HabboPage. |
30 | 30 | * |
31 | 31 | * @WARNING: Categories can still be pages |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return Response |
37 | 37 | */ |
38 | - public function habboPage(string $category, string $page = '') |
|
39 | - { |
|
40 | - return response(view(empty($page) ? "habbo-pages.{$category}" : "habbo-pages.{$category}.{$page}")); |
|
41 | - } |
|
38 | + public function habboPage(string $category, string $page = '') |
|
39 | + { |
|
40 | + return response(view(empty($page) ? "habbo-pages.{$category}" : "habbo-pages.{$category}.{$page}")); |
|
41 | + } |
|
42 | 42 | } |