auth->makePermissions([ dcAuth::PERMISSION_ADMIN, ])); $s = dcCore::app()->blog->settings->get(basename(__dir__)); $action = $_REQUEST['action'] ?? null; $order_combo = [ __('Ascending') => 'asc', __('Descending') => 'desc', ]; if ($action == 'saveconfig') { try { if (empty($_POST['comliste_page_title'])) { throw new Exception(__('No page title.')); } $s->put('enable', !empty($_POST['comliste_enable'])); $s->put('comliste_page_title', $_POST['comliste_page_title']); $s->put('comliste_nb_comments_per_page', $_POST['comliste_nb_comments_per_page'] ?? 10); $s->put('comliste_comments_order', $_POST['comliste_comments_order'] == 'asc' ? 'asc' : 'desc'); dcCore::app()->blog->triggerBlog(); dcAdminNotices::addSuccessNotice( __('Configuration successfully updated.') ); dcCore::app()->adminurl->redirect( 'admin.plugin.' . basename(__DIR__) ); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } echo ' ' . __('Comments list') . '' . dcPage::breadcrumb([ html::escapeHTML(dcCore::app()->blog->name) => '', __('Comments list') => '', ]) . dcPage::notices() . '
' . '

' . __('Plugin activation') . '

' . '

' . '
' . '

' . __('General options') . '

' . '

' . form::field('comliste_page_title', 30, 255, (string) $s->get('page_title')) . '

' . '

' . form::number('comliste_nb_comments_per_page', ['min' => 0, 'max' => 99, 'default' => (int) $s->get('nb_comments_per_page')]) . '

' . '

' . form::combo('comliste_comments_order', $order_combo, $s->get('comments_order') == 'asc' ? 'asc' : 'desc') . '

' . '

' . form::hidden(['action'], 'saveconfig') . dcCore::app()->formNonce() . '

'; dcPage::helpBlock('comListe'); echo '';