Apply php-cs-fixer
This commit is contained in:
parent
c6959ebc81
commit
6ead313999
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -23,3 +23,4 @@ storage/oauth-public.key
|
|||
storage/oauth-private.key
|
||||
storage/install.lock
|
||||
.phpunit.result.cache
|
||||
.php_cs.cache
|
||||
|
|
|
|||
21
.php_cs.dist
Normal file
21
.php_cs.dist
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->in('app')
|
||||
->in('database')
|
||||
->in('routes')
|
||||
->in('tests')
|
||||
;
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRules([
|
||||
'@Symfony' => true,
|
||||
'align_multiline_comment' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'increment_style' => ['style' => 'post'],
|
||||
'list_syntax' => ['syntax' => 'short'],
|
||||
'yoda_style' => false,
|
||||
|
||||
])
|
||||
->setFinder($finder)
|
||||
;
|
||||
|
|
@ -21,7 +21,7 @@ class BsInstallCommand extends Command
|
|||
}
|
||||
|
||||
$this->call('migrate', ['--force' => true]);
|
||||
if (! $this->getLaravel()->runningUnitTests()) {
|
||||
if (!$this->getLaravel()->runningUnitTests()) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$this->call('key:generate');
|
||||
$this->call('jwt:secret', ['--no-interaction' => true]);
|
||||
|
|
@ -31,7 +31,7 @@ class BsInstallCommand extends Command
|
|||
|
||||
option(['site_url' => url('/')]);
|
||||
|
||||
$admin = new User;
|
||||
$admin = new User();
|
||||
$admin->email = $this->argument('email');
|
||||
$admin->nickname = $this->argument('nickname');
|
||||
$admin->score = option('user_initial_score');
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ class SaltRandomCommand extends Command
|
|||
/**
|
||||
* Set the application salt in the environment file.
|
||||
*
|
||||
* @param string $salt
|
||||
* @param string $salt
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setKeyInEnvironmentFile($salt)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ class CheckPlayerExists extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param string $playerName
|
||||
* @param string $playerName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($playerName)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ class ConfigureAdminMenu extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param array $menu
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array &$menu)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ class ConfigureExploreMenu extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param array $menu
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array &$menu)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class ConfigureRoutes extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Router $router)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ class ConfigureUserMenu extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param array $menu
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array &$menu)
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ class EncryptUserPassword extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param string $raw The raw password before encrypted.
|
||||
* @param User $user
|
||||
* @param string $raw the raw password before encrypted
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($raw, User $user)
|
||||
|
|
|
|||
|
|
@ -4,5 +4,4 @@ namespace App\Events;
|
|||
|
||||
abstract class Event
|
||||
{
|
||||
//
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ class GetAvatarPreview extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Texture $texture
|
||||
* @param int $size
|
||||
* @param int $size
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Texture $texture, $size)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ class GetPlayerJson extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Player $player
|
||||
* @param int $apiType
|
||||
* @param int $apiType
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Player $player, $apiType)
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ class GetSkinPreview extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Texture $texture
|
||||
* @param int $size
|
||||
* @param int $size
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Texture $texture, $size)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class HashingFile extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param UploadedFile $file
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(UploadedFile $file)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class PlayerProfileUpdated extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Player $player
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Player $player)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class PlayerWasAdded extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Player $player
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Player $player)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ class PlayerWasDeleted extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param string $playerName
|
||||
* @param string $playerName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($playerName)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ class PlayerWillBeAdded extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param string $playerName
|
||||
* @param string $playerName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($playerName)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class PlayerWillBeDeleted extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Player $player
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Player $player)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class PluginWasDeleted extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Plugin $plugin
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Plugin $plugin)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class PluginWasDisabled extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Plugin $plugin
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Plugin $plugin)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class PluginWasEnabled extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param Plugin $plugin
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Plugin $plugin)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ class RenderingFooter extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param array $contents
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array &$contents)
|
||||
|
|
@ -21,13 +20,14 @@ class RenderingFooter extends Event
|
|||
/**
|
||||
* Add content to page footer.
|
||||
*
|
||||
* @param string $content
|
||||
* @param string $content
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addContent($content)
|
||||
{
|
||||
if ($content) {
|
||||
if (! is_string($content)) {
|
||||
if (!is_string($content)) {
|
||||
throw new \Exception('Can not add non-string content', 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ class RenderingHeader extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param array $contents
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array &$contents)
|
||||
|
|
@ -21,13 +20,14 @@ class RenderingHeader extends Event
|
|||
/**
|
||||
* Add content to page footer.
|
||||
*
|
||||
* @param string $content
|
||||
* @param string $content
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addContent($content)
|
||||
{
|
||||
if ($content) {
|
||||
if (! is_string($content)) {
|
||||
if (!is_string($content)) {
|
||||
throw new \Exception('Can not add non-string content', 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class UserAuthenticated extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class UserLoggedIn extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ class UserProfileUpdated extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param string $type Which type of user profile was updated.
|
||||
* @param User $user
|
||||
* @param string $type which type of user profile was updated
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($type, User $user)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ class UserRegistered extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@ class UserTryToLogin extends Event
|
|||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param string $identification Email or username of the user.
|
||||
* @param string $authType "email" or "username".
|
||||
* @param string $identification email or username of the user
|
||||
* @param string $authType "email" or "username"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($identification, $authType)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ class Handler extends ExceptionHandler
|
|||
})
|
||||
->filter(function ($trace) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$isFromPlugins = ! app()->runningUnitTests() &&
|
||||
$isFromPlugins = !app()->runningUnitTests() &&
|
||||
Str::contains($trace['file'], resolve('plugins')->getPluginsDirs()->all());
|
||||
// @codeCoverageIgnoreEnd
|
||||
return Str::startsWith($trace['file'], 'app') || $isFromPlugins;
|
||||
|
|
|
|||
|
|
@ -2,23 +2,23 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Player;
|
||||
use App\Models\Texture;
|
||||
use App\Models\User;
|
||||
use App\Notifications;
|
||||
use App\Services\OptionForm;
|
||||
use App\Services\PluginManager;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Option;
|
||||
use Notification;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Models\Player;
|
||||
use App\Notifications;
|
||||
use App\Models\Texture;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Services\OptionForm;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\PluginManager;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use Illuminate\Support\Str;
|
||||
use Notification;
|
||||
use Option;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
|
|
@ -224,7 +224,7 @@ class AdminController extends Controller
|
|||
Option::set('sign_score', $sign_score);
|
||||
})->with([
|
||||
'sign_score_from' => @explode(',', option('sign_score'))[0],
|
||||
'sign_score_to' => @explode(',', option('sign_score'))[1],
|
||||
'sign_score_to' => @explode(',', option('sign_score'))[1],
|
||||
])->handle();
|
||||
|
||||
$sharing = Option::form('sharing', OptionForm::AUTO_DETECT, function ($form) {
|
||||
|
|
@ -527,7 +527,7 @@ class AdminController extends Controller
|
|||
$user = User::find($request->uid);
|
||||
$currentUser = Auth::user();
|
||||
|
||||
if (! $user) {
|
||||
if (!$user) {
|
||||
return json(trans('admin.users.operations.non-existent'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -549,7 +549,7 @@ class AdminController extends Controller
|
|||
|
||||
return json(trans('admin.users.operations.email.success'), 0);
|
||||
} elseif ($action == 'verification') {
|
||||
$user->verified = ! $user->verified;
|
||||
$user->verified = !$user->verified;
|
||||
$user->save();
|
||||
|
||||
return json(trans('admin.users.operations.verification.success'), 0);
|
||||
|
|
@ -606,7 +606,7 @@ class AdminController extends Controller
|
|||
$currentUser = Auth::user();
|
||||
$player = Player::find($request->input('pid'));
|
||||
|
||||
if (! $player) {
|
||||
if (!$player) {
|
||||
return json(trans('general.unexistent-player'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -621,10 +621,10 @@ class AdminController extends Controller
|
|||
if ($action == 'texture') {
|
||||
$this->validate($request, [
|
||||
'type' => 'required',
|
||||
'tid' => 'required|integer',
|
||||
'tid' => 'required|integer',
|
||||
]);
|
||||
|
||||
if (! Texture::find($request->tid) && $request->tid != 0) {
|
||||
if (!Texture::find($request->tid) && $request->tid != 0) {
|
||||
return json(trans('admin.players.textures.non-existent', ['tid' => $request->tid]), 1);
|
||||
}
|
||||
|
||||
|
|
@ -640,7 +640,7 @@ class AdminController extends Controller
|
|||
|
||||
$user = User::find($request->uid);
|
||||
|
||||
if (! $user) {
|
||||
if (!$user) {
|
||||
return json(trans('admin.users.operations.non-existent'), 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use URL;
|
||||
use Auth;
|
||||
use Mail;
|
||||
use View;
|
||||
use Cache;
|
||||
use Session;
|
||||
use App\Events;
|
||||
use App\Models\User;
|
||||
use App\Models\Player;
|
||||
use App\Rules\Captcha;
|
||||
use App\Mail\ForgotPassword;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use App\Mail\ForgotPassword;
|
||||
use App\Models\Player;
|
||||
use App\Models\User;
|
||||
use App\Rules\Captcha;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Session;
|
||||
use URL;
|
||||
use View;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
|
|
@ -33,7 +33,7 @@ class AuthController extends Controller
|
|||
{
|
||||
$this->validate($request, [
|
||||
'identification' => 'required',
|
||||
'password' => 'required|min:6|max:32',
|
||||
'password' => 'required|min:6|max:32',
|
||||
]);
|
||||
|
||||
$identification = $request->input('identification');
|
||||
|
|
@ -58,7 +58,7 @@ class AuthController extends Controller
|
|||
$this->validate($request, ['captcha' => ['required', $captcha]]);
|
||||
}
|
||||
|
||||
if (! $user) {
|
||||
if (!$user) {
|
||||
return json(trans('auth.validation.user'), 2);
|
||||
} else {
|
||||
if ($user->verifyPassword($request->input('password'))) {
|
||||
|
|
@ -113,7 +113,7 @@ class AuthController extends Controller
|
|||
|
||||
public function handleRegister(Request $request, Captcha $captcha)
|
||||
{
|
||||
if (! option('user_can_register')) {
|
||||
if (!option('user_can_register')) {
|
||||
return json(trans('auth.register.close'), 7);
|
||||
}
|
||||
|
||||
|
|
@ -121,9 +121,9 @@ class AuthController extends Controller
|
|||
['player_name' => 'required|player_name|min:'.option('player_name_length_min').'|max:'.option('player_name_length_max')] :
|
||||
['nickname' => 'required|no_special_chars|max:255'];
|
||||
$data = $this->validate($request, array_merge([
|
||||
'email' => 'required|email|unique:users',
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => 'required|min:8|max:32',
|
||||
'captcha' => ['required', $captcha],
|
||||
'captcha' => ['required', $captcha],
|
||||
], $rule));
|
||||
|
||||
if (option('register_with_player_name')) {
|
||||
|
|
@ -140,7 +140,7 @@ class AuthController extends Controller
|
|||
return json(trans('auth.register.max', ['regs' => option('regs_per_ip')]), 7);
|
||||
}
|
||||
|
||||
$user = new User;
|
||||
$user = new User();
|
||||
$user->email = $data['email'];
|
||||
$user->nickname = $data[option('register_with_player_name') ? 'player_name' : 'nickname'];
|
||||
$user->score = option('user_initial_score');
|
||||
|
|
@ -157,7 +157,7 @@ class AuthController extends Controller
|
|||
event(new Events\UserRegistered($user));
|
||||
|
||||
if (option('register_with_player_name')) {
|
||||
$player = new Player;
|
||||
$player = new Player();
|
||||
$player->uid = $user->uid;
|
||||
$player->name = $request->get('player_name');
|
||||
$player->tid_skin = 0;
|
||||
|
|
@ -191,7 +191,7 @@ class AuthController extends Controller
|
|||
'captcha' => ['required', $captcha],
|
||||
]);
|
||||
|
||||
if (! config('mail.driver')) {
|
||||
if (!config('mail.driver')) {
|
||||
return json(trans('auth.forgot.disabled'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -206,7 +206,7 @@ class AuthController extends Controller
|
|||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
|
||||
if (! $user) {
|
||||
if (!$user) {
|
||||
return json(trans('auth.forgot.unregistered'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -264,13 +264,13 @@ class AuthController extends Controller
|
|||
|
||||
public function verify($uid)
|
||||
{
|
||||
if (! option('require_verification')) {
|
||||
if (!option('require_verification')) {
|
||||
throw new PrettyPageException(trans('user.verification.disabled'), 1);
|
||||
}
|
||||
|
||||
$user = User::find($uid);
|
||||
|
||||
if (! $user || $user->verified) {
|
||||
if (!$user || $user->verified) {
|
||||
throw new PrettyPageException(trans('auth.verify.invalid'), 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use App\Models\User;
|
||||
use App\Models\Texture;
|
||||
use App\Models\User;
|
||||
use Auth;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ClosetController extends Controller
|
||||
|
|
@ -13,7 +13,7 @@ class ClosetController extends Controller
|
|||
{
|
||||
return view('user.closet')
|
||||
->with('extra', [
|
||||
'unverified' => option('require_verification') && ! auth()->user()->verified,
|
||||
'unverified' => option('require_verification') && !auth()->user()->verified,
|
||||
'rule' => trans('user.player.player-name-rule.'.option('player_name_rule')),
|
||||
'length' => trans(
|
||||
'user.player.player-name-length',
|
||||
|
|
@ -66,7 +66,7 @@ class ClosetController extends Controller
|
|||
public function add(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'tid' => 'required|integer',
|
||||
'tid' => 'required|integer',
|
||||
'name' => 'required|no_special_chars',
|
||||
]);
|
||||
|
||||
|
|
@ -78,11 +78,11 @@ class ClosetController extends Controller
|
|||
|
||||
$tid = $request->tid;
|
||||
$texture = Texture::find($tid);
|
||||
if (! $texture) {
|
||||
if (!$texture) {
|
||||
return json(trans('user.closet.add.not-found'), 1);
|
||||
}
|
||||
|
||||
if (! $texture->public && $texture->uploader != $user->uid) {
|
||||
if (!$texture->public && $texture->uploader != $user->uid) {
|
||||
return json(trans('skinlib.show.private'), 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use DispatchesJobs, ValidatesRequests;
|
||||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Exception;
|
||||
use App\Services\PackageManager;
|
||||
use App\Services\Plugin;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\PluginManager;
|
||||
use Composer\Semver\Comparator;
|
||||
use App\Services\PackageManager;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class MarketController extends Controller
|
||||
{
|
||||
|
|
@ -78,7 +78,7 @@ class MarketController extends Controller
|
|||
$name = $request->get('name');
|
||||
$metadata = $this->getPluginMetadata($name);
|
||||
|
||||
if (! $metadata) {
|
||||
if (!$metadata) {
|
||||
return json(trans('admin.plugins.market.non-existent', ['plugin' => $name]), 1);
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ class MarketController extends Controller
|
|||
$unsatisfied = $manager->getUnsatisfied($fakePlugin);
|
||||
$conflicts = $manager->getConflicts($fakePlugin);
|
||||
if ($unsatisfied->isNotEmpty() || $conflicts->isNotEmpty()) {
|
||||
$reason = $manager->formatUnresolved($unsatisfied, $conflicts);
|
||||
$reason = $manager->formatUnresolved($unsatisfied, $conflicts);
|
||||
|
||||
return json(trans('admin.plugins.market.unresolved'), 1, compact('reason'));
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ class MarketController extends Controller
|
|||
protected function getAllAvailablePlugins()
|
||||
{
|
||||
$registryVersion = 1;
|
||||
if (app()->runningUnitTests() || ! $this->registryCache) {
|
||||
if (app()->runningUnitTests() || !$this->registryCache) {
|
||||
$registries = collect(explode(',', config('plugins.registry')));
|
||||
$this->registryCache = $registries->map(function ($registry) use ($registryVersion) {
|
||||
try {
|
||||
|
|
@ -123,9 +123,7 @@ class MarketController extends Controller
|
|||
['verify' => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()]
|
||||
)->getBody();
|
||||
} catch (Exception $e) {
|
||||
throw new Exception(trans('admin.plugins.market.connection-error', [
|
||||
'error' => htmlentities($e->getMessage()),
|
||||
]));
|
||||
throw new Exception(trans('admin.plugins.market.connection-error', ['error' => htmlentities($e->getMessage())]));
|
||||
}
|
||||
|
||||
$registryData = json_decode($pluginsJson, true);
|
||||
|
|
|
|||
|
|
@ -2,24 +2,23 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use View;
|
||||
use Event;
|
||||
use Option;
|
||||
use App\Models\User;
|
||||
use App\Models\Player;
|
||||
use App\Models\Texture;
|
||||
use App\Services\Filter;
|
||||
use App\Services\Rejection;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Events\CheckPlayerExists;
|
||||
use App\Events\PlayerWasAdded;
|
||||
use App\Events\PlayerWasDeleted;
|
||||
use App\Events\CheckPlayerExists;
|
||||
use App\Events\PlayerWillBeAdded;
|
||||
use App\Events\PlayerWillBeDeleted;
|
||||
use App\Http\Middleware\CheckPlayerExist;
|
||||
use App\Http\Middleware\CheckPlayerOwner;
|
||||
use App\Models\Player;
|
||||
use App\Models\Texture;
|
||||
use App\Services\Filter;
|
||||
use App\Services\Rejection;
|
||||
use Auth;
|
||||
use Event;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Http\Request;
|
||||
use Option;
|
||||
use View;
|
||||
|
||||
class PlayerController extends Controller
|
||||
{
|
||||
|
|
@ -69,7 +68,7 @@ class PlayerController extends Controller
|
|||
|
||||
event(new CheckPlayerExists($name));
|
||||
|
||||
if (! Player::where('name', $name)->get()->isEmpty()) {
|
||||
if (!Player::where('name', $name)->get()->isEmpty()) {
|
||||
return json(trans('user.player.add.repeated'), 6);
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +78,7 @@ class PlayerController extends Controller
|
|||
|
||||
event(new PlayerWillBeAdded($name));
|
||||
|
||||
$player = new Player;
|
||||
$player = new Player();
|
||||
|
||||
$player->uid = $user->uid;
|
||||
$player->name = $name;
|
||||
|
|
@ -137,7 +136,7 @@ class PlayerController extends Controller
|
|||
return json($can->getReason(), 1);
|
||||
}
|
||||
|
||||
if (! Player::where('name', $newName)->get()->isEmpty()) {
|
||||
if (!Player::where('name', $newName)->get()->isEmpty()) {
|
||||
return json(trans('user.player.rename.repeated'), 6);
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +161,7 @@ class PlayerController extends Controller
|
|||
foreach (['skin', 'cape'] as $type) {
|
||||
if ($tid = $request->input($type)) {
|
||||
$texture = Texture::find($tid);
|
||||
if (! $texture) {
|
||||
if (!$texture) {
|
||||
return json(trans('skinlib.non-existent'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -201,10 +200,10 @@ class PlayerController extends Controller
|
|||
|
||||
event(new CheckPlayerExists($name));
|
||||
$player = Player::where('name', $name)->first();
|
||||
if (! $player) {
|
||||
if (!$player) {
|
||||
event(new PlayerWillBeAdded($name));
|
||||
|
||||
$player = new Player;
|
||||
$player = new Player();
|
||||
$player->uid = $user->uid;
|
||||
$player->name = $name;
|
||||
$player->tid_skin = 0;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\Plugin;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\PluginManager;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PluginController extends Controller
|
||||
{
|
||||
|
|
@ -59,11 +59,12 @@ class PluginController extends Controller
|
|||
if ($result === true) {
|
||||
return json(trans('admin.plugins.operations.enabled', ['plugin' => $plugin->title]), 0);
|
||||
} else {
|
||||
$reason = $plugins->formatUnresolved($result['unsatisfied'], $result['conflicts']);
|
||||
$reason = $plugins->formatUnresolved($result['unsatisfied'], $result['conflicts']);
|
||||
|
||||
return json(trans('admin.plugins.operations.unsatisfied.notice'), 1, compact('reason'));
|
||||
}
|
||||
|
||||
// no break
|
||||
case 'disable':
|
||||
$plugins->disable($name);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Report;
|
||||
use App\Models\Texture;
|
||||
use App\Models\User;
|
||||
use App\Services\Filter;
|
||||
use App\Services\Rejection;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
|
|
@ -39,7 +39,7 @@ class ReportController extends Controller
|
|||
$reporter->score += $score;
|
||||
$reporter->save();
|
||||
|
||||
$report = new Report;
|
||||
$report = new Report();
|
||||
$report->tid = $data['tid'];
|
||||
$report->uploader = Texture::find($data['tid'])->uploader;
|
||||
$report->reporter = $reporter->uid;
|
||||
|
|
@ -141,7 +141,7 @@ class ReportController extends Controller
|
|||
break;
|
||||
case 'ban':
|
||||
$uploader = User::find($report->uploader);
|
||||
if (! $uploader) {
|
||||
if (!$uploader) {
|
||||
return json(trans('admin.users.operations.non-existent'), 1);
|
||||
}
|
||||
if (auth()->user()->permission <= $uploader->permission) {
|
||||
|
|
|
|||
|
|
@ -2,21 +2,20 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Composer\Semver\Comparator;
|
||||
use Illuminate\Database\Connection;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use Illuminate\Database\DatabaseManager;
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Console\Kernel as Artisan;
|
||||
use Illuminate\Database\Connection;
|
||||
use Illuminate\Database\DatabaseManager;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SetupController extends Controller
|
||||
{
|
||||
public function welcome(Filesystem $filesystem)
|
||||
{
|
||||
if (! $filesystem->exists(base_path('.env'))) {
|
||||
if (!$filesystem->exists(base_path('.env'))) {
|
||||
$filesystem->copy(base_path('.env.example'), base_path('.env'));
|
||||
}
|
||||
|
||||
|
|
@ -62,10 +61,7 @@ class SetupController extends Controller
|
|||
$msg = iconv('gbk', 'utf-8', $e->getMessage());
|
||||
$type = humanize_db_type($request->input('type'));
|
||||
|
||||
throw new PrettyPageException(
|
||||
trans('setup.database.connection-error', compact('msg', 'type')),
|
||||
$e->getCode()
|
||||
);
|
||||
throw new PrettyPageException(trans('setup.database.connection-error', compact('msg', 'type')), $e->getCode());
|
||||
}
|
||||
|
||||
$content = $filesystem->get(base_path('.env'));
|
||||
|
|
@ -112,9 +108,9 @@ class SetupController extends Controller
|
|||
public function finish(Request $request, Filesystem $filesystem, Artisan $artisan)
|
||||
{
|
||||
$data = $this->validate($request, [
|
||||
'email' => 'required|email',
|
||||
'nickname' => 'required|no_special_chars|max:255',
|
||||
'password' => 'required|min:8|max:32|confirmed',
|
||||
'email' => 'required|email',
|
||||
'nickname' => 'required|no_special_chars|max:255',
|
||||
'password' => 'required|min:8|max:32|confirmed',
|
||||
'site_name' => 'required',
|
||||
]);
|
||||
|
||||
|
|
@ -144,7 +140,7 @@ class SetupController extends Controller
|
|||
]);
|
||||
|
||||
// Register super admin
|
||||
$user = new User;
|
||||
$user = new User();
|
||||
$user->email = $data['email'];
|
||||
$user->nickname = $data['nickname'];
|
||||
$user->score = option('user_initial_score');
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Player;
|
||||
use App\Models\Texture;
|
||||
use App\Models\User;
|
||||
use App\Services\Filter;
|
||||
use Auth;
|
||||
use View;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Option;
|
||||
use Session;
|
||||
use Storage;
|
||||
use App\Models\User;
|
||||
use App\Models\Player;
|
||||
use App\Models\Texture;
|
||||
use App\Services\Filter;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use View;
|
||||
|
||||
class SkinlibController extends Controller
|
||||
{
|
||||
|
|
@ -20,6 +20,7 @@ class SkinlibController extends Controller
|
|||
* Map error code of file uploading to human-readable text.
|
||||
*
|
||||
* @see http://php.net/manual/en/features.file-upload.errors.php
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $phpFileUploadErrors = [
|
||||
|
|
@ -37,7 +38,8 @@ class SkinlibController extends Controller
|
|||
* Get skin library data filtered.
|
||||
* Available Query String: filter, uploader, page, sort, keyword, items_per_page.
|
||||
*
|
||||
* @param Request $request [description]
|
||||
* @param Request $request [description]
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getSkinlibFiltered(Request $request)
|
||||
|
|
@ -78,12 +80,12 @@ class SkinlibController extends Controller
|
|||
$query = $query->where('uploader', $uploader);
|
||||
}
|
||||
|
||||
if (! $user) {
|
||||
if (!$user) {
|
||||
// Show public textures only to anonymous visitors
|
||||
$query = $query->where('public', true);
|
||||
} else {
|
||||
// Show private textures when show uploaded textures of current user
|
||||
if ($uploader != $user->uid && ! $user->isAdmin()) {
|
||||
if ($uploader != $user->uid && !$user->isAdmin()) {
|
||||
$query = $query->where(function ($innerQuery) use ($user) {
|
||||
$innerQuery->where('public', true)->orWhere('uploader', '=', $user->uid);
|
||||
});
|
||||
|
|
@ -117,7 +119,7 @@ class SkinlibController extends Controller
|
|||
$texture = Texture::find($tid);
|
||||
$user = Auth::user();
|
||||
|
||||
if (! $texture || $texture && ! Storage::disk('textures')->has($texture->hash)) {
|
||||
if (!$texture || $texture && !Storage::disk('textures')->has($texture->hash)) {
|
||||
if (option('auto_del_invalid_texture')) {
|
||||
if ($texture) {
|
||||
$texture->delete();
|
||||
|
|
@ -128,8 +130,8 @@ class SkinlibController extends Controller
|
|||
abort(404, trans('skinlib.show.deleted').trans('skinlib.show.contact-admin'));
|
||||
}
|
||||
|
||||
if (! $texture->public) {
|
||||
if (! Auth::check() || ($user->uid != $texture->uploader && ! $user->isAdmin())) {
|
||||
if (!$texture->public) {
|
||||
if (!Auth::check() || ($user->uid != $texture->uploader && !$user->isAdmin())) {
|
||||
abort(option('status_code_for_private'), trans('skinlib.show.private'));
|
||||
}
|
||||
}
|
||||
|
|
@ -226,7 +228,7 @@ class SkinlibController extends Controller
|
|||
|
||||
$results = Texture::where('hash', $t->hash)->get();
|
||||
|
||||
if (! $results->isEmpty()) {
|
||||
if (!$results->isEmpty()) {
|
||||
foreach ($results as $result) {
|
||||
// if the texture already uploaded was set to private,
|
||||
// then allow to re-upload it.
|
||||
|
|
@ -259,11 +261,11 @@ class SkinlibController extends Controller
|
|||
$texture = Texture::find($request->tid);
|
||||
$user = Auth::user();
|
||||
|
||||
if (! $texture) {
|
||||
if (!$texture) {
|
||||
return json(trans('skinlib.non-existent'), 1);
|
||||
}
|
||||
|
||||
if ($texture->uploader != $user->uid && ! $user->isAdmin()) {
|
||||
if ($texture->uploader != $user->uid && !$user->isAdmin()) {
|
||||
return json(trans('skinlib.no-permission'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -282,11 +284,11 @@ class SkinlibController extends Controller
|
|||
$t = Texture::find($request->input('tid'));
|
||||
$user = $request->user();
|
||||
|
||||
if (! $t) {
|
||||
if (!$t) {
|
||||
return json(trans('skinlib.non-existent'), 1);
|
||||
}
|
||||
|
||||
if ($t->uploader != $user->uid && ! $user->isAdmin()) {
|
||||
if ($t->uploader != $user->uid && !$user->isAdmin()) {
|
||||
return json(trans('skinlib.no-permission'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -316,11 +318,11 @@ class SkinlibController extends Controller
|
|||
$uploader->score += $score_diff;
|
||||
$uploader->save();
|
||||
|
||||
$t->public = ! $t->public;
|
||||
$t->public = !$t->public;
|
||||
$t->save();
|
||||
|
||||
return json(
|
||||
trans('skinlib.privacy.success', ['privacy' => (! $t->public ? trans('general.private') : trans('general.public'))]),
|
||||
trans('skinlib.privacy.success', ['privacy' => (!$t->public ? trans('general.private') : trans('general.public'))]),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
|
@ -328,17 +330,17 @@ class SkinlibController extends Controller
|
|||
public function rename(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'tid' => 'required|integer',
|
||||
'tid' => 'required|integer',
|
||||
'new_name' => 'required|no_special_chars',
|
||||
]);
|
||||
$user = $request->user();
|
||||
$t = Texture::find($request->input('tid'));
|
||||
|
||||
if (! $t) {
|
||||
if (!$t) {
|
||||
return json(trans('skinlib.non-existent'), 1);
|
||||
}
|
||||
|
||||
if ($t->uploader != $user->uid && ! $user->isAdmin()) {
|
||||
if ($t->uploader != $user->uid && !$user->isAdmin()) {
|
||||
return json(trans('skinlib.no-permission'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -355,17 +357,17 @@ class SkinlibController extends Controller
|
|||
{
|
||||
$user = $request->user();
|
||||
$data = $this->validate($request, [
|
||||
'tid' => 'required|integer',
|
||||
'model' => 'required|in:steve,alex,cape',
|
||||
'tid' => 'required|integer',
|
||||
'model' => 'required|in:steve,alex,cape',
|
||||
]);
|
||||
|
||||
$t = Texture::find($request->input('tid'));
|
||||
|
||||
if (! $t) {
|
||||
if (!$t) {
|
||||
return json(trans('skinlib.non-existent'), 1);
|
||||
}
|
||||
|
||||
if ($t->uploader != $user->uid && ! $user->isAdmin()) {
|
||||
if ($t->uploader != $user->uid && !$user->isAdmin()) {
|
||||
return json(trans('skinlib.no-permission'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -383,12 +385,6 @@ class SkinlibController extends Controller
|
|||
return json(trans('skinlib.model.success', ['model' => $data['model']]), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Uploaded Files.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
protected function checkUpload(Request $request)
|
||||
{
|
||||
if ($file = $request->files->get('file')) {
|
||||
|
|
@ -398,11 +394,11 @@ class SkinlibController extends Controller
|
|||
}
|
||||
|
||||
$this->validate($request, [
|
||||
'name' => [
|
||||
'name' => [
|
||||
'required',
|
||||
option('texture_name_regexp') ? 'regex:'.option('texture_name_regexp') : 'no_special_chars',
|
||||
],
|
||||
'file' => 'required|max:'.option('max_upload_file_size'),
|
||||
'file' => 'required|max:'.option('max_upload_file_size'),
|
||||
'public' => 'required',
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Event;
|
||||
use Option;
|
||||
use Storage;
|
||||
use Response;
|
||||
use Exception;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Events\GetAvatarPreview;
|
||||
use App\Events\GetSkinPreview;
|
||||
use App\Models\Player;
|
||||
use App\Models\Texture;
|
||||
use App\Models\User;
|
||||
use App\Services\Minecraft;
|
||||
use Carbon\Carbon;
|
||||
use Event;
|
||||
use Exception;
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Events\GetSkinPreview;
|
||||
use App\Events\GetAvatarPreview;
|
||||
use Option;
|
||||
use Response;
|
||||
use Storage;
|
||||
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
|
||||
|
||||
class TextureController extends Controller
|
||||
|
|
@ -77,8 +77,9 @@ class TextureController extends Controller
|
|||
/**
|
||||
* Get the texture image of given type and player.
|
||||
*
|
||||
* @param string $player_name
|
||||
* @param string $type "steve" or "alex" or "cape".
|
||||
* @param string $player_name
|
||||
* @param string $type "steve" or "alex" or "cape"
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
protected function getBinaryTextureFromPlayer($player_name, $type)
|
||||
|
|
@ -88,7 +89,7 @@ class TextureController extends Controller
|
|||
if ($hash = $player->getTexture($type)) {
|
||||
return $this->texture(
|
||||
$hash,
|
||||
['Last-Modified' => $player->last_modified],
|
||||
['Last-Modified' => $player->last_modified],
|
||||
trans('general.texture-deleted')
|
||||
);
|
||||
} else {
|
||||
|
|
@ -242,6 +243,7 @@ class TextureController extends Controller
|
|||
* Default steve skin, base64 encoded.
|
||||
*
|
||||
* @see https://minecraft.gamepedia.com/File:Steve_skin.png
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDefaultSteveSkin()
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Foundation\Application;
|
||||
use App\Services\Translations\JavaScript;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\TranslationLoader\LanguageLine;
|
||||
|
||||
class TranslationsController extends Controller
|
||||
|
|
@ -13,6 +13,7 @@ class TranslationsController extends Controller
|
|||
{
|
||||
return LanguageLine::all()->map(function ($line) use ($app) {
|
||||
$line->text = $line->getTranslation($app->getLocale());
|
||||
|
||||
return $line;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use Composer\Semver\Comparator;
|
||||
use App\Services\PackageManager;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
use Composer\Semver\Comparator;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Console\Kernel as Artisan;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
|
||||
class UpdateController extends Controller
|
||||
{
|
||||
|
|
@ -29,7 +29,7 @@ class UpdateController extends Controller
|
|||
public function showUpdatePage()
|
||||
{
|
||||
$info = [
|
||||
'latest' => Arr::get($this->getUpdateInfo(), 'latest'),
|
||||
'latest' => Arr::get($this->getUpdateInfo(), 'latest'),
|
||||
'current' => $this->currentVersion,
|
||||
];
|
||||
$error = $this->error;
|
||||
|
|
@ -45,7 +45,7 @@ class UpdateController extends Controller
|
|||
|
||||
public function download(Request $request, PackageManager $package, Filesystem $filesystem)
|
||||
{
|
||||
if (! $this->canUpdate()) {
|
||||
if (!$this->canUpdate()) {
|
||||
return json([]);
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ class UpdateController extends Controller
|
|||
protected function getUpdateInfo()
|
||||
{
|
||||
$acceptableSpec = 2;
|
||||
if (app()->runningUnitTests() || ! $this->info) {
|
||||
if (app()->runningUnitTests() || !$this->info) {
|
||||
try {
|
||||
$json = $this->guzzle->request(
|
||||
'GET',
|
||||
|
|
|
|||
|
|
@ -3,27 +3,27 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App;
|
||||
use URL;
|
||||
use Auth;
|
||||
use Mail;
|
||||
use View;
|
||||
use Session;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Events\UserProfileUpdated;
|
||||
use App\Mail\EmailVerification;
|
||||
use App\Models\Texture;
|
||||
use App\Models\User;
|
||||
use App\Services\Filter;
|
||||
use App\Services\Rejection;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Mail\EmailVerification;
|
||||
use App\Events\UserProfileUpdated;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Session;
|
||||
use URL;
|
||||
use View;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(function ($request, $next) {
|
||||
if (! Auth::user()->verified) {
|
||||
if (!Auth::user()->verified) {
|
||||
$this->sendVerificationEmail();
|
||||
}
|
||||
|
||||
|
|
@ -43,9 +43,9 @@ class UserController extends Controller
|
|||
[$from, $to] = explode(',', option('sign_score'));
|
||||
$scoreIntro = trans('user.score-intro.introduction', [
|
||||
'initial_score' => option('user_initial_score'),
|
||||
'score-from' => $from,
|
||||
'score-to' => $to,
|
||||
'return-score' => option('return_score')
|
||||
'score-from' => $from,
|
||||
'score-to' => $to,
|
||||
'return-score' => option('return_score')
|
||||
? trans('user.score-intro.will-return-score')
|
||||
: trans('user.score-intro.no-return-score'),
|
||||
]);
|
||||
|
|
@ -58,7 +58,7 @@ class UserController extends Controller
|
|||
[
|
||||
['user.widgets.dashboard.usage'],
|
||||
['user.widgets.dashboard.announcement'],
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
$grid = $filter->apply('grid:user.index', $grid);
|
||||
|
|
@ -76,7 +76,7 @@ class UserController extends Controller
|
|||
],
|
||||
'announcement' => app('parsedown')->text(option_localized('announcement')),
|
||||
'grid' => $grid,
|
||||
'extra' => ['unverified' => option('require_verification') && ! $user->verified],
|
||||
'extra' => ['unverified' => option('require_verification') && !$user->verified],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ class UserController extends Controller
|
|||
|
||||
public function sendVerificationEmail()
|
||||
{
|
||||
if (! option('require_verification')) {
|
||||
if (!option('require_verification')) {
|
||||
return json(trans('user.verification.disabled'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ class UserController extends Controller
|
|||
[
|
||||
[
|
||||
'user.widgets.profile.avatar',
|
||||
'user.widgets.profile.password'
|
||||
'user.widgets.profile.password',
|
||||
],
|
||||
[
|
||||
'user.widgets.profile.nickname',
|
||||
|
|
@ -267,10 +267,10 @@ class UserController extends Controller
|
|||
case 'password':
|
||||
$this->validate($request, [
|
||||
'current_password' => 'required|min:6|max:32',
|
||||
'new_password' => 'required|min:8|max:32',
|
||||
'new_password' => 'required|min:8|max:32',
|
||||
]);
|
||||
|
||||
if (! $user->verifyPassword($request->input('current_password'))) {
|
||||
if (!$user->verifyPassword($request->input('current_password'))) {
|
||||
return json(trans('user.profile.password.wrong-password'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -288,14 +288,14 @@ class UserController extends Controller
|
|||
case 'email':
|
||||
$this->validate($request, [
|
||||
'new_email' => 'required|email',
|
||||
'password' => 'required|min:6|max:32',
|
||||
'password' => 'required|min:6|max:32',
|
||||
]);
|
||||
|
||||
if (User::where('email', $request->new_email)->count() > 0) {
|
||||
return json(trans('user.profile.email.existed'), 1);
|
||||
}
|
||||
|
||||
if (! $user->verifyPassword($request->input('password'))) {
|
||||
if (!$user->verifyPassword($request->input('password'))) {
|
||||
return json(trans('user.profile.email.wrong-password'), 1);
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ class UserController extends Controller
|
|||
return json(trans('user.profile.delete.admin'), 1);
|
||||
}
|
||||
|
||||
if (! $user->verifyPassword($request->input('password'))) {
|
||||
if (!$user->verifyPassword($request->input('password'))) {
|
||||
return json(trans('user.profile.delete.wrong-password'), 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,15 +56,15 @@ class Kernel extends HttpKernel
|
|||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'verified' => \App\Http\Middleware\CheckUserVerified::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'admin' => \App\Http\Middleware\CheckAdministrator::class,
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
'verified' => \App\Http\Middleware\CheckUserVerified::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'admin' => \App\Http\Middleware\CheckAdministrator::class,
|
||||
'super-admin' => \App\Http\Middleware\CheckSuperAdmin::class,
|
||||
'player' => \App\Http\Middleware\CheckPlayerExist::class,
|
||||
'setup' => \App\Http\Middleware\CheckInstallation::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'player' => \App\Http\Middleware\CheckPlayerExist::class,
|
||||
'setup' => \App\Http\Middleware\CheckInstallation::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class Authenticate extends Middleware
|
|||
{
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
if (!$request->expectsJson()) {
|
||||
session([
|
||||
'last_requested_path' => $request->fullUrl(),
|
||||
'msg' => trans('auth.check.anonymous'),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class CheckInstallation
|
|||
public function handle($request, \Closure $next)
|
||||
{
|
||||
$hasLock = resolve(Filesystem::class)->exists(storage_path('install.lock'));
|
||||
if ($hasLock && ! $request->is('setup/*update')) {
|
||||
if ($hasLock && !$request->is('setup/*update')) {
|
||||
return response()->view('setup.locked');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Event;
|
||||
use App\Models\Player;
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Events\CheckPlayerExists;
|
||||
use App\Models\Player;
|
||||
use Event;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class CheckPlayerExist
|
||||
{
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
$pid = Arr::get($request->route()->parameters, 'pid') ?? $request->input('pid');
|
||||
if (! $request->isMethod('get') && ! is_null($pid)) {
|
||||
if (!$request->isMethod('get') && !is_null($pid)) {
|
||||
if (is_null(Player::find($pid))) {
|
||||
return json(trans('general.unexistent-player'), 1);
|
||||
} else {
|
||||
|
|
@ -40,7 +40,7 @@ class CheckPlayerExist
|
|||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
if (! Player::where('name', $player_name)->get()->isEmpty()) {
|
||||
if (!Player::where('name', $player_name)->get()->isEmpty()) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use App\Models\Player;
|
||||
use Closure;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class CheckPlayerOwner
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
|
||||
class CheckSuperAdmin
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class CheckUserVerified
|
|||
{
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
abort_if(option('require_verification') && ! auth()->user()->verified, 403, trans('auth.check.verified'));
|
||||
abort_if(option('require_verification') && !auth()->user()->verified, 403, trans('auth.check.verified'));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class DetectLanguagePrefer
|
|||
$locale = $alias;
|
||||
}
|
||||
$locale ?? app()->getLocale();
|
||||
if (! Arr::has(config('locales'), $locale)) {
|
||||
if (!Arr::has(config('locales'), $locale)) {
|
||||
$locale = config('app.fallback_locale');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class EnsureEmailFilled
|
|||
{
|
||||
if ($request->user()->email != '' && $request->is('auth/bind')) {
|
||||
return redirect('/user');
|
||||
} elseif ($request->user()->email == '' && ! $request->is('auth/bind')) {
|
||||
} elseif ($request->user()->email == '' && !$request->is('auth/bind')) {
|
||||
return redirect('/auth/bind');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use Closure;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Exceptions\PrettyPageException;
|
||||
|
||||
class ForbiddenIE
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ class RedirectToSetup
|
|||
|
||||
// If lock isn't existed, it means that BS isn't installed.
|
||||
// Database is unavailable at this time, so we should disable the loader.
|
||||
if (! $hasLock) {
|
||||
if (!$hasLock) {
|
||||
config(['translation-loader.translation_loaders' => []]);
|
||||
}
|
||||
|
||||
if ($hasLock && ! $request->is('setup*') && Comparator::greaterThan($version, option('version', $version))) {
|
||||
if ($hasLock && !$request->is('setup*') && Comparator::greaterThan($version, option('version', $version))) {
|
||||
$user = $request->user();
|
||||
if ($user && $user->isAdmin()) {
|
||||
return redirect('/setup/update');
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
|
||||
class RejectBannedUser
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class RequireBindPlayer
|
|||
{
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (! option('single_player', false)) {
|
||||
if (!option('single_player', false)) {
|
||||
if ($request->is('user/player/bind')) {
|
||||
return redirect('/user');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
namespace App\Http\View\Composers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\Translations\JavaScript;
|
||||
use App\Services\Webpack;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Services\Translations\JavaScript;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class FootComposer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Http\View\Composers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use App\Services\Webpack;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class HeadComposer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Http\View\Composers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class LanguagesMenuComposer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
namespace App\Http\View\Composers;
|
||||
|
||||
use App\Events;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\PluginManager;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class SideMenuComposer
|
||||
{
|
||||
|
|
@ -80,8 +80,8 @@ class SideMenuComposer
|
|||
->map(function ($plugin) {
|
||||
return [
|
||||
'title' => trans($plugin->title),
|
||||
'link' => 'admin/plugins/config/'.$plugin->name,
|
||||
'icon' => 'fa-circle',
|
||||
'link' => 'admin/plugins/config/'.$plugin->name,
|
||||
'icon' => 'fa-circle',
|
||||
];
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Http\View\Composers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class UserMenuComposer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
namespace App\Http\View\Composers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class UserPanelComposer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Services\Minecraft;
|
||||
use Cache;
|
||||
use Storage;
|
||||
use App\Services\Minecraft;
|
||||
|
||||
class CacheAvatarPreview
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Listeners;
|
||||
|
||||
use Cache;
|
||||
use App\Events;
|
||||
use App\Models\Player;
|
||||
use Cache;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
||||
class CachePlayerExists
|
||||
|
|
@ -22,7 +22,7 @@ class CachePlayerExists
|
|||
if ($event->playerName && is_null(Cache::get($key))) {
|
||||
$player = Player::where('name', $event->playerName)->first();
|
||||
|
||||
if (! $player) {
|
||||
if (!$player) {
|
||||
Cache::forever($key, '1');
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Listeners;
|
||||
|
||||
use Cache;
|
||||
use App\Events;
|
||||
use App\Models\Player;
|
||||
use Cache;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class CachePlayerJson
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Services\Minecraft;
|
||||
use Cache;
|
||||
use Storage;
|
||||
use App\Services\Minecraft;
|
||||
|
||||
class CacheSkinPreview
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class ResetInvalidTextureForPlayer
|
|||
|
||||
foreach (['skin', 'cape'] as $type) {
|
||||
$field = "tid_$type";
|
||||
if (! \App\Models\Texture::find($player->$field)) {
|
||||
if (!\App\Models\Texture::find($player->$field)) {
|
||||
$player->$field = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ use Illuminate\Queue\SerializesModels;
|
|||
|
||||
class EmailVerification extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
public $url;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ use Illuminate\Queue\SerializesModels;
|
|||
|
||||
class ForgotPassword extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
|
@ -18,7 +19,6 @@ class ForgotPassword extends Mailable
|
|||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @param string $url
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $url)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Models\Concerns;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Events\EncryptUserPassword;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
trait HasPassword
|
||||
{
|
||||
|
|
@ -20,7 +20,8 @@ trait HasPassword
|
|||
/**
|
||||
* Try to get encrypted password from event dispatcher.
|
||||
*
|
||||
* @param string $raw
|
||||
* @param string $raw
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEncryptedPwdFromEvent($raw)
|
||||
|
|
@ -33,7 +34,8 @@ trait HasPassword
|
|||
/**
|
||||
* Change password of the user.
|
||||
*
|
||||
* @param string $password New password that will be set.
|
||||
* @param string $password new password that will be set
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function changePassword($password)
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Event;
|
||||
use Illuminate\Support\Arr;
|
||||
use App\Events\GetPlayerJson;
|
||||
use App\Events\PlayerProfileUpdated;
|
||||
use Event;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class Player extends Model
|
||||
{
|
||||
|
|
@ -46,8 +46,9 @@ class Player extends Model
|
|||
/**
|
||||
* Get specific texture of player.
|
||||
*
|
||||
* @param string $type "skin" or "cape".
|
||||
* @return string The sha256 hash of texture file.
|
||||
* @param string $type "skin" or "cape"
|
||||
*
|
||||
* @return string the sha256 hash of texture file
|
||||
*/
|
||||
public function getTexture($type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use App\Models\Concerns\HasPassword;
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
|
||||
class User extends Authenticatable implements JWTSubject
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
|||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class SiteMessage extends Notification implements ShouldQueue
|
||||
{
|
||||
|
|
@ -30,7 +30,8 @@ class SiteMessage extends Notification implements ShouldQueue
|
|||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
|
|
@ -41,7 +42,8 @@ class SiteMessage extends Notification implements ShouldQueue
|
|||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
|
|
|
|||
|
|
@ -2,13 +2,10 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Blade;
|
||||
use Event;
|
||||
use App\Events;
|
||||
use App\Models\User;
|
||||
use ReflectionException;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use Event;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
|
|
@ -61,13 +58,12 @@ class AppServiceProvider extends ServiceProvider
|
|||
try {
|
||||
if (option('enable_redis') && Redis::ping()) {
|
||||
config([
|
||||
'cache.default' => 'redis',
|
||||
'cache.default' => 'redis',
|
||||
'session.driver' => 'redis',
|
||||
'queue.default' => 'redis',
|
||||
]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
//
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
|
@ -81,7 +77,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
protected function configureUrlGenerator()
|
||||
{
|
||||
if (! option('auto_detect_asset_url')) {
|
||||
if (!option('auto_detect_asset_url')) {
|
||||
$rootUrl = option('site_url');
|
||||
|
||||
// Replace HTTP_HOST with site_url set in options,
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Event;
|
||||
use App\Events;
|
||||
use App\Listeners;
|
||||
use Event;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Route;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Routing\Router;
|
||||
use Laravel\Passport\Passport;
|
||||
use App\Events\ConfigureRoutes;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Passport\Passport;
|
||||
use Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -23,7 +23,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
|
|
@ -49,7 +48,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes(Router $router)
|
||||
|
|
@ -67,7 +65,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*
|
||||
* These routes will not load session, etc.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
protected function mapStaticRoutes(Router $router)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Validator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Validator;
|
||||
|
||||
class ValidatorExtendServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use View;
|
||||
use App\Services\Webpack;
|
||||
use App\Http\View\Composers;
|
||||
use App\Services\Webpack;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use View;
|
||||
|
||||
class ViewServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -15,7 +15,7 @@ class ViewServiceProvider extends ServiceProvider
|
|||
'home',
|
||||
'*.base',
|
||||
'*.master',
|
||||
'shared.header'
|
||||
'shared.header',
|
||||
], function ($view) {
|
||||
$lightColors = ['light', 'warning', 'white', 'orange'];
|
||||
$color = option('navbar_color');
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ abstract class BaseCipher implements EncryptInterface
|
|||
*/
|
||||
public function hash($value, $salt = '')
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ interface EncryptInterface
|
|||
/**
|
||||
* Encrypt given string with given salt.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $salt
|
||||
* @param string $value
|
||||
* @param string $salt
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function hash($value, $salt = '');
|
||||
|
|
@ -16,8 +17,9 @@ interface EncryptInterface
|
|||
/**
|
||||
* Verifies that the given hash matches the given password.
|
||||
*
|
||||
* @param string $password
|
||||
* @param string $hash
|
||||
* @param string $password
|
||||
* @param string $hash
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function verify($password, $hash);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Filter
|
|||
|
||||
public function add(string $hook, Closure $callback, $priority = 20)
|
||||
{
|
||||
if (! isset($this->listeners[$hook])) {
|
||||
if (!isset($this->listeners[$hook])) {
|
||||
$this->listeners[$hook] = collect();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,29 +4,28 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use Event;
|
||||
use Closure;
|
||||
use App\Events;
|
||||
use Notification;
|
||||
use App\Notifications;
|
||||
use Closure;
|
||||
use Event;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Notification;
|
||||
|
||||
class Hook
|
||||
{
|
||||
/**
|
||||
* Add an item to menu.
|
||||
*
|
||||
* @param string $category 'user' or 'admin' or 'explore'
|
||||
* @param int $position Where to insert the given item, start from 0.
|
||||
* @param array $menu e.g.
|
||||
* [
|
||||
* 'title' => 'Title', # will be translated by translator
|
||||
* 'link' => 'user/config', # route link
|
||||
* 'icon' => 'fa-book', # font-awesome icon
|
||||
* 'new-tab' => false, # open the link in new tab or not, false by default
|
||||
* ]
|
||||
* @return void
|
||||
* @param string $category 'user' or 'admin' or 'explore'
|
||||
* @param int $position where to insert the given item, start from 0
|
||||
* @param array $menu e.g.
|
||||
* [
|
||||
* 'title' => 'Title', # will be translated by translator
|
||||
* 'link' => 'user/config', # route link
|
||||
* 'icon' => 'fa-book', # font-awesome icon
|
||||
* 'new-tab' => false, # open the link in new tab or not, false by default
|
||||
* ]
|
||||
*/
|
||||
public static function addMenuItem(string $category, int $position, array $menu): void
|
||||
{
|
||||
|
|
@ -68,7 +67,7 @@ class Hook
|
|||
{
|
||||
Event::listen(Events\RenderingFooter::class, function ($event) use ($name, $pages) {
|
||||
foreach ($pages as $pattern) {
|
||||
if (! request()->is($pattern)) {
|
||||
if (!request()->is($pattern)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +89,7 @@ class Hook
|
|||
{
|
||||
Event::listen(Events\RenderingHeader::class, function ($event) use ($urls, $pages) {
|
||||
foreach ($pages as $pattern) {
|
||||
if (! request()->is($pattern)) {
|
||||
if (!request()->is($pattern)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +106,7 @@ class Hook
|
|||
{
|
||||
Event::listen(Events\RenderingFooter::class, function ($event) use ($urls, $pages) {
|
||||
foreach ($pages as $pattern) {
|
||||
if (! request()->is($pattern)) {
|
||||
if (!request()->is($pattern)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@ class Minecraft
|
|||
* HD skin support added by xfl03 <xfl03@hotmail.com>.
|
||||
*
|
||||
* @see https://github.com/jamiebicknell/Minecraft-Avatar/blob/master/face.php
|
||||
* @param string $binary Binary image data or decoded base64 formatted image.
|
||||
* @param int $height The height of generated image in pixel.
|
||||
* @param string $view Which side of head to be captured, defaults to 'f' for front view.
|
||||
*
|
||||
* @param string $binary binary image data or decoded base64 formatted image
|
||||
* @param int $height the height of generated image in pixel
|
||||
* @param string $view which side of head to be captured, defaults to 'f' for front view
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public static function generateAvatarFromSkin(string $binary, int $height, string $view = 'f')
|
||||
|
|
@ -40,11 +42,13 @@ class Minecraft
|
|||
* Generate a image preview for a skin texture.
|
||||
*
|
||||
* @see https://github.com/NC22/Minecraft-HD-skin-viewer-2D/blob/master/SkinViewer2D.class.php
|
||||
* @param string $binary Binary image data or decoded base64 formatted image.
|
||||
* @param int $height The height of generated image in pixel.
|
||||
* @param bool $alex Whether the given skin is in Alex model.
|
||||
* @param string $side Which side of model to be captured, 'front', 'back' or 'both'.
|
||||
* @param int $gap Gap size between front & back preview in relative pixel.
|
||||
*
|
||||
* @param string $binary binary image data or decoded base64 formatted image
|
||||
* @param int $height the height of generated image in pixel
|
||||
* @param bool $alex whether the given skin is in Alex model
|
||||
* @param string $side which side of model to be captured, 'front', 'back' or 'both'
|
||||
* @param int $gap gap size between front & back preview in relative pixel
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public static function generatePreviewFromSkin(string $binary, int $height, $alex = false, $side = 'both', $gap = 4)
|
||||
|
|
@ -166,10 +170,11 @@ class Minecraft
|
|||
/**
|
||||
* Generate a image preview for a cape texture.
|
||||
*
|
||||
* @param string $binary Binary image data or decoded base64 formatted image.
|
||||
* @param int $height The size of generated image in pixel.
|
||||
* @param int $fillWidth Create a image with given size, And draw the preview on the center of it.
|
||||
* @param int $fillHeight Set the value to 0 to disable.
|
||||
* @param string $binary binary image data or decoded base64 formatted image
|
||||
* @param int $height the size of generated image in pixel
|
||||
* @param int $fillWidth create a image with given size, And draw the preview on the center of it
|
||||
* @param int $fillHeight set the value to 0 to disable
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
public static function generatePreviewFromCape(string $binary, int $height, $fillWidth = 0, $fillHeight = 0)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
namespace App\Services;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class Option
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ class Option
|
|||
|
||||
public function get($key, $default = null, $raw = false)
|
||||
{
|
||||
if (! $this->items->has($key) && Arr::has(config('options'), $key)) {
|
||||
if (!$this->items->has($key) && Arr::has(config('options'), $key)) {
|
||||
$this->set($key, config("options.$key"));
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,6 @@ class Option
|
|||
['option_value' => $value]
|
||||
);
|
||||
} catch (QueryException $e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use Option;
|
||||
use ReflectionClass;
|
||||
use BadMethodCallException;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Option;
|
||||
use ReflectionClass;
|
||||
|
||||
class OptionForm
|
||||
{
|
||||
|
|
@ -40,8 +40,9 @@ class OptionForm
|
|||
/**
|
||||
* Create a new option form instance.
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $title
|
||||
* @param string $id
|
||||
* @param string $title
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($id, $title = self::AUTO_DETECT)
|
||||
|
|
@ -58,20 +59,21 @@ class OptionForm
|
|||
/**
|
||||
* Add option item to the form dynamically.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $params
|
||||
* @param string $method
|
||||
* @param array $params
|
||||
*
|
||||
* @return OptionItem
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __call($method, $params)
|
||||
{
|
||||
if (! in_array($method, ['text', 'checkbox', 'textarea', 'select', 'group'])) {
|
||||
if (!in_array($method, ['text', 'checkbox', 'textarea', 'select', 'group'])) {
|
||||
throw new BadMethodCallException("Method [$method] does not exist on option form.");
|
||||
}
|
||||
|
||||
// Assign name for option item
|
||||
if (! isset($params[1]) || Arr::get($params, 1) == OptionForm::AUTO_DETECT) {
|
||||
if (!isset($params[1]) || Arr::get($params, 1) == OptionForm::AUTO_DETECT) {
|
||||
$params[1] = Arr::get(trans("options.$this->id.$params[0]"), 'title', trans("options.$this->id.$params[0]"));
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +89,8 @@ class OptionForm
|
|||
/**
|
||||
* Set the box type of option form.
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $type
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function type($type)
|
||||
|
|
@ -100,7 +103,8 @@ class OptionForm
|
|||
/**
|
||||
* Add a hint to option form.
|
||||
*
|
||||
* @param array $info
|
||||
* @param array $info
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function hint($hintContent = self::AUTO_DETECT)
|
||||
|
|
@ -117,8 +121,9 @@ class OptionForm
|
|||
/**
|
||||
* Add a piece of data to the option form.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function with($key, $value = null)
|
||||
|
|
@ -135,7 +140,6 @@ class OptionForm
|
|||
/**
|
||||
* Add a button at the footer of option form.
|
||||
*
|
||||
* @param array $info
|
||||
* @return $this
|
||||
*/
|
||||
public function addButton(array $info)
|
||||
|
|
@ -143,10 +147,10 @@ class OptionForm
|
|||
$info = array_merge([
|
||||
'style' => 'default',
|
||||
'class' => [],
|
||||
'href' => '',
|
||||
'text' => 'BUTTON',
|
||||
'type' => 'button',
|
||||
'name' => '',
|
||||
'href' => '',
|
||||
'text' => 'BUTTON',
|
||||
'type' => 'button',
|
||||
'name' => '',
|
||||
], $info);
|
||||
|
||||
$info['class'] = array_merge(
|
||||
|
|
@ -161,8 +165,9 @@ class OptionForm
|
|||
/**
|
||||
* Add a message to the top of option form.
|
||||
*
|
||||
* @param string $msg
|
||||
* @param string $style
|
||||
* @param string $msg
|
||||
* @param string $style
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addMessage($msg = self::AUTO_DETECT, $style = 'info')
|
||||
|
|
@ -179,8 +184,9 @@ class OptionForm
|
|||
/**
|
||||
* Add an alert to the top of option form.
|
||||
*
|
||||
* @param string $msg
|
||||
* @param string $style
|
||||
* @param string $msg
|
||||
* @param string $style
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addAlert($msg = self::AUTO_DETECT, $style = 'info')
|
||||
|
|
@ -197,7 +203,6 @@ class OptionForm
|
|||
/**
|
||||
* Add callback which will be executed before handling options.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function before(callable $callback)
|
||||
|
|
@ -210,7 +215,6 @@ class OptionForm
|
|||
/**
|
||||
* Add callback which will be executed after handling options.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function after(callable $callback)
|
||||
|
|
@ -223,7 +227,6 @@ class OptionForm
|
|||
/**
|
||||
* Add callback which will be always executed.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function always(callable $callback)
|
||||
|
|
@ -236,7 +239,8 @@ class OptionForm
|
|||
/**
|
||||
* Handle the HTTP post request and update modified options.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable $callback
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function handle(callable $callback = null)
|
||||
|
|
@ -245,11 +249,11 @@ class OptionForm
|
|||
$allPostData = $request->all();
|
||||
|
||||
if ($request->isMethod('POST') && Arr::get($allPostData, 'option') == $this->id) {
|
||||
if (! is_null($callback)) {
|
||||
if (!is_null($callback)) {
|
||||
call_user_func($callback, $this);
|
||||
}
|
||||
|
||||
if (! is_null($this->hookBefore)) {
|
||||
if (!is_null($this->hookBefore)) {
|
||||
call_user_func($this->hookBefore, $this);
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +273,7 @@ class OptionForm
|
|||
}
|
||||
|
||||
foreach ($postOptionQueue as $item) {
|
||||
if ($item instanceof OptionFormCheckbox && ! isset($allPostData[$item->id])) {
|
||||
if ($item instanceof OptionFormCheckbox && !isset($allPostData[$item->id])) {
|
||||
// preset value for checkboxes which are not checked
|
||||
$allPostData[$item->id] = false;
|
||||
}
|
||||
|
|
@ -281,7 +285,7 @@ class OptionForm
|
|||
}
|
||||
}
|
||||
|
||||
if (! is_null($this->hookAfter)) {
|
||||
if (!is_null($this->hookAfter)) {
|
||||
call_user_func($this->hookAfter, $this);
|
||||
}
|
||||
|
||||
|
|
@ -294,7 +298,8 @@ class OptionForm
|
|||
/**
|
||||
* Load value from $this->values & options by given id.
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getValueById($id)
|
||||
|
|
@ -354,17 +359,17 @@ class OptionForm
|
|||
*/
|
||||
public function render()
|
||||
{
|
||||
if (! is_null($this->alwaysCallback)) {
|
||||
if (!is_null($this->alwaysCallback)) {
|
||||
call_user_func($this->alwaysCallback, $this);
|
||||
}
|
||||
|
||||
// attach submit button to the form
|
||||
if (! $this->renderWithoutSubmitButton) {
|
||||
if (!$this->renderWithoutSubmitButton) {
|
||||
$this->addButton([
|
||||
'style' => 'primary',
|
||||
'text' => trans('general.submit'),
|
||||
'type' => 'submit',
|
||||
'name' => 'submit_'.$this->id,
|
||||
'text' => trans('general.submit'),
|
||||
'type' => 'submit',
|
||||
'name' => 'submit_'.$this->id,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -506,7 +511,7 @@ class OptionFormCheckbox extends OptionFormItem
|
|||
public function render()
|
||||
{
|
||||
return view('forms.checkbox')->with([
|
||||
'id' => $this->id,
|
||||
'id' => $this->id,
|
||||
'value' => $this->value,
|
||||
'label' => $this->label,
|
||||
'disabled' => $this->disabled,
|
||||
|
|
@ -528,8 +533,8 @@ class OptionFormTextarea extends OptionFormItem
|
|||
public function render()
|
||||
{
|
||||
return view('forms.textarea')->with([
|
||||
'id' => $this->id,
|
||||
'rows' => $this->rows,
|
||||
'id' => $this->id,
|
||||
'rows' => $this->rows,
|
||||
'value' => $this->value,
|
||||
'disabled' => $this->disabled,
|
||||
]);
|
||||
|
|
@ -550,8 +555,8 @@ class OptionFormSelect extends OptionFormItem
|
|||
public function render()
|
||||
{
|
||||
return view('forms.select')->with([
|
||||
'id' => $this->id,
|
||||
'options' => (array) $this->options,
|
||||
'id' => $this->id,
|
||||
'options' => (array) $this->options,
|
||||
'selected' => $this->value,
|
||||
'disabled' => $this->disabled,
|
||||
]);
|
||||
|
|
@ -573,7 +578,7 @@ class OptionFormGroup extends OptionFormItem
|
|||
'type' => 'text',
|
||||
'id' => $id,
|
||||
'value' => $value,
|
||||
'placeholder' => $placeholder
|
||||
'placeholder' => $placeholder,
|
||||
];
|
||||
|
||||
return $this;
|
||||
|
|
@ -596,7 +601,7 @@ class OptionFormGroup extends OptionFormItem
|
|||
|
||||
foreach ($this->items as $item) {
|
||||
$rendered[] = view('forms.'.$item['type'])->with([
|
||||
'id' => $item['id'],
|
||||
'id' => $item['id'],
|
||||
'value' => $item['value'],
|
||||
'placeholder' => Arr::get($item, 'placeholder'),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ namespace App\Services;
|
|||
|
||||
use Cache;
|
||||
use Exception;
|
||||
use ZipArchive;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use ZipArchive;
|
||||
|
||||
class PackageManager
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@
|
|||
namespace App\Services;
|
||||
|
||||
use App\Events;
|
||||
use Composer\Semver\Semver;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Composer\Semver\Comparator;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use Composer\Semver\Comparator;
|
||||
use Composer\Semver\Semver;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class PluginManager
|
||||
{
|
||||
|
|
@ -100,10 +100,7 @@ class PluginManager
|
|||
|
||||
$name = $manifest['name'];
|
||||
if ($plugins->has($name)) {
|
||||
throw new PrettyPageException(trans('errors.plugins.duplicate', [
|
||||
'dir1' => $plugins->get($name)->getPath(),
|
||||
'dir2' => $directory,
|
||||
]), 5);
|
||||
throw new PrettyPageException(trans('errors.plugins.duplicate', ['dir1' => $plugins->get($name)->getPath(), 'dir2' => $directory]), 5);
|
||||
}
|
||||
|
||||
$plugin = new Plugin($directory, $manifest);
|
||||
|
|
@ -247,7 +244,7 @@ class PluginManager
|
|||
report($th);
|
||||
if (is_a($th, \Exception::class)) {
|
||||
$handler = $this->app->make(\App\Exceptions\Handler::class);
|
||||
if (! $handler->shouldReport($th)) {
|
||||
if (!$handler->shouldReport($th)) {
|
||||
throw $th;
|
||||
}
|
||||
}
|
||||
|
|
@ -284,12 +281,12 @@ class PluginManager
|
|||
}
|
||||
|
||||
/**
|
||||
* @return bool|array Return `true` if succeeded, or return information if failed.
|
||||
* @return bool|array return `true` if succeeded, or return information if failed
|
||||
*/
|
||||
public function enable($plugin)
|
||||
{
|
||||
$plugin = is_string($plugin) ? $this->get($plugin) : $plugin;
|
||||
if ($plugin && ! $plugin->isEnabled()) {
|
||||
if ($plugin && !$plugin->isEnabled()) {
|
||||
$unsatisfied = $this->getUnsatisfied($plugin);
|
||||
$conflicts = $this->getConflicts($plugin);
|
||||
if ($unsatisfied->isNotEmpty() || $conflicts->isNotEmpty()) {
|
||||
|
|
@ -367,22 +364,22 @@ class PluginManager
|
|||
if ($name == 'blessing-skin-server') {
|
||||
$version = config('app.version');
|
||||
|
||||
return (! Semver::satisfies($version, $constraint))
|
||||
return (!Semver::satisfies($version, $constraint))
|
||||
? [$name => compact('version', 'constraint')]
|
||||
: [];
|
||||
} elseif ($name == 'php') {
|
||||
preg_match('/(\d+\.\d+\.\d+)/', PHP_VERSION, $matches);
|
||||
$version = $matches[1];
|
||||
|
||||
return (! Semver::satisfies($version, $constraint))
|
||||
return (!Semver::satisfies($version, $constraint))
|
||||
? [$name => compact('version', 'constraint')]
|
||||
: [];
|
||||
} elseif (! $this->enabled->has($name)) {
|
||||
} elseif (!$this->enabled->has($name)) {
|
||||
return [$name => ['version' => null, 'constraint' => $constraint]];
|
||||
} else {
|
||||
$version = $this->enabled->get($name)['version'];
|
||||
|
||||
return (! Semver::satisfies($version, $constraint))
|
||||
return (!Semver::satisfies($version, $constraint))
|
||||
? [$name => compact('version', 'constraint')]
|
||||
: [];
|
||||
}
|
||||
|
|
@ -414,7 +411,7 @@ class PluginManager
|
|||
): array {
|
||||
$unsatisfied = $unsatisfied->map(function ($detail, $name) {
|
||||
$constraint = $detail['constraint'];
|
||||
if (! $detail['version']) {
|
||||
if (!$detail['version']) {
|
||||
$plugin = $this->get($name);
|
||||
$name = $plugin ? trans($plugin->title) : $name;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class JavaScript
|
|||
$sourceModified = $this->filesystem->lastModified($source);
|
||||
$compiledModified = intval($this->cache->get($this->prefix.$locale, 0));
|
||||
|
||||
if ($sourceModified > $compiledModified || ! $this->filesystem->exists($compiled)) {
|
||||
if ($sourceModified > $compiledModified || !$this->filesystem->exists($compiled)) {
|
||||
$content = 'blessing.i18n = '.json_encode(trans('front-end'), JSON_UNESCAPED_UNICODE);
|
||||
$this->filesystem->put($compiled, $content);
|
||||
$this->cache->put($this->prefix.$locale, $sourceModified);
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class Webpack
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,16 +4,15 @@ declare(strict_types=1);
|
|||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
if (! function_exists('plugin')) {
|
||||
if (!function_exists('plugin')) {
|
||||
function plugin(string $name)
|
||||
{
|
||||
return app('plugins')->get($name);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('plugin_assets')) {
|
||||
if (!function_exists('plugin_assets')) {
|
||||
function plugin_assets(string $name, string $relativeUri): string
|
||||
{
|
||||
$plugin = plugin($name);
|
||||
|
|
@ -25,7 +24,7 @@ if (! function_exists('plugin_assets')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! function_exists('json')) {
|
||||
if (!function_exists('json')) {
|
||||
function json()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
|
@ -48,15 +47,16 @@ if (! function_exists('json')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! function_exists('option')) {
|
||||
if (!function_exists('option')) {
|
||||
/**
|
||||
* Get / set the specified option value.
|
||||
*
|
||||
* If an array is passed as the key, we will assume you want to set an array of values.
|
||||
*
|
||||
* @param array|string $key
|
||||
* @param mixed $default
|
||||
* @param raw $raw return raw value without convertion
|
||||
* @param array|string $key
|
||||
* @param mixed $default
|
||||
* @param raw $raw return raw value without convertion
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function option($key = null, $default = null, $raw = false)
|
||||
|
|
@ -77,20 +77,20 @@ if (! function_exists('option')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! function_exists('option_localized')) {
|
||||
if (!function_exists('option_localized')) {
|
||||
function option_localized($key = null, $default = null, $raw = false)
|
||||
{
|
||||
return option($key.'_'.config('app.locale'), option($key));
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('humanize_db_type')) {
|
||||
if (!function_exists('humanize_db_type')) {
|
||||
function humanize_db_type($type = null): string
|
||||
{
|
||||
$map = [
|
||||
'mysql' => 'MySQL/MariaDB',
|
||||
'mysql' => 'MySQL/MariaDB',
|
||||
'sqlite' => 'SQLite',
|
||||
'pgsql' => 'PostgreSQL',
|
||||
'pgsql' => 'PostgreSQL',
|
||||
];
|
||||
|
||||
$type = $type ?: config('database.default');
|
||||
|
|
@ -99,7 +99,7 @@ if (! function_exists('humanize_db_type')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! function_exists('get_db_config')) {
|
||||
if (!function_exists('get_db_config')) {
|
||||
function get_db_config($type = null)
|
||||
{
|
||||
$type = $type ?: config('database.default');
|
||||
|
|
@ -108,12 +108,11 @@ if (! function_exists('get_db_config')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! function_exists('get_datetime_string')) {
|
||||
if (!function_exists('get_datetime_string')) {
|
||||
/**
|
||||
* Get date time string in "Y-m-d H:i:s" format.
|
||||
*
|
||||
* @param int $timestamp
|
||||
* @return string
|
||||
*/
|
||||
function get_datetime_string($timestamp = 0): string
|
||||
{
|
||||
|
|
@ -121,14 +120,12 @@ if (! function_exists('get_datetime_string')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! function_exists('get_client_ip')) {
|
||||
if (!function_exists('get_client_ip')) {
|
||||
/**
|
||||
* Return the client IP address.
|
||||
*
|
||||
* We define this function because Symfony's "Request::getClientIp()" method
|
||||
* needs "setTrustedProxies()", which sucks when load balancer is enabled.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_client_ip(): string
|
||||
{
|
||||
|
|
@ -145,13 +142,9 @@ if (! function_exists('get_client_ip')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! function_exists('get_string_replaced')) {
|
||||
if (!function_exists('get_string_replaced')) {
|
||||
/**
|
||||
* Replace content of string according to given rules.
|
||||
*
|
||||
* @param string $str
|
||||
* @param array $rules
|
||||
* @return string
|
||||
*/
|
||||
function get_string_replaced(string $str, array $rules): string
|
||||
{
|
||||
|
|
@ -163,26 +156,25 @@ if (! function_exists('get_string_replaced')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (! function_exists('is_request_secure')) {
|
||||
if (!function_exists('is_request_secure')) {
|
||||
/**
|
||||
* Check whether the request is secure or not.
|
||||
* True is always returned when "X-Forwarded-Proto" header is set.
|
||||
*
|
||||
* We define this function because Symfony's "Request::isSecure()" method
|
||||
* needs "setTrustedProxies()" which sucks when load balancer is enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_request_secure(): bool
|
||||
{
|
||||
$request = request();
|
||||
|
||||
return $request->server('HTTPS') === 'on'
|
||||
|| $request->server('HTTP_X_FORWARDED_PROTO') === 'https'
|
||||
|| $request->server('HTTP_X_FORWARDED_SSL') === 'on';
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('png')) {
|
||||
if (!function_exists('png')) {
|
||||
function png($resource)
|
||||
{
|
||||
ob_start();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateAllTables extends Migration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddVerificationToUsersTable extends Migration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRememberTokenToUsersTable extends Migration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTidSkin extends Migration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenamePlayersTableColumns extends Migration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCloset extends Migration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RemoveLikesField extends Migration
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateReportTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
if (! Schema::hasTable('reports')) {
|
||||
if (!Schema::hasTable('reports')) {
|
||||
Schema::create('reports', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('tid');
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user