[php-blog-cvs] serendipity serendipity_admin_comments.inc.php,1.5,1.6 serendipity_functions.inc.php,
A reliable, secure & extensible PHP blog | Not mainstream since 2002
Brought to you by:
garvinhicking,
jhermanns
From: Tom S. <tom...@us...> - 2004-07-26 17:05:56
|
Update of /cvsroot/php-blog/serendipity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15893 Modified Files: serendipity_admin_comments.inc.php serendipity_functions.inc.php Log Message: Add paging to comment moderation Index: serendipity_functions.inc.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v retrieving revision 1.367 retrieving revision 1.368 diff -u -d -r1.367 -r1.368 --- serendipity_functions.inc.php 26 Jul 2004 16:07:28 -0000 1.367 +++ serendipity_functions.inc.php 26 Jul 2004 17:05:46 -0000 1.368 @@ -1118,7 +1118,7 @@ <?php } ?> -(<?php printf(PAGE_BROWSE, $serendipity['GET']['page'], $totalPages, $totalEntries); ?>) +(<?php printf(PAGE_BROWSE_ENTRIES, $serendipity['GET']['page'], $totalPages, $totalEntries); ?>) <?php if ($serendipity['GET']['page'] < $totalPages) { ?> Index: serendipity_admin_comments.inc.php =================================================================== RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_comments.inc.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- serendipity_admin_comments.inc.php 20 Jul 2004 17:53:11 -0000 1.5 +++ serendipity_admin_comments.inc.php 26 Jul 2004 17:05:46 -0000 1.6 @@ -3,6 +3,8 @@ die ("Don't hack!"); } +$commentsPerPage = 15; + /* We are asked to save the edited comment, and we are not in preview mode */ if ( isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminAction'] == 'doEdit' && !isset($serendipity['POST']['preview']) ) { @@ -93,12 +95,28 @@ return true; } +$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}comments WHERE type = 'normal'", true); + +$totalComments = $sql['total']; +$pages = ceil($totalComments/$commentsPerPage); +$page = (int)$serendipity['GET']['page']; +if ( $page == 0 ) { + $page = 1; +} + +if ( $page != 1 && $page <= $pages ) { + $linkPrevious = '<a href="?serendipity[adminModule]=comments&serendipity[page]='. ($page-1) .'">« '. PREVIOUS_PAGE .'</a>'; +} +if ( $page != $pages ) { + $linkNext = '<a href="?serendipity[adminModule]=comments&serendipity[page]='. ($page+1) .'"> '. NEXT_PAGE .' »</a>'; +} + $sql = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']}comments c LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id) WHERE type = 'NORMAL' " . (($serendipity['serendipityUserlevel'] != USERLEVEL_ADMIN) ? 'AND e.authorid = ' . $serendipity['authorId'] : '') . " ORDER BY id DESC - LIMIT 10"); + LIMIT ". ($page-1)*$commentsPerPage .",". $commentsPerPage); if (!is_array($sql)) { echo NO_COMMENTS; return; @@ -119,6 +137,9 @@ } </script> <table width="100%" cellspacing="5" cellpadding="0" border="0" class="serendipity_admin_list"> +<tr> + <td align="center"><?php echo $linkPrevious; ?> (<?php printf(PAGE_BROWSE_COMMENTS, $page, $pages, $totalComments); ?>) <?php echo $linkNext ?></td> +</tr> <?php $i = 0; foreach ($sql as $rs) { @@ -162,4 +183,7 @@ </td> </tr> <?php } ?> +<tr> + <td align="center"><?php echo $linkPrevious; ?> (<?php printf(PAGE_BROWSE_COMMENTS, $page, $pages, $totalComments); ?>) <?php echo $linkNext ?></td> +</tr> </table> |