Ticket #15527: garyc40-15527.patch
| File garyc40-15527.patch, 12.9 KB (added by garyc40, 2 years ago) |
|---|
-
wp-admin/admin-ajax.php
diff --git wp-admin/admin-ajax.php wp-admin/admin-ajax.php index 5eb33e1..4319950 100644
function _wp_ajax_add_hierarchical_term() { 317 317 $x->send(); 318 318 } 319 319 320 function _wp_add_comment( $action ) { 321 global $wpdb; 322 323 check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ); 324 325 set_current_screen( 'edit-comments' ); 326 327 $comment_post_ID = (int) $_POST['comment_post_ID']; 328 if ( !current_user_can( 'edit_post', $comment_post_ID ) ) 329 die('-1'); 330 331 $error_messages = array( 332 'replyto-comment' => array( 333 'invalid_status' => __('Error: you are replying to a comment on a draft post.'), 334 'must_log_in' => __('Sorry, you must be logged in to reply to a comment.'), 335 'type_something' => __('Error: please type a comment.'), 336 ), 337 'add-comment' => array( 338 'invalid_status' => __('Error: you are adding comment on a draft post.'), 339 'must_log_in' => __('Sorry, you must be logged in to add a comment.'), 340 'type_something' => __('Error: please type a comment.'), 341 ), 342 ); 343 344 $status = get_post_status( $comment_post_ID ); 345 346 if ( empty($status) ) 347 die('1'); 348 elseif ( in_array($status, array('draft', 'pending', 'trash') ) ) 349 die( $error_messages[$action]['invalid_status'] ); 350 351 $user = wp_get_current_user(); 352 if ( ! $user->ID ) { 353 die( $error_messages[$action]['must_log_in'] ); 354 } 355 356 $comment_content = trim($_POST['content']); 357 358 if ( '' == $comment_content ) 359 die( $error_messages[$action]['type_something'] ); 360 361 $comment_author = $wpdb->escape($user->display_name); 362 $comment_author_email = $wpdb->escape($user->user_email); 363 $comment_author_url = $wpdb->escape($user->user_url); 364 $comment_type = ''; 365 366 if ( current_user_can('unfiltered_html') ) { 367 if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { 368 kses_remove_filters(); // start with a clean slate 369 kses_init_filters(); // set up the filters 370 } 371 } 372 373 $comment_parent = ( $action == 'replyto-comment' ) ? absint($_POST['comment_ID']) : 0; 374 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); 375 376 $comment_id = wp_new_comment( $commentdata ); 377 $comment = get_comment($comment_id); 378 if ( ! $comment ) die('1'); 379 380 $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; 381 382 $x = new WP_Ajax_Response(); 383 384 ob_start(); 385 if ( 'dashboard' == $_REQUEST['mode'] ) { 386 require_once( ABSPATH . 'wp-admin/includes/dashboard.php' ); 387 _wp_dashboard_recent_comments_row( $comment ); 388 } else { 389 if ( 'single' == $_REQUEST['mode'] ) { 390 $wp_list_table = get_list_table('WP_Post_Comments_List_Table'); 391 } else { 392 $wp_list_table = get_list_table('WP_Comments_List_Table'); 393 } 394 $wp_list_table->single_row( $comment ); 395 } 396 $comment_list_item = ob_get_contents(); 397 ob_end_clean(); 398 399 $x->add( array( 400 'what' => 'comment', 401 'id' => $comment->comment_ID, 402 'data' => $comment_list_item, 403 'position' => $position 404 )); 405 406 $x->send(); 407 break; 408 } 409 320 410 $id = isset($_POST['id'])? (int) $_POST['id'] : 0; 321 411 switch ( $action = $_POST['action'] ) : 322 412 case 'delete-comment' : // On success, die with time() instead of 1 … … case 'get-comments' : 620 710 ) ); 621 711 $x->send(); 622 712 break; 623 case 'replyto-comment' : 624 check_ajax_referer( $action, '_ajax_nonce-replyto-comment' ); 625 626 set_current_screen( 'edit-comments' ); 627 628 $comment_post_ID = (int) $_POST['comment_post_ID']; 629 if ( !current_user_can( 'edit_post', $comment_post_ID ) ) 630 die('-1'); 631 632 $status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); 633 634 if ( empty($status) ) 635 die('1'); 636 elseif ( in_array($status, array('draft', 'pending', 'trash') ) ) 637 die( __('Error: you are replying to a comment on a draft post.') ); 638 639 $user = wp_get_current_user(); 640 if ( $user->ID ) { 641 $comment_author = $wpdb->escape($user->display_name); 642 $comment_author_email = $wpdb->escape($user->user_email); 643 $comment_author_url = $wpdb->escape($user->user_url); 644 $comment_content = trim($_POST['content']); 645 if ( current_user_can('unfiltered_html') ) { 646 if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) { 647 kses_remove_filters(); // start with a clean slate 648 kses_init_filters(); // set up the filters 649 } 650 } 651 } else { 652 die( __('Sorry, you must be logged in to reply to a comment.') ); 653 } 654 655 if ( '' == $comment_content ) 656 die( __('Error: please type a comment.') ); 657 658 $comment_parent = absint($_POST['comment_ID']); 659 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID'); 660 661 $comment_id = wp_new_comment( $commentdata ); 662 $comment = get_comment($comment_id); 663 if ( ! $comment ) die('1'); 664 665 $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1'; 666 667 $x = new WP_Ajax_Response(); 668 669 ob_start(); 670 if ( 'dashboard' == $_REQUEST['mode'] ) { 671 require_once( ABSPATH . 'wp-admin/includes/dashboard.php' ); 672 _wp_dashboard_recent_comments_row( $comment ); 673 } else { 674 if ( 'single' == $_REQUEST['mode'] ) { 675 $wp_list_table = get_list_table('WP_Post_Comments_List_Table'); 676 } else { 677 $wp_list_table = get_list_table('WP_Comments_List_Table'); 678 } 679 $wp_list_table->single_row( $comment ); 680 } 681 $comment_list_item = ob_get_contents(); 682 ob_end_clean(); 683 684 $x->add( array( 685 'what' => 'comment', 686 'id' => $comment->comment_ID, 687 'data' => $comment_list_item, 688 'position' => $position 689 )); 690 691 $x->send(); 713 case 'add-comment': 714 case 'replyto-comment': 715 _wp_add_comment( $_POST['action'] ); 692 716 break; 693 717 case 'edit-comment' : 694 718 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 0b8183c..5e93f00 100644
table.diff .diff-addedline ins { 1315 1315 } 1316 1316 1317 1317 #edithead, 1318 #replyhead { 1318 #replyhead, 1319 #addhead { 1319 1320 background-color: #f1f1f1; 1320 1321 } 1321 1322 -
wp-admin/css/colors-fresh.dev.css
diff --git wp-admin/css/colors-fresh.dev.css wp-admin/css/colors-fresh.dev.css index ede8f38..f165b66 100644
table.diff .diff-addedline ins { 1312 1312 } 1313 1313 1314 1314 #edithead, 1315 #replyhead { 1315 #replyhead, 1316 #addhead { 1316 1317 background-color: #f1f1f1; 1317 1318 } 1318 1319 -
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 406fe80..7c82571 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 44ec7c3..b3a16fc 100644
ol { 558 558 padding-left: 0.5%; 559 559 padding-right: 0; 560 560 } 561 .postbox h3 .postbox-title-action { 562 right: auto; 563 left: 30px; 564 } 561 565 562 566 /* Media library */ 563 567 #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 1781101..c223c7c 100644
body.admin-bar { 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 { 3470 3481 display: none; 3471 3482 } 3472 3483 3473 # replyhead {3484 #addhead, #replyhead { 3474 3485 font-size: 12px; 3475 3486 font-weight: bold; 3476 3487 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 017a163..9fce136 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 8a1e995..fd7c585 100644
function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', 341 341 <div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;"> 342 342 <?php endif; ?> 343 343 <div id="replyhead" style="display:none;"><?php _e('Reply to Comment'); ?></div> 344 345 <div id="addhead" style="display:none;"><?php _e('Add new Comment'); ?></div> 344 346 345 347 <div id="edithead" style="display:none;"> 346 348 <div class="inside"> … … function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', 365 367 <p id="replysubmit" class="submit"> 366 368 <a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106"><?php _e('Cancel'); ?></a> 367 369 <a href="#comments-form" class="save button-primary alignright" tabindex="104"> 370 <span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span> 368 371 <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span> 369 372 <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a> 370 373 <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 ccb3508..01c1b82 100644
commentReply = { 281 281 $(listTable).bind('beforeChangePage', function(){ 282 282 commentReply.close(); 283 283 }); 284 285 $('#commentsdiv .postbox-title-action a').click(function(){ 286 var postID = $('input[name=post_ID]').val(); 287 commentReply.open('new', postID, 'add'); 288 return false; 289 }); 284 290 }, 285 291 286 292 addEvents : function(r) { … … commentReply = { 341 347 $('td', '#replyrow').attr('colspan', $('table.widefat thead th:visible').length); 342 348 editRow = $('#replyrow'); 343 349 rowData = $('#inline-'+id); 344 act = t.act = (a == 'edit') ? 'edit-comment' : 'replyto-comment'; 350 351 if (! a) { 352 a = 'replyto'; 353 } 354 355 act = t.act = a + '-comment'; 345 356 346 357 $('#action', editRow).val(act); 347 358 $('#comment_post_ID', editRow).val(p); … … commentReply = { 354 365 $('#status', editRow).val( $('div.comment_status', rowData).text() ); 355 366 $('#replycontent', editRow).val( $('textarea.comment', rowData).val() ); 356 367 $('#edithead, #savebtn', editRow).show(); 357 $('#replyhead, #replybtn ', editRow).hide();368 $('#replyhead, #replybtn, #addhead, #addbtn', editRow).hide(); 358 369 359 370 h = c.height(); 360 371 if ( h > 220 ) … … commentReply = { 366 377 c.after( editRow ).fadeOut('fast', function(){ 367 378 $('#replyrow').fadeIn(300, function(){ $(this).show() }); 368 379 }); 380 } else if (a == 'add') { 381 $('#addhead, #addbtn', editRow).show(); 382 $('#replyhead, #replybtn, #edithead, #editbtn', editRow).hide(); 383 $('#the-comment-list').prepend(editRow); 384 $('#replyrow').fadeIn(300); 369 385 } else { 370 $('#edithead, #savebtn ', editRow).hide();386 $('#edithead, #savebtn, #addhead, #addbtn', editRow).hide(); 371 387 $('#replyhead, #replybtn', editRow).show(); 372 388 c.after(editRow); 373 389 $('#replyrow').fadeIn(300, function(){ $(this).show() });