Changes in trunk/wp-admin/edit-comments.php [12162:12308]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r12162 r12308 21 21 check_admin_referer('bulk-comments'); 22 22 23 if ( (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {23 if ( (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp']) ) { 24 24 $comment_status = $wpdb->escape($_REQUEST['comment_status']); 25 25 $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']); 26 26 $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" ); 27 27 $doaction = 'delete'; 28 } elseif ( ($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) {28 } elseif ( ($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments']) ) { 29 29 $comment_ids = $_REQUEST['delete_comments']; 30 30 $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2']; 31 } elseif ($_REQUEST['action'] == 'untrash' && isset($_REQUEST['ids'])) { 32 $comment_ids = explode(',', $_REQUEST['ids']); 33 $doaction = 'untrash'; 34 } else wp_redirect($_SERVER['HTTP_REFERER']); 35 36 $approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0; 31 } elseif ( $_REQUEST['doaction'] == 'undo' && isset($_REQUEST['ids']) ) { 32 $comment_ids = array_map( 'absint', explode(',', $_REQUEST['ids']) ); 33 $doaction = $_REQUEST['action']; 34 } else { 35 wp_redirect($_SERVER['HTTP_REFERER']); 36 } 37 38 $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; 37 39 38 40 foreach ($comment_ids as $comment_id) { // Check the permissions on each … … 51 53 $unapproved++; 52 54 break; 53 case ' markspam' :54 wp_s et_comment_status($comment_id, 'spam');55 case 'spam' : 56 wp_spam_comment($comment_id); 55 57 $spammed++; 58 break; 59 case 'unspam' : 60 wp_unspam_comment($comment_id); 61 $unspammed++; 56 62 break; 57 63 case 'trash' : … … 70 76 } 71 77 72 $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted . '&ids=' . join(',', $comment_ids); 78 $redirect_to = 'edit-comments.php'; 79 80 if ( $approved ) 81 $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); 82 if ( $unapproved ) 83 $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); 84 if ( $spammed ) 85 $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); 86 if ( $unspammed ) 87 $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); 88 if ( $trashed ) 89 $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); 90 if ( $untrashed ) 91 $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); 92 if ( $deleted ) 93 $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); 94 if ( $trashed || $spammed ) 95 $redirect_to = add_query_arg( 'ids', join(',', $comment_ids), $redirect_to ); 96 73 97 if ( $post_id ) 74 98 $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); … … 113 137 114 138 <?php 115 if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spam ']) ) {139 if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) ) { 116 140 $approved = isset($_GET['approved']) ? (int) $_GET['approved'] : 0; 117 141 $deleted = isset($_GET['deleted']) ? (int) $_GET['deleted'] : 0; 118 142 $trashed = isset($_GET['trashed']) ? (int) $_GET['trashed'] : 0; 119 143 $untrashed = isset($_GET['untrashed']) ? (int) $_GET['untrashed'] : 0; 120 $spam = isset($_GET['spam']) ? (int) $_GET['spam'] : 0; 121 122 if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spam > 0 ) { 144 $spammed = isset($_GET['spammed']) ? (int) $_GET['spammed'] : 0; 145 $unspammed = isset($_GET['unspammed']) ? (int) $_GET['unspammed'] : 0; 146 147 if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 ) { 123 148 echo '<div id="moderated" class="updated fade"><p>'; 124 149 … … 127 152 echo '<br />'; 128 153 } 129 if ( $spam > 0 ) { 130 printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam ); 154 if ( $spammed > 0 ) { 155 printf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ); 156 $ids = isset($_GET['ids']) ? $_GET['ids'] : 0; 157 echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />'; 158 } 159 if ( $unspammed > 0 ) { 160 printf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); 131 161 echo '<br />'; 132 162 } … … 134 164 printf( _n( '%s comment moved to the trash.', '%s comments moved to the trash.', $trashed ), $trashed ); 135 165 $ids = isset($_GET['ids']) ? $_GET['ids'] : 0; 136 echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo ?') . '</a><br />';166 echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />'; 137 167 } 138 168 if ( $untrashed > 0 ) { … … 276 306 <?php endif; ?> 277 307 <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?> 278 <option value=" markspam"><?php _e('Mark as Spam'); ?></option>308 <option value="spam"><?php _e('Mark as Spam'); ?></option> 279 309 <?php endif; ?> 280 310 <?php if ( 'trash' == $comment_status ): ?> 281 311 <option value="untrash"><?php _e('Restore'); ?></option> 312 <?php elseif ( 'spam' == $comment_status ): ?> 313 <option value="unspam"><?php _e('Not Spam'); ?></option> 282 314 <?php endif; ?> 283 315 <?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?> … … 372 404 <?php endif; ?> 373 405 <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?> 374 <option value=" markspam"><?php _e('Mark as Spam'); ?></option>406 <option value="spam"><?php _e('Mark as Spam'); ?></option> 375 407 <?php endif; ?> 376 408 <?php if ( 'trash' == $comment_status ): ?> … … 379 411 <?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?> 380 412 <option value="delete"><?php _e('Delete Permanently'); ?></option> 413 <?php elseif ( 'spam' == $comment_status ): ?> 414 <option value="unspam"><?php _e('Not Spam'); ?></option> 381 415 <?php else: ?> 382 416 <option value="trash"><?php _e('Move to Trash'); ?></option>
Note: See TracChangeset
for help on using the changeset viewer.