[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[2682] | 6 | # Copyright (c) 2003-2014 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 | |
---|
| 13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
---|
| 14 | |
---|
| 15 | dcPage::check('usage,contentadmin'); |
---|
| 16 | |
---|
| 17 | $post_id = ''; |
---|
| 18 | $cat_id = ''; |
---|
| 19 | $post_dt = ''; |
---|
| 20 | $post_format = $core->auth->getOption('post_format'); |
---|
[2705] | 21 | $post_editor = $core->auth->getOption('editor'); |
---|
[0] | 22 | $post_password = ''; |
---|
| 23 | $post_url = ''; |
---|
| 24 | $post_lang = $core->auth->getInfo('user_lang'); |
---|
| 25 | $post_title = ''; |
---|
| 26 | $post_excerpt = ''; |
---|
| 27 | $post_excerpt_xhtml = ''; |
---|
| 28 | $post_content = ''; |
---|
| 29 | $post_content_xhtml = ''; |
---|
| 30 | $post_notes = ''; |
---|
| 31 | $post_status = $core->auth->getInfo('user_post_status'); |
---|
| 32 | $post_selected = false; |
---|
| 33 | $post_open_comment = $core->blog->settings->system->allow_comments; |
---|
| 34 | $post_open_tb = $core->blog->settings->system->allow_trackbacks; |
---|
| 35 | |
---|
[195] | 36 | $page_title = __('New entry'); |
---|
[0] | 37 | |
---|
| 38 | $can_view_page = true; |
---|
| 39 | $can_edit_post = $core->auth->check('usage,contentadmin',$core->blog->id); |
---|
| 40 | $can_publish = $core->auth->check('publish,contentadmin',$core->blog->id); |
---|
| 41 | $can_delete = false; |
---|
| 42 | |
---|
[2858] | 43 | $post_headlink = '<link rel="%s" title="%s" href="'.$core->adminurl->get('admin.post',array('id' => "%s"),'&',true).'" />'; |
---|
| 44 | $post_link = '<a href="'.$core->adminurl->get('admin.post',array('id' => "%s"),'&',true).'" title="%s">%s</a>'; |
---|
[0] | 45 | $next_link = $prev_link = $next_headlink = $prev_headlink = null; |
---|
| 46 | |
---|
| 47 | # If user can't publish |
---|
| 48 | if (!$can_publish) { |
---|
| 49 | $post_status = -2; |
---|
| 50 | } |
---|
| 51 | |
---|
[1288] | 52 | # Getting categories |
---|
[1719] | 53 | $categories_combo = dcAdminCombos::getCategoriesCombo( |
---|
[3209] | 54 | $core->blog->getCategories() |
---|
[1719] | 55 | ); |
---|
[1288] | 56 | |
---|
[1719] | 57 | $status_combo = dcAdminCombos::getPostStatusesCombo(); |
---|
| 58 | |
---|
[933] | 59 | $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
[0] | 60 | |
---|
[2736] | 61 | # Formats combo |
---|
| 62 | $core_formaters = $core->getFormaters(); |
---|
| 63 | $available_formats = array('' => ''); |
---|
| 64 | foreach ($core_formaters as $editor => $formats) { |
---|
[2705] | 65 | foreach ($formats as $format) { |
---|
[2761] | 66 | $available_formats[$format] = $format; |
---|
| 67 | } |
---|
[2705] | 68 | } |
---|
[0] | 69 | |
---|
| 70 | # Languages combo |
---|
| 71 | $rs = $core->blog->getLangs(array('order'=>'asc')); |
---|
[1719] | 72 | $lang_combo = dcAdminCombos::getLangsCombo($rs,true); |
---|
[0] | 73 | |
---|
[957] | 74 | # Validation flag |
---|
| 75 | $bad_dt = false; |
---|
[0] | 76 | |
---|
[1783] | 77 | # Trackbacks |
---|
| 78 | $TB = new dcTrackback($core); |
---|
| 79 | $tb_urls = $tb_excerpt = ''; |
---|
| 80 | |
---|
[0] | 81 | # Get entry informations |
---|
[2705] | 82 | if (!empty($_REQUEST['id'])) { |
---|
[1460] | 83 | $page_title = __('Edit entry'); |
---|
[2542] | 84 | |
---|
[0] | 85 | $params['post_id'] = $_REQUEST['id']; |
---|
[2542] | 86 | |
---|
[0] | 87 | $post = $core->blog->getPosts($params); |
---|
[2542] | 88 | |
---|
[2705] | 89 | if ($post->isEmpty()) { |
---|
[0] | 90 | $core->error->add(__('This entry does not exist.')); |
---|
| 91 | $can_view_page = false; |
---|
[2705] | 92 | } else { |
---|
[0] | 93 | $post_id = $post->post_id; |
---|
| 94 | $cat_id = $post->cat_id; |
---|
| 95 | $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); |
---|
| 96 | $post_format = $post->post_format; |
---|
| 97 | $post_password = $post->post_password; |
---|
| 98 | $post_url = $post->post_url; |
---|
| 99 | $post_lang = $post->post_lang; |
---|
| 100 | $post_title = $post->post_title; |
---|
| 101 | $post_excerpt = $post->post_excerpt; |
---|
| 102 | $post_excerpt_xhtml = $post->post_excerpt_xhtml; |
---|
| 103 | $post_content = $post->post_content; |
---|
| 104 | $post_content_xhtml = $post->post_content_xhtml; |
---|
| 105 | $post_notes = $post->post_notes; |
---|
| 106 | $post_status = $post->post_status; |
---|
| 107 | $post_selected = (boolean) $post->post_selected; |
---|
| 108 | $post_open_comment = (boolean) $post->post_open_comment; |
---|
| 109 | $post_open_tb = (boolean) $post->post_open_tb; |
---|
[2542] | 110 | |
---|
[0] | 111 | $can_edit_post = $post->isEditable(); |
---|
| 112 | $can_delete= $post->isDeletable(); |
---|
[2542] | 113 | |
---|
[0] | 114 | $next_rs = $core->blog->getNextPost($post,1); |
---|
| 115 | $prev_rs = $core->blog->getNextPost($post,-1); |
---|
[2542] | 116 | |
---|
[0] | 117 | if ($next_rs !== null) { |
---|
| 118 | $next_link = sprintf($post_link,$next_rs->post_id, |
---|
[1353] | 119 | html::escapeHTML($next_rs->post_title),__('Next entry').' »'); |
---|
[0] | 120 | $next_headlink = sprintf($post_headlink,'next', |
---|
| 121 | html::escapeHTML($next_rs->post_title),$next_rs->post_id); |
---|
| 122 | } |
---|
[2542] | 123 | |
---|
[0] | 124 | if ($prev_rs !== null) { |
---|
| 125 | $prev_link = sprintf($post_link,$prev_rs->post_id, |
---|
[1353] | 126 | html::escapeHTML($prev_rs->post_title),'« '.__('Previous entry')); |
---|
[0] | 127 | $prev_headlink = sprintf($post_headlink,'previous', |
---|
| 128 | html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); |
---|
| 129 | } |
---|
[2542] | 130 | |
---|
[0] | 131 | try { |
---|
| 132 | $core->media = new dcMedia($core); |
---|
[1537] | 133 | } catch (Exception $e) { |
---|
| 134 | $core->error->add($e->getMessage()); |
---|
| 135 | } |
---|
[1783] | 136 | |
---|
| 137 | # Sanitize trackbacks excerpt |
---|
[2542] | 138 | $tb_excerpt = empty($_POST['tb_excerpt']) ? |
---|
[1783] | 139 | $post_excerpt_xhtml.' '.$post_content_xhtml : |
---|
| 140 | $_POST['tb_excerpt']; |
---|
| 141 | $tb_excerpt = html::decodeEntities(html::clean($tb_excerpt)); |
---|
| 142 | $tb_excerpt = text::cutString(html::escapeHTML($tb_excerpt), 255); |
---|
| 143 | $tb_excerpt = preg_replace('/\s+/ms', ' ', $tb_excerpt); |
---|
| 144 | } |
---|
| 145 | } |
---|
[2067] | 146 | if (isset($_REQUEST['section']) && $_REQUEST['section']=='trackbacks') { |
---|
| 147 | $anchor = 'trackbacks'; |
---|
| 148 | } else { |
---|
| 149 | $anchor = 'comments'; |
---|
[2542] | 150 | } |
---|
[2071] | 151 | |
---|
[2708] | 152 | $comments_actions_page = new dcCommentsActionsPage($core,$core->adminurl->get('admin.post'),array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor)); |
---|
[2067] | 153 | |
---|
| 154 | if ($comments_actions_page->process()) { |
---|
| 155 | return; |
---|
| 156 | } |
---|
[1783] | 157 | |
---|
| 158 | # Ping blogs |
---|
| 159 | if (!empty($_POST['ping'])) |
---|
| 160 | { |
---|
| 161 | if (!empty($_POST['tb_urls']) && $post_id && $post_status == 1 && $can_edit_post) |
---|
| 162 | { |
---|
| 163 | $tb_urls = $_POST['tb_urls']; |
---|
| 164 | $tb_urls = str_replace("\r", '', $tb_urls); |
---|
| 165 | $tb_post_title = html::escapeHTML(trim(html::clean($post_title))); |
---|
[2542] | 166 | $tb_post_url = $post->getURL(); |
---|
| 167 | |
---|
[1783] | 168 | foreach (explode("\n", $tb_urls) as $tb_url) |
---|
| 169 | { |
---|
| 170 | try { |
---|
[3415] | 171 | # --BEHAVIOR-- adminBeforePingTrackback |
---|
| 172 | $core->callBehavior('adminBeforePingTrackback',$tb_url,$post_id,$tb_post_title,$tb_excerpt,$tb_post_url); |
---|
| 173 | |
---|
[2542] | 174 | $TB->ping($tb_url, $post_id, $tb_post_title, $tb_excerpt, $tb_post_url); |
---|
[1783] | 175 | } catch (Exception $e) { |
---|
| 176 | $core->error->add($e->getMessage()); |
---|
| 177 | } |
---|
| 178 | } |
---|
[2542] | 179 | |
---|
[1783] | 180 | if (!$core->error->flag()) { |
---|
[2256] | 181 | dcPage::addSuccessNotice(__('All pings sent.')); |
---|
[2852] | 182 | $core->adminurl->redirect( |
---|
[2708] | 183 | 'admin.post', |
---|
| 184 | array('id' => $post_id, 'tb'=> '1') |
---|
[2852] | 185 | ); |
---|
[1783] | 186 | } |
---|
[0] | 187 | } |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | # Format excerpt and content |
---|
[2705] | 191 | elseif (!empty($_POST) && $can_edit_post) { |
---|
[2736] | 192 | $post_format = $_POST['post_format']; |
---|
[0] | 193 | $post_excerpt = $_POST['post_excerpt']; |
---|
| 194 | $post_content = $_POST['post_content']; |
---|
[2542] | 195 | |
---|
[0] | 196 | $post_title = $_POST['post_title']; |
---|
[2542] | 197 | |
---|
[0] | 198 | $cat_id = (integer) $_POST['cat_id']; |
---|
[2542] | 199 | |
---|
[0] | 200 | if (isset($_POST['post_status'])) { |
---|
| 201 | $post_status = (integer) $_POST['post_status']; |
---|
| 202 | } |
---|
[2542] | 203 | |
---|
[0] | 204 | if (empty($_POST['post_dt'])) { |
---|
| 205 | $post_dt = ''; |
---|
| 206 | } else { |
---|
[957] | 207 | try |
---|
| 208 | { |
---|
| 209 | $post_dt = strtotime($_POST['post_dt']); |
---|
| 210 | if ($post_dt == false || $post_dt == -1) { |
---|
| 211 | $bad_dt = true; |
---|
| 212 | throw new Exception(__('Invalid publication date')); |
---|
| 213 | } |
---|
| 214 | $post_dt = date('Y-m-d H:i',$post_dt); |
---|
| 215 | } |
---|
| 216 | catch (Exception $e) |
---|
| 217 | { |
---|
| 218 | $core->error->add($e->getMessage()); |
---|
| 219 | } |
---|
[0] | 220 | } |
---|
[2542] | 221 | |
---|
[0] | 222 | $post_open_comment = !empty($_POST['post_open_comment']); |
---|
| 223 | $post_open_tb = !empty($_POST['post_open_tb']); |
---|
| 224 | $post_selected = !empty($_POST['post_selected']); |
---|
| 225 | $post_lang = $_POST['post_lang']; |
---|
| 226 | $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; |
---|
[2542] | 227 | |
---|
[0] | 228 | $post_notes = $_POST['post_notes']; |
---|
[2542] | 229 | |
---|
[0] | 230 | if (isset($_POST['post_url'])) { |
---|
| 231 | $post_url = $_POST['post_url']; |
---|
| 232 | } |
---|
[2542] | 233 | |
---|
[0] | 234 | $core->blog->setPostContent( |
---|
| 235 | $post_id,$post_format,$post_lang, |
---|
| 236 | $post_excerpt,$post_excerpt_xhtml,$post_content,$post_content_xhtml |
---|
| 237 | ); |
---|
| 238 | } |
---|
| 239 | |
---|
[1068] | 240 | # Delete post |
---|
| 241 | if (!empty($_POST['delete']) && $can_delete) |
---|
| 242 | { |
---|
| 243 | try { |
---|
| 244 | # --BEHAVIOR-- adminBeforePostDelete |
---|
| 245 | $core->callBehavior('adminBeforePostDelete',$post_id); |
---|
| 246 | $core->blog->delPost($post_id); |
---|
[2852] | 247 | $core->adminurl->redirect("admin.posts"); |
---|
[1068] | 248 | } catch (Exception $e) { |
---|
| 249 | $core->error->add($e->getMessage()); |
---|
| 250 | } |
---|
| 251 | } |
---|
| 252 | |
---|
[0] | 253 | # Create or update post |
---|
[957] | 254 | if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) |
---|
[0] | 255 | { |
---|
[1417] | 256 | # Create category |
---|
| 257 | if (!empty($_POST['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) { |
---|
[2542] | 258 | |
---|
[1417] | 259 | $cur_cat = $core->con->openCursor($core->prefix.'category'); |
---|
| 260 | $cur_cat->cat_title = $_POST['new_cat_title']; |
---|
| 261 | $cur_cat->cat_url = ''; |
---|
[2542] | 262 | |
---|
[1417] | 263 | $parent_cat = !empty($_POST['new_cat_parent']) ? $_POST['new_cat_parent'] : ''; |
---|
[2542] | 264 | |
---|
[1417] | 265 | # --BEHAVIOR-- adminBeforeCategoryCreate |
---|
| 266 | $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); |
---|
[2542] | 267 | |
---|
[1417] | 268 | $cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat); |
---|
[2542] | 269 | |
---|
[1417] | 270 | # --BEHAVIOR-- adminAfterCategoryCreate |
---|
| 271 | $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $cat_id); |
---|
| 272 | } |
---|
[2542] | 273 | |
---|
[0] | 274 | $cur = $core->con->openCursor($core->prefix.'post'); |
---|
[2542] | 275 | |
---|
[0] | 276 | $cur->post_title = $post_title; |
---|
[3340] | 277 | $cur->cat_id = ($cat_id ?: null); |
---|
[0] | 278 | $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; |
---|
| 279 | $cur->post_format = $post_format; |
---|
| 280 | $cur->post_password = $post_password; |
---|
| 281 | $cur->post_lang = $post_lang; |
---|
| 282 | $cur->post_title = $post_title; |
---|
| 283 | $cur->post_excerpt = $post_excerpt; |
---|
| 284 | $cur->post_excerpt_xhtml = $post_excerpt_xhtml; |
---|
| 285 | $cur->post_content = $post_content; |
---|
| 286 | $cur->post_content_xhtml = $post_content_xhtml; |
---|
| 287 | $cur->post_notes = $post_notes; |
---|
| 288 | $cur->post_status = $post_status; |
---|
| 289 | $cur->post_selected = (integer) $post_selected; |
---|
| 290 | $cur->post_open_comment = (integer) $post_open_comment; |
---|
| 291 | $cur->post_open_tb = (integer) $post_open_tb; |
---|
[2542] | 292 | |
---|
[0] | 293 | if (isset($_POST['post_url'])) { |
---|
| 294 | $cur->post_url = $post_url; |
---|
| 295 | } |
---|
[2542] | 296 | |
---|
[0] | 297 | # Update post |
---|
[2705] | 298 | if ($post_id) { |
---|
| 299 | try { |
---|
[0] | 300 | # --BEHAVIOR-- adminBeforePostUpdate |
---|
| 301 | $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); |
---|
[2542] | 302 | |
---|
[0] | 303 | $core->blog->updPost($post_id,$cur); |
---|
[2542] | 304 | |
---|
[0] | 305 | # --BEHAVIOR-- adminAfterPostUpdate |
---|
| 306 | $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); |
---|
[2385] | 307 | dcPage::addSuccessNotice (sprintf(__('The post "%s" has been successfully updated'),html::escapeHTML($cur->post_title))); |
---|
[2852] | 308 | $core->adminurl->redirect( |
---|
[2708] | 309 | 'admin.post', |
---|
| 310 | array('id' => $post_id) |
---|
[2852] | 311 | ); |
---|
[2705] | 312 | } catch (Exception $e) { |
---|
[0] | 313 | $core->error->add($e->getMessage()); |
---|
| 314 | } |
---|
[2705] | 315 | } else { |
---|
[0] | 316 | $cur->user_id = $core->auth->userID(); |
---|
[2542] | 317 | |
---|
[2705] | 318 | try { |
---|
[0] | 319 | # --BEHAVIOR-- adminBeforePostCreate |
---|
| 320 | $core->callBehavior('adminBeforePostCreate',$cur); |
---|
[2542] | 321 | |
---|
[0] | 322 | $return_id = $core->blog->addPost($cur); |
---|
[2542] | 323 | |
---|
[0] | 324 | # --BEHAVIOR-- adminAfterPostCreate |
---|
| 325 | $core->callBehavior('adminAfterPostCreate',$cur,$return_id); |
---|
[2256] | 326 | |
---|
| 327 | dcPage::addSuccessNotice(__('Entry has been successfully created.')); |
---|
[2852] | 328 | $core->adminurl->redirect( |
---|
[2708] | 329 | 'admin.post', |
---|
| 330 | array('id' => $return_id) |
---|
[2852] | 331 | ); |
---|
[2705] | 332 | } catch (Exception $e) { |
---|
[0] | 333 | $core->error->add($e->getMessage()); |
---|
| 334 | } |
---|
| 335 | } |
---|
| 336 | } |
---|
| 337 | |
---|
[1417] | 338 | # Getting categories |
---|
[1719] | 339 | $categories_combo = dcAdminCombos::getCategoriesCombo( |
---|
[3209] | 340 | $core->blog->getCategories() |
---|
[1719] | 341 | ); |
---|
[0] | 342 | /* DISPLAY |
---|
| 343 | -------------------------------------------------------- */ |
---|
| 344 | $default_tab = 'edit-entry'; |
---|
| 345 | if (!$can_edit_post) { |
---|
| 346 | $default_tab = ''; |
---|
| 347 | } |
---|
| 348 | if (!empty($_GET['co'])) { |
---|
| 349 | $default_tab = 'comments'; |
---|
| 350 | } |
---|
[1783] | 351 | elseif (!empty($_GET['tb'])) { |
---|
| 352 | $default_tab = 'trackbacks'; |
---|
| 353 | } |
---|
[0] | 354 | |
---|
[1358] | 355 | if ($post_id) { |
---|
| 356 | switch ($post_status) { |
---|
| 357 | case 1: |
---|
| 358 | $img_status = sprintf($img_status_pattern,__('Published'),'check-on.png'); |
---|
| 359 | break; |
---|
| 360 | case 0: |
---|
| 361 | $img_status = sprintf($img_status_pattern,__('Unpublished'),'check-off.png'); |
---|
| 362 | break; |
---|
| 363 | case -1: |
---|
| 364 | $img_status = sprintf($img_status_pattern,__('Scheduled'),'scheduled.png'); |
---|
| 365 | break; |
---|
| 366 | case -2: |
---|
| 367 | $img_status = sprintf($img_status_pattern,__('Pending'),'check-wrn.png'); |
---|
| 368 | break; |
---|
| 369 | default: |
---|
| 370 | $img_status = ''; |
---|
| 371 | } |
---|
| 372 | $edit_entry_str = __('“%s”'); |
---|
| 373 | $page_title_edit = sprintf($edit_entry_str, html::escapeHTML($post_title)).' '.$img_status; |
---|
[1427] | 374 | } else { |
---|
| 375 | $img_status = ''; |
---|
[1358] | 376 | } |
---|
| 377 | |
---|
[2740] | 378 | |
---|
[2705] | 379 | $admin_post_behavior = ''; |
---|
[2856] | 380 | if ($post_editor) { |
---|
| 381 | $p_edit = $c_edit = ''; |
---|
| 382 | if (!empty($post_editor[$post_format])) { |
---|
| 383 | $p_edit = $post_editor[$post_format]; |
---|
| 384 | } |
---|
| 385 | if (!empty($post_editor['xhtml'])) { |
---|
| 386 | $c_edit = $post_editor['xhtml']; |
---|
| 387 | } |
---|
| 388 | if ($p_edit == $c_edit) { |
---|
| 389 | $admin_post_behavior .= $core->callBehavior('adminPostEditor', |
---|
[3024] | 390 | $p_edit,'post',array('#post_excerpt','#post_content','#comment_content'),$post_format); |
---|
[2856] | 391 | } else { |
---|
| 392 | $admin_post_behavior .= $core->callBehavior('adminPostEditor', |
---|
[3024] | 393 | $p_edit,'post',array('#post_excerpt','#post_content'),$post_format); |
---|
[2856] | 394 | $admin_post_behavior .= $core->callBehavior('adminPostEditor', |
---|
[3024] | 395 | $c_edit,'comment',array('#comment_content'),'xhtml'); |
---|
[2856] | 396 | } |
---|
[2705] | 397 | } |
---|
[1358] | 398 | |
---|
[195] | 399 | dcPage::open($page_title.' - '.__('Entries'), |
---|
[0] | 400 | dcPage::jsDatePicker(). |
---|
| 401 | dcPage::jsModal(). |
---|
| 402 | dcPage::jsMetaEditor(). |
---|
[2761] | 403 | $admin_post_behavior. |
---|
[0] | 404 | dcPage::jsLoad('js/_post.js'). |
---|
| 405 | dcPage::jsConfirmClose('entry-form','comment-form'). |
---|
| 406 | # --BEHAVIOR-- adminPostHeaders |
---|
| 407 | $core->callBehavior('adminPostHeaders'). |
---|
| 408 | dcPage::jsPageTabs($default_tab). |
---|
[1358] | 409 | $next_headlink."\n".$prev_headlink, |
---|
| 410 | dcPage::breadcrumb( |
---|
| 411 | array( |
---|
| 412 | html::escapeHTML($core->blog->name) => '', |
---|
[2720] | 413 | __('Entries') => $core->adminurl->get("admin.posts"), |
---|
[2166] | 414 | ($post_id ? $page_title_edit : $page_title) => '' |
---|
[1358] | 415 | )) |
---|
[2907] | 416 | , array( |
---|
| 417 | 'x-frame-allow' => $core->blog->url |
---|
| 418 | ) |
---|
[0] | 419 | ); |
---|
| 420 | |
---|
| 421 | if (!empty($_GET['upd'])) { |
---|
[1550] | 422 | dcPage::success(__('Entry has been successfully updated.')); |
---|
[0] | 423 | } |
---|
| 424 | elseif (!empty($_GET['crea'])) { |
---|
[1550] | 425 | dcPage::success(__('Entry has been successfully created.')); |
---|
[0] | 426 | } |
---|
| 427 | elseif (!empty($_GET['attached'])) { |
---|
[1550] | 428 | dcPage::success(__('File has been successfully attached.')); |
---|
[0] | 429 | } |
---|
| 430 | elseif (!empty($_GET['rmattach'])) { |
---|
[1550] | 431 | dcPage::success(__('Attachment has been successfully removed.')); |
---|
[0] | 432 | } |
---|
| 433 | |
---|
| 434 | if (!empty($_GET['creaco'])) { |
---|
[1550] | 435 | dcPage::success(__('Comment has been successfully created.')); |
---|
[907] | 436 | } |
---|
[1783] | 437 | if (!empty($_GET['tbsent'])) { |
---|
| 438 | dcPage::success(__('All pings sent.')); |
---|
| 439 | } |
---|
[0] | 440 | |
---|
| 441 | # XHTML conversion |
---|
| 442 | if (!empty($_GET['xconv'])) |
---|
| 443 | { |
---|
| 444 | $post_excerpt = $post_excerpt_xhtml; |
---|
| 445 | $post_content = $post_content_xhtml; |
---|
| 446 | $post_format = 'xhtml'; |
---|
[2542] | 447 | |
---|
[907] | 448 | dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); |
---|
[0] | 449 | } |
---|
| 450 | |
---|
| 451 | if ($post_id && $post->post_status == 1) { |
---|
[2974] | 452 | echo '<p><a class="onblog_link outgoing" href="'.$post->getURL().'" title="'.html::escapeHTML($post_title).'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; |
---|
[0] | 453 | } |
---|
| 454 | if ($post_id) |
---|
| 455 | { |
---|
[1333] | 456 | echo '<p class="nav_prevnext">'; |
---|
[0] | 457 | if ($prev_link) { echo $prev_link; } |
---|
[1335] | 458 | if ($next_link && $prev_link) { echo ' | '; } |
---|
[0] | 459 | if ($next_link) { echo $next_link; } |
---|
[2542] | 460 | |
---|
[0] | 461 | # --BEHAVIOR-- adminPostNavLinks |
---|
[3550] | 462 | $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null,'post'); |
---|
[2542] | 463 | |
---|
[0] | 464 | echo '</p>'; |
---|
| 465 | } |
---|
| 466 | |
---|
| 467 | # Exit if we cannot view page |
---|
| 468 | if (!$can_view_page) { |
---|
| 469 | dcPage::helpBlock('core_post'); |
---|
| 470 | dcPage::close(); |
---|
| 471 | exit; |
---|
| 472 | } |
---|
[3491] | 473 | |
---|
| 474 | # Controls comments or trakbacks capabilities |
---|
| 475 | $isContributionAllowed = function ($id,$dt,$com=true) |
---|
| 476 | { |
---|
| 477 | global $core; |
---|
| 478 | |
---|
| 479 | if (!$id) { |
---|
| 480 | return true; |
---|
| 481 | } |
---|
| 482 | if ($com) { |
---|
| 483 | if (($core->blog->settings->system->comments_ttl == 0) || |
---|
| 484 | (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { |
---|
| 485 | return true; |
---|
| 486 | } |
---|
| 487 | } else { |
---|
| 488 | if (($core->blog->settings->system->trackbacks_ttl == 0) || |
---|
| 489 | (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { |
---|
| 490 | return true; |
---|
| 491 | } |
---|
| 492 | } |
---|
| 493 | return false; |
---|
| 494 | }; |
---|
| 495 | |
---|
| 496 | # Show comments or trackbacks |
---|
| 497 | $showComments = function($rs,$has_action,$tb=false) |
---|
| 498 | { |
---|
| 499 | global $core; |
---|
| 500 | echo |
---|
| 501 | '<div class="table-outer">'. |
---|
| 502 | '<table class="comments-list"><tr>'. |
---|
| 503 | '<th colspan="2" class="first">'.__('Author').'</th>'. |
---|
| 504 | '<th>'.__('Date').'</th>'. |
---|
| 505 | '<th class="nowrap">'.__('IP address').'</th>'. |
---|
| 506 | '<th>'.__('Status').'</th>'. |
---|
| 507 | '<th>'.__('Edit').'</th>'. |
---|
| 508 | '</tr>'; |
---|
| 509 | $comments = array(); |
---|
| 510 | if (isset($_REQUEST['comments'])) { |
---|
| 511 | foreach ($_REQUEST['comments'] as $v) { |
---|
| 512 | $comments[(integer)$v]=true; |
---|
| 513 | } |
---|
| 514 | } |
---|
| 515 | |
---|
| 516 | while($rs->fetch()) |
---|
| 517 | { |
---|
| 518 | $comment_url = $core->adminurl->get("admin.comment",array('id' => $rs->comment_id)); |
---|
| 519 | |
---|
| 520 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
| 521 | switch ($rs->comment_status) { |
---|
| 522 | case 1: |
---|
| 523 | $img_status = sprintf($img,__('Published'),'check-on.png'); |
---|
| 524 | break; |
---|
| 525 | case 0: |
---|
| 526 | $img_status = sprintf($img,__('Unpublished'),'check-off.png'); |
---|
| 527 | break; |
---|
| 528 | case -1: |
---|
| 529 | $img_status = sprintf($img,__('Pending'),'check-wrn.png'); |
---|
| 530 | break; |
---|
| 531 | case -2: |
---|
| 532 | $img_status = sprintf($img,__('Junk'),'junk.png'); |
---|
| 533 | break; |
---|
| 534 | } |
---|
| 535 | |
---|
| 536 | echo |
---|
| 537 | '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. |
---|
| 538 | ' id="c'.$rs->comment_id.'">'. |
---|
| 539 | |
---|
| 540 | '<td class="nowrap">'. |
---|
| 541 | ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,isset($comments[$rs->comment_id]),'','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. |
---|
| 542 | '<td class="maximal">'.html::escapeHTML($rs->comment_author).'</td>'. |
---|
| 543 | '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$rs->comment_dt).'</td>'. |
---|
| 544 | '<td class="nowrap"><a href="'.$core->adminurl->get("admin.comments",array('ip' => $rs->comment_ip)).'">'.$rs->comment_ip.'</a></td>'. |
---|
| 545 | '<td class="nowrap status">'.$img_status.'</td>'. |
---|
| 546 | '<td class="nowrap status"><a href="'.$comment_url.'">'. |
---|
| 547 | '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. |
---|
| 548 | |
---|
| 549 | '</tr>'; |
---|
| 550 | } |
---|
| 551 | |
---|
| 552 | echo '</table></div>'; |
---|
| 553 | }; |
---|
| 554 | |
---|
[0] | 555 | /* Post form if we can edit post |
---|
| 556 | -------------------------------------------------------- */ |
---|
[2705] | 557 | if ($can_edit_post) { |
---|
[1398] | 558 | $sidebar_items = new ArrayObject(array( |
---|
[1392] | 559 | 'status-box' => array( |
---|
| 560 | 'title' => __('Status'), |
---|
| 561 | 'items' => array( |
---|
[2542] | 562 | 'post_status' => |
---|
[2390] | 563 | '<p class="entry-status"><label for="post_status">'.__('Entry status').' '.$img_status.'</label>'. |
---|
[1392] | 564 | form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). |
---|
[1396] | 565 | '</p>', |
---|
[2542] | 566 | 'post_dt' => |
---|
[2390] | 567 | '<p><label for="post_dt">'.__('Publication date and hour').'</label>'. |
---|
[1392] | 568 | form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). |
---|
[1396] | 569 | '</p>', |
---|
[1392] | 570 | 'post_lang' => |
---|
[2390] | 571 | '<p><label for="post_lang">'.__('Entry language').'</label>'. |
---|
[1392] | 572 | form::combo('post_lang',$lang_combo,$post_lang). |
---|
[1396] | 573 | '</p>', |
---|
[1392] | 574 | 'post_format' => |
---|
[1619] | 575 | '<div>'. |
---|
[2390] | 576 | '<h5 id="label_format"><label for="post_format" class="classic">'.__('Text formatting').'</label></h5>'. |
---|
[2736] | 577 | '<p>'.form::combo('post_format',$available_formats,$post_format,'maximal').'</p>'. |
---|
[1830] | 578 | '<p class="format_control control_no_xhtml">'. |
---|
[2708] | 579 | '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="'. |
---|
| 580 | $core->adminurl->get('admin.post',array('id'=> $post_id,'xconv'=> '1')). |
---|
| 581 | '">'. |
---|
[1812] | 582 | __('Convert to XHTML').'</a></p></div>')), |
---|
[1392] | 583 | 'metas-box' => array( |
---|
[1964] | 584 | 'title' => __('Filing'), |
---|
[1392] | 585 | 'items' => array( |
---|
[2542] | 586 | 'post_selected' => |
---|
[1392] | 587 | '<p><label for="post_selected" class="classic">'. |
---|
| 588 | form::checkbox('post_selected',1,$post_selected).' '. |
---|
| 589 | __('Selected entry').'</label></p>', |
---|
| 590 | 'cat_id' => |
---|
[1935] | 591 | '<div>'. |
---|
| 592 | '<h5 id="label_cat_id">'.__('Category').'</h5>'. |
---|
| 593 | '<p><label for="cat_id">'.__('Category:').'</label>'. |
---|
[1392] | 594 | form::combo('cat_id',$categories_combo,$cat_id,'maximal'). |
---|
[1468] | 595 | '</p>'. |
---|
| 596 | ($core->auth->check('categories', $core->blog->id) ? |
---|
[1936] | 597 | '<div>'. |
---|
[1530] | 598 | '<h5 id="create_cat">'.__('Add a new category').'</h5>'. |
---|
[1468] | 599 | '<p><label for="new_cat_title">'.__('Title:').' '. |
---|
| 600 | form::field('new_cat_title',30,255,'','maximal').'</label></p>'. |
---|
| 601 | '<p><label for="new_cat_parent">'.__('Parent:').' '. |
---|
| 602 | form::combo('new_cat_parent',$categories_combo,'','maximal'). |
---|
[1936] | 603 | '</label></p>'. |
---|
| 604 | '</div>' |
---|
[1935] | 605 | : ''). |
---|
| 606 | '</div>')), |
---|
[1392] | 607 | 'options-box' => array( |
---|
| 608 | 'title' => __('Options'), |
---|
| 609 | 'items' => array( |
---|
[1711] | 610 | 'post_open_comment_tb' => |
---|
| 611 | '<div>'. |
---|
[1941] | 612 | '<h5 id="label_comment_tb">'.__('Comments and trackbacks list').'</h5>'. |
---|
[1392] | 613 | '<p><label for="post_open_comment" class="classic">'. |
---|
| 614 | form::checkbox('post_open_comment',1,$post_open_comment).' '. |
---|
| 615 | __('Accept comments').'</label></p>'. |
---|
[2542] | 616 | ($core->blog->settings->system->allow_comments ? |
---|
[3491] | 617 | ($isContributionAllowed($post_id,strtotime($post_dt),true) ? |
---|
[1392] | 618 | '' : |
---|
| 619 | '<p class="form-note warn">'. |
---|
[2542] | 620 | __('Warning: Comments are not more accepted for this entry.').'</p>') : |
---|
[1392] | 621 | '<p class="form-note warn">'. |
---|
[1711] | 622 | __('Comments are not accepted on this blog so far.').'</p>'). |
---|
[1392] | 623 | '<p><label for="post_open_tb" class="classic">'. |
---|
| 624 | form::checkbox('post_open_tb',1,$post_open_tb).' '. |
---|
| 625 | __('Accept trackbacks').'</label></p>'. |
---|
[2542] | 626 | ($core->blog->settings->system->allow_trackbacks ? |
---|
[3491] | 627 | ($isContributionAllowed($post_id,strtotime($post_dt),false) ? |
---|
[1392] | 628 | '' : |
---|
| 629 | '<p class="form-note warn">'. |
---|
[2542] | 630 | __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : |
---|
[1711] | 631 | '<p class="form-note warn">'.__('Trackbacks are not accepted on this blog so far.').'</p>'). |
---|
| 632 | '</div>', |
---|
[1392] | 633 | 'post_password' => |
---|
[2390] | 634 | '<p><label for="post_password">'.__('Password').'</label>'. |
---|
[1392] | 635 | form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). |
---|
[1396] | 636 | '</p>', |
---|
[1392] | 637 | 'post_url' => |
---|
| 638 | '<div class="lockable">'. |
---|
[2390] | 639 | '<p><label for="post_url">'.__('Edit basename').'</label>'. |
---|
[3572] | 640 | form::field('post_url',10,191,html::escapeHTML($post_url),'maximal'). |
---|
[1396] | 641 | '</p>'. |
---|
[1392] | 642 | '<p class="form-note warn">'. |
---|
| 643 | __('Warning: If you set the URL manually, it may conflict with another entry.'). |
---|
| 644 | '</p></div>' |
---|
| 645 | )))); |
---|
[1398] | 646 | |
---|
| 647 | $main_items = new ArrayObject(array( |
---|
| 648 | "post_title" => |
---|
| 649 | '<p class="col">'. |
---|
[2788] | 650 | '<label class="required no-margin bold" for="post_title"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label>'. |
---|
[1398] | 651 | form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). |
---|
| 652 | '</p>', |
---|
[2542] | 653 | |
---|
[1398] | 654 | "post_excerpt" => |
---|
[2390] | 655 | '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">'.__('Excerpt:').' <span class="form-note">'. |
---|
[1697] | 656 | __('Introduction to the post.').'</span></label> '. |
---|
[1398] | 657 | form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). |
---|
| 658 | '</p>', |
---|
[2542] | 659 | |
---|
[1398] | 660 | "post_content" => |
---|
[2390] | 661 | '<p class="area" id="content-area"><label class="required bold" '. |
---|
[1398] | 662 | 'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. |
---|
| 663 | form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). |
---|
| 664 | '</p>', |
---|
[2542] | 665 | |
---|
[1398] | 666 | "post_notes" => |
---|
[2390] | 667 | '<p class="area" id="notes-area"><label for="post_notes" class="bold">'.__('Personal notes:').' <span class="form-note">'. |
---|
[1697] | 668 | __('Unpublished notes.').'</span></label>'. |
---|
[1398] | 669 | form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). |
---|
| 670 | '</p>' |
---|
| 671 | ) |
---|
| 672 | ); |
---|
[2542] | 673 | |
---|
[1398] | 674 | # --BEHAVIOR-- adminPostFormItems |
---|
[3550] | 675 | $core->callBehavior('adminPostFormItems',$main_items,$sidebar_items,isset($post) ? $post : null,'post'); |
---|
[1398] | 676 | |
---|
[2926] | 677 | echo '<div class="multi-part" title="'.($post_id ? __('Edit entry') : __('New entry')). |
---|
| 678 | sprintf(' › %s',$post_format).'" id="edit-entry">'; |
---|
[2708] | 679 | echo '<form action="'.$core->adminurl->get('admin.post').'" method="post" id="entry-form">'; |
---|
[458] | 680 | echo '<div id="entry-wrapper">'; |
---|
[536] | 681 | echo '<div id="entry-content"><div class="constrained">'; |
---|
[1398] | 682 | |
---|
[1789] | 683 | echo '<h3 class="out-of-screen-if-js">'.__('Edit post').'</h3>'; |
---|
[2542] | 684 | |
---|
[1398] | 685 | foreach ($main_items as $id => $item) { |
---|
| 686 | echo $item; |
---|
| 687 | } |
---|
| 688 | |
---|
| 689 | # --BEHAVIOR-- adminPostForm (may be deprecated) |
---|
[3550] | 690 | $core->callBehavior('adminPostForm',isset($post) ? $post : null,'post'); |
---|
[2542] | 691 | |
---|
[458] | 692 | echo |
---|
[1398] | 693 | '<p class="border-top">'. |
---|
[458] | 694 | ($post_id ? form::hidden('id',$post_id) : ''). |
---|
| 695 | '<input type="submit" value="'.__('Save').' (s)" '. |
---|
[543] | 696 | 'accesskey="s" name="save" /> '; |
---|
[544] | 697 | if ($post_id) { |
---|
[543] | 698 | $preview_url = |
---|
[776] | 699 | $core->blog->url.$core->url->getURLFor('preview',$core->auth->userID().'/'. |
---|
[543] | 700 | http::browserUID(DC_MASTER_KEY.$core->auth->userID().$core->auth->getInfo('user_pwd')). |
---|
[772] | 701 | '/'.$post->post_url); |
---|
[3466] | 702 | echo '<a id="post-preview" href="'.$preview_url.'" class="button modal" accesskey="p">'.__('Preview').' (p)'.'</a>'; |
---|
[1215] | 703 | } else { |
---|
| 704 | echo |
---|
[2720] | 705 | '<a id="post-cancel" href="'.$core->adminurl->get("admin.home").'" class="button" accesskey="c">'.__('Cancel').' (c)</a>'; |
---|
[543] | 706 | } |
---|
[1215] | 707 | |
---|
[543] | 708 | echo |
---|
[3466] | 709 | ($can_delete ? ' <input type="submit" class="delete" value="'.__('Delete').'" name="delete" />' : ''). |
---|
[458] | 710 | $core->formNonce(). |
---|
| 711 | '</p>'; |
---|
[2542] | 712 | |
---|
[536] | 713 | echo '</div></div>'; // End #entry-content |
---|
[458] | 714 | echo '</div>'; // End #entry-wrapper |
---|
| 715 | |
---|
[2784] | 716 | echo '<div id="entry-sidebar" role="complementary">'; |
---|
[2542] | 717 | |
---|
[1398] | 718 | foreach ($sidebar_items as $id => $c) { |
---|
[1741] | 719 | echo '<div id="'.$id.'" class="sb-box">'. |
---|
[1392] | 720 | '<h4>'.$c['title'].'</h4>'; |
---|
| 721 | foreach ($c['items'] as $e_name=>$e_content) { |
---|
| 722 | echo $e_content; |
---|
| 723 | } |
---|
| 724 | echo '</div>'; |
---|
| 725 | } |
---|
[2542] | 726 | |
---|
| 727 | |
---|
[1398] | 728 | # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) |
---|
[3550] | 729 | $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null,'post'); |
---|
[0] | 730 | echo '</div>'; // End #entry-sidebar |
---|
[458] | 731 | |
---|
[0] | 732 | echo '</form>'; |
---|
[2542] | 733 | |
---|
[416] | 734 | # --BEHAVIOR-- adminPostForm |
---|
[3550] | 735 | $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null,'post'); |
---|
[2542] | 736 | |
---|
[0] | 737 | echo '</div>'; |
---|
| 738 | } |
---|
| 739 | |
---|
| 740 | if ($post_id) |
---|
| 741 | { |
---|
[1783] | 742 | /* Comments |
---|
| 743 | -------------------------------------------------------- */ |
---|
| 744 | |
---|
[0] | 745 | $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); |
---|
[2542] | 746 | |
---|
[0] | 747 | $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); |
---|
[2542] | 748 | |
---|
[1613] | 749 | echo |
---|
[1741] | 750 | '<div id="comments" class="clear multi-part" title="'.__('Comments').'">'; |
---|
[2542] | 751 | $combo_action = $comments_actions_page->getCombo(); |
---|
[1783] | 752 | $has_action = !empty($combo_action) && !$comments->isEmpty(); |
---|
[2542] | 753 | echo |
---|
[1741] | 754 | '<p class="top-add"><a class="button add" href="#comment-form">'.__('Add a comment').'</a></p>'; |
---|
[2542] | 755 | |
---|
[0] | 756 | if ($has_action) { |
---|
[2708] | 757 | echo '<form action="'.$core->adminurl->get('admin.post').'" id="form-comments" method="post">'; |
---|
[0] | 758 | } |
---|
[2542] | 759 | |
---|
[0] | 760 | echo '<h3>'.__('Comments').'</h3>'; |
---|
| 761 | if (!$comments->isEmpty()) { |
---|
[3491] | 762 | $showComments($comments,$has_action); |
---|
[0] | 763 | } else { |
---|
[2666] | 764 | echo '<p>'.__('No comments').'</p>'; |
---|
[0] | 765 | } |
---|
[2542] | 766 | |
---|
[0] | 767 | if ($has_action) { |
---|
| 768 | echo |
---|
| 769 | '<div class="two-cols">'. |
---|
| 770 | '<p class="col checkboxes-helpers"></p>'. |
---|
[2542] | 771 | |
---|
[96] | 772 | '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. |
---|
[0] | 773 | form::combo('action',$combo_action). |
---|
[2071] | 774 | form::hidden(array('section'),'comments'). |
---|
[2063] | 775 | form::hidden(array('id'),$post_id). |
---|
[0] | 776 | $core->formNonce(). |
---|
| 777 | '<input type="submit" value="'.__('ok').'" /></p>'. |
---|
| 778 | '</div>'. |
---|
| 779 | '</form>'; |
---|
| 780 | } |
---|
[1612] | 781 | /* Add a comment |
---|
| 782 | -------------------------------------------------------- */ |
---|
[0] | 783 | |
---|
| 784 | echo |
---|
[1613] | 785 | '<div class="fieldset clear">'. |
---|
[0] | 786 | '<h3>'.__('Add a comment').'</h3>'. |
---|
[2542] | 787 | |
---|
[2720] | 788 | '<form action="'.$core->adminurl->get("admin.comment").'" method="post" id="comment-form">'. |
---|
[536] | 789 | '<div class="constrained">'. |
---|
[1396] | 790 | '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:').'</label>'. |
---|
[0] | 791 | form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). |
---|
[1396] | 792 | '</p>'. |
---|
[2542] | 793 | |
---|
[1396] | 794 | '<p><label for="comment_email">'.__('Email:').'</label>'. |
---|
[0] | 795 | form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). |
---|
[1396] | 796 | '</p>'. |
---|
[2542] | 797 | |
---|
[1396] | 798 | '<p><label for="comment_site">'.__('Web site:').'</label>'. |
---|
[0] | 799 | form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). |
---|
[1396] | 800 | '</p>'. |
---|
[2542] | 801 | |
---|
[70] | 802 | '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. |
---|
| 803 | __('Comment:').'</label> '. |
---|
[0] | 804 | form::textarea('comment_content',50,8,html::escapeHTML('')). |
---|
| 805 | '</p>'. |
---|
[2542] | 806 | |
---|
[2063] | 807 | '<p>'. |
---|
[2091] | 808 | form::hidden('post_id',$post_id). |
---|
[0] | 809 | $core->formNonce(). |
---|
[217] | 810 | '<input type="submit" name="add" value="'.__('Save').'" /></p>'. |
---|
[1613] | 811 | '</div>'. #constrained |
---|
| 812 | |
---|
[0] | 813 | '</form>'. |
---|
[1613] | 814 | '</div>'. #add comment |
---|
| 815 | '</div>'; #comments |
---|
[0] | 816 | } |
---|
| 817 | |
---|
[1783] | 818 | if ($post_id && $post_status == 1) |
---|
| 819 | { |
---|
| 820 | /* Trackbacks |
---|
| 821 | -------------------------------------------------------- */ |
---|
| 822 | |
---|
| 823 | $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); |
---|
| 824 | $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); |
---|
[2542] | 825 | |
---|
[1783] | 826 | # Actions combo box |
---|
[2542] | 827 | $combo_action = $comments_actions_page->getCombo(); |
---|
[1783] | 828 | $has_action = !empty($combo_action) && !$trackbacks->isEmpty(); |
---|
[2542] | 829 | |
---|
[1783] | 830 | if (!empty($_GET['tb_auto'])) { |
---|
| 831 | $tb_urls = implode("\n", $TB->discover($post_excerpt_xhtml.' '.$post_content_xhtml)); |
---|
| 832 | } |
---|
[2542] | 833 | |
---|
[1783] | 834 | # Display tab |
---|
| 835 | echo |
---|
| 836 | '<div id="trackbacks" class="clear multi-part" title="'.__('Trackbacks').'">'; |
---|
[2542] | 837 | |
---|
[1783] | 838 | # tracbacks actions |
---|
| 839 | if ($has_action) { |
---|
[2720] | 840 | echo '<form action="'.$core->adminurl->get("admin.post").'" id="form-trackbacks" method="post">'; |
---|
[1783] | 841 | } |
---|
[2542] | 842 | |
---|
[2142] | 843 | echo '<h3>'.__('Trackbacks received').'</h3>'; |
---|
[2542] | 844 | |
---|
[1783] | 845 | if (!$trackbacks->isEmpty()) { |
---|
[3491] | 846 | $showComments($trackbacks, $has_action, true); |
---|
[1783] | 847 | } else { |
---|
| 848 | echo '<p>'.__('No trackback').'</p>'; |
---|
| 849 | } |
---|
[2542] | 850 | |
---|
[1783] | 851 | if ($has_action) { |
---|
| 852 | echo |
---|
| 853 | '<div class="two-cols">'. |
---|
| 854 | '<p class="col checkboxes-helpers"></p>'. |
---|
[2542] | 855 | |
---|
[1783] | 856 | '<p class="col right"><label for="action" class="classic">'.__('Selected trackbacks action:').'</label> '. |
---|
| 857 | form::combo('action', $combo_action). |
---|
[2063] | 858 | form::hidden('id',$post_id). |
---|
[2071] | 859 | form::hidden(array('section'),'trackbacks'). |
---|
[1783] | 860 | $core->formNonce(). |
---|
| 861 | '<input type="submit" value="'.__('ok').'" /></p>'. |
---|
| 862 | '</div>'. |
---|
| 863 | '</form>'; |
---|
| 864 | } |
---|
[2542] | 865 | |
---|
[1783] | 866 | /* Add trackbacks |
---|
| 867 | -------------------------------------------------------- */ |
---|
| 868 | if ($can_edit_post && $post->post_status) { |
---|
| 869 | echo |
---|
| 870 | '<div class="fieldset clear">'; |
---|
| 871 | |
---|
| 872 | echo |
---|
| 873 | '<h3>'.__('Ping blogs').'</h3>'. |
---|
[2720] | 874 | '<form action="'.$core->adminurl->get("admin.post",array('id' => $post_id)).'" id="trackback-form" method="post">'. |
---|
[1783] | 875 | '<p><label for="tb_urls" class="area">'.__('URLs to ping:').'</label>'. |
---|
| 876 | form::textarea('tb_urls', 60, 5, $tb_urls). |
---|
| 877 | '</p>'. |
---|
| 878 | |
---|
[2142] | 879 | '<p><label for="tb_excerpt" class="area">'.__('Excerpt to send:').'</label>'. |
---|
[1783] | 880 | form::textarea('tb_excerpt', 60, 5, $tb_excerpt).'</p>'. |
---|
| 881 | |
---|
| 882 | '<p>'. |
---|
| 883 | $core->formNonce(). |
---|
| 884 | '<input type="submit" name="ping" value="'.__('Ping blogs').'" />'. |
---|
[2542] | 885 | (empty($_GET['tb_auto']) ? |
---|
[1783] | 886 | ' <a class="button" href="'. |
---|
[2720] | 887 | $core->adminurl->get("admin.post",array('id'=> $post_id,'tb_auto' => 1,'tb' => 1)). |
---|
[1783] | 888 | '">'.__('Auto discover ping URLs').'</a>' |
---|
| 889 | : ''). |
---|
| 890 | '</p>'. |
---|
| 891 | '</form>'; |
---|
| 892 | |
---|
| 893 | $pings = $TB->getPostPings($post_id); |
---|
| 894 | |
---|
| 895 | if (!$pings->isEmpty()) |
---|
| 896 | { |
---|
| 897 | echo '<h3>'.__('Previously sent pings').'</h3>'; |
---|
[2542] | 898 | |
---|
[1783] | 899 | echo '<ul class="nice">'; |
---|
| 900 | while ($pings->fetch()) { |
---|
| 901 | echo |
---|
| 902 | '<li>'.dt::dt2str(__('%Y-%m-%d %H:%M'), $pings->ping_dt).' - '. |
---|
| 903 | $pings->ping_url.'</li>'; |
---|
| 904 | } |
---|
| 905 | echo '</ul>'; |
---|
| 906 | } |
---|
| 907 | |
---|
| 908 | echo '</div>'; |
---|
| 909 | } |
---|
| 910 | |
---|
| 911 | echo '</div>'; #trackbacks |
---|
| 912 | } |
---|
| 913 | |
---|
[1459] | 914 | dcPage::helpBlock('core_post','core_trackbacks','core_wiki'); |
---|
[0] | 915 | dcPage::close(); |
---|