Update of /cvsroot/php-blog/serendipity/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12213/include
Modified Files:
functions_comments.inc.php
Log Message:
* Fix bug #1079349 - Move nested comments to parent top when parent is deleted
* Try to optimize performance by passing $comments as reference (Tom, do you have objections?)
Index: functions_comments.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/functions_comments.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- functions_comments.inc.php 27 Jan 2005 12:46:33 -0000 1.14
+++ functions_comments.inc.php 27 Jan 2005 13:54:33 -0000 1.15
@@ -147,7 +147,7 @@
return $retval;
}
-function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace = null) {
+function serendipity_printComments(&$comments, $parentid = 0, $depth = 0, $trace = null) {
global $serendipity;
static $_smartyComments;
@@ -204,7 +204,7 @@
if ($depth !== 0) {
return true;
}
-
+
$serendipity['smarty']->assign('comments', $_smartyComments);
unset($_smartyComments);
@@ -222,7 +222,7 @@
/* We have to figure out if the comment we are about to delete, is awaiting approval,
if so - we should *not* subtract it from the entries table */
- $sql = serendipity_db_query("SELECT status FROM {$serendipity['dbPrefix']}comments
+ $sql = serendipity_db_query("SELECT status, parent_id FROM {$serendipity['dbPrefix']}comments
WHERE entry_id = '". (int)$entry_id ."'
AND id = '". (int)$id ."'
$admin", true);
@@ -232,9 +232,11 @@
AND id = '". (int)$id ."'
$admin");
- if ( $sql['status'] !== 'pending' ) {
+ if ($sql['status'] !== 'pending') {
serendipity_db_query("UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = '". (int)$entry_id ."' $admin");
}
+
+ serendipity_db_query("UPDATE {$serendipity['dbPrefix']}comments SET parent_id = " . (int)$sql['parent_id'] . " WHERE parent_id = '" . (int)$id . "'");
return true;
} else {
|