Dotclear

source: plugins/blogroll/edit.php @ 3898:a9b1e7de8211

Revision 3898:a9b1e7de8211, 9.4 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

Add spellcheck="true" attribute on input/textarea

RevLine 
[0]1<?php
[3731]2/**
3 * @brief blogroll, a plugin for Dotclear 2
4 *
5 * @package Dotclear
6 * @subpackage Plugins
7 *
8 * @copyright Olivier Meunier & Association Dotclear
9 * @copyright GPL-2.0-only
10 */
11
[3725]12if (!defined('DC_CONTEXT_ADMIN')) {return;}
[0]13
[3297]14$id = html::escapeHTML($_REQUEST['id']);
[0]15
16try {
[3725]17    $rs = $blogroll->getLink($id);
[0]18} catch (Exception $e) {
[3725]19    $core->error->add($e->getMessage());
[0]20}
21
22if (!$core->error->flag() && $rs->isEmpty()) {
[3725]23    $core->error->add(__('No such link or title'));
[0]24} else {
[3725]25    $link_title = $rs->link_title;
26    $link_href  = $rs->link_href;
27    $link_desc  = $rs->link_desc;
28    $link_lang  = $rs->link_lang;
29    $link_xfn   = $rs->link_xfn;
[0]30}
31
32# Update a link
[3725]33if (isset($rs) && !$rs->is_cat && !empty($_POST['edit_link'])) {
34    $link_title = html::escapeHTML($_POST['link_title']);
35    $link_href  = html::escapeHTML($_POST['link_href']);
36    $link_desc  = html::escapeHTML($_POST['link_desc']);
37    $link_lang  = html::escapeHTML($_POST['link_lang']);
[2566]38
[3725]39    $link_xfn = '';
[2566]40
[3725]41    if (!empty($_POST['identity'])) {
42        $link_xfn .= $_POST['identity'];
43    } else {
44        if (!empty($_POST['friendship'])) {
45            $link_xfn .= ' ' . $_POST['friendship'];
46        }
47        if (!empty($_POST['physical'])) {
48            $link_xfn .= ' met';
49        }
50        if (!empty($_POST['professional'])) {
51            $link_xfn .= ' ' . implode(' ', $_POST['professional']);
52        }
53        if (!empty($_POST['geographical'])) {
54            $link_xfn .= ' ' . $_POST['geographical'];
55        }
56        if (!empty($_POST['family'])) {
57            $link_xfn .= ' ' . $_POST['family'];
58        }
59        if (!empty($_POST['romantic'])) {
60            $link_xfn .= ' ' . implode(' ', $_POST['romantic']);
61        }
62    }
[2566]63
[3725]64    try {
65        $blogroll->updateLink($id, $link_title, $link_href, $link_desc, $link_lang, trim($link_xfn));
66        dcPage::addSuccessNotice(__('Link has been successfully updated'));
67        http::redirect($p_url . '&edit=1&id=' . $id);
68    } catch (Exception $e) {
69        $core->error->add($e->getMessage());
70    }
[0]71}
72
[3725]73# Update a category
74if (isset($rs) && $rs->is_cat && !empty($_POST['edit_cat'])) {
75    $link_desc = html::escapeHTML($_POST['link_desc']);
[0]76
[3725]77    try {
78        $blogroll->updateCategory($id, $link_desc);
79        dcPage::addSuccessNotice(__('Category has been successfully updated'));
80        http::redirect($p_url . '&edit=1&id=' . $id);
81    } catch (Exception $e) {
82        $core->error->add($e->getMessage());
83    }
[0]84}
85
[3817]86# Languages combo
[3874]87$links      = $blogroll->getLangs(['order' => 'asc']);
[3817]88$lang_combo = dcAdminCombos::getLangsCombo($links, true);
89
[0]90?>
91<html>
92<head>
93  <title>Blogroll</title>
94</head>
95
96<body>
[1339]97<?php
[3725]98echo dcPage::breadcrumb(
[3874]99    [
[3725]100        html::escapeHTML($core->blog->name) => '',
101        __('Blogroll')                      => $p_url
[3874]102    ]) .
[3725]103dcPage::notices();
[1339]104?>
105
[3725]106<?php echo '<p><a class="back" href="' . $p_url . '">' . __('Return to blogroll') . '</a></p>'; ?>
[0]107
108<?php
[3725]109if (isset($rs) && $rs->is_cat) {
110    echo
111    '<form action="' . $p_url . '" method="post">' .
112    '<h3>' . __('Edit category') . '</h3>' .
[2566]113
[3725]114    '<p><label for="link_desc" class="required classic"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Title:') . '</label> ' .
[3874]115    form::field('link_desc', 30, 255, [
[3725]116        'default'    => html::escapeHTML($link_desc),
[3898]117        'extra_html' => 'required placeholder="' . __('Title') . '" lang="' . $core->auth->getInfo('user_lang') . '" spellcheck="true"'
[3874]118    ]) .
[2566]119
[3725]120    form::hidden('edit', 1) .
121    form::hidden('id', $id) .
122    $core->formNonce() .
123    '<input type="submit" name="edit_cat" value="' . __('Save') . '"/></p>' .
124        '</form>';
[0]125}
[3725]126if (isset($rs) && !$rs->is_cat) {
[2256]127
[3725]128    echo
129    '<form action="' . $core->adminurl->get('admin.plugin') . '" method="post" class="two-cols fieldset">' .
[1454]130
[3725]131    '<div class="col30 first-col">' .
132    '<h3>' . __('Edit link') . '</h3>' .
[2566]133
[3725]134    '<p><label for="link_title" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Title:') . '</label> ' .
[3874]135    form::field('link_title', 30, 255, [
[3725]136        'default'    => html::escapeHTML($link_title),
[3898]137        'extra_html' => 'required placeholder="' . __('Title') . '" lang="' . $core->auth->getInfo('user_lang') . '" spellcheck="true"'
[3874]138    ]) .
[3725]139    '</p>' .
[2566]140
[3725]141    '<p><label for="link_href" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('URL:') . '</label> ' .
[3874]142    form::url('link_href', [
[3725]143        'size'       => 30,
144        'default'    => html::escapeHTML($link_href),
145        'extra_html' => 'required placeholder="' . __('URL') . '"'
[3874]146    ]) .
[3725]147    '</p>' .
[2566]148
[3725]149    '<p><label for="link_desc">' . __('Description:') . '</label> ' .
[3898]150    form::field('link_desc', 30, 255,
151        [
152            'default'    => html::escapeHTML($link_desc),
153            'extra_html' => 'lang="' . $core->auth->getInfo('user_lang') . '" spellcheck="true"'
154        ]) . '</p>' .
[2566]155
[3725]156    '<p><label for="link_lang">' . __('Language:') . '</label> ' .
[3817]157    form::combo('link_lang', $lang_combo, $link_lang) .
158    '</p>' .
159
[3725]160    '</div>' .
[2566]161
[3725]162    # XFN nightmare
163    '<div class="col70 last-col">' .
164    '<h3>' . __('XFN information') . '</h3>' .
[3817]165    '<p class="clear form-note">' . __('More information on <a href="https://en.wikipedia.org/wiki/XHTML_Friends_Network">Wikipedia</a> website') . '</p>' .
166
[3725]167    '<div class="table-outer">' .
168    '<table class="noborder">' .
[2566]169
[3725]170    '<tr class="line">' .
171    '<th>' . __('_xfn_Me') . '</th>' .
172    '<td><p>' . '<label class="classic">' .
[3874]173    form::checkbox(['identity'], 'me', ($link_xfn == 'me')) . ' ' .
[3725]174    __('_xfn_Another link for myself') . '</label></p></td>' .
175    '</tr>' .
[2566]176
[3725]177    '<tr class="line">' .
178    '<th>' . __('_xfn_Friendship') . '</th>' .
179    '<td><p>' .
[3874]180    '<label class="classic">' . form::radio(['friendship'], 'contact',
[3725]181        strpos($link_xfn, 'contact') !== false) . __('_xfn_Contact') . '</label> ' .
[3874]182    '<label class="classic">' . form::radio(['friendship'], 'acquaintance',
[3725]183        strpos($link_xfn, 'acquaintance') !== false) . __('_xfn_Acquaintance') . '</label> ' .
[3874]184    '<label class="classic">' . form::radio(['friendship'], 'friend',
[3725]185        strpos($link_xfn, 'friend') !== false) . __('_xfn_Friend') . '</label> ' .
[3874]186    '<label class="classic">' . form::radio(['friendship'], '') . __('None') . '</label>' .
[3725]187    '</p></td>' .
188    '</tr>' .
[2566]189
[3725]190    '<tr class="line">' .
191    '<th>' . __('_xfn_Physical') . '</th>' .
192    '<td><p>' .
[3874]193    '<label class="classic">' . form::checkbox(['physical'], 'met',
[3725]194        strpos($link_xfn, 'met') !== false) . __('_xfn_Met') . '</label>' .
195    '</p></td>' .
196    '</tr>' .
[2566]197
[3725]198    '<tr class="line">' .
199    '<th>' . __('_xfn_Professional') . '</th>' .
200    '<td><p>' .
[3874]201    '<label class="classic">' . form::checkbox(['professional[]'], 'co-worker',
[3725]202        strpos($link_xfn, 'co-worker') !== false) . __('_xfn_Co-worker') . '</label> ' .
[3874]203    '<label class="classic">' . form::checkbox(['professional[]'], 'colleague',
[3725]204        strpos($link_xfn, 'colleague') !== false) . __('_xfn_Colleague') . '</label>' .
205    '</p></td>' .
206    '</tr>' .
[2566]207
[3725]208    '<tr class="line">' .
209    '<th>' . __('_xfn_Geographical') . '</th>' .
210    '<td><p>' .
[3874]211    '<label class="classic">' . form::radio(['geographical'], 'co-resident',
[3725]212        strpos($link_xfn, 'co-resident') !== false) . __('_xfn_Co-resident') . '</label> ' .
[3874]213    '<label class="classic">' . form::radio(['geographical'], 'neighbor',
[3725]214        strpos($link_xfn, 'neighbor') !== false) . __('_xfn_Neighbor') . '</label> ' .
[3874]215    '<label class="classic">' . form::radio(['geographical'], '') . __('None') . '</label>' .
[3725]216    '</p></td>' .
217    '</tr>' .
[2566]218
[3725]219    '<tr class="line">' .
220    '<th>' . __('_xfn_Family') . '</th>' .
221    '<td><p>' .
[3874]222    '<label class="classic">' . form::radio(['family'], 'child',
[3725]223        strpos($link_xfn, 'child') !== false) . __('_xfn_Child') . '</label> ' .
[3874]224    '<label class="classic">' . form::radio(['family'], 'parent',
[3725]225        strpos($link_xfn, 'parent') !== false) . __('_xfn_Parent') . '</label> ' .
[3874]226    '<label class="classic">' . form::radio(['family'], 'sibling',
[3725]227        strpos($link_xfn, 'sibling') !== false) . __('_xfn_Sibling') . '</label> ' .
[3874]228    '<label class="classic">' . form::radio(['family'], 'spouse',
[3725]229        strpos($link_xfn, 'spouse') !== false) . __('_xfn_Spouse') . '</label> ' .
[3874]230    '<label class="classic">' . form::radio(['family'], 'kin',
[3725]231        strpos($link_xfn, 'kin') !== false) . __('_xfn_Kin') . '</label> ' .
[3874]232    '<label class="classic">' . form::radio(['family'], '') . __('None') . '</label>' .
[3725]233    '</p></td>' .
234    '</tr>' .
[2566]235
[3725]236    '<tr class="line">' .
237    '<th>' . __('_xfn_Romantic') . '</th>' .
238    '<td><p>' .
[3874]239    '<label class="classic">' . form::checkbox(['romantic[]'], 'muse',
[3725]240        strpos($link_xfn, 'muse') !== false) . __('_xfn_Muse') . '</label> ' .
[3874]241    '<label class="classic">' . form::checkbox(['romantic[]'], 'crush',
[3725]242        strpos($link_xfn, 'crush') !== false) . __('_xfn_Crush') . '</label> ' .
[3874]243    '<label class="classic">' . form::checkbox(['romantic[]'], 'date',
[3725]244        strpos($link_xfn, 'date') !== false) . __('_xfn_Date') . '</label> ' .
[3874]245    '<label class="classic">' . form::checkbox(['romantic[]'], 'sweetheart',
[3725]246        strpos($link_xfn, 'sweetheart') !== false) . __('_xfn_Sweetheart') . '</label> ' .
247    '</p></td>' .
248    '</tr>' .
249    '</table></div>' .
[2566]250
[3725]251    '</div>' .
252    '<p class="clear">' . form::hidden('p', 'blogroll') .
253    form::hidden('edit', 1) .
254    form::hidden('id', $id) .
255    $core->formNonce() .
256    '<input type="submit" name="edit_link" value="' . __('Save') . '"/></p>' .
[2566]257
[3725]258        '</form>';
[0]259}
260?>
261</body>
[2566]262</html>
Note: See TracBrowser for help on using the repository browser.

Sites map