Ejemplo n.º 1
0
print "<table border=0 cellspacing=0 cellpadding=3 width=940><tr>" . "<td class=colhead align=left width=80%>" . $lang_usercp['col_topic_title'] . "</td>" . "<td class=colhead align=center><nobr>" . $lang_usercp['col_replies'] . "/" . $lang_usercp['col_views'] . "</nobr></td>" . "<td class=colhead align=center>" . $lang_usercp['col_topic_starter'] . "</td>" . "<td class=colhead align=center width=20%>" . $lang_usercp['col_last_post'] . "</td>" . "</tr>";
$res_topics = sql_query("SELECT * FROM readposts INNER JOIN topics ON topics.id = readposts.topicid WHERE readposts.userid = " . $CURUSER[id] . " ORDER BY readposts.id DESC LIMIT 5") or sqlerr();
while ($topicarr = mysql_fetch_assoc($res_topics)) {
    $topicid = $topicarr["id"];
    $topic_title = $topicarr["subject"];
    $topic_userid = $topicarr["userid"];
    $topic_views = $topicarr["views"];
    $views = number_format($topic_views);
    /// GETTING TOTAL NUMBER OF POSTS ///
    if (!($posts = $Cache->get_value('topic_' . $topicid . '_post_count'))) {
        $posts = get_row_count("posts", "WHERE topicid=" . sqlesc($topicid));
        $Cache->cache_value('topic_' . $topicid . '_post_count', $posts, 3600);
    }
    $replies = max(0, $posts - 1);
    /// GETTING USERID AND DATE OF LAST POST ///
    $arr = get_post_row($topicarr['lastpost']);
    $postid = 0 + $arr["id"];
    $userid = 0 + $arr["userid"];
    $added = gettime($arr['added'], true, false);
    /// GET NAME OF LAST POSTER ///
    $username = get_username($userid);
    /// GET NAME OF THE AUTHOR ///
    $author = get_username($topic_userid);
    $subject = "<a href=forums.php?action=viewtopic&topicid={$topicid}><b>" . htmlspecialchars($topicarr["subject"]) . "</b></a>";
    print "<tr class=tableb><td style='padding-left: 10px' align=left class=rowfollow>{$subject}</td>" . "<td align=center class=rowfollow>" . $replies . "/" . $views . "</td>" . "<td align=center class=rowfollow>" . $author . "</td>" . "<td align=center class=rowfollow><nobr>" . $added . " | " . $username . "</nobr></td></tr>";
}
?>
</table>
</td>
</tr>
<?php 
Ejemplo n.º 2
0
 if (!$forummoderators) {
     $forummoderators = "<a href=\"contactstaff.php\"><i>" . $lang_forums['text_apply_now'] . "</i></a>";
 }
 $topiccount = number_format($forums_arr["topiccount"]);
 $postcount = number_format($forums_arr["postcount"]);
 // Find last post ID
 //Returns the ID of the last post of a forum
 if (!($arr = $Cache->get_value('forum_' . $forumid . '_last_replied_topic_content'))) {
     $res = sql_query("SELECT * FROM topics WHERE forumid=" . sqlesc($forumid) . " ORDER BY lastpost DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
     $arr = mysql_fetch_array($res);
     $Cache->cache_value('forum_' . $forumid . '_last_replied_topic_content', $arr, 900);
 }
 if ($arr) {
     $lastpostid = $arr['lastpost'];
     // Get last post info
     $post_arr = get_post_row($lastpostid);
     $lastposterid = $post_arr["userid"];
     $lastpostdate = gettime($post_arr["added"], true, false);
     $lasttopicid = $arr['id'];
     $hlcolor = $arr['hlcolor'];
     $lasttopicdissubject = $lasttopicsubject = $arr['subject'];
     $max_length_of_topic_subject = 35;
     $count_dispname = mb_strlen($lasttopicdissubject, "UTF-8");
     if ($count_dispname > $max_length_of_topic_subject) {
         $lasttopicdissubject = mb_substr($lasttopicdissubject, 0, $max_length_of_topic_subject - 2, "UTF-8") . "..";
     }
     $lasttopic = highlight_topic(htmlspecialchars($lasttopicdissubject), $hlcolor);
     $lastpost = "<a href=\"" . htmlspecialchars("?action=viewtopic&topicid=" . $lasttopicid . "&page=last#last") . "\" title=\"" . htmlspecialchars($lasttopicsubject) . "\">" . $lasttopic . "</a><br />" . $lastpostdate . "&nbsp;|&nbsp;" . get_username($lastposterid);
     $lastreadpost = get_last_read_post_id($lasttopicid);
     if ($lastreadpost >= $lastpostid) {
         $img = get_topic_image("read");