fix nullsafe warnings
This commit is contained in:
parent
42d301a77e
commit
58bee72e62
@ -9,10 +9,12 @@
|
|||||||
# DOT NOT MODIFY THIS FILE !
|
# DOT NOT MODIFY THIS FILE !
|
||||||
#
|
#
|
||||||
|
|
||||||
l10n::$locales['You must provide a content.'] = 'Vous devez fournir un contenu.';
|
use Dotclear\Helper\L10n;
|
||||||
l10n::$locales['Mail successuffly sent.'] = 'Mail envoyer avec succès.';
|
|
||||||
l10n::$locales['Mailto:'] = 'Envoyer à :';
|
L10n::$locales['You must provide a content.'] = 'Vous devez fournir un contenu.';
|
||||||
l10n::$locales['Subject:'] = 'Sujet :';
|
L10n::$locales['Mail successuffly sent.'] = 'Mail envoyer avec succès.';
|
||||||
l10n::$locales['Active mail headers'] = 'Activer les entêtes de mail';
|
L10n::$locales['Mailto:'] = 'Envoyer à :';
|
||||||
l10n::$locales['Mail test'] = 'Testeur de mail';
|
L10n::$locales['Subject:'] = 'Sujet :';
|
||||||
l10n::$locales['Send a simple mail from admin'] = 'Envoyer un simple mail depuis l\'admin';
|
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';
|
||||||
|
@ -24,7 +24,9 @@ class Backend extends dcNsProcess
|
|||||||
{
|
{
|
||||||
public static function init(): bool
|
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;
|
return static::$init;
|
||||||
}
|
}
|
||||||
@ -35,6 +37,11 @@ class Backend extends dcNsProcess
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nullsafe
|
||||||
|
if (is_null(dcCore::app()->auth) || is_null(dcCore::app()->adminurl)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
My::name(),
|
My::name(),
|
||||||
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
|
@ -36,7 +36,9 @@ class Manage extends dcNsProcess
|
|||||||
{
|
{
|
||||||
public static function init(): bool
|
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;
|
return static::$init;
|
||||||
}
|
}
|
||||||
@ -47,6 +49,11 @@ class Manage extends dcNsProcess
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nullsafe
|
||||||
|
if (is_null(dcCore::app()->adminurl)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$active_headers = !empty($_POST['active_headers']);
|
$active_headers = !empty($_POST['active_headers']);
|
||||||
$mail_to = $_POST['mail_to'] ?? '';
|
$mail_to = $_POST['mail_to'] ?? '';
|
||||||
$mail_subject = $_POST['mail_subject'] ?? '';
|
$mail_subject = $_POST['mail_subject'] ?? '';
|
||||||
@ -126,6 +133,11 @@ class Manage extends dcNsProcess
|
|||||||
|
|
||||||
private static function getHeaders(): array
|
private static function getHeaders(): array
|
||||||
{
|
{
|
||||||
|
// nullsafe
|
||||||
|
if (is_null(dcCore::app()->blog)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'From: ' . Mail::B64Header(dcCore::app()->blog->name) .
|
'From: ' . Mail::B64Header(dcCore::app()->blog->name) .
|
||||||
'<no-reply@' . str_replace('http://', '', Http::getHost()) . ' >',
|
'<no-reply@' . str_replace('http://', '', Http::getHost()) . ' >',
|
||||||
|
Loading…
Reference in New Issue
Block a user