Exemplo n.º 1
0
print "<table class='lista' border='0' width='100%' cellspacing='1' cellpadding='5'>\n";
print "<tr><td class='header' align='center'>" . FORUM . "</td><td class='header' align='center' width='15%'>" . TOPICS . "</td>" . "<td class='header' align='center' width='15%'>" . POSTS . "</td>" . "<td class='header' align='center' width='15%'>" . LASTPOST . "</td></tr>\n";
if ($forums_res->num_rows == 0) {
    print "<tr><td class='lista' colspan='4' align='center'>" . NO_FORUMS . "</td></tr>";
}
while ($forums_arr = $forums_res->fetch_assoc()) {
    if (user::$current["id_level"] < $forums_arr["minclassread"]) {
        continue;
    }
    $forumid = (int) $forums_arr["id"];
    $forumname = security::html_safe(unesc($forums_arr["name"]));
    $forumdescription = security::html_safe(unesc($forums_arr["description"]));
    $topiccount = number_format((int) $forums_arr["topiccount"]);
    $postcount = number_format((int) $forums_arr["postcount"]);
    // Find last post ID
    $lastpostid = Cached::get_forum_last_post($forumid);
    // Get last post info
    $post_res = $db->query("SELECT added, topicid, userid FROM posts WHERE id = " . $lastpostid) or sqlerr(__FILE__, __LINE__);
    if ($post_res->num_rows == 1) {
        $post_arr = $post_res->fetch_assoc() or die(ERR_BAD_LAST_POST);
        $lastposterid = (int) $post_arr["userid"];
        $lastpostdate = get_date_time($post_arr["added"]);
        $lasttopicid = (int) $post_arr["topicid"];
        $user_res = $db->query("SELECT username FROM users WHERE id = " . $lastposterid) or sqlerr(__FILE__, __LINE__);
        $user_arr = $user_res->fetch_assoc();
        $lastposter = security::html_safe($user_arr['username']);
        $topic_res = $db->query("SELECT subject FROM topics WHERE id = " . $lasttopicid) or sqlerr(__FILE__, __LINE__);
        $topic_arr = $topic_res->fetch_assoc();
        $lasttopic = security::html_safe(unesc($topic_arr['subject']));
        //---- Get reply count
        $postsperpage = user::$current["postsperpage"] > 0 ? user::$current["postsperpage"] : 15;