Changeset 1783:cf1158c74315 for admin/post.php
- Timestamp:
- 09/10/13 16:21:32 (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r1741 r1783 69 69 $bad_dt = false; 70 70 71 # Trackbacks 72 $TB = new dcTrackback($core); 73 $tb_urls = $tb_excerpt = ''; 74 71 75 # Get entry informations 72 76 if (!empty($_REQUEST['id'])) … … 128 132 $core->error->add($e->getMessage()); 129 133 } 134 135 # Sanitize trackbacks excerpt 136 $tb_excerpt = empty($_POST['tb_excerpt']) ? 137 $post_excerpt_xhtml.' '.$post_content_xhtml : 138 $_POST['tb_excerpt']; 139 $tb_excerpt = html::decodeEntities(html::clean($tb_excerpt)); 140 $tb_excerpt = text::cutString(html::escapeHTML($tb_excerpt), 255); 141 $tb_excerpt = preg_replace('/\s+/ms', ' ', $tb_excerpt); 142 } 143 } 144 145 # Ping blogs 146 if (!empty($_POST['ping'])) 147 { 148 if (!empty($_POST['tb_urls']) && $post_id && $post_status == 1 && $can_edit_post) 149 { 150 $tb_urls = $_POST['tb_urls']; 151 $tb_urls = str_replace("\r", '', $tb_urls); 152 $tb_post_title = html::escapeHTML(trim(html::clean($post_title))); 153 154 foreach (explode("\n", $tb_urls) as $tb_url) 155 { 156 try { 157 $TB->ping($tb_url, $post_id, $tb_post_title, $tb_excerpt, $post_url); 158 } catch (Exception $e) { 159 $core->error->add($e->getMessage()); 160 } 161 } 162 163 if (!$core->error->flag()) { 164 http::redirect('post.php?id='.$post_id.'&tbsent=1&tb=1'); 165 } 130 166 } 131 167 } 132 168 133 169 # Format excerpt and content 134 if (!empty($_POST) && $can_edit_post)170 elseif (!empty($_POST) && $can_edit_post) 135 171 { 136 172 $post_format = $_POST['post_format']; … … 294 330 if (!empty($_GET['co'])) { 295 331 $default_tab = 'comments'; 332 } 333 elseif (!empty($_GET['tb'])) { 334 $default_tab = 'trackbacks'; 296 335 } 297 336 … … 354 393 if (!empty($_GET['creaco'])) { 355 394 dcPage::success(__('Comment has been successfully created.')); 395 } 396 if (!empty($_GET['tbsent'])) { 397 dcPage::success(__('All pings sent.')); 356 398 } 357 399 … … 567 609 568 610 echo '</div>'; 569 570 if ($post_id && $post->post_status == 1) { 571 echo '<p><a href="trackbacks.php?id='.$post_id.'" class="multi-part">'. 572 __('Ping blogs').'</a></p>'; 573 } 574 575 } 576 577 578 /* Comments and trackbacks 579 -------------------------------------------------------- */ 611 } 612 580 613 if ($post_id) 581 614 { 615 /* Comments 616 -------------------------------------------------------- */ 617 582 618 $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 583 619 584 620 $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 585 $trackbacks = $core->blog->getComments(array_merge($params,array('comment_trackback'=>1)));586 621 587 622 # Actions combo box … … 606 641 $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); 607 642 608 $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty());643 $has_action = !empty($combo_action) && !$comments->isEmpty(); 609 644 echo 610 645 '<p class="top-add"><a class="button add" href="#comment-form">'.__('Add a comment').'</a></p>'; … … 612 647 if ($has_action) { 613 648 echo '<form action="comments_actions.php" id="form-comments" method="post">'; 614 }615 616 echo '<h3>'.__('Trackbacks').'</h3>';617 618 if (!$trackbacks->isEmpty()) {619 showComments($trackbacks,$has_action,true);620 } else {621 echo '<p>'.__('No trackback').'</p>';622 649 } 623 650 … … 676 703 '</div>'. #add comment 677 704 '</div>'; #comments 705 } 706 707 if ($post_id && $post_status == 1) 708 { 709 /* Trackbacks 710 -------------------------------------------------------- */ 711 712 $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 713 $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); 714 715 # Actions combo box 716 $combo_action = array(); 717 if ($can_edit_post && $core->auth->check('publish,contentadmin', $core->blog->id)) 718 { 719 $combo_action[__('Publish')] = 'publish'; 720 $combo_action[__('Unpublish')] = 'unpublish'; 721 $combo_action[__('Mark as pending')] = 'pending'; 722 $combo_action[__('Mark as junk')] = 'junk'; 723 } 724 725 if ($can_edit_post && $core->auth->check('delete,contentadmin', $core->blog->id)) 726 { 727 $combo_action[__('Delete')] = 'delete'; 728 } 729 730 # --BEHAVIOR-- adminTrackbacksActionsCombo 731 $core->callBehavior('adminTrackbacksActionsCombo', array(&$combo_action)); 732 733 $has_action = !empty($combo_action) && !$trackbacks->isEmpty(); 734 735 if (!empty($_GET['tb_auto'])) { 736 $tb_urls = implode("\n", $TB->discover($post_excerpt_xhtml.' '.$post_content_xhtml)); 737 } 738 739 # Display tab 740 echo 741 '<div id="trackbacks" class="clear multi-part" title="'.__('Trackbacks').'">'; 742 743 # tracbacks actions 744 if ($has_action) { 745 echo '<form action="comments_actions.php" id="form-trackbacks" method="post">'; 746 } 747 748 echo '<h3>'.__('Trackbacks').'</h3>'; 749 750 if (!$trackbacks->isEmpty()) { 751 showComments($trackbacks, $has_action, true); 752 } else { 753 echo '<p>'.__('No trackback').'</p>'; 754 } 755 756 if ($has_action) { 757 echo 758 '<div class="two-cols">'. 759 '<p class="col checkboxes-helpers"></p>'. 760 761 '<p class="col right"><label for="action" class="classic">'.__('Selected trackbacks action:').'</label> '. 762 form::combo('action', $combo_action). 763 form::hidden('redir', 'post.php?id='.$post_id.'&tb=1'). 764 $core->formNonce(). 765 '<input type="submit" value="'.__('ok').'" /></p>'. 766 '</div>'. 767 '</form>'; 768 } 769 770 /* Add trackbacks 771 -------------------------------------------------------- */ 772 if ($can_edit_post && $post->post_status) { 773 echo 774 '<div class="fieldset clear">'; 775 776 echo 777 '<h3>'.__('Ping blogs').'</h3>'. 778 '<form action="post.php?id='.$post_id.'" id="trackback-form" method="post">'. 779 '<p><label for="tb_urls" class="area">'.__('URLs to ping:').'</label>'. 780 form::textarea('tb_urls', 60, 5, $tb_urls). 781 '</p>'. 782 783 '<p><label for="tb_excerpt" class="area">'.__('Send excerpt:').'</label>'. 784 form::textarea('tb_excerpt', 60, 5, $tb_excerpt).'</p>'. 785 786 '<p>'. 787 $core->formNonce(). 788 '<input type="submit" name="ping" value="'.__('Ping blogs').'" />'. 789 (empty($_GET['tb_auto']) ? 790 ' <a class="button" href="'. 791 'post.php?id='.$post_id.'&tb_auto=1&tb=1'. 792 '">'.__('Auto discover ping URLs').'</a>' 793 : ''). 794 '</p>'. 795 '</form>'; 796 797 $pings = $TB->getPostPings($post_id); 798 799 if (!$pings->isEmpty()) 800 { 801 echo '<h3>'.__('Previously sent pings').'</h3>'; 802 803 echo '<ul class="nice">'; 804 while ($pings->fetch()) { 805 echo 806 '<li>'.dt::dt2str(__('%Y-%m-%d %H:%M'), $pings->ping_dt).' - '. 807 $pings->ping_url.'</li>'; 808 } 809 echo '</ul>'; 810 } 811 812 echo '</div>'; 813 } 814 815 echo '</div>'; #trackbacks 678 816 } 679 817
Note: See TracChangeset
for help on using the changeset viewer.