Completed
Branch master (bf361a)
by Pierre-Henry
35:18
created

app/system/modules/admin123/config/Permission.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * @author         Pierre-Henry Soria <[email protected]>
4
 * @copyright      (c) 2012-2017, Pierre-Henry Soria. All Rights Reserved.
5
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
6
 * @package        PH7 / App / System / Module / Admin / Config
7
 */
8
namespace PH7;
9
10
defined('PH7') or die('Restricted access');
11
12
use
0 ignored issues
show
There must be a single space after the USE keyword
Loading history...
13
PH7\Framework\Layout\Html\Design,
14
PH7\Framework\Mvc\Router\Uri,
15
PH7\Framework\Url\Header;
16
17
class Permission extends PermissionCore
18
{
19
    public function __construct()
20
    {
21
        parent::__construct();
22
23
        $bAdminAuth = AdminCore::auth();
24
25
        /***** Levels for admin module *****/
26
27
        // Overall levels
28
29
        if (!$bAdminAuth && $this->registry->action !== 'login') {
30
            Header::redirect(
31
                Uri::get(PH7_ADMIN_MOD, 'main', 'login'),
32
                $this->signInMsg(),
33
                Design::ERROR_TYPE
34
            );
35
        }
36
37
        if ($bAdminAuth && $this->registry->action === 'login') {
38
            Header::redirect(
39
                Uri::get(PH7_ADMIN_MOD, 'main', 'index'),
40
                t('Oops! You are already logged in as administrator.'),
41
                Design::ERROR_TYPE
42
            );
43
        }
44
45
        // Options ...
46
    }
47
}
48