} } $allow_html = true; $allow_sig = true; if (isset($t_fid) && !session::check_perm(USER_PERM_HTML_POSTING, $t_fid)) { $allow_html = false; } if (isset($t_fid) && !session::check_perm(USER_PERM_SIGNATURE, $t_fid)) { $allow_sig = false; } if ($allow_html == false) { $t_content = htmlentities_array($t_content); $t_sig = htmlentities_array($t_sig); } if (!$new_thread) { if (!($reply_message = messages_get($reply_to_tid, $reply_to_pid))) { html_draw_error(gettext("That post does not exist in this thread!")); } if (!($thread_data = thread_get($reply_to_tid))) { html_draw_error(gettext("The requested thread could not be found or access was denied.")); } $reply_message['CONTENT'] = message_get_content($reply_to_tid, $reply_to_pid); if (perm_get_user_permissions($reply_message['FROM_UID']) & USER_PERM_WORMED && !session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid) || (!isset($reply_message['CONTENT']) || $reply_message['CONTENT'] == "") && $thread_data['POLL_FLAG'] != 'Y' && $reply_to_pid != 0) { html_draw_error(gettext("Message not found. Check that it hasn't been deleted.")); } } if ($valid && isset($_POST['post'])) { if (post_check_frequency()) { if (post_check_ddkey($t_dedupe)) { if ($new_thread) { if (session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) {
} if (!($edit_message = messages_get($tid, 1, 1))) { html_draw_top(sprintf("title=%s", gettext("Error"))); html_display_error_msg(gettext("That post does not exist in this thread!")); html_draw_bottom(); exit; } $post_edit_time = forum_get_setting('post_edit_time', null, 0); $uid = session::get_value('UID'); if ((forum_get_setting('allow_post_editing', 'N') || $uid != $edit_message['FROM_UID'] && !(perm_get_user_permissions($edit_message['FROM_UID']) & USER_PERM_PILLORIED) || session::check_perm(USER_PERM_PILLORIED, 0) || $post_edit_time > 0 && time() - $edit_message['CREATED'] >= $post_edit_time * HOUR_IN_SECONDS) && !session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) { html_draw_error(gettext("You are not permitted to edit this message."), 'discussion.php', 'get', array('back' => gettext("Back")), array('msg' => $edit_message)); } if (forum_get_setting('require_post_approval', 'Y') && isset($edit_message['APPROVED']) && $edit_message['APPROVED'] == 0 && !session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) { html_draw_error(gettext("You are not permitted to edit this message."), 'discussion.php', 'get', array('back' => gettext("Back")), array('msg' => $edit_message)); } if ($preview_message = messages_get($tid, $pid, 1)) { $preview_message['CONTENT'] = message_get_content($tid, $pid); if (strlen(trim($preview_message['CONTENT'])) < 1 && !thread_is_poll($tid)) { html_draw_top(sprintf("title=%s", gettext("Error"))); post_edit_refuse($tid, $pid); html_draw_bottom(); exit; } if ((session::get_value('UID') != $preview_message['FROM_UID'] || session::check_perm(USER_PERM_PILLORIED, 0)) && !session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) { html_draw_top(sprintf("title=%s", gettext("Error"))); post_edit_refuse($tid, $pid); html_draw_bottom(); exit; } if (forum_get_setting('require_post_approval', 'Y') && isset($preview_message['APPROVED']) && $preview_message['APPROVED'] == 0 && !session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) { html_draw_top(sprintf("title=%s", gettext("Error")));
function message_get_post_options_html($tid, $pid, $folder_fid) { $webtag = get_webtag(); if (($message = messages_get($tid, $pid, 1)) === false) { return false; } if (($uid = session::get_value('UID')) === false) { return false; } $perm_is_moderator = session::check_perm(USER_PERM_FOLDER_MODERATE, $folder_fid); $perm_has_admin_access = session::check_perm(USER_PERM_ADMIN_TOOLS, 0); if (($quick_reply = session::get_value('REPLY_QUICK')) === false) { $quick_reply = 'N'; } $html = "<div class=\"post_options_container\">\n"; $html .= " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n"; $html .= " <tr>\n"; $html .= " <td align=\"left\" colspan=\"3\">\n"; $html .= " <table class=\"box\" width=\"100%\">\n"; $html .= " <tr>\n"; $html .= " <td align=\"left\" class=\"posthead\">\n"; $html .= " <table class=\"posthead\" width=\"100%\">\n"; $html .= " <tr>\n"; $html .= " <td class=\"subhead\" colspan=\"2\">" . gettext("Post Options") . "</td>\n"; $html .= " </tr>\n"; $html .= " <tr>\n"; $html .= " <td align=\"center\">\n"; $html .= " <table width=\"95%\" class=\"post_options_menu\">\n"; $html .= " <tr>\n"; if ($quick_reply == 'N') { $html .= " <td align=\"left\"><a href=\"Javascript:void(0)\" rel=\"{$tid}.{$message['PID']}\" target=\"_self\" class=\"quick_reply_link\"><img src=\"" . html_style_image('quickreply.png') . "\" border=\"0\" alt=\"" . gettext("Quick Reply") . "\" title=\"" . gettext("Quick Reply") . "\" /></a></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"Javascript:void(0)\" rel=\"{$tid}.{$message['PID']}\" target=\"_self\" class=\"quick_reply_link\">" . gettext("Quick Reply") . "</a></td>\n"; } else { $html .= " <td align=\"left\"><img src=\"" . html_style_image('post.png') . "\" border=\"0\" alt=\"" . gettext("Reply") . "\" title=\"" . gettext("Reply") . "\" /></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"post.php?webtag={$webtag}&replyto={$tid}.{$message['PID']}\" target=\"_parent\" id=\"reply_{$message['PID']}\">" . gettext("Reply") . "</a></td>\n"; } $html .= " </tr>\n"; if ($uid == $message['FROM_UID'] && session::check_perm(USER_PERM_POST_DELETE, $folder_fid) && !session::check_perm(USER_PERM_PILLORIED, 0) || $perm_is_moderator) { $html .= " <tr>\n"; $html .= " <td align=\"left\"><a href=\"delete.php?webtag={$webtag}&msg={$tid}.{$message['PID']}\" target=\"_parent\"><img src=\"" . html_style_image('delete.png') . "\" border=\"0\" alt=\"" . gettext("Delete") . "\" title=\"" . gettext("Delete") . "\" /></a></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"delete.php?webtag={$webtag}&msg={$tid}.{$message['PID']}\" target=\"_parent\">" . gettext("Delete") . "</a></td>\n"; $html .= " </tr>\n"; } $html .= " <tr>\n"; $html .= " <td align=\"left\"><a href=\"pm_write.php?webtag={$webtag}&uid={$message['FROM_UID']}&msg={$tid}.{$message['PID']}\" target=\"_parent\" title=\"" . gettext("Reply as PM") . "\"><img src=\"" . html_style_image('pmunread.png') . "\" border=\"0\" alt=\"" . gettext("Reply as PM") . "\" title=\"" . gettext("Reply as PM") . "\" /></a></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"pm_write.php?webtag={$webtag}&uid={$message['FROM_UID']}&msg={$tid}.{$message['PID']}\" target=\"_parent\" title=\"" . gettext("Reply as PM") . "\">" . gettext("Reply as PM") . "</a></td>\n"; $html .= " </tr>\n"; $html .= " <tr>\n"; $html .= " <td align=\"left\"><a href=\"display.php?webtag={$webtag}&print_msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Print") . "\"><img src=\"" . html_style_image('print.png') . "\" border=\"0\" alt=\"" . gettext("Print") . "\" title=\"" . gettext("Print") . "\" /></a></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"display.php?webtag={$webtag}&print_msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Print") . "\">" . gettext("Print") . "</a></td>\n"; $html .= " </tr>\n"; $html .= " <tr>\n"; $html .= " <td align=\"left\"><a href=\"thread_options.php?webtag={$webtag}&msg={$tid}.{$message['PID']}&markasread=" . ($message['PID'] - 1) . "\" target=\"_self\" title=\"" . gettext("Mark as unread") . "\"><img src=\"" . html_style_image('markasunread.png') . "\" border=\"0\" alt=\"" . gettext("Mark as unread") . "\" title=\"" . gettext("Mark as unread") . "\" /></a></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"thread_options.php?webtag={$webtag}&msg={$tid}.{$message['PID']}&markasread=" . ($message['PID'] - 1) . "\" target=\"_self\" title=\"" . gettext("Mark as unread") . "\">" . gettext("Mark as unread") . "</a></td>\n"; $html .= " </tr>\n"; if ($uid != $message['FROM_UID']) { $html .= " <tr>\n"; $html .= " <td align=\"left\"><a href=\"user_rel.php?webtag={$webtag}&uid={$message['FROM_UID']}&msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Relationship") . "\"><img src=\"" . html_style_image('enemy.png') . "\" border=\"0\" alt=\"" . gettext("Relationship") . "\" title=\"" . gettext("Relationship") . "\" /></a></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"user_rel.php?webtag={$webtag}&uid={$message['FROM_UID']}&msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Relationship") . "\">" . gettext("Relationship") . "</a></td>\n"; $html .= " </tr>\n"; } if ($perm_has_admin_access) { $html .= " <tr>\n"; $html .= " <td align=\"left\"><a href=\"admin_user.php?webtag={$webtag}&uid={$message['FROM_UID']}&msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Privileges") . "\"><img src=\"" . html_style_image('admintool.png') . "\" border=\"0\" alt=\"" . gettext("Privileges") . "\" title=\"" . gettext("Privileges") . "\" /></a></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"admin_user.php?webtag={$webtag}&uid={$message['FROM_UID']}&msg={$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Privileges") . "\">" . gettext("Privileges") . "</a></td>\n"; $html .= " </tr>\n"; } if ($perm_is_moderator || $perm_has_admin_access) { if ($perm_is_moderator) { if (forum_get_setting('require_post_approval', 'Y') && isset($message['APPROVED']) && $message['APPROVED'] == 0) { $html .= " <tr>\n"; $html .= " <td align=\"left\"><a href=\"admin_post_approve.php?webtag={$webtag}&msg={$tid}.{$message['PID']}&ret=messages.php%3Fwebtag%3D{$webtag}%26msg%3D{$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Approve Post") . "\"><img src=\"" . html_style_image('approved.png') . "\" border=\"0\" alt=\"" . gettext("Approve Post") . "\" title=\"" . gettext("Approve Post") . "\" /></a></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"admin_post_approve.php?webtag={$webtag}&msg={$tid}.{$message['PID']}&ret=messages.php%3Fwebtag%3D{$webtag}%26msg%3D{$tid}.{$message['PID']}\" target=\"_self\" title=\"" . gettext("Approve Post") . "\">" . gettext("Approve Post") . "</a></td>\n"; $html .= " </tr>\n"; } } if (isset($message['IPADDRESS']) && strlen($message['IPADDRESS']) > 0) { $html .= " <tr>\n"; $html .= " <td align=\"left\"><span class=\"adminipdisplay\"><b>" . gettext("IP") . "</b></span></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\"><a href=\"admin_banned.php?webtag={$webtag}&ban_ipaddress={$message['IPADDRESS']}&msg={$tid}.{$message['PID']}\" target=\"_self\">" . gettext("Ban IP Address") . "</a></td>\n"; $html .= " </tr>"; } else { $html .= " <tr>\n"; $html .= " <td align=\"left\"><span class=\"adminipdisplay\"><b>" . gettext("IP") . "</b></span></td>\n"; $html .= " <td align=\"left\" style=\"white-space: nowrap\">" . gettext("Not Logged") . "</td>\n"; $html .= " </tr>"; } } $html .= " </table>\n"; $html .= " </td>\n"; $html .= " </tr>\n"; $html .= " </table>\n"; $html .= " </td>\n"; $html .= " </tr>\n"; $html .= " </table>\n"; $html .= " </td>\n"; $html .= " </tr>\n"; $html .= " </table>\n"; $html .= "</div>\n"; return $html; }
list($tid, $pid) = explode('.', $_GET['msg']); if (!($t_fid = thread_get_folder($tid, $pid))) { html_draw_error(gettext("The requested thread could not be found or access was denied.")); } } else { if (isset($_POST['msg']) && validate_msg($_POST['msg'])) { $msg = $_POST['msg']; list($tid, $pid) = explode('.', $_POST['msg']); if (!($t_fid = thread_get_folder($tid, $pid))) { html_draw_error(gettext("The requested thread could not be found or access was denied.")); } } else { html_draw_error(gettext("No message specified for editing"), 'discussion.php', 'get', array('back' => gettext("Back"))); } } if (!($edit_message = messages_get($tid, $pid, 1))) { html_draw_top(sprintf("title=%s", gettext("Error"))); html_display_error_msg(gettext("That post does not exist in this thread!")); html_draw_bottom(); exit; } if (thread_is_poll($tid) && $pid == 1) { header_redirect("edit_poll.php?webtag={$webtag}&msg={$msg}"); exit; } if (session::check_perm(USER_PERM_EMAIL_CONFIRM, 0)) { html_email_confirmation_error(); exit; } if (!session::check_perm(USER_PERM_POST_EDIT | USER_PERM_POST_READ, $t_fid)) { html_draw_error(gettext("You cannot edit posts in this folder"));
list($tid, $pid) = explode('.', $msg); } else { if (isset($_GET['print_msg']) && validate_msg($_GET['print_msg'])) { $msg = $_GET['print_msg']; list($tid, $pid) = explode('.', $msg); } else { html_draw_error(gettext("Invalid Message ID or no Message ID specified.")); } } if (!($thread_data = thread_get($tid, session::check_perm(USER_PERM_ADMIN_TOOLS, 0)))) { html_draw_error(gettext("The requested thread could not be found or access was denied.")); } if (!($folder_data = folder_get($thread_data['FID']))) { html_draw_error(gettext("The requested folder could not be found or access was denied.")); } if (!($message = messages_get($tid, $pid, 1))) { html_draw_error(gettext("That post does not exist in this thread!")); } html_draw_top("title={$thread_data['TITLE']}", "post.js", "basetarget=_blank", 'class=window_title'); if (isset($thread_data['STICKY']) && isset($thread_data['STICKY_UNTIL'])) { if ($thread_data['STICKY'] == "Y" && $thread_data['STICKY_UNTIL'] != 0 && time() > $thread_data['STICKY_UNTIL']) { thread_set_sticky($tid, false); $thread_data['STICKY'] = "N"; } } $show_sigs = session::get_value('VIEW_SIGS') == 'N' ? false : true; echo "<div align=\"center\">\n"; echo "<table width=\"96%\" border=\"0\">\n"; echo " <tr>\n"; echo " <td align=\"left\">", messages_top($tid, $pid, $thread_data['FID'], $folder_data['TITLE'], $thread_data['TITLE'], $thread_data['INTEREST'], $folder_data['INTEREST'], $thread_data['STICKY'], $thread_data['CLOSED'], $thread_data['ADMIN_LOCK'], $thread_data['DELETED'] == 'Y', true), "</td>\n"; echo " <td align=\"right\">", messages_social_links($tid), "</td>\n";
} // Number of posts per page if (isset($_SESSION['POSTS_PER_PAGE']) && is_numeric($_SESSION['POSTS_PER_PAGE'])) { $posts_per_page = max(min($_SESSION['POSTS_PER_PAGE'], 30), 10); } else { $posts_per_page = 20; } $high_interest = isset($_SESSION['MARK_AS_OF_INT']) && $_SESSION['MARK_AS_OF_INT'] == 'Y' ? 'Y' : 'N'; if (!($folder_data = thread_get_folder($tid))) { html_draw_error(gettext("The requested folder could not be found or access was denied.")); } $perm_folder_moderate = session::check_perm(USER_PERM_FOLDER_MODERATE, $folder_data['FID']); if (!($thread_data = thread_get($tid, $perm_folder_moderate, false, $perm_folder_moderate))) { html_draw_error(gettext("The requested thread could not be found or access was denied.")); } if (!($messages = messages_get($tid, $pid, $posts_per_page))) { html_draw_error(gettext("That post does not exist in this thread!")); } html_draw_top(array('title' => $thread_data['TITLE'], 'class' => 'window_title', 'js' => array('js/post.js', 'js/poll.js', 'js/messages.js', 'ckeditor/ckeditor.js'), 'base_target' => '_blank')); if (isset($thread_data['STICKY']) && isset($thread_data['STICKY_UNTIL'])) { if ($thread_data['STICKY'] == "Y" && $thread_data['STICKY_UNTIL'] != 0 && time() > $thread_data['STICKY_UNTIL']) { thread_set_sticky($tid, false); $thread_data['STICKY'] = "N"; } } $show_sigs = session::show_sigs(); $page_prefs = session::get_post_page_prefs(); $msg_count = count($messages); $highlight_array = array(); if (isset($_GET['highlight'])) { $highlight_array = search_get_keywords();
} if (!thread_is_poll($tid) || $pid != 1) { header_redirect("discussion.php?webtag={$webtag}&msg={$return_msg}"); exit; } if (!($edit_message = messages_get($tid, 1, 1))) { html_draw_top(array('title' => gettext('Error'))); html_display_error_msg(gettext("That post does not exist in this thread!")); html_draw_bottom(); exit; } $post_edit_time = forum_get_setting('post_edit_time', 'is_numeric', 0); if ((forum_get_setting('allow_post_editing', 'N') || $_SESSION['UID'] != $edit_message['FROM_UID'] && !(perm_get_user_permissions($edit_message['FROM_UID']) & USER_PERM_PILLORIED) || session::check_perm(USER_PERM_PILLORIED, 0) || $post_edit_time > 0 && time() - $edit_message['CREATED'] >= $post_edit_time * HOUR_IN_SECONDS) && !session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) { html_draw_error(gettext("You are not permitted to edit this message."), 'discussion.php', 'get', array('back' => gettext("Back")), array('msg' => $return_msg)); } if (($preview_message = messages_get($tid, $pid, 1)) !== false) { $preview_message['CONTENT'] = message_get_content($tid, $pid); if (strlen(trim($preview_message['CONTENT'])) < 1 && !thread_is_poll($tid)) { html_draw_top(array('title' => gettext('Error'))); post_edit_refuse($tid, $pid); html_draw_bottom(); exit; } if (($_SESSION['UID'] != $preview_message['FROM_UID'] || session::check_perm(USER_PERM_PILLORIED, 0)) && !session::check_perm(USER_PERM_FOLDER_MODERATE, $t_fid)) { html_draw_top(array('title' => gettext('Error'))); post_edit_refuse($tid, $pid); html_draw_bottom(); exit; } } if (isset($_POST['endpoll'])) {
echo "<noframes>\n"; echo "<body>\n"; } if (forum_check_webtag_available($webtag, false)) { if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { list($tid, $pid) = explode('.', $_GET['msg']); if (!($folder_data = thread_get_folder($tid))) { light_html_display_error_msg(gettext("The requested folder could not be found or access was denied.")); return; } $perm_folder_moderate = session::check_perm(USER_PERM_FOLDER_MODERATE, $folder_data['FID']); if (!($thread_data = thread_get($tid, $perm_folder_moderate, false, $perm_folder_moderate))) { light_html_display_error_msg(gettext("The requested thread could not be found or access was denied.")); return; } if (!($messages = messages_get($tid, $pid, 10))) { light_html_display_error_msg(gettext("That post does not exist in this thread!")); return; } if (browser_mobile()) { light_html_draw_top(array('js' => array('js/messages.js'))); } $nav_links = array(array('text' => gettext('Show messages'), 'url' => '#', 'class' => 'navigation', 'html' => light_messages_navigation_strip($tid, $pid, $thread_data['LENGTH'], 10), 'image' => 'mobile_navigation')); if (!$thread_data['CLOSED'] && session::check_perm(USER_PERM_POST_CREATE, $folder_data['FID'])) { array_unshift($nav_links, array('text' => gettext('Reply to All'), 'url' => "lpost.php?webtag={$webtag}&reply_to={$tid}.0&return_msg={$tid}.{$pid}", 'class' => 'reply_all', 'image' => 'mobile_reply_all')); } light_navigation_bar(array('back' => "lthread_list.php?webtag={$webtag}", 'nav_links' => $nav_links)); light_draw_messages($tid, $pid, $thread_data, $messages); } else { if (isset($_GET['mid']) && is_numeric($_GET['mid'])) { if (!session::logged_in()) {
} } else { if (isset($_GET['page']) && is_numeric($_GET['page'])) { $page = $_GET['page']; if (($search_results_array = search_fetch_results($page, $sort_by, $sort_dir)) !== false) { html_draw_top(array('js' => array('js/search.js', 'js/search_popup.js', 'js/thread_list.js'))); thread_list_draw_top(SEARCH_RESULTS); echo "<br />\n"; echo "<h1>", gettext("Search Results"), "</h1>\n"; echo "", html_style_image('search', gettext("Found")), " ", gettext("Found"), ": {$search_results_array['result_count']} ", gettext("matches"), "<br />\n"; if ($page > 1) { echo "", html_style_image('current_thread', gettext("Previous page")), " <a href=\"search.php?webtag={$webtag}&page=", $page - 1, "&sort_by={$sort_by}&sort_dir={$sort_dir}\">", gettext("Previous page"), "</a>\n"; } echo "<ol start=\"", $page * 20 - 20 + 1, "\">\n"; foreach ($search_results_array['result_array'] as $search_result) { if (($message = messages_get($search_result['TID'], $search_result['PID'], 1)) !== false) { if (($thread_data = thread_get($search_result['TID'])) !== false) { $message['TITLE'] = trim($thread_data['TITLE']); // Fetch the messaage content, strip the signature and remove HTML. $message['CONTENT'] = message_get_content($search_result['TID'], $search_result['PID']); $message['CONTENT'] = message_apply_formatting($message['CONTENT'], true); $message['CONTENT'] = trim(strip_tags($message['CONTENT'])); // Limit thread title to 20 characters. if (mb_strlen($message['TITLE']) > 20) { $message['TITLE'] = word_filter_add_ob_tags(mb_substr($message['TITLE'], 0, 20), true) . "…"; } else { $message['TITLE'] = word_filter_add_ob_tags($message['TITLE'], true); } // Limit displayed post content to 35 characters if (mb_strlen($message['CONTENT']) > 70) { $message['CONTENT'] = word_filter_add_ob_tags(fix_html(mb_substr($message['CONTENT'], 0, 70)), true) . "…";
function light_draw_messages($tid, $pid) { $webtag = get_webtag(); if (!($thread_data = thread_get($tid, session::check_perm(USER_PERM_ADMIN_TOOLS, 0)))) { light_html_display_error_msg(gettext("The requested thread could not be found or access was denied.")); return; } if (!folder_get($thread_data['FID'])) { light_html_display_error_msg(gettext("The requested folder could not be found or access was denied.")); return; } if (!($messages = messages_get($tid, $pid, 10))) { light_html_display_error_msg(gettext("That post does not exist in this thread!")); return; } $msg_count = count($messages); light_messages_top($tid, $pid, $thread_data['TITLE'], $thread_data['INTEREST'], $thread_data['STICKY'], $thread_data['CLOSED'], $thread_data['ADMIN_LOCK'], $thread_data['DELETED'] == 'Y'); if ($tracking_data_array = thread_get_tracking_data($tid)) { foreach ($tracking_data_array as $tracking_data) { if ($tracking_data['TRACK_TYPE'] == THREAD_TYPE_MERGE) { // Thread merged if ($tracking_data['TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['NEW_TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Threads Merged:</b> This thread has moved %s"), $thread_link)); } if ($tracking_data['NEW_TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Threads Merged:</b> This thread was merged from %s"), $thread_link)); } } else { if ($tracking_data['TRACK_TYPE'] == THREAD_TYPE_SPLIT) { // Thread Split if ($tracking_data['TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['NEW_TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Thread Split:</b> Some posts in this thread have been moved %s"), $thread_link)); } if ($tracking_data['NEW_TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Thread Split:</b> Some posts in this thread were moved from %s"), $thread_link)); } } } } } if ($msg_count > 0) { foreach ($messages as $message_number => $message) { if (isset($message['RELATIONSHIP'])) { if ($message['RELATIONSHIP'] >= 0) { // if we're not ignoring this user $message['CONTENT'] = message_get_content($tid, $message['PID']); } else { $message['CONTENT'] = gettext("Ignored"); // must be set to something or will show as deleted } } else { $message['CONTENT'] = message_get_content($tid, $message['PID']); } if ($thread_data['POLL_FLAG'] == 'Y') { if ($message['PID'] == 1) { light_poll_display($tid, $thread_data['LENGTH'], $thread_data['FID'], true, $thread_data['CLOSED'], false, false); $last_pid = $message['PID']; } else { light_message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], true, true, false); $last_pid = $message['PID']; } } else { light_message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], true, false, false); $last_pid = $message['PID']; } if (adsense_check_user() && adsense_check_page($message_number, 10, $thread_data['LENGTH'])) { adsense_output_html(); } } } unset($messages, $message); echo "<div class=\"message_page_footer\">\n"; echo "<ul>\n"; if ($thread_data['CLOSED'] == 0 && session::check_perm(USER_PERM_POST_CREATE, $thread_data['FID']) || session::check_perm(USER_PERM_FOLDER_MODERATE, $thread_data['FID'])) { echo "<li><a href=\"lpost.php?webtag={$webtag}&replyto={$tid}.0\" class=\"reply_all\">", gettext("Reply to All"), "</a></li>\n"; } if ($last_pid < $thread_data['LENGTH']) { $npid = $last_pid + 1; echo "<li class=\"right_col\">", light_form_quick_button("lmessages.php", gettext("Keep reading…"), array('msg' => "{$tid}.{$npid}")), "</li>\n"; } echo "</ul>\n"; echo "</div>\n"; echo "<a href=\"lthread_list.php?webtag={$webtag}\" class=\"thread_list_link\">", gettext("Back to thread list"), "</a>"; light_messages_nav_strip($tid, $pid, $thread_data['LENGTH'], 10); if ($msg_count > 0 && session::logged_in()) { messages_update_read($tid, $last_pid, $thread_data['LAST_READ'], $thread_data['LENGTH'], $thread_data['MODIFIED']); } }
} } else { if (isset($_GET['page']) && is_numeric($_GET['page'])) { $page = $_GET['page']; if ($search_results_array = search_fetch_results($page, $sort_by, $sort_dir)) { html_draw_top('search.js', 'search_popup.js'); thread_list_draw_top(SEARCH_RESULTS); echo "<br />\n"; echo "<h1>", gettext("Search Results"), "</h1>\n"; echo "<img src=\"", html_style_image('search.png'), "\" alt=\"", gettext("Found"), "\" title=\"", gettext("Found"), "\" /> ", gettext("Found"), ": {$search_results_array['result_count']} ", gettext("matches"), "<br />\n"; if ($page > 1) { echo "<img src=\"" . html_style_image('current_thread.png') . "\" alt=\"", gettext("Previous page"), "\" title=\"", gettext("Previous page"), "\" /> <a href=\"search.php?webtag={$webtag}&page=", $page - 1, "&sort_by={$sort_by}&sort_dir={$sort_dir}\">", gettext("Previous page"), "</a>\n"; } echo "<ol start=\"", $page * 20 - 20 + 1, "\">\n"; foreach ($search_results_array['result_array'] as $search_result) { if ($message = messages_get($search_result['TID'], $search_result['PID'], 1)) { $message['CONTENT'] = message_get_content($search_result['TID'], $search_result['PID']); if ($thread_data = thread_get($search_result['TID'])) { $message['TITLE'] = trim($thread_data['TITLE']); $message['CONTENT'] = trim(strip_tags(message_get_content($search_result['TID'], $search_result['PID']))); // Limit thread title to 20 characters. if (mb_strlen($message['TITLE']) > 20) { $message['TITLE'] = word_filter_add_ob_tags(mb_substr($message['TITLE'], 0, 20), true) . "…"; } else { $message['TITLE'] = word_filter_add_ob_tags($message['TITLE'], true); } // Limit displayed post content to 35 characters if (mb_strlen($message['CONTENT']) > 35) { $message['CONTENT'] = word_filter_add_ob_tags(mb_substr($message['CONTENT'], 0, 35), true) . "…"; } else { $message['CONTENT'] = word_filter_add_ob_tags($message['CONTENT'], true);
$delete_fid = null; $process_valid = true; list($delete_tid, $delete_pid) = explode(".", $process_message); if ($process_valid && !($delete_fid = thread_get_folder_fid($delete_tid))) { $process_valid = false; } if ($process_valid && !session::check_perm(USER_PERM_POST_EDIT | USER_PERM_POST_READ, $delete_fid)) { $process_valid = false; } if ($process_valid && !session::check_perm(USER_PERM_FOLDER_MODERATE, $delete_fid)) { $process_valid = false; } if ($process_valid && !($thread_data = thread_get($delete_tid, false, false, true))) { $process_valid = false; } if ($process_valid && !($preview_message = messages_get($delete_tid, $delete_pid, 1))) { $process_valid = false; } if ($process_valid && isset($preview_message['APPROVED'])) { $process_valid = false; } if ($process_valid && post_delete($delete_tid, $delete_pid)) { post_add_edit_text($delete_tid, $delete_pid); if (session::check_perm(USER_PERM_FOLDER_MODERATE, $delete_fid) && (!isset($preview_message['FROM_UID']) || $preview_message['FROM_UID'] != $_SESSION['UID'])) { admin_add_log_entry(DELETE_POST, array($delete_fid, $delete_tid, $delete_pid)); } } else { $valid = false; } } if ($valid) {