mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Util/MostComments
* fixed wrong indexing on counting comments per page
This commit is contained in:
@@ -214,7 +214,7 @@ class UtilityPage extends GenericPage
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
$comments = DB::Aowow()->selectCol('
|
$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)
|
WHERE `replyTo` = 0 AND (`flags` & ?d) = 0 AND `type`= ?d AND `date` > (UNIX_TIMESTAMP() - ?d)
|
||||||
GROUP BY `type`, `typeId`
|
GROUP BY `type`, `typeId`
|
||||||
LIMIT 100',
|
LIMIT 100',
|
||||||
@@ -238,14 +238,14 @@ class UtilityPage extends GenericPage
|
|||||||
'title' => [true, [], htmlentities(Util::$typeStrings[$type] == 'item' ? substr($d['name'], 1) : $d['name'])],
|
'title' => [true, [], htmlentities(Util::$typeStrings[$type] == 'item' ? substr($d['name'], 1) : $d['name'])],
|
||||||
'type' => [false, [], Util::$typeStrings[$type]],
|
'type' => [false, [], Util::$typeStrings[$type]],
|
||||||
'link' => [false, [], HOST_URL.'/?'.Util::$typeStrings[$type].'='.$d['id']],
|
'link' => [false, [], HOST_URL.'/?'.Util::$typeStrings[$type].'='.$d['id']],
|
||||||
'ncomments' => [false, [], $comments[$typeId]['ncomments']]
|
'ncomments' => [false, [], $comments[$typeId]]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach ($data as $typeId => &$d)
|
foreach ($data as $typeId => &$d)
|
||||||
$d['ncomments'] = $comments[$typeId]['ncomments'];
|
$d['ncomments'] = $comments[$typeId];
|
||||||
|
|
||||||
$this->extendGlobalData($typeClass->getJSGlobals(GLOBALINFO_ANY));
|
$this->extendGlobalData($typeClass->getJSGlobals(GLOBALINFO_ANY));
|
||||||
$this->lvTabs[] = array(
|
$this->lvTabs[] = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user