From 600b71019494e1c29898a620e58c0d2602f37b74 Mon Sep 17 00:00:00 2001
From: donncha
Date: Fri, 24 Nov 2006 16:16:44 +0000
Subject: WP Merge to 4524
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@810 7be80a69-a1ef-0310-a953-fb0f7c49ff36
---
wp-admin/edit-comments.php | 94 ++++++++++++++++++++++++++++++++++++++++------
1 file changed, 82 insertions(+), 12 deletions(-)
(limited to 'wp-admin/edit-comments.php')
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index 6227ef7..488a055 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -2,7 +2,7 @@
require_once('admin.php');
$title = __('Edit Comments');
-$parent_file = 'edit.php';
+$parent_file = 'edit-comments.php';
wp_enqueue_script( 'admin-comments' );
require_once('admin-header.php');
@@ -85,19 +85,57 @@ if (isset($_GET['s'])) {
comment_approved != 'spam'
ORDER BY comment_date DESC");
} else {
- if ( isset($_GET['offset']) )
- $offset = (int) $_GET['offset'] * 20;
+ if ( isset( $_GET['apage'] ) )
+ $page = (int) $_GET['apage'];
else
- $offset = 0;
+ $page = 1;
+ $start = $offset = ( $page - 1 ) * 20;
+ $end = $start + 20;
- $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $offset,20");
+ $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $end" );
+ $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1'" );
}
+?>
+ 20 ) {
+$total_pages = ceil( $total / 20 );
+$r = '';
+if ( 1 < $page ) {
+ $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
+ $r .= '« '. __('Previous Page') .'' . "\n";
+}
+if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
+ for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :
+ if ( $page == $page_num ) :
+ $r .= "$page_num\n";
+ else :
+ $p = false;
+ if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :
+ $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num;
+ $r .= '' . ( $page_num ) . "\n";
+ $in = true;
+ elseif ( $in == true ) :
+ $r .= "...\n";
+ $in = false;
+ endif;
+ endif;
+ endfor;
+}
+if ( ( $page ) * 20 < $total || -1 == $total ) {
+ $args['apage'] = $page + 1;
+ $r .= ''. __('Next Page') .' »' . "\n";
+}
+echo "$r
";
+?>
+
+
+
+
+";
$i = 0;
@@ -105,7 +143,7 @@ if ('view' == $mode) {
++$i; $class = '';
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$comment_status = wp_get_comment_status($comment->comment_ID);
- if ('unapproved' == $comment_status)
+ if ('unapproved' == $comment_status)
$class .= ' unapproved';
if ($i % 2)
$class .= ' alternate';
@@ -115,7 +153,7 @@ if ('view' == $mode) {
- — [
+
— [
comment_post_ID) ) {
echo " " . __('Edit') . '';
@@ -143,7 +181,7 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?>
-
+
comment_post_ID" : $post_title;
} // end if ($comments)
}
?>
+ 20 ) {
+$total_pages = ceil( $total / 20 );
+$r = '';
+if ( 1 < $page ) {
+ $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
+ $r .= '« '. __('Previous Page') .'' . "\n";
+}
+if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) {
+ for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) :
+ if ( $page == $page_num ) :
+ $r .= "$page_num\n";
+ else :
+ $p = false;
+ if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) :
+ $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num;
+ $r .= '' . ( $page_num ) . "\n";
+ $in = true;
+ elseif ( $in == true ) :
+ $r .= "...\n";
+ $in = false;
+ endif;
+ endif;
+ endfor;
+}
+if ( ( $page ) * 20 < $total || -1 == $total ) {
+ $args['apage'] = $page + 1;
+ $r .= ''. __('Next Page') .' »' . "\n";
+}
+echo "$r
";
+?>
+
+
--
cgit