Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1:/tmp/cvs-serv8329
Modified Files:
serendipity_functions.inc.php comment.php
Log Message:
Admins can now delete comments, if they are logged in
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- serendipity_functions.inc.php 28 Apr 2003 16:59:12 -0000 1.36
+++ serendipity_functions.inc.php 28 Apr 2003 17:35:50 -0000 1.37
@@ -345,6 +345,20 @@
}
+function serendipity_deleteComment($id)
+{
+ global $serendipity;
+
+ if ($_SESSION["serendipityAuthedUser"] === true ) {
+ $query = "DELETE FROM {$serendipity['dbPrefix']}comments WHERE id = ". $id;
+ serendipity_db_query($query);
+
+ header('Location: '. $_SERVER['HTTP_REFERER']);
+ } else {
+ die('What are you up to? You need to be an admin to delete comments');
+ }
+}
+
function serendipity_fetchComments($id, $limit = null)
{
global $serendipity;
@@ -381,7 +395,13 @@
<div class="serendipity_comment_source">
<?=$type?> <?=($link ? "<a href=\"$link\">$name</a>" : $name)?> <?=ON?>
<a href="<?=$PHP_SELF?>#comment<?=$comment['id']?>"><?=date("M d, h:i", $comment['timestamp'])?></a>
- </div>
+ <?php
+ if ($_SESSION["serendipityAuthedUser"] === true) {
+ ?>
+ (<a href="<?=$serendipity["baseURL"]?>comment.php?delete=<?=$comment['id']?>"><?= DELETE ?></a>)
+ <?php
+ }
+ ?></div>
</td>
</tr>
<?php
Index: comment.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/comment.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- comment.php 28 Mar 2003 20:05:24 -0000 1.1.1.1
+++ comment.php 28 Apr 2003 17:35:53 -0000 1.2
@@ -2,6 +2,11 @@
session_start();
include_once('serendipity_config.inc.php');
+if ( isset($_GET['delete']) ) {
+ serendipity_deleteComment($_GET['delete']);
+}
+
+
if (!($type = @$_GET['type'])) {
$type = 'normal';
}
|