Changeset 10082 for trunk/wp-admin/edit-comments.php
- Timestamp:
- 12/06/2008 03:59:03 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r10067 r10082 13 13 enqueue_comment_hotkeys_js(); 14 14 15 $post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0; 16 15 17 if ( ( isset( $_REQUEST['delete_all_spam'] ) || isset( $_REQUEST['delete_all_spam2'] ) ) && !empty( $_REQUEST['pagegen_timestamp'] ) ) { 16 18 check_admin_referer('bulk-spam-delete', '_spam_nonce'); … … 19 21 $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" ); 20 22 21 wp_redirect('edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam); 23 $redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam; 24 if ( $post_id ) 25 $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); 26 wp_redirect( $redirect_to ); 22 27 } elseif ( isset($_REQUEST['delete_comments']) && isset($_REQUEST['action']) && ( -1 != $_REQUEST['action'] || -1 != $_REQUEST['action2'] ) ) { 23 28 check_admin_referer('bulk-comments'); … … 27 32 foreach ( (array) $_REQUEST['delete_comments'] as $comment_id) : // Check the permissions on each 28 33 $comment_id = (int) $comment_id; 29 $ post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );30 31 if ( !current_user_can('edit_post', $ post_id) )34 $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) ); 35 36 if ( !current_user_can('edit_post', $_post_id) ) 32 37 continue; 33 38 … … 53 58 54 59 $redirect_to = 'edit-comments.php?deleted=' . $deleted . '&approved=' . $approved . '&spam=' . $spammed . '&unapproved=' . $unapproved; 60 if ( $post_id ) 61 $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); 55 62 if ( isset($_REQUEST['apage']) ) 56 63 $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to ); … … 67 74 } 68 75 69 $post_id = isset($_GET['p']) ? (int) $_GET['p'] : 0;70 71 76 if ( $post_id ) 72 77 $title = sprintf(__('Edit Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50)); … … 89 94 <h2><?php echo wp_specialchars( $title ); 90 95 if ( isset($_GET['s']) && $_GET['s'] ) 91 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', wp_specialchars( stripslashes($_GET['s']) )); ?>96 printf( '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( wp_specialchars( stripslashes( $_GET['s'] ) ), 50 ) ) . '</span>' ); ?> 92 97 </h2> 93 98 … … 125 130 <?php 126 131 $status_links = array(); 127 $num_comments = wp_count_comments();132 $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); 128 133 //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), 129 134 //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>") 130 135 $stati = array( 136 'all' => __ngettext_noop('All', 'All'), // singular not used 131 137 'moderated' => __ngettext_noop('Pending (<span class="pending-count">%s</span>)', 'Pending (<span class="pending-count">%s</span>)'), 132 138 'approved' => __ngettext_noop('Approved', 'Approved'), // singular not used … … 134 140 ); 135 141 $class = ( '' === $comment_status ) ? ' class="current"' : ''; 136 $status_links[] = "<li><a href='edit-comments.php'$class>" . __( 'All' ) . '</a>'; 137 $type = ( !$comment_type && 'all' != $comment_type ) ? '' : "&comment_type=$comment_type"; 142 // $status_links[] = "<li><a href='edit-comments.php'$class>" . __( 'All' ) . '</a>'; 143 $link = 'edit-comments.php'; 144 if ( !empty($comment_type) && 'all' != $comment_type ) 145 $link = add_query_arg( 'comment_type', $comment_type, $link ); 138 146 foreach ( $stati as $status => $label ) { 139 147 $class = ''; 140 148 141 if ( $status== $comment_status )149 if ( str_replace( 'all', '', $status ) == $comment_status ) 142 150 $class = ' class="current"'; 143 151 if ( !isset( $num_comments->$status ) ) 144 152 $num_comments->$status = 10; 145 146 $status_links[] = "<li class='$status'><a href='edit-comments.php?comment_status=$status$type'$class>" . sprintf( 153 if ( 'all' != $status ) 154 $link = add_query_arg( 'comment_status', $status, $link ); 155 if ( $post_id ) 156 $link = add_query_arg( 'p', absint( $post_id ), $link ); 157 /* 158 // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark 159 if ( !empty( $_GET['s'] ) ) 160 $link = add_query_arg( 's', attribute_escape( stripslashes( $_GET['s'] ) ), $link ); 161 */ 162 $status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf( 147 163 __ngettext( $label[0], $label[1], $num_comments->$status ), 148 164 number_format_i18n( $num_comments->$status ) … … 190 206 191 207 <input type="hidden" name="mode" value="<?php echo $mode; ?>" /> 208 <?php if ( $post_id ) : ?> 209 <input type="hidden" name="p" value="<?php echo intval( $post_id ); ?>" /> 210 <?php endif; ?> 192 211 <input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" /> 193 212 <input type="hidden" name="pagegen_timestamp" value="<?php echo current_time('mysql', 1); ?>" />
Note: See TracChangeset
for help on using the changeset viewer.