Compare commits

..

No commits in common. "5e7765d39576b20a4ad6566d0b91b481f41473cc" and "742692f9dbcf41c1851fd1e2c5f3db4f6bcc1ce9" have entirely different histories.

9 changed files with 53 additions and 34 deletions

View File

@ -1,11 +1,4 @@
simplyFavicon 2023.10.20 simplyFavicon 2023.10.13
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Fix use of interface
* Use default permissions
simplyFavicon 2023.10.14
=========================================================== ===========================================================
* Require Dotclear 2.28 * Require Dotclear 2.28
* Require PHP 8.1 * Require PHP 8.1

View File

@ -1,14 +1,14 @@
# README # README
[![Release](https://img.shields.io/badge/release-2023.10.20-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/simplyFavicon/releases) [![Release](https://img.shields.io/badge/release-2023.10.13-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/simplyFavicon/releases)
![Date](https://img.shields.io/badge/date-2023.10.20-c44d58.svg) ![Date](https://img.shields.io/badge/date-2023.10.13-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download) [![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/simplyFavicon) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/simplyFavicon)
[![License](https://img.shields.io/github/license/JcDenis/simplyFavicon)](https://git.dotclear.watch/JcDenis/simplyFavicon/blob/master/LICENSE) [![License](https://img.shields.io/github/license/JcDenis/simplyFavicon)](https://git.dotclear.watch/JcDenis/simplyFavicon/blob/master/LICENSE)
## ABOUT ## ABOUT
_simplyFavicon_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org). _pacKman_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
> Add a favicon to your blog. > Add a favicon to your blog.
@ -17,7 +17,7 @@ _simplyFavicon_ is a plugin for the open-source web publishing software called [
* Dotclear 2.28 * Dotclear 2.28
* PHP 8.1+ * PHP 8.1+
* A readable public directory * A readable public directory
* Dotclear admin permissions * Administrator permissions
## USAGE ## USAGE

View File

@ -1,5 +1,16 @@
<?php <?php
/** /**
* @brief simplyFavicon, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
/*
* @file * @file
* @brief The simplyFavicon pacKman definition * @brief The simplyFavicon pacKman definition
* @ingroup simplyFavicon * @ingroup simplyFavicon
@ -17,11 +28,13 @@ $this->registerModule(
'Simply favicon', 'Simply favicon',
'Multi-agents favicon', 'Multi-agents favicon',
'Jean-Christian Denis', 'Jean-Christian Denis',
'2023.10.20', '2023.08.13',
[ [
'requires' => [['core', '2.28']], 'requires' => [['core', '2.28']],
'permissions' => 'My', 'permissions' => 'My',
'settings' => ['blog' => '#params.' . basename(__DIR__) . '_params'], 'settings' => [
'blog' => '#params.' . basename(__DIR__) . '_params',
],
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues', 'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md', 'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',

View File

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="simplyFavicon"> <module id="simplyFavicon">
<name>Simply favicon</name> <name>Simply favicon</name>
<version>2023.10.20</version> <version>2023.10.13</version>
<author>Jean-Christian Denis</author> <author>Jean-Christian Denis</author>
<desc>Multi-agents favicon</desc> <desc>Multi-agents favicon</desc>
<file>https://git.dotclear.watch/JcDenis/simplyFavicon/releases/download/v2023.10.20/plugin-simplyFavicon.zip</file> <file>https://git.dotclear.watch/JcDenis/simplyFavicon/releases/download/v2023.10.13/plugin-simplyFavicon.zip</file>
<da:dcmin>2.28</da:dcmin> <da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/simplyFavicon/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/simplyFavicon/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/simplyFavicon/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/simplyFavicon/issues</da:support>

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Dotclear\Plugin\simplyFavicon; namespace Dotclear\Plugin\simplyFavicon;
use Dotclear\App; use Dotclear\App;
use Dotclear\Core\BlogSettings;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Helper\File\Path; use Dotclear\Helper\File\Path;
use Dotclear\Helper\Html\Form\{ use Dotclear\Helper\Html\Form\{
@ -14,7 +15,6 @@ use Dotclear\Helper\Html\Form\{
Note, Note,
Para Para
}; };
use Dotclear\Interface\Core\BlogSettingsInterface;
/** /**
* @brief simplyFavicon backend class. * @brief simplyFavicon backend class.
@ -37,7 +37,7 @@ class Backend extends Process
} }
App::behavior()->addBehaviors([ App::behavior()->addBehaviors([
'adminBlogPreferencesFormV2' => function (BlogSettingsInterface $blog_settings): void { 'adminBlogPreferencesFormV2' => function (BlogSettings $blog_settings): void {
if (!App::blog()->isDefined()) { if (!App::blog()->isDefined()) {
return; return;
} }
@ -78,7 +78,7 @@ class Backend extends Process
) . ) .
'</div></div><br class="clear" /></div>'; '</div></div><br class="clear" /></div>';
}, },
'adminBeforeBlogSettingsUpdate' => function (BlogSettingsInterface $blog_settings): void { 'adminBeforeBlogSettingsUpdate' => function (BlogSettings $blog_settings): void {
$blog_settings->get('system')->put('simply_favicon', !empty($_POST['simply_favicon'])); $blog_settings->get('system')->put('simply_favicon', !empty($_POST['simply_favicon']));
}, },
]); ]);

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Dotclear\Plugin\simplyFavicon; namespace Dotclear\Plugin\simplyFavicon;
use Dotclear\App;
use Dotclear\Module\MyPlugin; use Dotclear\Module\MyPlugin;
/** /**
@ -15,5 +16,17 @@ use Dotclear\Module\MyPlugin;
*/ */
class My extends MyPlugin class My extends MyPlugin
{ {
// Use default permissions protected static function checkCustomContext(int $context): ?bool
{
return match ($context) {
// Limit BACKEND to admin
self::BACKEND => App::task()->checkContext('BACKEND')
&& App::blog()->isDefined()
&& App::auth()->check(App::auth()->makePermissions([
App::auth()::PERMISSION_ADMIN,
]), App::blog()->id()),
default => null,
};
}
} }