use Dotclear Helper

This commit is contained in:
Jean-Christian Paul Denis 2023-04-08 10:23:01 +02:00
parent be8b30af29
commit 1d1156d438
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

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