if ($arr_post_read[0] < $arr_unread['last_post'] && $posted) { //=== change colors $colour = ++$colour % 2; $class = $colour == 0 ? 'one' : 'two'; $locked = $arr_unread['locked'] == 'yes'; $sticky = $arr_unread['sticky'] == 'yes'; $topic_poll = $arr_unread['poll_id'] > 0; $first_unread_poster = sql_query('SELECT added FROM posts WHERE status = \'ok\' AND topic_id=' . $arr_unread['topic_id'] . ' ORDER BY id ASC LIMIT 1'); $first_unread_poster_arr = mysql_fetch_row($first_unread_poster); $thread_starter = ($arr_unread['username'] !== '' ? print_user_stuff($arr_unread) : 'Lost [' . $arr_unread['id'] . ']') . '<br />' . get_date($first_unread_poster_arr[0], ''); $topicpic = $arr_unread['post_count'] < 30 ? $locked ? 'lockednew' : 'topicnew' : ($locked ? 'lockednew' : 'hot_topic_new'); $rpic = $arr_unread['num_ratings'] != 0 ? ratingpic_forums(ROUND($arr_unread['rating_sum'] / $arr_unread['num_ratings'], 1)) : ''; $sub = sql_query('SELECT user_id FROM subscriptions WHERE user_id=' . $CURUSER['id'] . ' AND topic_id=' . $arr_unread['topic_id']); $subscriptions = mysql_num_rows($sub) > 0 ? 1 : 0; $icon = $arr_unread['icon'] == '' ? '<img src="pic/forums/topic_normal.gif" alt="Topic" title="Topic" />' : '<img src="pic/smilies/' . htmlspecialchars($arr_unread['icon']) . '.gif" alt="' . htmlspecialchars($arr_unread['icon']) . '" title="' . htmlspecialchars($arr_unread['icon']) . '" />'; $first_post_text = tool_tip(' <img src="pic/forums/mg.gif" height="14" alt="Preview" title="Preview" />', format_comment($arr_unread['body']), 'Last Post Preview'); $topic_name = ($sticky ? '<img src="pic/forums/pinned.gif" alt="Pinned" title="Pinned" /> ' : ' ') . ($topicpoll ? '<img src="pic/forums/poll.gif" alt="Poll" title="Poll" /> ' : ' ') . ' <a class="altlink" href="?action=view_topic&topic_id=' . $arr_unread['topic_id'] . '" title="First post in thread">' . htmlentities($arr_unread['topic_name'], ENT_QUOTES) . '</a> <a class="altlink" href="forums.php?action=view_topic&topic_id=' . $arr_unread['topic_id'] . '&page=0#' . $arr_post_read[0] . '" title="First unread post in this thread"><img src="pic/forums/last_post.gif" alt="First unread post" title="First unread post" /></a> ' . ($posted ? '<img src="pic/forums/posted.gif" alt="Posted" title="Posted" /> ' : ' ') . ($subscriptions ? '<img src="pic/forums/subscriptions.gif" alt="subscribed" title="subscribed" /> ' : ' ') . ' <img src="pic/forums/new.gif" alt="New post in topic!" title="New post in topic!" />'; //=== print here $HTMLOUT .= '<tr> <td class="' . $class . '" align="center"><img src="pic/forums/' . $topicpic . '.gif" alt="topic" title="topic" /></td> <td class="' . $class . '" align="center">' . $icon . '</td> <td align="left" valign="middle" class="' . $class . '"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="' . $class . '" align="left">' . $topic_name . $first_post_text . ' </td> <td class="' . $class . '" align="right">' . $rpic . '</td> </tr> </table>
$post_status_image = ' <img src="pic/forums/delete_icon.gif" alt="Deleted" title="this post is currently deleted" />'; break; } $last_post_username = $arr_post_stuff['username'] !== '' ? print_user_stuff($arr_post_stuff) : 'Lost [' . $arr_post_stuff['id'] . ']'; $last_post_id = $arr_post_stuff['last_post_id']; //=== Get author / first post info $first_post_res = sql_query('SELECT p.id AS first_post_id, p.added, p.icon, p.body, u.id, u.username, u.class, u.donor, u.suspended, u.warned, u.enabled, u.chatpost, u.leechwarn, u.pirate, u.king FROM posts AS p LEFT JOIN users AS u ON p.user_id = u.id WHERE ' . ($CURUSER['class'] < UC_STAFF ? ' p.status = \'ok\' AND' : ($CURUSER['class'] < $min_delete_view_class ? ' p.status != \'deleted\' AND' : '')) . ' topic_id=' . $topic_id . ' ORDER BY p.id ASC LIMIT 1'); $first_post_arr = mysql_fetch_assoc($first_post_res); $thread_starter = ($first_post_arr['username'] !== '' ? print_user_stuff($first_post_arr) : 'Lost [' . $topic_arr['user_id'] . ']') . '<br />' . get_date($first_post_arr['added'], ''); $icon = $first_post_arr['icon'] == '' ? '<img src="pic/forums/topic_normal.gif" alt="Topic" title="Topic" />' : '<img src="pic/smilies/' . htmlspecialchars($first_post_arr['icon']) . '.gif" alt="' . htmlspecialchars($first_post_arr['icon']) . '" />'; $first_post_text = tool_tip(' <img src="pic/forums/mg.gif" height="14" alt="Preview" title="Preview" />', format_comment($first_post_arr['body'], 1, 0), 'First Post Preview'); //=== last post read in topic $last_unread_post_res = sql_query('SELECT last_post_read FROM read_posts WHERE user_id=' . $CURUSER['id'] . ' AND topic_id=' . $topic_id); $last_unread_post_arr = mysql_fetch_row($last_unread_post_res); $last_unread_post_id = $last_unread_post_arr[0] > 0 ? $last_unread_post_arr[0] : $first_post_arr['first_post_id']; $did_i_post_here = sql_query('SELECT user_id FROM posts WHERE user_id=' . $CURUSER['id'] . ' AND topic_id=' . $topic_id); $posted = mysql_num_rows($did_i_post_here) > 0 ? 1 : 0; //=== add subscribed forum image $sub = sql_query('SELECT user_id FROM subscriptions WHERE user_id=' . $CURUSER['id'] . ' AND topic_id=' . $topic_id); $subscriptions = mysql_num_rows($sub) > 0 ? 1 : 0; //=== make the multi pages thing... $total_pages = floor($posts / $perpage); switch (true) { case $total_pages == 0: $multi_pages = ''; break;
$last_post_username = $topic_arr['pan'] == 'no' && $topic_arr['username'] !== '' ? print_user_stuff($topic_arr) : '[<i>' . $lang['fe_anonymous'] . '</i>]'; $last_post_id = (int) $topic_arr['last_post']; //=== Get author / first post info $first_post_res = sql_query('SELECT p.added, p.icon, p.body, p.user_id, p.anonymous, u.id, u.username, u.class, u.donor, u.suspended, u.warned, u.enabled, u.chatpost, u.leechwarn, u.pirate, u.king FROM posts AS p LEFT JOIN users AS u ON p.user_id = u.id WHERE ' . ($CURUSER['class'] < UC_STAFF ? 'p.status = \'ok\' AND' : ($CURUSER['class'] < $min_delete_view_class ? 'p.status != \'deleted\' AND' : '')) . ' topic_id=' . sqlesc($topic_id) . ' ORDER BY id DESC LIMIT 1'); $first_post_arr = mysqli_fetch_assoc($first_post_res); if ($topic_arr['tan'] == 'yes') { if ($CURUSER['class'] < UC_STAFF && $first_post_arr['user_id'] != $CURUSER['id']) { $thread_starter = ($first_post_arr['username'] !== '' ? '<i>' . $lang['fe_anonymous'] . '</i>' : '' . $lang['fe_lost'] . ' [' . (int) $first_post_arr['id'] . ']') . '<br />' . get_date($first_post_arr['added'], ''); } else { $thread_starter = ($first_post_arr['username'] !== '' ? '<i>' . $lang['fe_anonymous'] . '</i> [' . print_user_stuff($first_post_arr) . ']' : '' . $lang['fe_lost'] . ' [' . (int) $first_post_arr['id'] . ']') . '<br />' . get_date($first_post_arr['added'], ''); } } else { $thread_starter = ($first_post_arr['username'] !== '' ? print_user_stuff($first_post_arr) : '' . $lang['fe_lost'] . ' [' . (int) $first_post_arr['id'] . ']') . '<br />' . get_date($first_post_arr['added'], ''); } $icon = $first_post_arr['icon'] == '' ? '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="' . $lang['fe_topic'] . '" title="' . $lang['fe_topic'] . '" />' : '<img src="' . $INSTALLER09['pic_base_url'] . 'smilies/' . htmlsafechars($first_post_arr['icon']) . '.gif" alt="' . htmlsafechars($first_post_arr['icon']) . '" title="' . htmlsafechars($first_post_arr['icon']) . '" />'; $first_post_text = tool_tip(' <img src="' . $INSTALLER09['pic_base_url'] . 'forums/mg.gif" height="14" alt="' . $lang['fe_preview'] . '" title="' . $lang['fe_preview'] . '" />', format_comment($first_post_arr['body'], true, false, false), '' . $lang['fe_first_post'] . ' ' . $lang['fe_preview'] . ''); //=== last post read in topic $last_unread_post_res = sql_query('SELECT last_post_read FROM read_posts WHERE user_id=' . sqlesc($CURUSER['id']) . ' AND topic_id=' . sqlesc($topic_id)); $last_unread_post_arr = mysqli_fetch_row($last_unread_post_res); $did_i_post_here = sql_query('SELECT user_id FROM posts WHERE user_id=' . sqlesc($CURUSER['id']) . ' AND topic_id=' . sqlesc($topic_id)); $posted = mysqli_num_rows($did_i_post_here) > 0 ? 1 : 0; //=== make the multi pages thing... $total_pages = floor($posts / $perpage); switch (true) { case $total_pages == 0: $multi_pages = ''; break; case $total_pages > 11: $multi_pages = ' <span style="font-size: xx-small;"> <img src="' . $INSTALLER09['pic_base_url'] . 'forums/multipage.gif" alt="+" title="+" />'; for ($i = 1; $i < 5; ++$i) { $multi_pages .= ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_topic&topic_id=' . $topic_id . '&page=' . $i . '">' . $i . '</a>';
$count2 = ++$count2 % 2; $class = $count2 == 0 ? 'one' : 'two'; if ($search_what === 'all' || $search_what === 'title') { $topic_title = highlightWords(htmlsafechars($arr['topic_title'], ENT_QUOTES), $search); $topic_desc = highlightWords(htmlsafechars($arr['topic_desc'], ENT_QUOTES), $search); $post_title = highlightWords(htmlsafechars($arr['post_title'], ENT_QUOTES), $search); } else { $topic_title = htmlsafechars($arr['topic_title'], ENT_QUOTES); $topic_desc = htmlsafechars($arr['topic_desc'], ENT_QUOTES); $post_title = htmlsafechars($arr['post_title'], ENT_QUOTES); } $body = format_comment($arr['body'], 1, 0); $search_post = str_replace(' ', '+', $search); $post_id = (int) $arr['post_id']; $posts = (int) $arr['post_count']; $post_text = tool_tip('<img src="pic/forums/mg.gif" height="14" alt="' . $lang['fe_preview'] . '" title="' . $lang['fe_preview'] . '" />', $body, '' . $lang['fe_post_preview'] . ''); $rpic = $arr['num_ratings'] != 0 ? ratingpic_forums(ROUND($arr['rating_sum'] / $arr['num_ratings'], 1)) : ''; $content .= '<tr> <td class="' . $class . '" align="center"><img src="pic/forums/' . ($posts < 30 ? $arr['locked'] == 'yes' ? 'locked' : 'topic' : 'hot_topic') . '.gif" alt="' . $lang['fe_topic'] . '" title="' . $lang['fe_topic'] . '" /></td> <td class="' . $class . '" align="center">' . ($arr['icon'] == '' ? '<img src="pic/forums/topic_normal.gif" alt="' . $lang['fe_topic'] . '" title="' . $lang['fe_topic'] . '" />' : '<img src="pic/smilies/' . htmlsafechars($arr['icon']) . '.gif" alt="' . htmlsafechars($arr['icon']) . '" title="' . htmlsafechars($arr['icon']) . '" />') . '</td> <td align="left" valign="middle" class="' . $class . '"> <table border="0" cellspacing="2" cellpadding="2"> <tr> <td class="' . $class . '" align="right"><span style="font-weight: bold;">' . $lang['fe_post'] . ': </span></td> <td class="' . $class . '" align="left"> <a class="altlink" href="forums.php?action=view_topic&topic_id=15&page=p' . (int) $arr['post_id'] . '&search=' . $search_post . '#' . (int) $arr['post_id'] . '" title="' . $lang['sea_go_to_the_post'] . '">' . ($post_title == '' ? '' . $lang['fe_link_to_post'] . '' : $post_title) . '</a></td> <td class="' . $class . '" align="right"></td> </tr> <tr> <td class="' . $class . '" align="right"><span style="font-style: italic;">by: </span></td> <td class="' . $class . '" align="left">' . ($arr['pan'] == 'yes' ? '<i>' . $lang['fe_anonymous'] . '</i>' : print_user_stuff($arr)) . '</td>
$count2 = ++$count2 % 2; $class = $count2 == 0 ? 'one' : 'two'; if ($search_what === 'all' || $search_what === 'title') { $topic_title = highlightWords(htmlentities($arr['topic_title'], ENT_QUOTES), $search); $topic_desc = highlightWords(htmlentities($arr['topic_desc'], ENT_QUOTES), $search); $post_title = highlightWords(htmlentities($arr['post_title'], ENT_QUOTES), $search); } else { $topic_title = htmlentities($arr['topic_title'], ENT_QUOTES); $topic_desc = htmlentities($arr['topic_desc'], ENT_QUOTES); $post_title = htmlentities($arr['post_title'], ENT_QUOTES); } $body = format_comment($arr['body'], 1, 0); $search_post = str_replace(' ', '+', $search); $post_id = $arr['post_id']; $posts = $arr['post_count']; $post_text = tool_tip(' <img src="pic/forums/mg.gif" height="14" alt="Preview" title="Preview" />', $body, 'Post Preview'); $rpic = $arr['num_ratings'] != 0 ? ratingpic_forums(ROUND($arr['rating_sum'] / $arr['num_ratings'], 1)) : ''; $content .= '<tr> <td class="' . $class . '" align="center"><img src="pic/forums/' . ($posts < 30 ? $arr['locked'] == 'yes' ? 'locked' : 'topic' : 'hot_topic') . '.gif" alt="topic" title="topic" /></td> <td class="' . $class . '" align="center">' . ($arr['icon'] == '' ? '<img src="pic/forums/topic_normal.gif" alt="Topic" title="Topic" />' : '<img src="pic/smilies/' . htmlspecialchars($arr['icon']) . '.gif" alt="' . htmlspecialchars($arr['icon']) . '" title="' . htmlspecialchars($arr['icon']) . '" />') . '</td> <td align="left" valign="middle" class="' . $class . '"> <table border="0" cellspacing="2" cellpadding="2"> <tr> <td class="' . $class . '" align="right"><span style="font-weight: bold;">Post: </span></td> <td class="' . $class . '" align="left"> <a class="altlink" href="forums.php?action=view_topic&topic_id=15&page=p' . $arr['post_id'] . '&search=' . $search_post . '#' . $arr['post_id'] . '" title="go to the post">' . ($post_title == '' ? 'Link To Post' : $post_title) . '</a></td> <td class="' . $class . '" align="right"></td> </tr> <tr> <td class="' . $class . '" align="right"><span style="font-style: italic;">by: </span></td> <td class="' . $class . '" align="left">' . print_user_stuff($arr) . '</td>
$first_unread_poster_arr = mysqli_fetch_row($first_unread_poster); if ($arr_unread['tan'] == 'yes') { if ($CURUSER['class'] < UC_STAFF && $arr_unread['user_id'] != $CURUSER['id']) { $thread_starter = ($arr_unread['username'] !== '' ? '<i>Anonymous</i>' : 'Lost [' . $arr_unread['id'] . ']') . '<br />' . get_date($first_unread_poster_arr[0], ''); } else { $thread_starter = ($arr_unread['username'] !== '' ? '<i>Anonymous</i> [' . print_user_stuff($arr_unread) . ']' : 'Lost [' . $arr_unread['id'] . ']') . '<br />' . get_date($first_unread_poster_arr[0], ''); } } else { $thread_starter = ($arr_unread['username'] !== '' ? print_user_stuff($arr_unread) : 'Lost [' . $arr_unread['id'] . ']') . '<br />' . get_date($first_unread_poster_arr[0], ''); } $topicpic = $arr_unread['post_count'] < 30 ? $locked ? 'lockednew' : 'topicnew' : ($locked ? 'lockednew' : 'hot_topic_new'); $rpic = $arr_unread['num_ratings'] != 0 ? ratingpic_forums(ROUND($arr_unread['rating_sum'] / $arr_unread['num_ratings'], 1)) : ''; $sub = sql_query('SELECT user_id FROM subscriptions WHERE user_id=' . sqlesc($CURUSER['id']) . ' AND topic_id=' . sqlesc($arr_unread['topic_id'])); $subscriptions = mysqli_num_rows($sub) > 0 ? 1 : 0; $icon = $arr_unread['icon'] == '' ? '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/topic_normal.gif" alt="Topic" title="Topic" />' : '<img src="pic/smilies/' . htmlsafechars($arr_unread['icon']) . '.gif" alt="' . htmlsafechars($arr_unread['icon']) . '" title="' . htmlsafechars($arr_unread['icon']) . '" />'; $first_post_text = tool_tip(' <img src="' . $INSTALLER09['pic_base_url'] . 'forums/mg.gif" height="14" alt="Preview" title="Preview" />', format_comment($arr_unread['body'], true, false, false), 'Last Post Preview'); $topic_name = ($sticky ? '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/pinned.gif" alt="Pinned" title="Pinned" /> ' : ' ') . ($topicpoll ? '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/poll.gif" alt="Poll" title="Poll" /> ' : ' ') . ' <a class="altlink" href="?action=view_topic&topic_id=' . (int) $arr_unread['topic_id'] . '" title="First post in thread">' . htmlsafechars($arr_unread['topic_name'], ENT_QUOTES) . '</a><a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_topic&topic_id=' . (int) $arr_unread['topic_id'] . '&page=0#' . (int) $arr_post_read[0] . '" title="First unread post in this thread"><img src="' . $INSTALLER09['pic_base_url'] . 'forums/last_post.gif" alt="First unread post" title="First unread post" /></a>' . ($posted ? '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/posted.gif" alt="Posted" title="Posted" /> ' : ' ') . ($subscriptions ? '<img src="' . $INSTALLER09['pic_base_url'] . 'forums/subscriptions.gif" alt="subscribed" title="subscribed" /> ' : ' ') . ' <img src="' . $INSTALLER09['pic_base_url'] . 'forums/new.gif" alt="New post in topic!" title="New post in topic!" />'; //=== print here $HTMLOUT .= '<tr> <td class="' . $class . '" align="center"><img src="' . $INSTALLER09['pic_base_url'] . 'forums/' . $topicpic . '.gif" alt="topic" title="topic" /></td> <td class="' . $class . '" align="center">' . $icon . '</td> <td align="left" valign="middle" class="' . $class . '"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="' . $class . '" align="left">' . $topic_name . $first_post_text . ' </td> <td class="' . $class . '" align="right">' . $rpic . '</td> </tr> </table> ' . ($arr_unread['topic_desc'] !== '' ? '► <span style="font-size: x-small;">' . htmlsafechars($arr_unread['topic_desc'], ENT_QUOTES) . '</span>' : '') . ' <hr />in: <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_forum&forum_id=' . (int) $arr_unread['forum_id'] . '">' . htmlsafechars($arr_unread['forum_name'], ENT_QUOTES) . '</a> ' . ($arr_unread['topic_desc'] !== '' ? ' [ <span style="font-size: x-small;">' . htmlsafechars($arr_unread['topic_desc'], ENT_QUOTES) . '</span> ]' : '') . '</td>