Update of /cvsroot/php-blog/serendipity/include/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31847/include/admin
Modified Files:
comments.inc.php
Log Message:
* make HTTP host autodetectable easier
* allow to configure amount of comments to display
Index: comments.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/comments.inc.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- comments.inc.php 30 Jan 2005 18:23:15 -0000 1.22
+++ comments.inc.php 17 Feb 2005 17:05:32 -0000 1.23
@@ -6,7 +6,7 @@
die ("Don't hack!");
}
-$commentsPerPage = 10;
+$commentsPerPage = (!empty($serendipity['GET']['filter']['perpage']) ? $serendipity['GET']['filter']['perpage'] : 10);
$summaryLength = 200;
if ( $serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity['POST']['delete']) != 0 ) {
@@ -141,7 +141,7 @@
$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}comments c WHERE c.type = '$c_type' ". $and, true);
$totalComments = $sql['total'];
-$pages = ceil($totalComments/$commentsPerPage);
+$pages = ($commentsPerPage == COMMENTS_FILTER_ALL ? 1 : ceil($totalComments/(int)$commentsPerPage));
$page = (int)$serendipity['GET']['page'];
if ( $page == 0 || $page > $pages ) {
$page = 1;
@@ -150,7 +150,12 @@
$linkPrevious = 'serendipity_admin.php?serendipity[adminModule]=comments&serendipity[page]='. ($page-1) . $searchString;
$linkNext = 'serendipity_admin.php?serendipity[adminModule]=comments&serendipity[page]='. ($page+1) . $searchString;
-$limit = serendipity_db_limit_sql(serendipity_db_limit(($page-1)*$commentsPerPage, $commentsPerPage));
+if ($commentsPerPage == COMMENTS_FILTER_ALL) {
+ $limit = '';
+}else {
+ $limit = serendipity_db_limit_sql(serendipity_db_limit(($page-1)*(int)$commentsPerPage, (int)$commentsPerPage));
+}
+
$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 = '$c_type'
@@ -215,7 +220,16 @@
<td><input type="text" name="serendipity[filter][referer]" size="15" value="<?php echo $serendipity['GET']['filter']['referer'] ?>" /></td>
</tr>
<tr>
- <td colspan="2"> </td>
+ <td><?php echo COMMENTS; ?>:</td>
+ <td><select name="serendipity[filter][perpage]">
+ <?php
+ $filter_vals = array(10, 20, 50, COMMENTS_FILTER_ALL);
+ foreach($filter_vals AS $filter_val) { ?>
+ <option value="<?php echo $filter_val; ?>" <?php echo ($commentsPerPage == $filter_val ? ' selected="selected"' : ''); ?>><?php echo $filter_val; ?></option>
+ <?php
+ }
+ ?>
+ </select></td>
<td><?php echo COMMENTS_FILTER_SHOW ?>:</td>
<td><select name="serendipity[filter][show]">
<option value="all"<?php if ( $serendipity['GET']['filter']['show'] == 'all' ) echo ' selected="selected"' ?>><?php echo COMMENTS_FILTER_ALL ?></option>
|