echo "
".$locale['global_021']."
\n";
$result = dbquery("
SELECT tt.forum_id, tt.thread_id, tt.thread_subject, tt.thread_lastpost FROM ".DB_THREADS." tt
INNER JOIN ".DB_FORUMS." tf ON tt.forum_id=tf.forum_id
WHERE ".groupaccess('tf.forum_access')." AND tt.thread_hidden='0'
ORDER BY thread_lastpost DESC LIMIT 5
");
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['thread_subject'], 23);
echo THEME_BULLET." $itemsubject
\n";
}
} else {
echo "".$locale['global_023']."
\n";
}
echo "".$locale['global_022']."
\n";
$timeframe = ($settings['popular_threads_timeframe'] != 0 ? "thread_lastpost >= ".(time()-$settings['popular_threads_timeframe']) : "");
list($min_posts) = dbarraynum(dbquery("SELECT thread_postcount FROM ".DB_THREADS.($timeframe ? " WHERE ".$timeframe : "")." ORDER BY thread_postcount DESC LIMIT 4,1"));
$timeframe = ($timeframe ? " AND tt.".$timeframe : "");
$result = dbquery("
SELECT tf.forum_id, tt.thread_id, tt.thread_subject, tt.thread_postcount
FROM ".DB_FORUMS." tf
INNER JOIN ".DB_THREADS." tt USING(forum_id)
WHERE ".groupaccess('tf.forum_access')." AND tt.thread_postcount >= '".$min_posts."'".$timeframe." AND tt.thread_hidden='0'
ORDER BY thread_postcount DESC, thread_lastpost DESC LIMIT 5
");
if (dbrows($result) != 0) {
echo "\n";
while($data = dbarray($result)) {
$itemsubject = trimlink($data['thread_subject'], 20);
echo "\n".THEME_BULLET." $itemsubject | \n";
echo "[".($data['thread_postcount'] - 1)."] | \n
\n";
}
echo "
\n";
} else {
echo "".$locale['global_023']."
\n";
}