From f35be8fa36db720b1aacf3f18c4f7583ff431c5e Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Tue, 4 Aug 2015 00:34:08 +0200 Subject: [PATCH] Util/MostComments * fixed wrong indexing on counting comments per page --- pages/utility.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/utility.php b/pages/utility.php index b01bf6b5..b8c70f36 100644 --- a/pages/utility.php +++ b/pages/utility.php @@ -214,7 +214,7 @@ class UtilityPage extends GenericPage continue; $comments = DB::Aowow()->selectCol(' - SELECT `typeId` AS ARRAY_KEY, count(1) AS ncomments FROM ?_comments + SELECT `typeId` AS ARRAY_KEY, count(1) FROM ?_comments WHERE `replyTo` = 0 AND (`flags` & ?d) = 0 AND `type`= ?d AND `date` > (UNIX_TIMESTAMP() - ?d) GROUP BY `type`, `typeId` LIMIT 100', @@ -238,14 +238,14 @@ class UtilityPage extends GenericPage 'title' => [true, [], htmlentities(Util::$typeStrings[$type] == 'item' ? substr($d['name'], 1) : $d['name'])], 'type' => [false, [], Util::$typeStrings[$type]], 'link' => [false, [], HOST_URL.'/?'.Util::$typeStrings[$type].'='.$d['id']], - 'ncomments' => [false, [], $comments[$typeId]['ncomments']] + 'ncomments' => [false, [], $comments[$typeId]] ); } } else { foreach ($data as $typeId => &$d) - $d['ncomments'] = $comments[$typeId]['ncomments']; + $d['ncomments'] = $comments[$typeId]; $this->extendGlobalData($typeClass->getJSGlobals(GLOBALINFO_ANY)); $this->lvTabs[] = array(