Ticket #15527: 15527.2.diff
File 15527.2.diff, 12.9 KB (added by , 14 years ago) |
---|
-
wp-admin/admin-ajax.php
diff --git wp-admin/admin-ajax.php wp-admin/admin-ajax.php index d2a8d4d..9c56917 100644
function _wp_ajax_add_hierarchical_term() { 316 316 $x->send(); 317 317 } 318 318 319 function _wp_add_comment( $action ) { 320 global $wpdb; 321 322 check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); 323 324 set_current_screen( 'edit-comments' ); 325 326 $comment_post_ID = (int) $_POST['comment_post_ID']; 327 if ( !current_user_can( 'edit_post', $comment_post_ID ) ) 328 die('-1'); 329 330 $error_messages = array( 331 'replyto-comment' => array( 332 'invalid_status' => __( 'Error: you are replying to a comment on a draft post.' ), 333 'must_log_in' => __( 'Sorry, you must be logged in to reply to a comment.' ), 334 'type_something' => __( 'Error: please type a comment.' ), 335 ), 336 'add-comment' => array( 337 'invalid_status' => __( 'Error: you are adding comment on a draft post.' ), 338 'must_log_in' => __( 'Sorry, you must be logged in to add a comment.' ), 339 'type_something' => __( 'Error: please type a comment.' ), 340 ), 341 ); 342 343 $status = get_post_status( $comment_post_ID ); 344 345 if ( empty( $status ) ) 346 die( '1' ); 347 elseif ( in_array( $status, array( 'draft', 'pending', 'trash' ) ) ) 348 die( $error_messages[$action]['invalid_status'] ); 349 350 $user = wp_get_current_user(); 351 if ( ! $user->ID ) { 352 die( $error_messages[$action]['must_log_in'] ); 353 } 354 355 $comment_content = trim($_POST['content']); 356 357 if ( '' == $comment_content ) 358 die( $error_messages[$action]['type_something'] ); 359 360 $comment_author = $wpdb->escape($user->display_name); 361 $comment_author_email = $wpdb->escape($user->user_email); 362 $comment_author_url = $wpdb->escape($user->user_url); 363 $comment_type = ''; 364 365 if ( current_user_can( 'unfiltered_html' ) ) { 366 if ( wp_create_nonce( 'unfiltered-html-comment_' . $comment_post_ID ) != $_POST['_wp_unfiltered_html_comment'] ) { 367 kses_remove_filters(); // start with a clean slate 368 kses_init_filters(); // set up the filters 369 } 370 } 371 372 $comment_parent = ( $action == 'replyto-comment' ) ? absint( $_POST['comment_ID'] ) : 0; 373 $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID' ); 374 $comment_id = wp_new_comment( $commentdata ); 375 $comment = get_comment( $comment_id ); 376 377 if ( ! $comment ) die( '1' ); 378 379 $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; 380 381 $x = new WP_Ajax_Response(); 382 383 ob_start(); 384 if ( 'dashboard' == $_REQUEST['mode'] ) { 385 require_once( ABSPATH . 'wp-admin/includes/dashboard.php' ); 386 _wp_dashboard_recent_comments_row( $comment ); 387 } else { 388 if ( 'single' == $_REQUEST['mode'] ) { 389 $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' ); 390 } else { 391 $wp_list_table = _get_list_table( 'WP_Comments_List_Table' ); 392 } 393 $wp_list_table->single_row( $comment ); 394 } 395 $comment_list_item = ob_get_contents(); 396 ob_end_clean(); 397 398 $x->add( array( 399 'what' => 'comment', 400 'id' => $comment->comment_ID, 401 'data' => $comment_list_item, 402 'position' => $position 403 )); 404 405 $x->send(); 406 } 407 319 408 $id = isset($_POST['id'])? (int) $_POST['id'] : 0; 320 409 switch ( $action = $_POST['action'] ) : 321 410 case 'delete-comment' : // On success, die with time() instead of 1 … … case 'get-comments' : 624 713 ) ); 625 714 $x->send(); 626 715 break; 627 case 'replyto-comment' :628 check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );629 630 set_current_screen( 'edit-comments' );631 716 632 $comment_post_ID = (int) $_POST['comment_post_ID']; 633 if ( !current_user_can( 'edit_post', $comment_post_ID ) ) 634 die('-1'); 635 636 $status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); 637 638 if ( empty($status) ) 639 die('1'); 640 elseif ( in_array($status, array('draft', 'pending', 'trash') ) ) 641 die( __('Error: you are replying to a comment on a draft post.') ); 642 643 $user = wp_get_current_user(); 644 if ( $user->ID ) { 645 $comment_author = $wpdb->escape($user->display_name); 646 $comment_author_email = $wpdb->escape($user->user_email); 647 $comment_author_url = $wpdb->escape($user->user_url); 648 $comment_content = trim($_POST['content']); 649 if ( current_user_can('unfiltered_html') ) { 650 if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { 651 kses_remove_filters(); // start with a clean slate 652 kses_init_filters(); // set up the filters 653 } 654 } 655 } else { 656 die( __('Sorry, you must be logged in to reply to a comment.') ); 657 } 658 659 if ( '' == $comment_content ) 660 die( __('Error: please type a comment.') ); 661 662 $comment_parent = absint($_POST['comment_ID']); 663 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); 664 665 $comment_id = wp_new_comment( $commentdata ); 666 $comment = get_comment($comment_id); 667 if ( ! $comment ) die('1'); 668 669 $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; 670 671 $x = new WP_Ajax_Response(); 672 673 ob_start(); 674 if ( 'dashboard' == $_REQUEST['mode'] ) { 675 require_once( ABSPATH . 'wp-admin/includes/dashboard.php' ); 676 _wp_dashboard_recent_comments_row( $comment ); 677 } else { 678 if ( 'single' == $_REQUEST['mode'] ) { 679 $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); 680 } else { 681 $wp_list_table = _get_list_table('WP_Comments_List_Table'); 682 } 683 $wp_list_table->single_row( $comment ); 684 } 685 $comment_list_item = ob_get_contents(); 686 ob_end_clean(); 687 688 $x->add( array( 689 'what' => 'comment', 690 'id' => $comment->comment_ID, 691 'data' => $comment_list_item, 692 'position' => $position 693 )); 694 695 $x->send(); 717 case 'add-comment': 718 case 'replyto-comment': 719 _wp_add_comment( $_POST['action'] ); 696 720 break; 697 721 case 'edit-comment' : 698 722 check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); -
wp-admin/css/colors-classic.dev.css
diff --git wp-admin/css/colors-classic.dev.css wp-admin/css/colors-classic.dev.css index 26cb708..c6d0c23 100644
table.diff .diff-addedline ins { 1304 1304 } 1305 1305 1306 1306 #edithead, 1307 #replyhead { 1307 #replyhead, 1308 #addhead { 1308 1309 background-color: #f1f1f1; 1309 1310 } 1310 1311 -
wp-admin/css/colors-fresh.dev.css
diff --git wp-admin/css/colors-fresh.dev.css wp-admin/css/colors-fresh.dev.css index 6325917..b66fd7f 100644
table.diff .diff-addedline ins { 1301 1301 } 1302 1302 1303 1303 #edithead, 1304 #replyhead { 1304 #replyhead, 1305 #addhead { 1305 1306 background-color: #f1f1f1; 1306 1307 } 1307 1308 -
wp-admin/css/dashboard-rtl.dev.css
diff --git wp-admin/css/dashboard-rtl.dev.css wp-admin/css/dashboard-rtl.dev.css index b0219f2..b6d40a4 100644
41 41 float: left; 42 42 clear: left; 43 43 } 44 #dashboard-widgets h3 .postbox-title-action {45 right: auto;46 left: 30px;47 }48 44 #the-comment-list .pingback { 49 45 padding-left: 0 !important; 50 46 padding-right: 9px !important; -
wp-admin/css/dashboard.dev.css
diff --git wp-admin/css/dashboard.dev.css wp-admin/css/dashboard.dev.css index 15da850..f212dcb 100644
1 1 .postbox p, .postbox ul, .postbox ol, .postbox blockquote, #wp-version-message { font-size: 11px; } 2 2 3 .edit-box {4 display: none;5 }6 7 h3:hover .edit-box {8 display: inline;9 }10 11 3 form .input-text-wrap { 12 4 border-style: solid; 13 5 border-width: 1px; … … div.postbox div.inside { 69 61 text-decoration: underline; 70 62 } 71 63 72 #dashboard-widgets h3 .postbox-title-action {73 position: absolute;74 right: 30px;75 padding: 0;76 }77 78 64 #dashboard-widgets h4 { 79 65 font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; 80 66 font-size: 13px; -
wp-admin/css/wp-admin-rtl.dev.css
diff --git wp-admin/css/wp-admin-rtl.dev.css wp-admin/css/wp-admin-rtl.dev.css index 463be70..ff2d096 100644
ol { 604 604 padding-left: 0.5%; 605 605 padding-right: 0; 606 606 } 607 .postbox h3 .postbox-title-action { 608 right: auto; 609 left: 30px; 610 } 607 611 608 612 /* Media library */ 609 613 #wpbody-content .describe th { -
wp-admin/css/wp-admin.dev.css
diff --git wp-admin/css/wp-admin.dev.css wp-admin/css/wp-admin.dev.css index 8506810..c0059eb 100644
body.admin-bar #wphead { 1199 1199 padding: 6px 0; 1200 1200 } 1201 1201 1202 .postbox h3 .postbox-title-action { 1203 display:none; 1204 position:absolute; 1205 right:30px; 1206 padding:0; 1207 } 1208 1209 .postbox h3:hover .postbox-title-action { 1210 display:inline; 1211 } 1212 1202 1213 .postbox .hndle { 1203 1214 cursor: move; 1204 1215 } … … span.imgedit-scale-warn { 3476 3487 display: none; 3477 3488 } 3478 3489 3479 # replyhead {3490 #addhead, #replyhead { 3480 3491 font-size: 12px; 3481 3492 font-weight: bold; 3482 3493 padding: 2px 10px 4px; -
wp-admin/edit-form-advanced.php
diff --git wp-admin/edit-form-advanced.php wp-admin/edit-form-advanced.php index 30f1c0f..9e19117 100644
if ( post_type_supports($post_type, 'comments') ) 146 146 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', $post_type, 'normal', 'core'); 147 147 148 148 if ( ('publish' == $post->post_status || 'private' == $post->post_status) && post_type_supports($post_type, 'comments') ) 149 add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $post_type, 'normal', 'core');149 add_meta_box('commentsdiv', sprintf( '%s<span class="postbox-title-action"><a href="#">%s</a></span>', __('Comments'), __('Add new comment') ), 'post_comment_meta_box', $post_type, 'normal', 'core'); 150 150 151 151 if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) 152 152 add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', $post_type, 'normal', 'core'); -
wp-admin/includes/template.php
diff --git wp-admin/includes/template.php wp-admin/includes/template.php index b345c36..204862b 100644
function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', 345 345 <div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;"> 346 346 <?php endif; ?> 347 347 <div id="replyhead" style="display:none;"><?php _e('Reply to Comment'); ?></div> 348 349 <div id="addhead" style="display:none;"><?php _e('Add new Comment'); ?></div> 348 350 349 351 <div id="edithead" style="display:none;"> 350 352 <div class="inside"> … … function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', 369 371 <p id="replysubmit" class="submit"> 370 372 <a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106"><?php _e('Cancel'); ?></a> 371 373 <a href="#comments-form" class="save button-primary alignright" tabindex="104"> 374 <span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span> 372 375 <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span> 373 376 <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a> 374 377 <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> -
wp-admin/js/edit-comments.dev.js
diff --git wp-admin/js/edit-comments.dev.js wp-admin/js/edit-comments.dev.js index fbadeba..3248e82 100644
commentReply = { 302 302 /* $(listTable).bind('beforeChangePage', function(){ 303 303 commentReply.close(); 304 304 }); */ 305 306 $('#commentsdiv .postbox-title-action a').click(function(){ 307 var postID = $('input[name=post_ID]').val(); 308 commentReply.open('new', postID, 'add'); 309 return false; 310 }); 305 311 }, 306 312 307 313 addEvents : function(r) { … … commentReply = { 361 367 362 368 editRow = $('#replyrow'); 363 369 rowData = $('#inline-'+id); 364 act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment'; 370 371 if (! a) { 372 a = 'replyto'; 373 } 374 375 act = t.act = a + '-comment'; 365 376 366 377 $('#action', editRow).val(act); 367 378 $('#comment_post_ID', editRow).val(p); … … commentReply = { 374 385 $('#status', editRow).val( $('div.comment_status', rowData).text() ); 375 386 $('#replycontent', editRow).val( $('textarea.comment', rowData).val() ); 376 387 $('#edithead, #savebtn', editRow).show(); 377 $('#replyhead, #replybtn ', editRow).hide();388 $('#replyhead, #replybtn, #addhead, #addbtn', editRow).hide(); 378 389 379 390 h = c.height(); 380 391 if ( h > 220 ) … … commentReply = { 386 397 c.after( editRow ).fadeOut('fast', function(){ 387 398 $('#replyrow').fadeIn(300, function(){ $(this).show() }); 388 399 }); 400 } else if (a == 'add') { 401 $('#addhead, #addbtn', editRow).show(); 402 $('#replyhead, #replybtn, #edithead, #editbtn', editRow).hide(); 403 $('#the-comment-list').prepend(editRow); 404 $('#replyrow').fadeIn(300); 389 405 } else { 390 $('#edithead, #savebtn ', editRow).hide();406 $('#edithead, #savebtn, #addhead, #addbtn', editRow).hide(); 391 407 $('#replyhead, #replybtn', editRow).show(); 392 408 c.after(editRow); 393 409 $('#replyrow').fadeIn(300, function(){ $(this).show() });