From e5790dfa23285e3816d54aaf66ae8d03f79a7445 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Fri, 20 Oct 2023 23:06:17 +0200 Subject: [PATCH] cosmetic --- CHANGELOG.md | 6 ++++++ README.md | 10 +++++----- _define.php | 14 +++++++------- dcstore.xml | 4 ++-- src/Backend.php | 5 ++--- src/My.php | 24 ++++++++++++------------ 6 files changed, 34 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89ee8ce..f04c2c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +tinyPacker 1.4.2 - 2023.10.20 +=========================================================== +* Require Dotclear 2.28 +* Require PHP 8.1+ +* Code review + tinyPacker 1.4.1 - 2023.10.09 =========================================================== * Require Dotclear 2.28 diff --git a/README.md b/README.md index c595624..669338b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # README -[![Release](https://img.shields.io/badge/release-1.4.1-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/tinyPacker/releases) -![Date](https://img.shields.io/badge/date-2023.10.07-c44d58.svg) +[![Release](https://img.shields.io/badge/release-1.4.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/tinyPacker/releases) +![Date](https://img.shields.io/badge/date-2023.10.20-c44d58.svg) [![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/tinyPacker) [![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/tinyPacker/src/branch/master/LICENSE) @@ -16,8 +16,8 @@ _tinyPacker_ is a plugin for the open-source web publishing software called [Dot * Dotclear 2.28 * PHP 8.1+ -* Super administrator permissions -* A writable public directory. +* System writable public directory +* Dotlear super admin permissions ## USAGE @@ -37,6 +37,6 @@ and it's pack into current blog public directory. ## CONTRIBUTORS -* Jean-Christian Denis +* Jean-Christian Denis (author) You are welcome to contribute to this code. diff --git a/_define.php b/_define.php index 58fa8bc..5e34507 100644 --- a/_define.php +++ b/_define.php @@ -9,7 +9,6 @@ * Quick pack theme or plugin into public dir. * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ declare(strict_types=1); @@ -18,12 +17,13 @@ $this->registerModule( 'Tiny packer', 'Quick pack theme or plugin into public dir', 'Jean-Christian Denis', - '1.4.1', + '1.4.2', [ - 'requires' => [['core', '2.28']], - 'type' => 'plugin', - 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', - 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', - 'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml', + 'requires' => [['core', '2.28']], + 'permissions' => 'My', + 'type' => 'plugin', + 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', + 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', + 'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml', ] ); diff --git a/dcstore.xml b/dcstore.xml index 92158c5..27173b8 100644 --- a/dcstore.xml +++ b/dcstore.xml @@ -2,10 +2,10 @@ Tiny packer - 1.4.1 + 1.4.2 Jean-Christian Denis Quick pack theme or plugin into public dir - https://git.dotclear.watch/JcDenis/tinyPacker/releases/download/v1.4.1/plugin-tinyPacker.zip + https://git.dotclear.watch/JcDenis/tinyPacker/releases/download/v1.4.2/plugin-tinyPacker.zip 2.28 https://git.dotclear.watch/JcDenis/tinyPacker/src/branch/master/README.md https://git.dotclear.watch/JcDenis/tinyPacker/issues diff --git a/src/Backend.php b/src/Backend.php index 1dd9d04..f3d6d06 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -23,7 +23,6 @@ use Exception; * Add action and button to modules lists. * * @author Jean-Christian Denis - * @copyright Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class Backend extends Process @@ -69,7 +68,7 @@ class Backend extends Process $modules = array_keys($_POST[My::id()]); $id = $modules[0]; - $module = $list->modules->getDefine($id); + $module = $list->modules->getDefine((string) $id); if (!$module->isDefined()) { throw new Exception(__('No such module.')); } @@ -93,7 +92,7 @@ class Backend extends Process )); } - $zip->addDirectory((string) Path::real($module->get('root')), $id, true); + $zip->addDirectory((string) Path::real($module->get('root')), (string) $id, true); $zip->write(); $zip->close(); unset($zip, $fp); diff --git a/src/My.php b/src/My.php index a703a3a..9f8bb0c 100644 --- a/src/My.php +++ b/src/My.php @@ -1,15 +1,5 @@ checkContext('BACKEND') && App::auth()->isSuperAdmin(); + return match ($context) { + self::MODULE => App::task()->checkContext('BACKEND') && App::auth()->isSuperAdmin(), + default => null, + }; } }