diff --git a/src/Backend.php b/src/Backend.php index 24bf31f..a4eb76f 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -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; } diff --git a/src/Frontend.php b/src/Frontend.php index 57d07ab..650496a 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -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); } diff --git a/src/Install.php b/src/Install.php index cd47085..11f9c56 100644 --- a/src/Install.php +++ b/src/Install.php @@ -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; } diff --git a/src/Manage.php b/src/Manage.php index 3186d54..97692a1 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -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 ''; 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 '