escape($_REQUEST['comment_status']); $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']); $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" ); $doaction = 'delete'; } elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) { $comment_ids = $_REQUEST['delete_comments']; $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2']; } else wp_redirect($_SERVER['HTTP_REFERER']); $approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0; foreach ($comment_ids as $comment_id) { // Check the permissions on each $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) ); if ( !current_user_can('edit_post', $_post_id) ) continue; switch( $doaction ) { case 'approve' : wp_set_comment_status($comment_id, 'approve'); $approved++; break; case 'unapprove' : wp_set_comment_status($comment_id, 'hold'); $unapproved++; break; case 'markspam' : wp_set_comment_status($comment_id, 'spam'); $spammed++; break; case 'trash' : wp_trash_comment($comment_id); $trashed++; break; case 'untrash' : wp_untrash_comment($comment_id); $untrashed++; break; case 'delete' : wp_delete_comment($comment_id); $deleted++; break; } } $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted; if ( $post_id ) $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); if ( isset($_REQUEST['apage']) ) $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to ); if ( !empty($_REQUEST['mode']) ) $redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to); if ( !empty($_REQUEST['comment_status']) ) $redirect_to = add_query_arg('comment_status', $_REQUEST['comment_status'], $redirect_to); if ( !empty($_REQUEST['s']) ) $redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to); wp_redirect( $redirect_to ); } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); exit; } if ( $post_id ) $title = sprintf(__('Edit Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50)); else $title = __('Edit Comments'); require_once('admin-header.php'); $mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']); $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all'; if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash')) ) $comment_status = 'all'; $comment_type = !empty($_GET['comment_type']) ? esc_attr($_GET['comment_type']) : ''; $search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : ''; $search = esc_attr( $search_dirty ); ?>

' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( stripslashes( $_GET['s'] ) ), 50 ) ) . '' ); ?>

0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spam > 0 ) { echo '

'; if ( $approved > 0 ) { printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); echo '
'; } if ( $spam > 0 ) { printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam ); echo '
'; } if ( $trashed > 0 ) { printf( _n( '%s comment moved to the trash', '%s comments moved to the trash', $trashed ), $trashed ); echo ' ' . __('View trash') . '
'; } if ( $untrashed > 0 ) { printf( _n( '%s comment restored from the trash', '%s comments restored from the trash', $untrashed ), $untrashed ); echo '
'; } if ( $deleted > 0 ) { printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); echo '
'; } echo '

'; } } ?>
comment_post_ID; } $_comment_pending_count_temp = (array) get_pending_comments_num($_comment_post_ids); foreach ( (array) $_comment_post_ids as $_cpid ) $_comment_pending_count[$_cpid] = isset( $_comment_pending_count_temp[$_cpid] ) ? $_comment_pending_count_temp[$_cpid] : 0; if ( empty($_comment_pending_count) ) $_comment_pending_count = array(); $comments = array_slice($_comments, 0, $comments_per_page); $extra_comments = array_slice($_comments, $comments_per_page); $page_links = paginate_links( array( 'base' => add_query_arg( 'apage', '%#%' ), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($total / $comments_per_page), 'current' => $page )); ?>
' . __( 'Displaying %s–%s of %s' ) . '%s', number_format_i18n( $start + 1 ), number_format_i18n( min( $page * $comments_per_page, $total ) ), '' . number_format_i18n( $total ) . '', $page_links ); echo $page_links_text; ?>

comment_ID, $mode, $comment_status ); ?> comment_ID, $mode, $comment_status ); ?>
$page_links_text
"; ?>