Changeset 2542:602b5c046fef
- Timestamp:
- 11/13/13 20:09:24 (10 years ago)
- Branch:
- 2.6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r2486 r2542 77 77 { 78 78 $page_title = __('Edit entry'); 79 79 80 80 $params['post_id'] = $_REQUEST['id']; 81 81 82 82 $post = $core->blog->getPosts($params); 83 83 84 84 if ($post->isEmpty()) 85 85 { … … 106 106 $post_open_comment = (boolean) $post->post_open_comment; 107 107 $post_open_tb = (boolean) $post->post_open_tb; 108 108 109 109 $can_edit_post = $post->isEditable(); 110 110 $can_delete= $post->isDeletable(); 111 111 112 112 $next_rs = $core->blog->getNextPost($post,1); 113 113 $prev_rs = $core->blog->getNextPost($post,-1); 114 114 115 115 if ($next_rs !== null) { 116 116 $next_link = sprintf($post_link,$next_rs->post_id, … … 119 119 html::escapeHTML($next_rs->post_title),$next_rs->post_id); 120 120 } 121 121 122 122 if ($prev_rs !== null) { 123 123 $prev_link = sprintf($post_link,$prev_rs->post_id, … … 126 126 html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 127 127 } 128 128 129 129 try { 130 130 $core->media = new dcMedia($core); … … 134 134 135 135 # Sanitize trackbacks excerpt 136 $tb_excerpt = empty($_POST['tb_excerpt']) ? 136 $tb_excerpt = empty($_POST['tb_excerpt']) ? 137 137 $post_excerpt_xhtml.' '.$post_content_xhtml : 138 138 $_POST['tb_excerpt']; … … 146 146 } else { 147 147 $anchor = 'comments'; 148 } 148 } 149 149 150 150 $comments_actions_page = new dcCommentsActionsPage($core,'post.php',array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor)); … … 162 162 $tb_urls = str_replace("\r", '', $tb_urls); 163 163 $tb_post_title = html::escapeHTML(trim(html::clean($post_title))); 164 164 $tb_post_url = $post->getURL(); 165 165 166 foreach (explode("\n", $tb_urls) as $tb_url) 166 167 { 167 168 try { 168 $TB->ping($tb_url, $post_id, $tb_post_title, $tb_excerpt, $ post_url);169 $TB->ping($tb_url, $post_id, $tb_post_title, $tb_excerpt, $tb_post_url); 169 170 } catch (Exception $e) { 170 171 $core->error->add($e->getMessage()); 171 172 } 172 173 } 173 174 174 175 if (!$core->error->flag()) { 175 176 dcPage::addSuccessNotice(__('All pings sent.')); … … 185 186 $post_excerpt = $_POST['post_excerpt']; 186 187 $post_content = $_POST['post_content']; 187 188 188 189 $post_title = $_POST['post_title']; 189 190 190 191 $cat_id = (integer) $_POST['cat_id']; 191 192 192 193 if (isset($_POST['post_status'])) { 193 194 $post_status = (integer) $_POST['post_status']; 194 195 } 195 196 196 197 if (empty($_POST['post_dt'])) { 197 198 $post_dt = ''; … … 211 212 } 212 213 } 213 214 214 215 $post_open_comment = !empty($_POST['post_open_comment']); 215 216 $post_open_tb = !empty($_POST['post_open_tb']); … … 217 218 $post_lang = $_POST['post_lang']; 218 219 $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 219 220 220 221 $post_notes = $_POST['post_notes']; 221 222 222 223 if (isset($_POST['post_url'])) { 223 224 $post_url = $_POST['post_url']; 224 225 } 225 226 226 227 $core->blog->setPostContent( 227 228 $post_id,$post_format,$post_lang, … … 248 249 # Create category 249 250 if (!empty($_POST['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) { 250 251 251 252 $cur_cat = $core->con->openCursor($core->prefix.'category'); 252 253 $cur_cat->cat_title = $_POST['new_cat_title']; 253 254 $cur_cat->cat_url = ''; 254 255 255 256 $parent_cat = !empty($_POST['new_cat_parent']) ? $_POST['new_cat_parent'] : ''; 256 257 257 258 # --BEHAVIOR-- adminBeforeCategoryCreate 258 259 $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); 259 260 260 261 $cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat); 261 262 262 263 # --BEHAVIOR-- adminAfterCategoryCreate 263 264 $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $cat_id); 264 265 } 265 266 266 267 $cur = $core->con->openCursor($core->prefix.'post'); 267 268 268 269 $cur->post_title = $post_title; 269 270 $cur->cat_id = ($cat_id ? $cat_id : null); … … 282 283 $cur->post_open_comment = (integer) $post_open_comment; 283 284 $cur->post_open_tb = (integer) $post_open_tb; 284 285 285 286 if (isset($_POST['post_url'])) { 286 287 $cur->post_url = $post_url; 287 288 } 288 289 289 290 # Update post 290 291 if ($post_id) … … 294 295 # --BEHAVIOR-- adminBeforePostUpdate 295 296 $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); 296 297 297 298 $core->blog->updPost($post_id,$cur); 298 299 299 300 # --BEHAVIOR-- adminAfterPostUpdate 300 301 $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); … … 310 311 { 311 312 $cur->user_id = $core->auth->userID(); 312 313 313 314 try 314 315 { 315 316 # --BEHAVIOR-- adminBeforePostCreate 316 317 $core->callBehavior('adminBeforePostCreate',$cur); 317 318 318 319 $return_id = $core->blog->addPost($cur); 319 320 320 321 # --BEHAVIOR-- adminAfterPostCreate 321 322 $core->callBehavior('adminAfterPostCreate',$cur,$return_id); … … 417 418 $post_content = $post_content_xhtml; 418 419 $post_format = 'xhtml'; 419 420 420 421 dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 421 422 } … … 430 431 if ($next_link && $prev_link) { echo ' | '; } 431 432 if ($next_link) { echo $next_link; } 432 433 433 434 # --BEHAVIOR-- adminPostNavLinks 434 435 $core->callBehavior('adminPostNavLinks',isset($post) ? $post : null); 435 436 436 437 echo '</p>'; 437 438 } … … 451 452 'title' => __('Status'), 452 453 'items' => array( 453 'post_status' => 454 'post_status' => 454 455 '<p class="entry-status"><label for="post_status">'.__('Entry status').' '.$img_status.'</label>'. 455 456 form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). 456 457 '</p>', 457 'post_dt' => 458 'post_dt' => 458 459 '<p><label for="post_dt">'.__('Publication date and hour').'</label>'. 459 460 form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). … … 474 475 'title' => __('Filing'), 475 476 'items' => array( 476 'post_selected' => 477 'post_selected' => 477 478 '<p><label for="post_selected" class="classic">'. 478 479 form::checkbox('post_selected',1,$post_selected).' '. … … 504 505 form::checkbox('post_open_comment',1,$post_open_comment).' '. 505 506 __('Accept comments').'</label></p>'. 506 ($core->blog->settings->system->allow_comments ? 507 (isContributionAllowed($post_id,strtotime($post_dt),true) ? 507 ($core->blog->settings->system->allow_comments ? 508 (isContributionAllowed($post_id,strtotime($post_dt),true) ? 508 509 '' : 509 510 '<p class="form-note warn">'. 510 __('Warning: Comments are not more accepted for this entry.').'</p>') : 511 __('Warning: Comments are not more accepted for this entry.').'</p>') : 511 512 '<p class="form-note warn">'. 512 513 __('Comments are not accepted on this blog so far.').'</p>'). … … 514 515 form::checkbox('post_open_tb',1,$post_open_tb).' '. 515 516 __('Accept trackbacks').'</label></p>'. 516 ($core->blog->settings->system->allow_trackbacks ? 517 (isContributionAllowed($post_id,strtotime($post_dt),false) ? 517 ($core->blog->settings->system->allow_trackbacks ? 518 (isContributionAllowed($post_id,strtotime($post_dt),false) ? 518 519 '' : 519 520 '<p class="form-note warn">'. 520 __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 521 __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 521 522 '<p class="form-note warn">'.__('Trackbacks are not accepted on this blog so far.').'</p>'). 522 523 '</div>', … … 541 542 form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 542 543 '</p>', 543 544 544 545 "post_excerpt" => 545 546 '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">'.__('Excerpt:').' <span class="form-note">'. … … 547 548 form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 548 549 '</p>', 549 550 550 551 "post_content" => 551 552 '<p class="area" id="content-area"><label class="required bold" '. … … 553 554 form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 554 555 '</p>', 555 556 556 557 "post_notes" => 557 558 '<p class="area" id="notes-area"><label for="post_notes" class="bold">'.__('Personal notes:').' <span class="form-note">'. … … 561 562 ) 562 563 ); 563 564 564 565 # --BEHAVIOR-- adminPostFormItems 565 566 $core->callBehavior('adminPostFormItems',$main_items,$sidebar_items, isset($post) ? $post : null); … … 571 572 572 573 echo '<h3 class="out-of-screen-if-js">'.__('Edit post').'</h3>'; 573 574 574 575 foreach ($main_items as $id => $item) { 575 576 echo $item; … … 578 579 # --BEHAVIOR-- adminPostForm (may be deprecated) 579 580 $core->callBehavior('adminPostForm',isset($post) ? $post : null); 580 581 581 582 echo 582 583 '<p class="border-top">'. … … 599 600 $core->formNonce(). 600 601 '</p>'; 601 602 602 603 echo '</div></div>'; // End #entry-content 603 604 echo '</div>'; // End #entry-wrapper 604 605 605 606 echo '<div id="entry-sidebar">'; 606 607 607 608 foreach ($sidebar_items as $id => $c) { 608 609 echo '<div id="'.$id.'" class="sb-box">'. … … 613 614 echo '</div>'; 614 615 } 615 616 616 617 617 618 # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) 618 619 $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); … … 620 621 621 622 echo '</form>'; 622 623 623 624 # --BEHAVIOR-- adminPostForm 624 625 $core->callBehavior('adminPostAfterForm',isset($post) ? $post : null); 625 626 626 627 echo '</div>'; 627 628 } … … 633 634 634 635 $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 635 636 636 637 $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 637 638 638 639 echo 639 640 '<div id="comments" class="clear multi-part" title="'.__('Comments').'">'; 640 $combo_action = $comments_actions_page->getCombo(); 641 $combo_action = $comments_actions_page->getCombo(); 641 642 $has_action = !empty($combo_action) && !$comments->isEmpty(); 642 echo 643 echo 643 644 '<p class="top-add"><a class="button add" href="#comment-form">'.__('Add a comment').'</a></p>'; 644 645 645 646 if ($has_action) { 646 647 echo '<form action="post.php" id="form-comments" method="post">'; 647 648 } 648 649 649 650 echo '<h3>'.__('Comments').'</h3>'; 650 651 if (!$comments->isEmpty()) { … … 653 654 echo '<p>'.__('No comment').'</p>'; 654 655 } 655 656 656 657 if ($has_action) { 657 658 echo 658 659 '<div class="two-cols">'. 659 660 '<p class="col checkboxes-helpers"></p>'. 660 661 661 662 '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 662 663 form::combo('action',$combo_action). … … 674 675 '<div class="fieldset clear">'. 675 676 '<h3>'.__('Add a comment').'</h3>'. 676 677 677 678 '<form action="comment.php" method="post" id="comment-form">'. 678 679 '<div class="constrained">'. … … 680 681 form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 681 682 '</p>'. 682 683 683 684 '<p><label for="comment_email">'.__('Email:').'</label>'. 684 685 form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 685 686 '</p>'. 686 687 687 688 '<p><label for="comment_site">'.__('Web site:').'</label>'. 688 689 form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 689 690 '</p>'. 690 691 691 692 '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 692 693 __('Comment:').'</label> '. 693 694 form::textarea('comment_content',50,8,html::escapeHTML('')). 694 695 '</p>'. 695 696 696 697 '<p>'. 697 698 form::hidden('post_id',$post_id). … … 712 713 $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 713 714 $trackbacks = $core->blog->getComments(array_merge($params, array('comment_trackback' => 1))); 714 715 715 716 # Actions combo box 716 $combo_action = $comments_actions_page->getCombo(); 717 $combo_action = $comments_actions_page->getCombo(); 717 718 $has_action = !empty($combo_action) && !$trackbacks->isEmpty(); 718 719 719 720 if (!empty($_GET['tb_auto'])) { 720 721 $tb_urls = implode("\n", $TB->discover($post_excerpt_xhtml.' '.$post_content_xhtml)); 721 722 } 722 723 723 724 # Display tab 724 725 echo 725 726 '<div id="trackbacks" class="clear multi-part" title="'.__('Trackbacks').'">'; 726 727 727 728 # tracbacks actions 728 729 if ($has_action) { 729 730 echo '<form action="post.php" id="form-trackbacks" method="post">'; 730 731 } 731 732 732 733 echo '<h3>'.__('Trackbacks received').'</h3>'; 733 734 734 735 if (!$trackbacks->isEmpty()) { 735 736 showComments($trackbacks, $has_action, true); … … 737 738 echo '<p>'.__('No trackback').'</p>'; 738 739 } 739 740 740 741 if ($has_action) { 741 742 echo 742 743 '<div class="two-cols">'. 743 744 '<p class="col checkboxes-helpers"></p>'. 744 745 745 746 '<p class="col right"><label for="action" class="classic">'.__('Selected trackbacks action:').'</label> '. 746 747 form::combo('action', $combo_action). … … 752 753 '</form>'; 753 754 } 754 755 755 756 /* Add trackbacks 756 757 -------------------------------------------------------- */ … … 772 773 $core->formNonce(). 773 774 '<input type="submit" name="ping" value="'.__('Ping blogs').'" />'. 774 (empty($_GET['tb_auto']) ? 775 (empty($_GET['tb_auto']) ? 775 776 ' <a class="button" href="'. 776 777 'post.php?id='.$post_id.'&tb_auto=1&tb=1'. … … 785 786 { 786 787 echo '<h3>'.__('Previously sent pings').'</h3>'; 787 788 788 789 echo '<ul class="nice">'; 789 790 while ($pings->fetch()) { … … 810 811 } 811 812 if ($com) { 812 if (($core->blog->settings->system->comments_ttl == 0) || 813 if (($core->blog->settings->system->comments_ttl == 0) || 813 814 (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 814 815 return true; 815 816 } 816 817 } else { 817 if (($core->blog->settings->system->trackbacks_ttl == 0) || 818 if (($core->blog->settings->system->trackbacks_ttl == 0) || 818 819 (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 819 820 return true; … … 840 841 $comments[(integer)$v]=true; 841 842 } 842 } 843 843 } 844 844 845 while($rs->fetch()) 845 846 { 846 847 $comment_url = 'comment.php?id='.$rs->comment_id; 847 848 848 849 $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 849 850 switch ($rs->comment_status) { … … 861 862 break; 862 863 } 863 864 864 865 echo 865 866 '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 866 867 ' id="c'.$rs->comment_id.'">'. 867 868 868 869 '<td class="nowrap">'. 869 870 ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,isset($comments[$rs->comment_id]),'','',0,'title="'.($tb ? __('select this trackback') : __('select this comment')).'"') : '').'</td>'. … … 874 875 '<td class="nowrap status"><a href="'.$comment_url.'">'. 875 876 '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. 876 877 877 878 '</tr>'; 878 879 } 879 880 880 881 echo '</table></div>'; 881 882 }
Note: See TracChangeset
for help on using the changeset viewer.