fix nullsafe warnings and type hint
This commit is contained in:
parent
e9242f40c3
commit
7a3117e1ac
@ -17,6 +17,7 @@ namespace Dotclear\Plugin\httpPassword;
|
||||
use dcAdmin;
|
||||
use dcCore;
|
||||
use dcPage;
|
||||
use dcMenu;
|
||||
use dcNsProcess;
|
||||
|
||||
class Backend extends dcNsProcess
|
||||
@ -35,15 +36,17 @@ class Backend extends dcNsProcess
|
||||
}
|
||||
|
||||
// add backend sidebar menu icon
|
||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||
My::name(),
|
||||
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||
dcPage::getPF(My::id() . '/icon.png'),
|
||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
||||
My::PERMISSION,
|
||||
]), dcCore::app()->blog->id)
|
||||
);
|
||||
if ((dcCore::app()->menu[dcAdmin::MENU_PLUGINS] instanceof dcMenu)) {
|
||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||
My::name(),
|
||||
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||
dcPage::getPF(My::id() . '/icon.png'),
|
||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
||||
My::PERMISSION,
|
||||
]), dcCore::app()->blog->id)
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class Frontend extends dcNsProcess
|
||||
if (!$logs->isEmpty()) {
|
||||
$ids = [];
|
||||
while ($logs->fetch()) {
|
||||
$ids[] = (int) $logs->f('log_id');
|
||||
$ids[] = is_numeric($logs->f('log_id')) ? (int) $logs->f('log_id') : 0;
|
||||
}
|
||||
$logs = dcCore::app()->log->delLogs($ids);
|
||||
}
|
||||
|
@ -22,8 +22,10 @@ class Install extends dcNsProcess
|
||||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
||||
if (defined('DC_CONTEXT_ADMIN')) {
|
||||
$version = dcCore::app()->plugins->moduleInfo(My::id(), 'version');
|
||||
static::$init = is_string($version) ? dcCore::app()->newVersion(My::id(), $version) : true;
|
||||
}
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ class Manage extends dcNsProcess
|
||||
(new Submit(['save']))->value(__('Save')),
|
||||
(new Hidden(['action'], 'savesettings')),
|
||||
(new Hidden(['part'], $part)),
|
||||
(new Text('', dcCore::app()->formNonce())),
|
||||
dcCore::app()->formNonce(false),
|
||||
]),
|
||||
])->render();
|
||||
}
|
||||
@ -234,7 +234,7 @@ class Manage extends dcNsProcess
|
||||
(new Submit(['save']))->value(__('Clear logs')),
|
||||
(new Hidden(['action'], 'savelogins')),
|
||||
(new Hidden(['part'], $part)),
|
||||
(new Text('', dcCore::app()->formNonce())),
|
||||
dcCore::app()->formNonce(false),
|
||||
]),
|
||||
])->render() .
|
||||
|
||||
@ -246,10 +246,12 @@ class Manage extends dcNsProcess
|
||||
'</tr></thead<tbody>';
|
||||
|
||||
while ($logs->fetch()) {
|
||||
$msg = is_string($logs->f('log_msg')) ? $logs->f('log_msg') : '';
|
||||
$dt = is_string($logs->f('log_dt')) ? $logs->f('log_dt') : '';
|
||||
echo
|
||||
'<tr class="line">' .
|
||||
'<td class="nowrap maximal">' . Html::escapeHTML($logs->f('log_msg')) . '</td>' .
|
||||
'<td class="nowrap count">' . Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $logs->f('log_dt'))) . '</td>' .
|
||||
'<td class="nowrap maximal">' . Html::escapeHTML($msg) . '</td>' .
|
||||
'<td class="nowrap count">' . Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $dt)) . '</td>' .
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
@ -299,7 +301,7 @@ class Manage extends dcNsProcess
|
||||
(new Para())->items([
|
||||
(new Hidden(['action'], 'savepasswords')),
|
||||
(new Hidden(['part'], $part)),
|
||||
(new Text('', dcCore::app()->formNonce())),
|
||||
dcCore::app()->formNonce(false),
|
||||
]),
|
||||
])->render();
|
||||
}
|
||||
@ -322,7 +324,7 @@ class Manage extends dcNsProcess
|
||||
(new Submit(['add']))->value(__('Save')),
|
||||
(new Hidden(['action'], 'savepasswords')),
|
||||
(new Hidden(['part'], $part)),
|
||||
(new Text('', dcCore::app()->formNonce())),
|
||||
dcCore::app()->formNonce(false),
|
||||
]),
|
||||
])->render();
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class Utils
|
||||
*/
|
||||
public static function cryptMethod(): string
|
||||
{
|
||||
return is_null(dcCore::app()->blog) ? '' : (string) dcCore::app()->blog->settings->get(My::id())->get('crypt');
|
||||
return !is_null(dcCore::app()->blog) && is_string(dcCore::app()->blog->settings->get(My::id())->get('crypt')) ? dcCore::app()->blog->settings->get(My::id())->get('crypt') : '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ class Utils
|
||||
*/
|
||||
public static function httpMessage(): string
|
||||
{
|
||||
return is_null(dcCore::app()->blog) ? '' : (string) dcCore::app()->blog->settings->get(My::id())->get('message');
|
||||
return !is_null(dcCore::app()->blog) && is_string(dcCore::app()->blog->settings->get(My::id())->get('message')) ? dcCore::app()->blog->settings->get(My::id())->get('message') : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user