diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php index 3d64be8..35c8027 100644 --- a/locales/fr/main.lang.php +++ b/locales/fr/main.lang.php @@ -9,10 +9,12 @@ # DOT NOT MODIFY THIS FILE ! # -l10n::$locales['You must provide a content.'] = 'Vous devez fournir un contenu.'; -l10n::$locales['Mail successuffly sent.'] = 'Mail envoyer avec succès.'; -l10n::$locales['Mailto:'] = 'Envoyer à :'; -l10n::$locales['Subject:'] = 'Sujet :'; -l10n::$locales['Active mail headers'] = 'Activer les entêtes de mail'; -l10n::$locales['Mail test'] = 'Testeur de mail'; -l10n::$locales['Send a simple mail from admin'] = 'Envoyer un simple mail depuis l\'admin'; +use Dotclear\Helper\L10n; + +L10n::$locales['You must provide a content.'] = 'Vous devez fournir un contenu.'; +L10n::$locales['Mail successuffly sent.'] = 'Mail envoyer avec succès.'; +L10n::$locales['Mailto:'] = 'Envoyer à :'; +L10n::$locales['Subject:'] = 'Sujet :'; +L10n::$locales['Active mail headers'] = 'Activer les entêtes de mail'; +L10n::$locales['Mail test'] = 'Testeur de mail'; +L10n::$locales['Send a simple mail from admin'] = 'Envoyer un simple mail depuis l\'admin'; diff --git a/src/Backend.php b/src/Backend.php index 5a8f346..e8fb6ce 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -24,7 +24,9 @@ class Backend extends dcNsProcess { public static function init(): bool { - static::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin(); + static::$init = defined('DC_CONTEXT_ADMIN') + && !is_null(dcCore::app()->auth) + && dcCore::app()->auth->isSuperAdmin(); return static::$init; } @@ -35,6 +37,11 @@ class Backend extends dcNsProcess return false; } + // nullsafe + if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->adminurl)) { + return false; + } + dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( My::name(), dcCore::app()->adminurl->get('admin.plugin.' . My::id()), diff --git a/src/Manage.php b/src/Manage.php index df97f73..5524bc8 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -36,7 +36,9 @@ class Manage extends dcNsProcess { public static function init(): bool { - static::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin(); + static::$init = defined('DC_CONTEXT_ADMIN') + && !is_null(dcCore::app()->auth) + && dcCore::app()->auth->isSuperAdmin(); return static::$init; } @@ -47,6 +49,11 @@ class Manage extends dcNsProcess return false; } + // nullsafe + if (is_null(dcCore::app()->adminurl)) { + return false; + } + $active_headers = !empty($_POST['active_headers']); $mail_to = $_POST['mail_to'] ?? ''; $mail_subject = $_POST['mail_subject'] ?? ''; @@ -126,6 +133,11 @@ class Manage extends dcNsProcess private static function getHeaders(): array { + // nullsafe + if (is_null(dcCore::app()->blog)) { + return []; + } + return [ 'From: ' . Mail::B64Header(dcCore::app()->blog->name) . '',