getForumPermList('view')); $qry = " SELECT t.*, u.user_name, ul.user_name AS user_last, f.forum_name FROM `#forum_thread` as t LEFT JOIN `#forum` AS f ON f.forum_id = t.thread_forum_id LEFT JOIN `#user` AS u ON u.user_id = t.thread_user LEFT JOIN `#user` AS ul ON ul.user_id = t.thread_lastuser WHERE t.thread_forum_id IN ({$forumList}) ORDER BY t.thread_views DESC LIMIT {$from}, {$view} "; if ($sql->gen($qry)) { $text = "
\n\n"; $gen = e107::getDate(); $text .= "\n"; while ($row = $sql->fetch()) { if ($row['user_name']) { $POSTER = "{$row['user_name']}"; } else { $POSTER = $row['thread_user_anon']; } $LINKTOTHREAD = e107::getUrl()->create('forum/thread/view', array('id' =>$row['thread_id'])); //$e107->url->getUrl('forum', 'thread', "func=view&id={$row['thread_id']}"); $LINKTOFORUM = e107::getUrl()->create('forum/forum/view', array('id' => $row['thread_forum_id'])); //$e107->url->getUrl('forum', 'forum', "func=view&id={$row['thread_forum_id']}"); $lastpost_datestamp = $gen->convert_date($row['thread_lastpost'], 'forum'); if ($row['user_last']) { $LASTPOST = "{$row['user_last']}
".$lastpost_datestamp; } else { $LASTPOST = $row['thread_lastuser_anon'].'
'.$lastpost_datestamp; } $text .= "\n"; } $text .= "
  ".LAN_1." ".LAN_2." ".LAN_3." ".LAN_4." ".LAN_5."
{$row['thread_name']} ({$row['forum_name']}) {$POSTER} {$row['thread_views']} {$row['thread_total_replies']} {$LASTPOST}
\n
"; $ftotal = $sql->count('forum_thread', '(*)', 'WHERE `thread_parent` = 0'); $parms = "{$ftotal},{$view},{$from},".e_SELF.'?[FROM].active.forum.'.$view; $text .= "
".$tp->parseTemplate("{NEXTPREV={$parms}}").'
'; $ns->tablerender(LAN_7, $text, 'nfp'); /* require_once (e_HANDLER.'np_class.php'); $ftotal = $sql->db_Count('forum_thread', '(*)', 'WHERE 1'); $ix = new nextprev('top.php', $from, $view, $ftotal, '', 'active.forum.'.$view); */ } } if ($action == 'top') { //require_once (e_HANDLER.'level_handler.php'); $rank = e107::getRank(); if(!defined('IMAGE_rank_main_admin_image')) { define('IMAGE_rank_main_admin_image', (!empty($pref['rank_main_admin_image']) && file_exists(THEME."forum/".$pref['rank_main_admin_image']) ? "" : "")); } if(!defined('IMAGE_rank_main_admin_image')) { define('IMAGE_rank_admin_image', (!empty($pref['rank_admin_image']) && file_exists(THEME."forum/".$pref['rank_admin_image']) ? "" : "")); } if(!defined('IMAGE_rank_main_admin_image')) { define('IMAGE_rank_moderator_image', (!empty($pref['rank_moderator_image']) && file_exists(THEME."forum/".$pref['rank_moderator_image']) ? "" : "")); } if ($subaction == 'forum' || $subaction == 'all') { require_once (e_PLUGIN.'forum/forum_class.php'); $forum = new e107forum(); $qry = " SELECT ue.*, u.* FROM `#user_extended` AS ue LEFT JOIN `#user` AS u ON u.user_id = ue.user_extended_id WHERE ue.user_plugin_forum_posts > 0 ORDER BY ue.user_plugin_forum_posts DESC LIMIT {$from}, {$view} "; $text = "
\n"; $counter = 1 + $from; $sql2 = e107::getDb('sql2'); if ($sql2->gen($qry)) { while ($row = $sql2->fetch()) { //$ldata = get_level($row['user_id'], $row['user_plugin_forum_posts'], $row['user_comments'], $row['user_chats'], $row['user_visits'], $row['user_join'], $row['user_admin'], $row['user_perms'], $pref); $ldata = $rank->getRanks($row['user_id'], (USER && $forum->isModerator(USERID))); if(vartrue($ldata['special'])) { $r = $ldata['special']; } else { $r = $ldata['pic'] ? $ldata['pic'] : defset($ldata['name'], $ldata['name']); } if(!$r) $r = 'n/a'; $text .= ""; $counter++; } } $text .= "
  ".TOP_LAN_1." ".TOP_LAN_2." ".TOP_LAN_6."
{$counter} {$row['user_name']} {$row['user_plugin_forum_posts']} {$r}
\n
"; if ($subaction == 'forum') { //$ftotal = $sql->db_Count('user', '(*)', 'WHERE `user_forums` > 0'); $ftotal = $sql->count('user_extended', '(*)', 'WHERE `user_plugin_forum_posts` > 0'); $parms = "{$ftotal},{$view},{$from},".e_SELF.'?[FROM].top.forum.'.$view; $text .= "
".$tp->parseTemplate("{NEXTPREV={$parms}}").'
'; } $ns->tablerender(TOP_LAN_0, $text); /* if ($subaction == 'forum') { require_once (e_HANDLER.'np_class.php'); $ftotal = $sql->db_Count('user_extended', '(*)', 'WHERE `user_plugin_forum_posts` > 0'); $ix = new nextprev('top.php', $from, $view, $ftotal, 'Forum Posts', 'top.forum.'.$view); }*/ } if ($subaction == 'comment' || $subaction == 'all') { $top_forum_posters = $sql->select("user", "*", "`user_comments` > 0 ORDER BY user_comments DESC LIMIT 0, 10"); $text = "
\n"; $counter = 1; if($top_forum_posters) { while ($row = $sql->fetch()) { // TODO - Custom ranking (comments), LANs $ldata = $rank->getRanks($row['user_id']); if(vartrue($ldata['special'])) { $r = $ldata['special']; } else { $r = $ldata['pic'] ? $ldata['pic'] : defset($ldata['name'], $ldata['name']); } if(!$r) $r = 'n/a'; $text .= ""; $counter++; } } else { $text .= " "; } $text .= "
  ".TOP_LAN_1." ".LAN_COMMENTS." ".TOP_LAN_6."
{$counter} {$row['user_name']} {$row['user_comments']} {$r}
No results
\n
"; $ns->tablerender(TOP_LAN_3, $text); } if ($subaction == 'chat' || $subaction == 'all') { $top_forum_posters = $sql->select("user", "*", "`user_chats` > 0 ORDER BY user_chats DESC LIMIT 0, 10"); $text = "
\n"; $counter = 1; if($top_forum_posters) { while ($row = $sql->fetch()) { // TODO - Custom ranking (chat), LANs $ldata = $rank->getRanks($row['user_id']); if(vartrue($ldata['special'])) { $r = $ldata['special']; } else { $r = $ldata['pic'] ? $ldata['pic'] : defset($ldata['name'], $ldata['name']); } if(!$r) $r = 'n/a'; $text .= ""; $counter++; } } else { $text .= " "; } $text .= "
  ".TOP_LAN_1." ".TOP_LAN_2." ".TOP_LAN_6."
{$counter} {$row['user_name']} {$row['user_chats']} {$r}
No results
\n
"; $ns->tablerender(TOP_LAN_5, $text); } } require_once(FOOTERF);