🆙 Final fix delete storage link to fix news_images and logs 🆙

This commit is contained in:
Remco
2026-01-07 20:29:24 +01:00
parent 65ea6c167f
commit acf2d7e661
447 changed files with 208 additions and 66965 deletions
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace App\Rules;
use App\Models\Miscellaneous\WebsiteBetaCode;
use Closure;
use Illuminate\Contracts\Validation\InvokableRule;
class BetaCodeRule implements InvokableRule
{
public function __invoke(string $attribute, mixed $value, Closure $fail)
{
if (setting('requires_beta_code') && WebsiteBetaCode::whereCode($value)->whereNull('user_id')->doesntExist()) {
$fail(__('The beta code is invalid.'));
}
}
}
@@ -1,21 +0,0 @@
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\InvokableRule;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class CurrentPasswordRule implements InvokableRule
{
/**
* Run the validation rule.
*/
public function __invoke(string $attribute, mixed $value, Closure $fail): void
{
if (! Hash::check($value, Auth::user()->password)) {
$fail('It seems like your current password is wrong.');
}
}
}
@@ -1,38 +0,0 @@
<?php
namespace App\Rules;
use Closure;
use GuzzleHttp\Client;
use Illuminate\Contracts\Validation\InvokableRule;
class GoogleRecaptchaRule implements InvokableRule
{
public function __invoke(string $attribute, mixed $value, Closure $fail)
{
// If recaptcha is disabled
if ((int) setting('google_recaptcha_enabled') === 0) {
return true;
}
$client = new Client;
$response = $client->request(
'POST', 'https://www.google.com/recaptcha/api/siteverify', [
'form_params' => [
'secret' => config('habbo.site.recaptcha_secret_key'),
'response' => $value,
'remoteip' => request()->ip(),
],
],
);
if ($response->getStatusCode() !== 200) {
$fail(__('The Google recaptcha was not successful.'));
}
$body = json_decode((string) $response->getBody());
return $body->success;
}
}
-180
View File
@@ -1,180 +0,0 @@
<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Str;
class Password implements Rule
{
/**
* The minimum length of the password.
*/
protected int $length = 6;
/**
* Indicates if the password must contain one uppercase character.
*/
protected bool $requireUppercase = false;
/**
* Indicates if the password must contain one numeric digit.
*/
protected bool $requireNumeric = false;
/**
* Indicates if the password must contain one special character.
*/
protected bool $requireSpecialCharacter = false;
/**
* The message that should be used when validation fails.
*/
protected ?string $message = null;
/**
* Determine if the validation rule passes.
*
* @param mixed $value
*/
public function passes($attribute, $value): bool
{
$value = is_scalar($value) ? (string) $value : '';
if ($this->requireUppercase && Str::lower($value) === $value) {
return false;
}
if ($this->requireNumeric && ! preg_match('/\d/', $value)) {
return false;
}
if ($this->requireSpecialCharacter && ! preg_match('/[\W_]/', $value)) {
return false;
}
return Str::length($value) >= $this->length;
}
/**
* Get the validation error message.
*/
public function message(): string
{
if ($this->message) {
return $this->message;
}
return match (true) {
$this->requireUppercase
&& ! $this->requireNumeric
&& ! $this->requireSpecialCharacter => __(
'The :attribute must be at least :length characters and contain at least one uppercase character.',
[
'length' => $this->length,
],
),
$this->requireNumeric
&& ! $this->requireUppercase
&& ! $this->requireSpecialCharacter => __(
'The :attribute must be at least :length characters and contain at least one number.',
[
'length' => $this->length,
],
),
$this->requireSpecialCharacter
&& ! $this->requireUppercase
&& ! $this->requireNumeric => __(
'The :attribute must be at least :length characters and contain at least one special character.',
[
'length' => $this->length,
],
),
$this->requireUppercase
&& $this->requireNumeric
&& ! $this->requireSpecialCharacter => __(
'The :attribute must be at least :length characters and contain at least one uppercase character and one number.',
[
'length' => $this->length,
],
),
$this->requireUppercase
&& $this->requireSpecialCharacter
&& ! $this->requireNumeric => __(
'The :attribute must be at least :length characters and contain at least one uppercase character and one special character.',
[
'length' => $this->length,
],
),
$this->requireUppercase
&& $this->requireNumeric
&& $this->requireSpecialCharacter => __(
'The :attribute must be at least :length characters and contain at least one uppercase character, one number, and one special character.',
[
'length' => $this->length,
],
),
$this->requireNumeric
&& $this->requireSpecialCharacter
&& ! $this->requireUppercase => __(
'The :attribute must be at least :length characters and contain at least one special character and one number.',
[
'length' => $this->length,
],
),
default => __('The :attribute must be at least :length characters.', [
'length' => $this->length,
]),
};
}
/**
* Set the minimum length of the password.
*/
public function length(int $length)
{
$this->length = $length;
return $this;
}
/**
* Indicate that at least one uppercase character is required.
*/
public function requireUppercase(): static
{
$this->requireUppercase = true;
return $this;
}
/**
* Indicate that at least one numeric digit is required.
*/
public function requireNumeric(): static
{
$this->requireNumeric = true;
return $this;
}
/**
* Indicate that at least one special character is required.
*/
public function requireSpecialCharacter(): static
{
$this->requireSpecialCharacter = true;
return $this;
}
/**
* Set the message that should be used when the rule fails.
*/
public function withMessage(string $message): static
{
$this->message = $message;
return $this;
}
}
-19
View File
@@ -1,19 +0,0 @@
<?php
namespace App\Rules;
use Closure;
use Coderflex\LaravelTurnstile\Facades\LaravelTurnstile;
use Illuminate\Contracts\Validation\ValidationRule;
class TurnstileCheck implements ValidationRule
{
public function validate(string $attribute, mixed $value, Closure $fail): void
{
$response = LaravelTurnstile::validate($value);
if (! $response['success'] && setting('cloudflare_turnstile_enabled')) {
$fail(__(config('turnstile.error_messages.turnstile_check_message')));
}
}
}
@@ -1,17 +0,0 @@
<?php
namespace App\Rules;
use App\Models\Miscellaneous\WebsiteInstallation;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class ValidateInstallationKeyRule implements ValidationRule
{
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if ($value !== WebsiteInstallation::first()->installation_key) {
$fail('The :attribute does not match');
}
}
}
@@ -1,22 +0,0 @@
<?php
namespace App\Rules;
use App\Models\Miscellaneous\WebsiteWordfilter;
use Closure;
use Illuminate\Contracts\Validation\InvokableRule;
use Illuminate\Support\Str;
class WebsiteWordfilterRule implements InvokableRule
{
public function __invoke(string $attribute, mixed $value, Closure $fail)
{
$words = WebsiteWordfilter::get()
->pluck('word')
->toArray();
if (setting('website_wordfilter_enabled') === '1' && in_array(strtolower((string) $value), $words) || Str::contains(strtolower((string) $value), $words)) {
$fail(__('You entered something that is not allowed on :hotel', ['hotel' => setting('hotel_name')]));
}
}
}