diff --git a/_define.php b/_define.php index e4eeaa2..9ef53b6 100644 --- a/_define.php +++ b/_define.php @@ -10,7 +10,7 @@ * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ -if (!defined('DC_RC_PATH')) { +if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) { return; } @@ -22,7 +22,7 @@ $this->registerModule( [ 'requires' => [['core', '2.26']], 'permissions' => dcCore::app()->auth->makePermissions([ - dcAuth::PERMISSION_ADMIN, + dcCore::app()->auth::PERMISSION_ADMIN, ]), 'type' => 'plugin', 'support' => 'https://github.com/JcDenis/' . basename(__DIR__), diff --git a/src/Backend.php b/src/Backend.php index bff287f..b690ba8 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -43,6 +43,11 @@ class Backend extends dcNsProcess dcCore::app()->addBehaviors([ 'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void { + // nullsafe + if (is_null(dcCore::app()->blog)) { + return; + } + $exists = []; $path = Path::fullFromRoot((string) $blog_settings->get('system')->get('public_path'), DC_ROOT); foreach (['ico', 'png', 'bmp', 'gif', 'jpg', 'mng'] as $ext) { diff --git a/src/Frontend.php b/src/Frontend.php index ee5d234..b6b4179 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -34,7 +34,7 @@ class Frontend extends dcNsProcess } dcCore::app()->addBehavior('publicHeadContent', function (): void { - if (!dcCore::app()->blog->settings->get('system')->get('simply_favicon')) { + if (is_null(dcCore::app()->blog) || !dcCore::app()->blog->settings->get('system')->get('simply_favicon')) { return; } diff --git a/src/UrlHandler.php b/src/UrlHandler.php index e847c57..5fd05fd 100644 --- a/src/UrlHandler.php +++ b/src/UrlHandler.php @@ -31,6 +31,11 @@ class UrlHandler extends dcUrlHandlers public static function simplyFaviconUrl(string $arg): void { + // nullsafe + if (is_null(dcCore::app()->blog)) { + return; + } + $public_path = Path::fullFromRoot(dcCore::app()->blog->settings->get('system')->get('public_path'), DC_ROOT); if (dcCore::app()->blog->settings->get('system')->get('simply_favicon')