use Dotclear Helper

This commit is contained in:
Jean-Christian Paul Denis 2023-03-27 23:47:12 +02:00
parent de3f675e33
commit de2becbe4e
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -18,10 +18,10 @@ use dcAuth;
use dcCore; use dcCore;
use dcNsProcess; use dcNsProcess;
use dcPage; use dcPage;
use Dotclear\Helper\Html\Form\Input;
use Dotclear\Helper\Html\Html;
use Dotclear\Helper\Text;
use Exception; use Exception;
use form;
use html;
use text;
/** /**
* Manage contributions list * Manage contributions list
@ -31,7 +31,7 @@ class Manage extends dcNsProcess
public static function init(): bool public static function init(): bool
{ {
static::$init = defined('DC_CONTEXT_ADMIN') static::$init = defined('DC_CONTEXT_ADMIN')
&& dcCore:app()->auth->check( && dcCore::app()->auth->check(
dcCore::app()->auth->makePermissions([ dcCore::app()->auth->makePermissions([
dcAuth::PERMISSION_CONTENT_ADMIN, dcAuth::PERMISSION_CONTENT_ADMIN,
]), dcCore::app()->blog->id ]), dcCore::app()->blog->id
@ -51,19 +51,19 @@ class Manage extends dcNsProcess
if (!empty($_POST['handlers']) && is_array($_POST['handlers'])) { if (!empty($_POST['handlers']) && is_array($_POST['handlers'])) {
foreach ($_POST['handlers'] as $name => $url) { foreach ($_POST['handlers'] as $name => $url) {
$url = text::tidyURL($url); $url = Text::tidyURL($url);
if (empty($handlers[$name])) { if (empty($handlers[$name])) {
throw new Exception(sprintf( throw new Exception(sprintf(
__('Uknown handler "%s".'), __('Uknown handler "%s".'),
html::escapeHTML($name) Html::escapeHTML($name)
)); ));
} }
if (empty($url)) { if (empty($url)) {
throw new Exception(sprintf( throw new Exception(sprintf(
__('Invalid URL for handler "%s".'), __('Invalid URL for handler "%s".'),
html::escapeHTML($name) Html::escapeHTML($name)
)); ));
} }
@ -127,7 +127,7 @@ class Manage extends dcNsProcess
echo echo
dcPage::breadcrumb( dcPage::breadcrumb(
[ [
html::escapeHTML(dcCore::app()->blog->name) => '', Html::escapeHTML(dcCore::app()->blog->name) => '',
My::name() => '', My::name() => '',
] ]
) . ) .
@ -153,9 +153,9 @@ class Manage extends dcNsProcess
foreach ($handlers as $name => $url) { foreach ($handlers as $name => $url) {
echo echo
'<tr class="line">' . '<tr class="line">' .
'<td class="nowrap minimal">' . html::escapeHTML($name) . '</td>' . '<td class="nowrap minimal">' . Html::escapeHTML($name) . '</td>' .
'<td>' . '<td>' .
form::field(['handlers[' . $name . ']'], 20, 255, html::escapeHTML($url)) . (new Input(['handlers[' . $name . ']']))->size(20)->maxlenght(255)->value(Html::escapeHTML($url))->render() .
'</td>' . '</td>' .
'</tr>'; '</tr>';
} }