@@ -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,9 +1,9 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Helpers; |
|
| 3 | + namespace App\Helpers; |
|
| 4 | 4 | |
| 5 | -/* Avoids CloudFlare IP to be logged as users IP */ |
|
| 5 | + /* Avoids CloudFlare IP to be logged as users IP */ |
|
| 6 | 6 | |
| 7 | -if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { |
|
| 8 | - $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; |
|
| 7 | + if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { |
|
| 8 | + $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP']; |
|
| 9 | 9 | } |
@@ -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 | } |