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 dcAdmin;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use dcPage;
|
use dcPage;
|
||||||
|
use dcMenu;
|
||||||
use dcNsProcess;
|
use dcNsProcess;
|
||||||
|
|
||||||
class Backend extends dcNsProcess
|
class Backend extends dcNsProcess
|
||||||
@ -35,15 +36,17 @@ class Backend extends dcNsProcess
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add backend sidebar menu icon
|
// add backend sidebar menu icon
|
||||||
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
if ((dcCore::app()->menu[dcAdmin::MENU_PLUGINS] instanceof dcMenu)) {
|
||||||
My::name(),
|
dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem(
|
||||||
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
My::name(),
|
||||||
dcPage::getPF(My::id() . '/icon.png'),
|
dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
dcPage::getPF(My::id() . '/icon.png'),
|
||||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']),
|
||||||
My::PERMISSION,
|
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
||||||
]), dcCore::app()->blog->id)
|
My::PERMISSION,
|
||||||
);
|
]), dcCore::app()->blog->id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class Frontend extends dcNsProcess
|
|||||||
if (!$logs->isEmpty()) {
|
if (!$logs->isEmpty()) {
|
||||||
$ids = [];
|
$ids = [];
|
||||||
while ($logs->fetch()) {
|
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);
|
$logs = dcCore::app()->log->delLogs($ids);
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,10 @@ class Install extends dcNsProcess
|
|||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
if (defined('DC_CONTEXT_ADMIN')) {
|
||||||
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
$version = dcCore::app()->plugins->moduleInfo(My::id(), 'version');
|
||||||
|
static::$init = is_string($version) ? dcCore::app()->newVersion(My::id(), $version) : true;
|
||||||
|
}
|
||||||
|
|
||||||
return static::$init;
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ class Manage extends dcNsProcess
|
|||||||
(new Submit(['save']))->value(__('Save')),
|
(new Submit(['save']))->value(__('Save')),
|
||||||
(new Hidden(['action'], 'savesettings')),
|
(new Hidden(['action'], 'savesettings')),
|
||||||
(new Hidden(['part'], $part)),
|
(new Hidden(['part'], $part)),
|
||||||
(new Text('', dcCore::app()->formNonce())),
|
dcCore::app()->formNonce(false),
|
||||||
]),
|
]),
|
||||||
])->render();
|
])->render();
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ class Manage extends dcNsProcess
|
|||||||
(new Submit(['save']))->value(__('Clear logs')),
|
(new Submit(['save']))->value(__('Clear logs')),
|
||||||
(new Hidden(['action'], 'savelogins')),
|
(new Hidden(['action'], 'savelogins')),
|
||||||
(new Hidden(['part'], $part)),
|
(new Hidden(['part'], $part)),
|
||||||
(new Text('', dcCore::app()->formNonce())),
|
dcCore::app()->formNonce(false),
|
||||||
]),
|
]),
|
||||||
])->render() .
|
])->render() .
|
||||||
|
|
||||||
@ -246,10 +246,12 @@ class Manage extends dcNsProcess
|
|||||||
'</tr></thead<tbody>';
|
'</tr></thead<tbody>';
|
||||||
|
|
||||||
while ($logs->fetch()) {
|
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
|
echo
|
||||||
'<tr class="line">' .
|
'<tr class="line">' .
|
||||||
'<td class="nowrap maximal">' . Html::escapeHTML($logs->f('log_msg')) . '</td>' .
|
'<td class="nowrap maximal">' . Html::escapeHTML($msg) . '</td>' .
|
||||||
'<td class="nowrap count">' . Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $logs->f('log_dt'))) . '</td>' .
|
'<td class="nowrap count">' . Html::escapeHTML(Date::dt2str(__('%Y-%m-%d %H:%M'), $dt)) . '</td>' .
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +301,7 @@ class Manage extends dcNsProcess
|
|||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Hidden(['action'], 'savepasswords')),
|
(new Hidden(['action'], 'savepasswords')),
|
||||||
(new Hidden(['part'], $part)),
|
(new Hidden(['part'], $part)),
|
||||||
(new Text('', dcCore::app()->formNonce())),
|
dcCore::app()->formNonce(false),
|
||||||
]),
|
]),
|
||||||
])->render();
|
])->render();
|
||||||
}
|
}
|
||||||
@ -322,7 +324,7 @@ class Manage extends dcNsProcess
|
|||||||
(new Submit(['add']))->value(__('Save')),
|
(new Submit(['add']))->value(__('Save')),
|
||||||
(new Hidden(['action'], 'savepasswords')),
|
(new Hidden(['action'], 'savepasswords')),
|
||||||
(new Hidden(['part'], $part)),
|
(new Hidden(['part'], $part)),
|
||||||
(new Text('', dcCore::app()->formNonce())),
|
dcCore::app()->formNonce(false),
|
||||||
]),
|
]),
|
||||||
])->render();
|
])->render();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ class Utils
|
|||||||
*/
|
*/
|
||||||
public static function cryptMethod(): string
|
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
|
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