diff --git a/src/Backend.php b/src/Backend.php index 7bd18a9..3d211ec 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -40,7 +40,7 @@ class Backend extends dcNsProcess dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (dcFavorites $favs): void { $favs->register(My::id(), [ 'title' => My::name(), - 'url' => dcCore::app()->adminurl->get('admin.plugin.' . My::id(), [], '#packman-repository-repository'), + 'url' => dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), [], '#packman-repository-repository'), 'small-icon' => [dcPage::getPF(My::id() . '/icon.svg'), dcPage::getPF(My::id() . '/icon-dark.svg')], 'large-icon' => [dcPage::getPF(My::id() . '/icon.svg'), dcPage::getPF(My::id() . '/icon-dark.svg')], //'permissions' => dcCore::app()->auth->isSuperAdmin(), @@ -49,10 +49,10 @@ class Backend extends dcNsProcess dcCore::app()->menu[dcAdmin::MENU_PLUGINS]->addItem( My::name(), - dcCore::app()->adminurl->get('admin.plugin.' . My::id()) . '#packman-repository-repository', + dcCore::app()->adminurl?->get('admin.plugin.' . My::id()) . '#packman-repository-repository', [dcPage::getPF(My::id() . '/icon.svg'), dcPage::getPF(My::id() . '/icon-dark.svg')], - preg_match('/' . preg_quote(dcCore::app()->adminurl->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']), - dcCore::app()->auth->isSuperAdmin() + preg_match('/' . preg_quote((string) dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) . '(&.*)?$/', $_SERVER['REQUEST_URI']), + dcCore::app()->auth?->isSuperAdmin() ); return true; diff --git a/src/Config.php b/src/Config.php index 8dec66c..ed78a29 100644 --- a/src/Config.php +++ b/src/Config.php @@ -61,7 +61,7 @@ class Config extends dcNsProcess dcPage::addSuccessNotice( __('Configuration has been successfully updated.') ); - dcCore::app()->adminurl->redirect('admin.plugins', [ + dcCore::app()->adminurl?->redirect('admin.plugins', [ 'module' => My::id(), 'conf' => '1', 'redir' => dcCore::app()->admin->__get('list')->getRedir(), @@ -87,12 +87,13 @@ class Config extends dcNsProcess $img_on = sprintf($img, __('writable'), 'check-on.png'); $img_off = sprintf($img, __('not writable'), 'check-off.png'); - $check_repo = Utils::is_writable(Utils::getRepositoryDir($s->pack_repository), '_.zip') ? $img_on : $img_off; - $check_first = !empty($s->pack_filename) && Utils::is_writable(Utils::getRepositoryDir($repo), $s->pack_filename) ? $img_on : $img_off; - $check_second = !empty($s->secondpack_filename) && Utils::is_writable(Utils::getRepositoryDir($repo), $s->secondpack_filename) ? $img_on : $img_off; + $repo = Utils::getRepositoryDir($s->pack_repository); + $check_repo = Utils::is_writable($repo, '_.zip') ? $img_on : $img_off; + $check_first = !empty($s->pack_filename) && Utils::is_writable($repo, $s->pack_filename) ? $img_on : $img_off; + $check_second = !empty($s->secondpack_filename) && Utils::is_writable($repo, $s->secondpack_filename) ? $img_on : $img_off; $is_configured = Utils::is_configured( - Utils::getRepositoryDir($s->pack_repository), + $repo, $s->pack_filename, $s->secondpack_filename ); @@ -117,7 +118,7 @@ class Config extends dcNsProcess (new Note())->class('form-note')->text( sprintf( __('Preconization: %s'), - dcCore::app()->blog->public_path ? + dcCore::app()->blog?->public_path ? dcCore::app()->blog->public_path : __("Blog's public directory") ) . ' ' . __('Leave it empty to use Dotclear VAR directory') ), diff --git a/src/Core.php b/src/Core.php index c558775..7372c3b 100644 --- a/src/Core.php +++ b/src/Core.php @@ -164,7 +164,7 @@ class Core $zip->addExclusion($e); } $zip->addDirectory( - path::real($info['root']), + (string) path::real($info['root'], false), $info['id'], true ); diff --git a/src/Manage.php b/src/Manage.php index 802deb9..42e72e7 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -52,7 +52,7 @@ class Manage extends dcNsProcess # Modules if (!(dcCore::app()->themes instanceof dcThemes)) { dcCore::app()->themes = new dcThemes(); - dcCore::app()->themes->loadModules(dcCore::app()->blog->themes_path, null); + dcCore::app()->themes->loadModules((string) dcCore::app()->blog?->themes_path, null); } $themes = dcCore::app()->themes; $plugins = dcCore::app()->plugins; @@ -113,7 +113,7 @@ class Manage extends dcNsProcess if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { - dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), [], '#packman-' . $type); + dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-' . $type); } # Pack @@ -151,7 +151,7 @@ class Manage extends dcNsProcess if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { - dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), [], '#packman-' . $type); + dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-' . $type); } # Delete @@ -176,7 +176,7 @@ class Manage extends dcNsProcess if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { - dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type); + dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type); } # Install @@ -203,7 +203,7 @@ class Manage extends dcNsProcess if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { - dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type); + dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type); } # Copy @@ -229,7 +229,7 @@ class Manage extends dcNsProcess if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { - dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type); + dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type); } # Move @@ -256,7 +256,7 @@ class Manage extends dcNsProcess if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { - dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type); + dcCore::app()->adminurl?->redirect('admin.plugin.' . My::id(), [], '#packman-repository-' . $type); } } } catch (Exception $e) { @@ -302,7 +302,7 @@ class Manage extends dcNsProcess if (dcCore::app()->error->flag() || !$is_configured) { echo '