Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7837
Modified Files:
NEWS serendipity_admin_comments.inc.php
Log Message:
- Add ability to filter comments depending on their approval status (idea by isotopp)
- Fix some very broken logic when there were no comments returned by the SQL query
Index: serendipity_admin_comments.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_comments.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- serendipity_admin_comments.inc.php 16 Sep 2004 10:29:08 -0000 1.20
+++ serendipity_admin_comments.inc.php 24 Sep 2004 21:58:17 -0000 1.21
@@ -113,6 +113,13 @@
$searchString .= (!empty($serendipity['GET']['filter'][$filter]) ? "&serendipity[filter][". $filter ."]=". $serendipity['GET']['filter'][$filter] : "");
}
+if ( $serendipity['GET']['filter']['show'] == 'approved' ) {
+ $and .= "AND status = 'approved'";
+} elseif ( $serendipity['GET']['filter']['show'] == 'pending' ) {
+ $and .= "AND status = 'pending'";
+} else {
+ $serendipity['GET']['filter']['show'] = 'all';
+}
/* Paging */
$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}comments c WHERE c.type = 'NORMAL' ". $and, true);
@@ -143,11 +150,6 @@
". $and ."
" . (($serendipity['serendipityUserlevel'] != USERLEVEL_ADMIN) ? 'AND e.authorid = ' . $serendipity['authorId'] : '') . "
ORDER BY id DESC $limit");
-if (!is_array($sql)) {
- echo NO_COMMENTS;
- return;
-}
-
?>
<script type="text/javascript">
function toggle(id) {
@@ -201,10 +203,24 @@
<td><input type="text" name="serendipity[filter][ip]" size="15" value="<?php echo $serendipity['GET']['filter']['ip'] ?>" /></td>
<td><?php echo CONTENT ?>:</td>
<td><input type="text" name="serendipity[filter][body]" size="15" value="<?php echo $serendipity['GET']['filter']['body'] ?>" /></td>
- <td colspan="2" align="center"><input type="submit" name="submit" value=" - <?php echo GO ?> - " /></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' ?>><?php echo COMMENTS_FILTER_ALL ?></option>
+ <option value="approved"<?php if ( $serendipity['GET']['filter']['show'] == 'approved' ) echo ' SELECTED' ?>><?php echo COMMENTS_FILTER_APPROVED_ONLY ?></option>
+ <option value="pending"<?php if ( $serendipity['GET']['filter']['show'] == 'pending' ) echo ' SELECTED' ?>><?php echo COMMENTS_FILTER_NEED_APPROVAL ?></option>
+ </select></td>
+ </tr>
+ <tr>
+ <td colspan="6" align="right"><input type="submit" name="submit" value=" - <?php echo GO ?> - " /></td>
</tr>
</table>
</form>
+<?php
+ if (!is_array($sql)) {
+ echo '<div align="center">'. NO_COMMENTS .'</div>';
+ $sql = array();
+ } else {
+?>
<form action="" method="POST" name="formMultiDelete" id="formMultiDelete">
<input type="hidden" name="serendipity[formAction]" value="multiDelete" />
<table width="100%" cellspacing="5" cellpadding="0" border="0" class="serendipity_admin_list">
@@ -220,6 +236,12 @@
</td>
</tr>
<?php
+
+if (!is_array($sql)) {
+ echo NO_COMMENTS;
+ $sql = array();
+}
+
$i = 0;
foreach ($sql as $rs) {
$i++;
@@ -299,3 +321,4 @@
</tr>
</table>
</form>
+<?php } ?>
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.232
retrieving revision 1.233
diff -u -d -r1.232 -r1.233
--- NEWS 23 Sep 2004 12:31:57 -0000 1.232
+++ NEWS 24 Sep 2004 21:58:17 -0000 1.233
@@ -3,6 +3,10 @@
Version 0.7 ()
------------------------------------------------------------------------
+ * Extend filter in commment moderation to allow the user to select
+ which types of comments he wants displayed "All", "Only approved",
+ "Need approval" (tomsommer)
+
* Upgraded Spam Protector event plugin. Optionally:
- use Captchas - images with string sequences which a
user has to enter before his comment is accepted.
@@ -28,7 +32,7 @@
* Bug #1031444 - Fixed postgreSQL error (for older versions of
pgsql) when creating categories (garvinhicking)
- * Fixed wrong XHTML enties in remoterss and shoutbox plugin. Thanks
+ * Fixed wrong XHTML entities in remoterss and shoutbox plugin. Thanks
to Stephan van Beerschoten! (garvinhicking)
* Fixed bug #1030581: Category sidebar plugin now properly displays
|