diff --git a/src/Backend.php b/src/Backend.php index aa243fe..e9b4a52 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -35,7 +35,7 @@ class Backend extends dcNsProcess public static function init(): bool { if (defined('DC_CONTEXT_ADMIN')) { - self::$init = true; + self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>='); } return self::$init; diff --git a/src/Config.php b/src/Config.php index cf23682..9a51fdf 100644 --- a/src/Config.php +++ b/src/Config.php @@ -43,10 +43,12 @@ class Config extends dcNsProcess public static function init(): bool { if (defined('DC_CONTEXT_ADMIN')) { - dcPage::checkSuper(); - self::$init = true; + if (version_compare(phpversion(), My::PHP_MIN, '>=')) { + self::$init = dcCore::app()->auth->isSuperAdmin(); + } else { + dcCore::app()->error->add(sprintf(__('%s required php >= %s'), My::id(), My::PHP_MIN)); + } } - return self::$init; } diff --git a/src/Install.php b/src/Install.php index a873835..1201403 100644 --- a/src/Install.php +++ b/src/Install.php @@ -40,7 +40,10 @@ class Install extends dcNsProcess public static function init(): bool { - self::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version')); + if (defined('DC_CONTEXT_ADMIN')) { + self::$init = version_compare(phpversion(), My::PHP_MIN, '>=') + && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version')); + } return self::$init; } diff --git a/src/Manage.php b/src/Manage.php index 182082e..f3fa2a2 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -51,13 +51,14 @@ class Manage extends dcNsProcess public static function init(): bool { if (defined('DC_CONTEXT_ADMIN')) { - dcPage::checkSuper(); + self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>='); + } + if (self::$init) { self::$improve = new Core(); self::$type = self::getType(); self::$module = self::getModule(); self::$action = self::getAction(); - self::$init = true; } return self::$init;