diff --git a/src/BackendBehaviors.php b/src/BackendBehaviors.php index 59058a7..24bfd93 100644 --- a/src/BackendBehaviors.php +++ b/src/BackendBehaviors.php @@ -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 - '
'; + (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 - ''; + (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(); }