@@ -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,41 +1,41 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Helpers; |
|
| 3 | + namespace App\Helpers; |
|
| 4 | 4 | |
| 5 | -use App\Models\Mail as MailModel; |
|
| 6 | -use App\Singleton; |
|
| 7 | -use Illuminate\Support\Facades\Config; |
|
| 8 | -use Illuminate\Support\Facades\Mail as MailFacade; |
|
| 5 | + use App\Models\Mail as MailModel; |
|
| 6 | + use App\Singleton; |
|
| 7 | + use Illuminate\Support\Facades\Config; |
|
| 8 | + use Illuminate\Support\Facades\Mail as MailFacade; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Class Mail. |
| 12 | 12 | */ |
| 13 | -final class Mail extends Singleton |
|
| 14 | -{ |
|
| 15 | - /** |
|
| 13 | + final class Mail extends Singleton |
|
| 14 | + { |
|
| 15 | + /** |
|
| 16 | 16 | * Stored Mail Model. |
| 17 | 17 | * |
| 18 | 18 | * @var MailModel |
| 19 | 19 | */ |
| 20 | - protected $mailModel; |
|
| 20 | + protected $mailModel; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | + /** |
|
| 23 | 23 | * Send an Email. |
| 24 | 24 | * |
| 25 | 25 | * @param array $configuration |
| 26 | 26 | * @param string $view |
| 27 | 27 | */ |
| 28 | - public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail') |
|
| 29 | - { |
|
| 30 | - if (Config::get('mail.enable')) { |
|
| 31 | - MailFacade::send($view, $configuration, function ($message) use ($configuration) { |
|
| 32 | - $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
|
| 33 | - $message->to($configuration['email'])->subject($configuration['subject']); |
|
| 34 | - }); |
|
| 35 | - } |
|
| 36 | - } |
|
| 28 | + public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail') |
|
| 29 | + { |
|
| 30 | + if (Config::get('mail.enable')) { |
|
| 31 | + MailFacade::send($view, $configuration, function ($message) use ($configuration) { |
|
| 32 | + $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
|
| 33 | + $message->to($configuration['email'])->subject($configuration['subject']); |
|
| 34 | + }); |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * Store an E-mail. |
| 40 | 40 | * |
| 41 | 41 | * @param string $email |
@@ -43,72 +43,72 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return string |
| 45 | 45 | */ |
| 46 | - public function store(string $email, string $url): string |
|
| 47 | - { |
|
| 48 | - (new MailModel())->store($token = uniqid('HabboMail', true), $url, $email); |
|
| 46 | + public function store(string $email, string $url): string |
|
| 47 | + { |
|
| 48 | + (new MailModel())->store($token = uniqid('HabboMail', true), $url, $email); |
|
| 49 | 49 | |
| 50 | - return $token; |
|
| 51 | - } |
|
| 50 | + return $token; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 53 | + /** |
|
| 54 | 54 | * Return if Exists E-Mail with that Token. |
| 55 | 55 | * |
| 56 | 56 | * @param string $token |
| 57 | 57 | * |
| 58 | 58 | * @return bool |
| 59 | 59 | */ |
| 60 | - public function has(string $token) |
|
| 61 | - { |
|
| 62 | - return $this->get($token) !== null; |
|
| 63 | - } |
|
| 60 | + public function has(string $token) |
|
| 61 | + { |
|
| 62 | + return $this->get($token) !== null; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 65 | + /** |
|
| 66 | 66 | * Get an E-mail by Token. |
| 67 | 67 | * |
| 68 | 68 | * @param string $token |
| 69 | 69 | * |
| 70 | 70 | * @return MailModel |
| 71 | 71 | */ |
| 72 | - public function get(string $token = '') |
|
| 73 | - { |
|
| 74 | - if ($this->mailModel == null && !empty($token)) { |
|
| 75 | - $mailModel = MailModel::where('token', $token)->where('used', '0')->first(); |
|
| 72 | + public function get(string $token = '') |
|
| 73 | + { |
|
| 74 | + if ($this->mailModel == null && !empty($token)) { |
|
| 75 | + $mailModel = MailModel::where('token', $token)->where('used', '0')->first(); |
|
| 76 | 76 | |
| 77 | - if ($mailModel !== null) { |
|
| 78 | - if (strtotime($mailModel->created_at) + (Config::get('mail.expire') * 24 * 60 * 60) >= time()) { |
|
| 79 | - $this->set($mailModel); |
|
| 77 | + if ($mailModel !== null) { |
|
| 78 | + if (strtotime($mailModel->created_at) + (Config::get('mail.expire') * 24 * 60 * 60) >= time()) { |
|
| 79 | + $this->set($mailModel); |
|
| 80 | 80 | |
| 81 | - $this->update(['used' => '1']); |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - } |
|
| 81 | + $this->update(['used' => '1']); |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - return $this->mailModel; |
|
| 87 | - } |
|
| 86 | + return $this->mailModel; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 89 | + /** |
|
| 90 | 90 | * Set Mail Model in Cache. |
| 91 | 91 | * |
| 92 | 92 | * @param MailModel $model |
| 93 | 93 | * |
| 94 | 94 | * @return MailModel |
| 95 | 95 | */ |
| 96 | - public function set(MailModel $model) |
|
| 97 | - { |
|
| 98 | - return $this->mailModel = $model; |
|
| 99 | - } |
|
| 96 | + public function set(MailModel $model) |
|
| 97 | + { |
|
| 98 | + return $this->mailModel = $model; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - /** |
|
| 101 | + /** |
|
| 102 | 102 | * Update Mail Model Data. |
| 103 | 103 | * |
| 104 | 104 | * @param array $parameters |
| 105 | 105 | * |
| 106 | 106 | * @return MailModel |
| 107 | 107 | */ |
| 108 | - public function update(array $parameters) |
|
| 109 | - { |
|
| 110 | - $this->mailModel->update($parameters); |
|
| 108 | + public function update(array $parameters) |
|
| 109 | + { |
|
| 110 | + $this->mailModel->update($parameters); |
|
| 111 | 111 | |
| 112 | - return $this->mailModel; |
|
| 113 | - } |
|
| 112 | + return $this->mailModel; |
|
| 113 | + } |
|
| 114 | 114 | } |
@@ -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 | } |
@@ -1,23 +1,23 @@ |
||
| 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 Illuminate\Support\Facades\Redirect; |
|
| 7 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 5 | + use Illuminate\Http\Response; |
|
| 6 | + use Illuminate\Support\Facades\Redirect; |
|
| 7 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Class HomePageController. |
| 11 | 11 | */ |
| 12 | -class HomePageController extends BaseController |
|
| 13 | -{ |
|
| 14 | - /** |
|
| 12 | + class HomePageController extends BaseController |
|
| 13 | + { |
|
| 14 | + /** |
|
| 15 | 15 | * Render the Home Page. |
| 16 | 16 | * |
| 17 | 17 | * @return Response|Redirect |
| 18 | 18 | */ |
| 19 | - public function show() |
|
| 20 | - { |
|
| 21 | - return response(view('habbo-web-pages.habbo-web')); |
|
| 22 | - } |
|
| 19 | + public function show() |
|
| 20 | + { |
|
| 21 | + return response(view('habbo-web-pages.habbo-web')); |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -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 | } |
@@ -1,33 +1,33 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Exceptions; |
|
| 3 | + namespace App\Exceptions; |
|
| 4 | 4 | |
| 5 | -use Exception; |
|
| 6 | -use Illuminate\Auth\Access\AuthorizationException; |
|
| 7 | -use Illuminate\Database\Eloquent\ModelNotFoundException; |
|
| 8 | -use Illuminate\Validation\ValidationException; |
|
| 9 | -use Laravel\Lumen\Exceptions\Handler as ExceptionHandler; |
|
| 10 | -use Symfony\Component\HttpKernel\Exception\HttpException; |
|
| 11 | -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
|
| 5 | + use Exception; |
|
| 6 | + use Illuminate\Auth\Access\AuthorizationException; |
|
| 7 | + use Illuminate\Database\Eloquent\ModelNotFoundException; |
|
| 8 | + use Illuminate\Validation\ValidationException; |
|
| 9 | + use Laravel\Lumen\Exceptions\Handler as ExceptionHandler; |
|
| 10 | + use Symfony\Component\HttpKernel\Exception\HttpException; |
|
| 11 | + use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Class Handler. |
| 15 | 15 | */ |
| 16 | -class Handler extends ExceptionHandler |
|
| 17 | -{ |
|
| 18 | - /** |
|
| 16 | + class Handler extends ExceptionHandler |
|
| 17 | + { |
|
| 18 | + /** |
|
| 19 | 19 | * A list of the exception types that should not be reported. |
| 20 | 20 | * |
| 21 | 21 | * @var array |
| 22 | 22 | */ |
| 23 | - protected $dontReport = [ |
|
| 24 | - AuthorizationException::class, |
|
| 25 | - HttpException::class, |
|
| 26 | - ModelNotFoundException::class, |
|
| 27 | - ValidationException::class, |
|
| 28 | - ]; |
|
| 23 | + protected $dontReport = [ |
|
| 24 | + AuthorizationException::class, |
|
| 25 | + HttpException::class, |
|
| 26 | + ModelNotFoundException::class, |
|
| 27 | + ValidationException::class, |
|
| 28 | + ]; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 30 | + /** |
|
| 31 | 31 | * Report or log an exception. |
| 32 | 32 | * |
| 33 | 33 | * This is a great spot to send exceptions to Sentry, Bugsnag, etc. |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | - public function report(Exception $e) |
|
| 40 | - { |
|
| 41 | - parent::report($e); |
|
| 42 | - } |
|
| 39 | + public function report(Exception $e) |
|
| 40 | + { |
|
| 41 | + parent::report($e); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | + /** |
|
| 45 | 45 | * Render an exception into an HTTP response. |
| 46 | 46 | * |
| 47 | 47 | * @param \Illuminate\Http\Request $request |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return \Illuminate\Http\Response |
| 51 | 51 | */ |
| 52 | - public function render($request, Exception $e) |
|
| 53 | - { |
|
| 54 | - if ($e instanceof NotFoundHttpException) { |
|
| 55 | - return response(view('habbo-web-pages.habbo-web')); |
|
| 56 | - } |
|
| 52 | + public function render($request, Exception $e) |
|
| 53 | + { |
|
| 54 | + if ($e instanceof NotFoundHttpException) { |
|
| 55 | + return response(view('habbo-web-pages.habbo-web')); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - return parent::render($request, $e); |
|
| 59 | - } |
|
| 58 | + return parent::render($request, $e); |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -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 | } |