$edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">' . $lang['vmp_last_edit_by_anony'] . ' at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ ' . $lang['fe_reason'] . ': ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . ' ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&post_id=' . (int) $arr['post_id'] . '&forum_id=' . (int) $arr['forum_id'] . '&topic_id=' . (int) $arr['topic_id'] . '">' . $lang['fe_read_post_history'] . '</a></span><br />' : '</span>'); } else { $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">' . $lang['vmp_last_edit_by_anony'] . ' [<a class="altlink" href="userdetails.php?id=' . (int) $arr['edited_by'] . '">' . htmlsafechars($arr_edited['username']) . '</a>] at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ ' . $lang['fe_reason'] . ': ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . ' ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&post_id=' . (int) $arr['post_id'] . '&forum_id=' . (int) $arr['forum_id'] . '&topic_id=' . (int) $arr['topic_id'] . '">' . $lang['fe_read_post_history'] . '</a></span><br />' : '</span>'); } } else { $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">' . $lang['fe_last_edited_by'] . ' <a class="altlink" href="userdetails.php?id=' . (int) $arr['edited_by'] . '">' . htmlsafechars($arr_edited['username']) . '</a> at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] !== '' ? ' </span>[ ' . $lang['fe_reason'] . ': ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : '') . ' ' . ($CURUSER['class'] >= UC_STAFF && $arr['post_history'] !== '' ? ' <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_post_history&post_id=' . (int) $arr['post_id'] . '&forum_id=' . (int) $arr['forum_id'] . '&topic_id=' . (int) $arr['topic_id'] . '">' . $lang['fe_read_post_history'] . '</a></span><br />' : '</span>'); } //== } $body = $arr['bbcode'] == 'yes' ? format_comment($arr['body']) : format_comment_no_bbcode($arr['body']); $post_id = (int) $arr['post_id']; $width = 100; $HTMLOUT .= '<tr> <td class="forum_head_dark" colspan="3" align="left">' . $lang['fe_forum'] . ': <a class="altlink" href="forums.php?action=view_forum&forum_id=' . (int) $arr['forum_id'] . '" title="' . $lang['fe_link_to_forum'] . '"> <span style="color: white;font-weight: bold;">' . htmlsafechars($arr['forum_name'], ENT_QUOTES) . '</span></a> ' . $lang['fe_topic'] . ': <a class="altlink" href="forums.php?action=view_topic&topic_id=' . (int) $arr['topic_id'] . '" title="' . $lang['fe_link_to_forum'] . '"> <span style="color: white;font-weight: bold;">' . htmlsafechars($arr['topic_name'], ENT_QUOTES) . '</span></a>' . $topic_status_image . '</td> </tr> <tr> <td class="forum_head" align="left" width="100" valign="middle"><a name="' . $post_id . '"></a></td> <td class="forum_head" align="left" valign="middle"> <span style="white-space:nowrap;">' . $post_icon . ' <a class="altlink" href="forums.php?action=view_topic&topic_id=' . (int) $arr['topic_id'] . '&page=' . $page . '#' . (int) $arr['post_id'] . '" title="' . $lang['fe_link_to_post'] . '"> ' . $post_title . '</a> ' . $post_status_image . ' ' . $lang['fe_posted_on'] . ': ' . get_date($arr['added'], '') . ' [' . get_date($arr['added'], '', 0, 1) . ']</span></td> <td class="forum_head" align="right" valign="middle"><span style="white-space:nowrap;">
$topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : (isset($_POST['topic_id']) ? intval($_POST['topic_id']) : 0); if (!is_valid_id($post_id) || !is_valid_id($forum_id) || !is_valid_id($topic_id)) { stderr($lang['gl_error'], $lang['gl_bad_id']); } $res = sql_query('SELECT p.added, p.body, p.edited_by, p.user_id AS poster_id, p.edit_date, p.post_title, p.icon, p.post_history, p.bbcode, p.anonymous, t.topic_name AS topic_name, f.name AS forum_name, u.id, u.username, u.class, u.donor, u.suspended, u.warned, u.enabled, u.avatar, u.offensive_avatar, u.chatpost, u.leechwarn, u.pirate, u.king FROM posts AS p LEFT JOIN topics AS t ON p.topic_id = t.id LEFT JOIN forums AS f ON t.forum_id = f.id LEFT JOIN users AS u ON p.user_id = u.id WHERE ' . ($CURUSER['class'] < UC_STAFF ? 'p.status = \'ok\' AND t.status = \'ok\' AND' : ($CURUSER['class'] < $min_delete_view_class ? 'p.status != \'deleted\' AND t.status != \'deleted\' AND' : '')) . ' p.id = ' . sqlesc($post_id)); $arr = mysqli_fetch_array($res); $res_edited = sql_query('SELECT id, username, class, donor, suspended, warned, enabled, avatar, chatpost, leechwarn, pirate, king, offensive_avatar FROM users WHERE id = ' . $arr['edited_by']); $arr_edited = mysqli_fetch_array($res_edited); $icon = htmlsafechars($arr['icon']); $post_title = htmlsafechars($arr['post_title'], ENT_QUOTES); $location_bar = '<h1><a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php">' . $lang['fe_forums'] . '</a> <img src="' . $INSTALLER09['pic_base_url'] . 'arrow_next.gif" alt="►" title="►" /> <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_forum&forum_id=' . $forum_id . '">' . htmlsafechars($arr['forum_name'], ENT_QUOTES) . '</a> <img src="' . $INSTALLER09['pic_base_url'] . 'arrow_next.gif" alt="►" title="►" /> <a class="altlink" href="' . $INSTALLER09['baseurl'] . '/forums.php?action=view_topic&topic_id=' . $topic_id . '">' . htmlsafechars($arr['topic_name'], ENT_QUOTES) . '</a></h1> <span style="text-align: center;">' . $mini_menu . '</span><br /><br />'; $width = 100; $HTMLOUT .= $location_bar; $HTMLOUT .= '<h1>' . ($arr['anonymous'] == 'yes' ? '<i>' . $lang['fe_anonymous'] . '</>' : htmlsafechars($arr['username'])) . '\'s ' . $lang['vph_final_edit_post'] . '. ' . $lang['vph_last_edit_by'] . ': ' . ($arr['anonymous'] == 'yes' ? '<i>' . $lang['fe_anonymous'] . '</i>' : print_user_stuff($arr_edited)) . '</h1> <table border="0" cellspacing="5" cellpadding="10" width="90%"> <tr> <td class="forum_head" align="left" width="120px" valign="middle"> <span style="white-space:nowrap;">#' . $post_id . ' <span style="font-weight: bold;">' . ($arr['anonymous'] == 'yes' ? '<i>' . $lang['fe_anonymous'] . '</i>' : htmlsafechars($arr['username'])) . '</span></span></td> <td class="forum_head" align="left" valign="middle"> <span style="white-space:nowrap;"> ' . $lang['fe_posted_on'] . ': ' . get_date($arr['added'], '') . ' [' . get_date($arr['added'], '', 0, 1) . '] GMT ' . ($post_title !== '' ? ' ' . $lang['fe_title'] . ': <span style="font-weight: bold;">' . $post_title . '</span>' : '') . ($icon !== '' ? ' <img src="' . $INSTALLER09['pic_base_url'] . 'smilies/' . $icon . '.gif" alt="' . $icon . '" title="' . $icon . '"/>' : '') . '</span> </td></tr> <tr> <td class="two" align="center" width="120px" valign="top">' . ($arr['anonymous'] == 'yes' ? '<img style="max-width:' . $width . 'px;" src="' . $INSTALLER09['pic_base_url'] . 'anonymous_1.jpg" alt="avatar" />' : avatar_stuff($arr)) . '<br />' . ($arr['anonymous'] == 'yes' ? '<i>' . $lang['fe_anonymous'] . '</i>' : print_user_stuff($arr)) . '</td> <td class="one" align="left" valign="top" colspan="2">' . ($arr['bbcode'] == 'yes' ? format_comment($arr['body']) : format_comment_no_bbcode($arr['body'])) . '</td> </tr> </table><br /><h1>' . $lang['fe_post_history'] . '</h1>[ ' . $lang['vph_all_post_edits_date'] . '. ]<br /><br />' . htmlspecialchars_decode($arr['post_history']) . '<br />' . $location_bar;
$topic_desc = highlightWords(htmlsafechars($arr['topic_desc'], ENT_QUOTES), $search); $post_title = highlightWords($post_title, $search); } else { $topic_title = htmlsafechars($arr['topic_title'], ENT_QUOTES); $topic_desc = htmlsafechars($arr['topic_desc'], ENT_QUOTES); } $post_id = (int) $arr['post_id']; $posts = (int) $arr['post_count']; $post_icon = $arr['icon'] != '' ? '<img src="pic/smilies/' . htmlsafechars($arr['icon']) . '.gif" alt="icon" title="icon" /> ' : '<img src="pic/forums/topic_normal.gif" alt="Normal Topic" /> '; $edited_by = ''; if ($arr['edit_date'] > 0) { $res_edited = sql_query('SELECT username FROM users WHERE id=' . sqlesc($arr['edited_by'])); $arr_edited = mysqli_fetch_assoc($res_edited); $edited_by = '<br /><br /><br /><span style="font-weight: bold; font-size: x-small;">Last edited by <a class="altlink" href="member_details.php?id=' . (int) $arr['edited_by'] . '">' . htmlsafechars($arr_edited['username']) . '</a> at ' . get_date($arr['edit_date'], '') . ' GMT ' . ($arr['edit_reason'] != '' ? ' </span>[ Reason: ' . htmlsafechars($arr['edit_reason']) . ' ] <span style="font-weight: bold; font-size: x-small;">' : ''); } $body = $arr['bbcode'] == 'yes' ? highlightWords(format_comment($arr['body']), $search) : highlightWords(format_comment_no_bbcode($arr['body']), $search); $search_post = str_replace(' ', '+', $search); $content .= '<tr><td class="forum_head_dark" colspan="3" align="left">in: <a class="altlink" href="forums.php?action=view_forum&forum_id=' . (int) $arr['forum_id'] . '" title="' . sprintf($lang['sea_link_to_x'], "Forum") . '"> <span style="color: white;font-weight: bold;">' . htmlsafechars($arr['forum_name'], ENT_QUOTES) . '</span></a> in: <a class="altlink" href="forums.php?action=view_topic&topic_id=' . (int) $arr['topic_id'] . '" title="' . sprintf($lang['sea_link_to_x'], "topic") . '"><span style="color: white;font-weight: bold;"> ' . $topic_title . '</span></a></td></tr> <tr><td class="forum_head" align="left" width="100" valign="middle"><a name="' . $post_id . '"></a> <span style="font-weight: bold;">' . $lang['sea_relevance'] . ': ' . ROUND($arr['relevance'], 3) . '</span></td> <td class="forum_head" align="left" valign="middle"> <span style="white-space:nowrap;">' . $post_icon . '<a class="altlink" href="forums.php?action=view_topic&topic_id=' . $arr['topic_id'] . '&page=' . $page . '#' . (int) $arr['post_id'] . '" title="Link to Post">' . $post_title . '</a> ' . $lang['fe_posted_on'] . ': ' . get_date($arr['added'], '') . ' [' . get_date($arr['added'], '', 0, 1) . ']</span></td> <td class="forum_head" align="right" valign="middle"><span style="white-space:nowrap;"> <a href="forums.php?action=view_my_posts&page=' . $page . '#top"><img src="pic/forums/up.gif" alt="' . $lang['fe_top'] . '" title="' . $lang['fe_top'] . '"/></a> <a href="forums.php?action=view_my_posts&page=' . $page . '#bottom"><img src="pic/forums/down.gif" alt="' . $lang['fe_bottom'] . '" title="' . $lang['fe_bottom'] . '" /></a> </span></td> </tr>
//=== get last ten posts $res_posts = sql_query('SELECT p.id AS post_id, p.user_id, p.added, p.body, p.icon, p.post_title, p.bbcode, p.anonymous, u.id, u.username, u.class, u.donor, u.suspended, u.chatpost, u.leechwarn, u.pirate, u.king, u.warned, u.enabled, u.avatar, u.offensive_avatar 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 p.id DESC LIMIT 0, 10'); $HTMLOUT .= '<br /><span style="text-align: center;">' . $lang['fe_last_ten_posts_in_reverse_order'] . '</span> <table border="0" cellspacing="5" cellpadding="10" width="90%" align="center">'; //=== lets start the loop \o/ while ($arr = mysqli_fetch_assoc($res_posts)) { //=== change colors $colour = ++$colour % 2; $class = $colour == 0 ? 'one' : 'two'; $class_alt = $colour == 0 ? 'two' : 'one'; $HTMLOUT .= '<tr><td class="forum_head" align="left" width="100" valign="middle"># <span style="font-weight: bold;">' . ($arr['anonymous'] == 'yes' ? '<i>' . $lang['fe_anonymous'] . '</i>' : htmlsafechars($arr['username'])) . '</span></td> <td class="forum_head" align="left" valign="middle"><span style="white-space:nowrap;"> ' . $lang['fe_posted_on'] . ': ' . get_date($arr['added'], '') . ' [' . get_date($arr['added'], '', 0, 1) . ']</span></td></tr>'; $width = 100; if ($arr['anonymous'] == 'yes') { if ($CURUSER['class'] < UC_STAFF && $arr['user_id'] != $CURUSER['id']) { $HTMLOUT .= '<tr><td class="' . $class_alt . '" align="center" width="100" valign="top"><img style="max-width:' . $width . 'px;" src="' . $INSTALLER09['pic_base_url'] . 'anonymous_1.jpg" alt="avatar" /><br /><i>' . $lang['fe_anonymous'] . '</i></td>'; } else { $HTMLOUT .= '<tr><td class="' . $class_alt . '" align="center" width="100" valign="top">' . avatar_stuff($arr) . '<br /><i>' . $lang['fe_anonymous'] . '</i>[' . print_user_stuff($arr) . ']</td>'; } } else { $HTMLOUT .= '<tr><td class="' . $class_alt . '" align="center" width="100" valign="top">' . avatar_stuff($arr) . '<br />' . print_user_stuff($arr) . '</td>'; } $HTMLOUT .= '<td class="' . $class . '" align="left" valign="top" colspan="2">' . ($arr['bbcode'] == 'yes' ? format_comment($arr['body']) : format_comment_no_bbcode($arr['body'])) . '</td></tr>'; } //=== end while loop $HTMLOUT .= '</table> </td></tr></table><br /><br />';
header('Location: forums.php?action=view_topic&topic_id=' . $topic_id . ($extension_error !== 0 ? '&ee=' . $extension_error : '') . ($size_error !== 0 ? '&se=' . $size_error : '')); die; } $res = sql_query('SELECT name FROM forums WHERE id=' . $forum_id); $arr = mysql_fetch_assoc($res); $section_name = htmlentities($arr['name'], ENT_QUOTES); $HTMLOUT .= '<table align="center" class="main" width="750px" border="0" cellspacing="0" cellpadding="0"> <tr><td class="embedded" align="center"> <h1 style="text-align: center;">New topic in "<a class="altlink" href="forums.php?action=view_forum&forum_id=' . $forum_id . '">' . $section_name . '</a>"</h1> <form method="post" action="forums.php?action=new_topic&forum_id=' . $forum_id . '" enctype="multipart/form-data"> ' . (isset($_POST['button']) && $_POST['button'] == 'Preview' ? '<br /> <table align="center" width="80%" border="0" cellspacing="5" cellpadding="5"> <tr><td class="forum_head" colspan="2"><span style="color: black; font-weight: bold;">Preview</span></td></tr> <tr><td width="80" valign="top" class="one">' . avatar_stuff($CURUSER) . '</td> <td valign="top" align="left" class="two">' . ($bb_code === 'yes' ? format_comment($body) : format_comment_no_bbcode($body)) . '</td> </tr></table><br />' : '') . ' <table align="center" width="80%" border="0" cellspacing="0" cellpadding="5"> <tr><td align="left" class="forum_head_dark" colspan="2">Compose</td></tr> <tr><td align="right" class="two"><span style="white-space:nowrap; font-weight: bold;">Icon</span></td> <td align="left" class="two"> <table> <tr> <td class="two" align="center" valign="middle"><img src="pic/smilies/smile1.gif" alt="Smile" title="Smile" /></td> <td class="two" align="center" valign="middle"><img src="pic/smilies/grin.gif" alt="Grin" title="Grin" /></td> <td class="two" align="center" valign="middle"><img src="pic/smilies/tongue.gif" alt="Tongue" title="Tongue" /></td> <td class="two" align="center" valign="middle"><img src="pic/smilies/cry.gif" alt="Cry" title="Cry" /></td> <td class="two" align="center" valign="middle"><img src="pic/smilies/wink.gif" alt="Wink" title="Wink" /></td> <td class="two" align="center" valign="middle"><img src="pic/smilies/rolleyes.gif" alt="Roll eyes" title="Roll eyes" /></td> <td class="two" align="center" valign="middle"><img src="pic/smilies/blink.gif" alt="Blink" title="Blink" /></td> <td class="two" align="center" valign="middle"><img src="pic/smilies/bow.gif" alt="Bow" title="Bow" /></td>