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