use Dotclear Helper

master
Jean-Christian Paul Denis 2023-04-08 10:23:01 +02:00
parent be8b30af29
commit 1d1156d438
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 37 additions and 25 deletions

View File

@ -19,9 +19,15 @@ use dcBlog;
use dcCore;
use dcPage;
use dcPostsActions;
use Dotclear\Helper\Html\Form\{
Form,
Hidden,
Para,
Submit,
Text
};
use Dotclear\Helper\Html\Html;
use Exception;
use form;
use html;
class BackendBehaviors
{
@ -50,23 +56,26 @@ class BackendBehaviors
if (empty($_POST['confirmdeletecomments'])) {
$pa->beginPage(
dcPage::breadcrumb([
html::escapeHTML(dcCore::app()->blog->name) => '',
Html::escapeHTML(dcCore::app()->blog->name) => '',
$pa->getCallerTitle() => $pa->getRedirection(true),
__('Delete posts comments') => '',
])
);
echo
'<form action="' . $pa->getURI() . '" method="post">' .
$pa->getCheckboxes() .
'<p>' . __('Are you sure you want to delete all comments?') . '</p>' .
'<p>' .
dcCore::app()->formNonce() .
$pa->getHiddenFields() .
form::hidden(['action'], 'commentsdelete') .
form::hidden(['confirmdeletecomments'], 1) .
'<input type="submit" value="' . __('yes') . '" /></p>' .
'</form>';
(new Form('plocd'))->method('post')->action($pa->getURI())->fields([
(new Text('', $pa->getCheckboxes())),
(new Text('p', __('Are you sure you want to delete all comments?'))),
(new Para())->items(array_merge(
[
(new Submit(['do']))->value(__('yes')),
dcCore::app()->formNonce(false),
(new Hidden(['action'], 'commentsdelete')),
(new Hidden(['confirmdeletecomments'], '1')),
],
$pa->hiddenFields(),
)),
])->render();
$pa->endPage();
} else {
@ -104,23 +113,26 @@ class BackendBehaviors
if (empty($_POST['confirmdeletetrackbacks'])) {
$pa->beginPage(
dcPage::breadcrumb([
html::escapeHTML(dcCore::app()->blog->name) => '',
Html::escapeHTML(dcCore::app()->blog->name) => '',
$pa->getCallerTitle() => $pa->getRedirection(true),
__('Delete posts trackbacks') => '',
])
);
echo
'<form action="' . $pa->getURI() . '" method="post">' .
$pa->getCheckboxes() .
'<p>' . __('Are you sure you want to delete all trackbacks?') . '</p>' .
'<p>' .
dcCore::app()->formNonce() .
$pa->getHiddenFields() .
form::hidden(['action'], 'trackbacksdelete') .
form::hidden(['confirmdeletetrackbacks'], 1) .
'<input type="submit" value="' . __('yes') . '" /></p>' .
'</form>';
(new Form('plotd'))->method('post')->action($pa->getURI())->fields([
(new Text('', $pa->getCheckboxes())),
(new Text('p', __('Are you sure you want to delete all trackbacks?'))),
(new Para())->items(array_merge(
[
(new Submit(['do']))->value(__('yes')),
dcCore::app()->formNonce(false),
(new Hidden(['action'], 'trackbacksdelete')),
(new Hidden(['confirmdeletetrackbacks'], '1')),
],
$pa->hiddenFields(),
)),
])->render();
$pa->endPage();
} else {
@ -153,7 +165,7 @@ class BackendBehaviors
$cur->update(
'WHERE post_id = ' . $id . ' ' .
"AND blog_id = '" . dcCore::app()->con->escape(dcCore::app()->blog->id) . "' "
"AND blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog->id) . "' "
);
dcCore::app()->blog->triggerBlog();
}