Ejemplo n.º 1
0
function light_draw_messages($tid, $pid, array $thread_data, array $messages)
{
    $webtag = get_webtag();
    forum_check_webtag_available($webtag);
    $msg_count = count($messages);
    $last_pid = null;
    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 (isset($_GET['post_success']) && validate_msg($_GET['post_success'])) {
        list($return_tid, $return_pid) = explode(".", $_GET['post_success']);
        if ($return_tid != $tid || $return_pid > $pid + 10) {
            light_html_display_success_msg(sprintf(gettext("Successfully created post %s"), $_GET['post_success']));
        }
    } else {
        if (isset($_GET['edit_success']) && validate_msg($_GET['edit_success'])) {
            light_html_display_success_msg(sprintf(gettext("Successfully edited post %s"), $_GET['edit_success']));
        } else {
            if (isset($_GET['delete_success']) && validate_msg($_GET['delete_success'])) {
                light_html_display_success_msg(sprintf(gettext("Successfully deleted post %s"), $_GET['delete_success']));
            } else {
                if (isset($_GET['delete_success']) && validate_msg($_GET['delete_success'])) {
                    light_html_display_success_msg(sprintf(gettext("Successfully deleted post %s"), $_GET['delete_success']));
                } else {
                    if (isset($_GET['post_approve_success']) && validate_msg($_GET['post_approve_success'])) {
                        light_html_display_success_msg(sprintf(gettext("Successfully approved post %s"), $_GET['post_approve_success']));
                    }
                }
            }
        }
    }
    if (($tracking_data_array = thread_get_tracking_data($tid)) !== false) {
        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}&amp;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}&amp;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}&amp;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}&amp;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));
                    }
                }
            }
        }
    }
    echo "<div id=\"messages\" data-navigation=\"{$tid}_{$pid}_{$thread_data['LENGTH']}_10\">\n";
    if ($msg_count > 0) {
        foreach ($messages as $message_number => $message) {
            if (isset($message['RELATIONSHIP']) && ($message['RELATIONSHIP'] & USER_IGNORED || $message['RELATIONSHIP'] & USER_IGNORED_COMPLETELY)) {
                $message['CONTENT'] = gettext("Ignored");
            } 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>\n";
    if ($last_pid < $thread_data['LENGTH']) {
        echo "<div class=\"message_page_footer\">\n";
        echo "<ul>\n";
        echo "<li class=\"right_col\">", light_form_quick_button("lmessages.php", gettext("Keep reading&hellip;"), array('msg' => $tid . '.' . ($last_pid + 1)), '_self', 'keep_reading'), "</li>\n";
        echo "</ul>\n";
        echo "</div>\n";
    }
    if ($msg_count > 0 && session::logged_in()) {
        messages_update_read($tid, $last_pid, $thread_data['LAST_READ'], $thread_data['LENGTH'], $thread_data['MODIFIED']);
    }
}
Ejemplo n.º 2
0
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}&amp;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}&amp;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}&amp;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}&amp;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}&amp;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&hellip;"), 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']);
    }
}