From 3dea5d16a049a9c335def928e7192948c761c940 Mon Sep 17 00:00:00 2001 From: Sazpaimon Date: Tue, 22 Dec 2009 21:07:44 +0000 Subject: [PATCH] Fixed a couple issues with r234 git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@238 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee --- inc/classes/board-post.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/classes/board-post.class.php b/inc/classes/board-post.class.php index 96a671b..01df0bb 100644 --- a/inc/classes/board-post.class.php +++ b/inc/classes/board-post.class.php @@ -159,7 +159,7 @@ class Board { $threads = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND `parentid` = 0 AND `IS_DELETED` = 0 ORDER BY `stickied` DESC, `bumped` DESC LIMIT ". ($postsperpage)." OFFSET ". $postsperpage * $i); $executiontime_start_page = microtime_float(); - foreach ($threads as $thread) { + foreach ($threads as $k=>$thread) { // If the thread is on the page set to mark, && hasn't been marked yet, mark it if ($thread['deleted_timestamp'] == 0 && $this->board['markpage'] > 0 && $i >= $this->board['markpage']) { $tc_db->Execute("UPDATE `".KU_DBPREFIX."posts` SET `deleted_timestamp` = '" . (time() + 7200) . "' WHERE `boardid` = " . $tc_db->qstr($this->board['id'])." AND `id` = '" . $thread['id'] . "'"); @@ -189,7 +189,7 @@ class Board { if ($this->board['type'] == 1 || $this->board['type'] == 3 ) { $replycount = $tc_db->GetAll("SELECT COUNT(`id`) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $tc_db->qstr($this->board['id'])." AND `parentid` = " . $thread['id']); } else { - $replycount = $tc_db->GetAll("SELECT COUNT(`id`)) AS replies, SUM(CASE WHEN `file_md5` = '' THEN 0 ELSE 1 END) AS files FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id']." AND `parentid` = ".$thread['id']." AND `is_deleted` = 0 AND `id` NOT IN (" . $omitids . ")"); + $replycount = $tc_db->GetAll("SELECT COUNT(`id`) AS replies, SUM(CASE WHEN `file_md5` = '' THEN 0 ELSE 1 END) AS files FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id']." AND `parentid` = ".$thread['id']." AND `is_deleted` = 0 AND `id` NOT IN (" . $omitids . ")"); } $newposts[$k][0]['replies'] = $replycount[0][0]; $newposts[$k][0]['images'] = (isset($replycount[0][1]) ? $replycount[0][1] : '');