diff --git a/src/Backend.php b/src/Backend.php index 4a3a8db..09608ce 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -37,6 +37,7 @@ class Backend extends dcNsProcess { static::$init = defined('DC_CONTEXT_ADMIN') && My::phpCompliant() + && !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog) // nullsafe PHP < 8.0 && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, ]), dcCore::app()->blog->id); @@ -69,6 +70,10 @@ class Backend extends dcNsProcess }, 'adminBlogPreferencesHeaders' => function (): string { + // nullsafe PHP < 8.0 + if (is_null(dcCore::app()->auth)) { + return ''; + } $editor = dcCore::app()->auth->getOption('editor'); return @@ -111,7 +116,7 @@ class Backend extends dcNsProcess (new Div())->class('clear')->items([ (new Para())->items([ (new Label(__('Disclaimer:'), Label::OUTSIDE_LABEL_BEFORE))->for('disclaimer_text'), - (new Textarea('disclaimer_text', Html::escapeHTML((string) $s->get('disclaimer_text'))))->cols(60)->rows(5)->lang(dcCore::app()->blog->settings->get('system')->get('lang'))->spellcheck(true), + (new Textarea('disclaimer_text', Html::escapeHTML((string) $s->get('disclaimer_text'))))->cols(60)->rows(5)->lang($blog_settings->get('system')->get('lang'))->spellcheck(true), ]), (new Para())->items([ (new Label(__('List of robots allowed to index the site pages (separated by semicolons):')))->for('disclaimer_bots_agents'), diff --git a/src/Frontend.php b/src/Frontend.php index 3e468ec..5f78053 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -34,6 +34,11 @@ class Frontend extends dcNsProcess return false; } + // nullsafe PHP < 8.0 + if (is_null(dcCore::app()->blog)) { + return false; + } + # Is active if (!dcCore::app()->blog->settings->get(My::id())->get('disclaimer_active')) { return false; diff --git a/src/Install.php b/src/Install.php index 81cb845..ff24e1a 100644 --- a/src/Install.php +++ b/src/Install.php @@ -35,6 +35,11 @@ class Install extends dcNsProcess return false; } + // nullsafe PHP < 8.0 + if (is_null(dcCore::app()->blog)) { + return false; + } + // Module specs $mod_conf = [ [ diff --git a/src/UrlHandler.php b/src/UrlHandler.php index 5ed9f0e..195185a 100644 --- a/src/UrlHandler.php +++ b/src/UrlHandler.php @@ -45,6 +45,11 @@ class UrlHandler extends dcUrlHandlers */ public static function publicBeforeDocumentV2(): void { + // nullsafe PHP < 8.0 + if (is_null(dcCore::app()->blog)) { + return; + } + $s = dcCore::app()->blog->settings->get(My::id()); # Test user-agent to see if it is a bot