This commit is contained in:
Jean-Christian Paul Denis 2023-04-16 15:49:26 +02:00
parent df4ce849f5
commit fef508d329
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 13 additions and 7 deletions

View File

@ -41,7 +41,7 @@ class Backend extends dcNsProcess
dcCore::app()->adminurl?->get('admin.plugin.' . My::id()), dcCore::app()->adminurl?->get('admin.plugin.' . My::id()),
dcPage::getPF(My::id() . '/icon.svg'), dcPage::getPF(My::id() . '/icon.svg'),
preg_match( preg_match(
'/' . preg_quote(dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) . '(&.*)?$/', '/' . preg_quote((string) dcCore::app()->adminurl?->get('admin.plugin.' . My::id())) . '(&.*)?$/',
$_SERVER['REQUEST_URI'] $_SERVER['REQUEST_URI']
), ),
dcCore::app()->auth?->isSuperAdmin() dcCore::app()->auth?->isSuperAdmin()

View File

@ -26,7 +26,8 @@ use Dotclear\Helper\Html\Form\{
Note, Note,
Para, Para,
Select, Select,
Submit Submit,
Text
}; };
use Dotclear\Helper\Html\Html; use Dotclear\Helper\Html\Html;
use Exception; use Exception;
@ -50,6 +51,10 @@ class Manage extends dcNsProcess
$vars = ManageVars::init(); $vars = ManageVars::init();
if (null === $vars->cleaner) {
return true;
}
if (!empty($_POST['option-action'])) { if (!empty($_POST['option-action'])) {
dcCore::app()->blog?->settings->get(My::id())->dropEvery( dcCore::app()->blog?->settings->get(My::id())->dropEvery(
'dcproperty_hide' 'dcproperty_hide'
@ -65,19 +70,19 @@ class Manage extends dcNsProcess
dcPage::addSuccessNotice(__('Configuration successfuly updated')); dcPage::addSuccessNotice(__('Configuration successfuly updated'));
dcCore::app()->adminurl?->redirect( dcCore::app()->adminurl?->redirect(
'admin.plugin.' . My::id(), 'admin.plugin.' . My::id(),
['part' => $vars->cleaner?->id] ['part' => $vars->cleaner->id]
); );
} }
if (!empty($vars->entries) && !empty($vars->action)) { if (!empty($vars->entries) && !empty($vars->action)) {
try { try {
foreach ($vars->entries as $ns) { foreach ($vars->entries as $ns) {
$vars->cleaners->execute($vars->cleaner?->id, $vars->action, $ns); $vars->cleaners->execute($vars->cleaner->id, $vars->action, $ns);
} }
dcPage::addSuccessNotice(__('Action successfuly excecuted')); dcPage::addSuccessNotice(__('Action successfuly excecuted'));
dcCore::app()->adminurl?->redirect( dcCore::app()->adminurl?->redirect(
'admin.plugin.' . My::id(), 'admin.plugin.' . My::id(),
['part' => $vars->cleaner?->id] ['part' => $vars->cleaner->id]
); );
} catch (Exception $e) { } catch (Exception $e) {
dcCore::app()->error->add($e->getMessage()); dcCore::app()->error->add($e->getMessage());
@ -111,7 +116,8 @@ class Manage extends dcNsProcess
]) . ]) .
dcPage::notices(); dcPage::notices();
if ($vars->cleaner === null) { if (null === $vars->cleaner) {
echo (new Text('p', __('There is nothing to display')))->class('error')->render();
dcPage::closeModule(); dcPage::closeModule();
return; return;
@ -132,7 +138,7 @@ class Manage extends dcNsProcess
$rs = $vars->cleaner->values(); $rs = $vars->cleaner->values();
if (empty($rs)) { if (empty($rs)) {
echo '<p>' . __('There is nothing to display') . '</p>'; echo (new Text('p', __('There is nothing to display')))->class('error')->render();
} else { } else {
$combo_actions = []; $combo_actions = [];
foreach ($vars->cleaner->actions as $descriptor) { foreach ($vars->cleaner->actions as $descriptor) {