diff --git a/_define.php b/_define.php index 4fdb29c..02894b2 100644 --- a/_define.php +++ b/_define.php @@ -10,7 +10,7 @@ * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ -if (!defined('DC_RC_PATH')) { +if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) { return null; } @@ -22,7 +22,7 @@ $this->registerModule( [ 'requires' => [['core', '2.26']], 'permissions' => dcCore::app()->auth->makePermissions([ - dcAuth::PERMISSION_ADMIN, + dcCore::app()->auth::PERMISSION_ADMIN, ]), 'type' => 'plugin', 'support' => 'http://forum.dotclear.org/viewtopic.php?pid=321044#p321044', diff --git a/src/Widgets.php b/src/Widgets.php index 81710a9..2748add 100644 --- a/src/Widgets.php +++ b/src/Widgets.php @@ -43,7 +43,12 @@ class Widgets public static function parseWidget(WidgetsElement $w): string { - if ($w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) { + // nullsafe + if (is_null(dcCore::app()->blog)) { + return ''; + } + + if ($w->__get('offline') || !$w->checkHomeOnly(dcCore::app()->url->type)) { return ''; } @@ -60,7 +65,7 @@ class Widgets $posts = []; while ($rs->fetch()) { $posts[Date::dt2str(__('%Y'), $rs->f('dt'))][] = [ - 'url' => $rs->url(), + 'url' => $rs->__call('url', []), 'date' => Html::escapeHTML(Date::dt2str(__('%B'), $rs->f('dt'))), 'nbpost' => $rs->f('nb_post'), ]; @@ -77,23 +82,23 @@ class Widgets $res .= '' . $annee . '