Changeset 4479
- Timestamp:
- 11/18/2006 06:52:01 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r4478 r4479 84 84 ORDER BY comment_date DESC"); 85 85 } else { 86 if ( isset( $_GET['offset']) )87 $ offset = (int) $_GET['offset'] * 20;86 if ( isset( $_GET['apage'] ) ) 87 $page = (int) $_GET['apage']; 88 88 else 89 $offset = 0; 90 91 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $offset,20"); 92 } 89 $page = 1; 90 $start = $offset = ( $page - 1 ) * 20; 91 $end = $start + 20; 92 93 $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1' ORDER BY comment_date DESC LIMIT $start, $end" ); 94 $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0' OR comment_approved = '1'" ); 95 } 96 ?> 97 <?php if ( $total > 20 ) { 98 $total_pages = ceil( $total / 20 ); 99 $r = ''; 100 if ( 1 < $page ) { 101 $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; 102 $r .= '<a class="prev" href="' . add_query_arg( $args ) . '">« '. __('Previous Page') .'</a>' . "\n"; 103 } 104 if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { 105 for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : 106 if ( $page == $page_num ) : 107 $r .= "<span>$page_num</span>\n"; 108 else : 109 $p = false; 110 if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : 111 $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num; 112 $r .= '<a class="page-numbers" href="' . add_query_arg($args) . '">' . ( $page_num ) . "</a>\n"; 113 $in = true; 114 elseif ( $in == true ) : 115 $r .= "...\n"; 116 $in = false; 117 endif; 118 endif; 119 endfor; 120 } 121 if ( ( $page ) * 20 < $total || -1 == $total ) { 122 $args['apage'] = $page + 1; 123 $r .= '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page') .' »</a>' . "\n"; 124 } 125 echo "<p>$r</p>"; 126 ?> 127 128 <?php } ?> 129 130 <?php 93 131 if ('view' == $mode) { 94 132 if ($comments) { 95 if ($offset) 96 $start = " start='$offset'"; 97 else 98 $start = '';133 ?> 134 <?php 135 $offset = $offset + 1; 136 $start = " start='$offset'"; 99 137 100 138 echo "<ol id='the-comment-list' class='commentlist' $start>"; … … 204 242 } 205 243 ?> 244 <?php if ( $total > 20 ) { 245 $total_pages = ceil( $total / 20 ); 246 $r = ''; 247 if ( 1 < $page ) { 248 $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; 249 $r .= '<a class="prev" href="' . add_query_arg( $args ) . '">« '. __('Previous Page') .'</a>' . "\n"; 250 } 251 if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { 252 for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : 253 if ( $page == $page_num ) : 254 $r .= "<span>$page_num</span>\n"; 255 else : 256 $p = false; 257 if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : 258 $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num; 259 $r .= '<a class="page-numbers" href="' . add_query_arg($args) . '">' . ( $page_num ) . "</a>\n"; 260 $in = true; 261 elseif ( $in == true ) : 262 $r .= "...\n"; 263 $in = false; 264 endif; 265 endif; 266 endfor; 267 } 268 if ( ( $page ) * 20 < $total || -1 == $total ) { 269 $args['apage'] = $page + 1; 270 $r .= '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page') .' »</a>' . "\n"; 271 } 272 echo "<p>$r</p>"; 273 ?> 274 275 <?php } ?> 206 276 207 277 </div>
Note: See TracChangeset
for help on using the changeset viewer.