mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-19 16:10:00 +00:00
Code cleanup
This commit is contained in:
@@ -84,10 +84,10 @@ class Authenticate
|
||||
if ($this->auth->check()) {
|
||||
// do an extra check on user object.
|
||||
$user = $this->auth->authenticate();
|
||||
if (1 === intval($user->blocked)) {
|
||||
$message = strval(trans('firefly.block_account_logout'));
|
||||
if (1 === (int)$user->blocked) {
|
||||
$message = (string)trans('firefly.block_account_logout');
|
||||
if ('email_changed' === $user->blocked_code) {
|
||||
$message = strval(trans('firefly.email_changed_logout'));
|
||||
$message = (string)trans('firefly.email_changed_logout');
|
||||
}
|
||||
app('session')->flash('logoutMessage', $message);
|
||||
$this->auth->logout();
|
||||
|
||||
@@ -58,7 +58,6 @@ class AuthenticateTwoFactor
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|mixed
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Illuminate\Container\EntryNotFoundException
|
||||
*/
|
||||
public function handle($request, Closure $next, ...$guards)
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ class Binder
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \LogicException
|
||||
|
||||
*/
|
||||
public function handle($request, Closure $next, ...$guards)
|
||||
{
|
||||
|
||||
@@ -58,8 +58,8 @@ class Installer
|
||||
}
|
||||
|
||||
// older version in config than database?
|
||||
$configVersion = intval(config('firefly.db_version'));
|
||||
$dbVersion = intval(FireflyConfig::getFresh('db_version', 1)->data);
|
||||
$configVersion = (int)config('firefly.db_version');
|
||||
$dbVersion = (int)FireflyConfig::getFresh('db_version', 1)->data;
|
||||
if ($configVersion > $dbVersion) {
|
||||
Log::warning(
|
||||
sprintf(
|
||||
|
||||
@@ -39,18 +39,17 @@ class IsDemoUser
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $request->user();
|
||||
if (is_null($user)) {
|
||||
if (null === $user) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
if ($user->hasRole('demo')) {
|
||||
$request->session()->flash('info', strval(trans('firefly.not_available_demo_user')));
|
||||
$request->session()->flash('info', (string)trans('firefly.not_available_demo_user'));
|
||||
$current = $request->url();
|
||||
$previous = $request->session()->previousUrl();
|
||||
if ($current !== $previous) {
|
||||
|
||||
@@ -48,8 +48,8 @@ class IsSandStormUser
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
if (1 === intval(getenv('SANDSTORM'))) {
|
||||
Session::flash('warning', strval(trans('firefly.sandstorm_not_available')));
|
||||
if (1 === (int)getenv('SANDSTORM')) {
|
||||
Session::flash('warning', (string)trans('firefly.sandstorm_not_available'));
|
||||
|
||||
return response()->redirectTo(route('index'));
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class Sandstorm
|
||||
public function handle(Request $request, Closure $next, $guard = null)
|
||||
{
|
||||
// is in Sandstorm environment?
|
||||
$sandstorm = 1 === intval(getenv('SANDSTORM'));
|
||||
$sandstorm = 1 === (int)getenv('SANDSTORM');
|
||||
View::share('SANDSTORM', $sandstorm);
|
||||
if (!$sandstorm) {
|
||||
return $next($request);
|
||||
@@ -62,7 +62,7 @@ class Sandstorm
|
||||
if (Auth::guard($guard)->guest()) {
|
||||
/** @var UserRepositoryInterface $repository */
|
||||
$repository = app(UserRepositoryInterface::class);
|
||||
$userId = strval($request->header('X-Sandstorm-User-Id'));
|
||||
$userId = (string)$request->header('X-Sandstorm-User-Id');
|
||||
Log::debug(sprintf('Sandstorm user ID is "%s"', $userId));
|
||||
$count = $repository->count();
|
||||
|
||||
@@ -120,7 +120,7 @@ class Sandstorm
|
||||
}
|
||||
}
|
||||
// if in Sandstorm, user logged in, still must check if user is anon.
|
||||
$userId = strval($request->header('X-Sandstorm-User-Id'));
|
||||
$userId = (string)$request->header('X-Sandstorm-User-Id');
|
||||
if (strlen($userId) === 0) {
|
||||
View::share('SANDSTORM_ANON', true);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class TrustProxies extends Middleware
|
||||
{
|
||||
$trustedProxies = env('TRUSTED_PROXIES', null);
|
||||
if (false !== $trustedProxies && null !== $trustedProxies && strlen($trustedProxies) > 0) {
|
||||
$this->proxies = strval($trustedProxies);
|
||||
$this->proxies = (string)$trustedProxies;
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
|
||||
Reference in New Issue
Block a user