Skip to content

Commit d12e6d2

Browse files
committed
Update
tr
1 parent 25ffd54 commit d12e6d2

File tree

8 files changed

+31
-40
lines changed

8 files changed

+31
-40
lines changed

src/BackendController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ public function __construct(array $content = [])
3131
// Set view global content
3232
$id = (int)$this->getSession('userId');
3333
$content = $this->mergeArray([
34-
[
35-
'user' => (new User)->get($id),
36-
'execution' => Debugger::getExecutionTime()
37-
]
34+
'user' => (new User)->get($id),
35+
'execution' => Debugger::getExecutionTime()
3836
], $content);
3937
$this->setContent($content);
4038

src/Base.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class Base
2121
{
2222
use TraitConfiguration,
2323
TraitException,
24-
\FloatPHP\Helpers\Framework\inc\TraitHookable,
25-
\FloatPHP\Helpers\Framework\inc\TraitPermissionable,
26-
\FloatPHP\Helpers\Framework\inc\TraitRequestable,
27-
\FloatPHP\Helpers\Framework\inc\TraitThrowable,
28-
\FloatPHP\Helpers\Framework\inc\TraitAuthenticatable;
24+
\FloatPHP\Helpers\Framework\tr\TraitHookable,
25+
\FloatPHP\Helpers\Framework\tr\TraitPermissionable,
26+
\FloatPHP\Helpers\Framework\tr\TraitRequestable,
27+
\FloatPHP\Helpers\Framework\tr\TraitThrowable,
28+
\FloatPHP\Helpers\Framework\tr\TraitAuthenticatable;
2929

3030
/**
3131
* Get token (CSRF).

src/BaseController.php

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,38 +39,31 @@ public function redirectIndex() : void
3939
public function hasAccess() : bool
4040
{
4141
$ip = $this->getServerIp();
42-
$access = false;
4342

4443
// Allow local access
45-
if ( $this->hasString(['127.0.0.1', '::1'], $ip) ) {
46-
$access = true;
44+
if ( $this->isDebug() && $this->hasString(['127.0.0.1', '::1'], $ip) ) {
45+
return true;
46+
}
47+
48+
// Check allowed IPs
49+
$access = false;
50+
$allowed = $this->getAllowedAccess();
51+
$allowed = $this->applyFilter('access-allowed-ip', $allowed);
52+
53+
if ( !empty($allowed) ) {
54+
$access = $this->hasString($allowed, $ip);
4755

4856
} else {
4957

50-
// Check allowed IPs
51-
$allowed = $this->applyFilter('access-allowed-ip', $this->getAllowedAccess());
52-
if ( !empty($allowed) ) {
53-
if ( $this->hasString($allowed, $ip) ) {
54-
$access = true;
55-
56-
} else {
57-
$access = false;
58-
}
59-
60-
} else {
61-
// Deny access
62-
$denied = $this->applyFilter('access-denied-ip', $this->getDeniedAccess());
63-
if ( $this->hasString($denied, $ip) ) {
64-
$access = false;
65-
66-
} else {
67-
$access = true;
68-
}
69-
}
58+
// Deny access
59+
$denied = $this->getDeniedAccess();
60+
$denied = $this->applyFilter('access-denied-ip', $denied);
61+
$access = !$this->hasString($denied, $ip);
7062
}
7163

7264
$data = ['ip' => $ip, 'access' => $access];
7365
$this->doAction('ip-access', $data);
66+
7467
return $access;
7568
}
7669

src/Core.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
final class Core
2222
{
2323
use TraitException,
24-
\FloatPHP\Helpers\Framework\inc\TraitDatable,
25-
\FloatPHP\Helpers\Framework\inc\TraitSessionable;
24+
\FloatPHP\Helpers\Framework\tr\TraitDatable,
25+
\FloatPHP\Helpers\Framework\tr\TraitSessionable;
2626

2727
/**
2828
* Init Core.

src/Orm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class Orm implements OrmInterface
2424
{
2525
use TraitConfiguration,
26-
\FloatPHP\Helpers\Framework\inc\TraitConnectable;
26+
\FloatPHP\Helpers\Framework\tr\TraitConnectable;
2727

2828
/**
2929
* @access private

src/TraitConfiguration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
trait TraitConfiguration
2222
{
23-
use \FloatPHP\Helpers\Framework\inc\TraitIO,
24-
\FloatPHP\Helpers\Framework\inc\TraitFormattable;
23+
use \FloatPHP\Helpers\Framework\tr\TraitIO,
24+
\FloatPHP\Helpers\Framework\tr\TraitFormattable;
2525

2626
/**
2727
* @access private

src/TraitException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
trait TraitException
1919
{
20-
use \FloatPHP\Helpers\Framework\inc\TraitFormattable,
21-
\FloatPHP\Helpers\Framework\inc\TraitRequestable;
20+
use \FloatPHP\Helpers\Framework\tr\TraitFormattable,
21+
\FloatPHP\Helpers\Framework\tr\TraitRequestable;
2222

2323
/**
2424
* Throw error controller.

src/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535
class View extends Base implements ViewInterface
3636
{
37-
use \FloatPHP\Helpers\Framework\inc\TraitViewable;
37+
use \FloatPHP\Helpers\Framework\tr\TraitViewable;
3838

3939
/**
4040
* @access private

0 commit comments

Comments
 (0)