Esempio n. 1
0
}
require_once PHORUM_PATH . '/include/api/newflags.php';
require_once PHORUM_PATH . '/include/api/format/messages.php';
// Process the arguments.
$count = phorum_ajax_getarg('count', 'int>0', NULL);
$forum_id = phorum_ajax_getarg('forum_id', 'int', 0);
$thread_id = phorum_ajax_getarg('thread_id', 'int', 0);
$threads_only = phorum_ajax_getarg('threads_only', 'boolean', 0);
$format = phorum_ajax_getarg('format', 'string', 'html');
// Retrieve the recent messages.
$recent = $PHORUM['DB']->get_recent_messages($count, 0, $forum_id, $thread_id, $threads_only);
unset($recent["users"]);
// Add newflag info to the messages.
if ($PHORUM["DATA"]["LOGGEDIN"]) {
    $type = $threads_only ? PHORUM_NEWFLAGS_BY_THREAD : PHORUM_NEWFLAGS_BY_MESSAGE;
    $recent = phorum_api_newflags_apply_to_messages($recent, $type);
}
// Format the messages.
$recent = phorum_api_format_messages($recent);
// Apply the list hook to the messages.
if (isset($PHORUM["hooks"]["list"])) {
    $recent = phorum_api_hook("list", $recent);
}
// Retrieve information about the forums for the active user.
$allowed_forums = phorum_api_user_check_access(PHORUM_USER_ALLOW_READ, PHORUM_ACCESS_LIST);
$forums = $PHORUM['DB']->get_forums($allowed_forums);
foreach ($forums as $id => $forum) {
    $forums[$id]['url'] = phorum_get_url(PHORUM_LIST_URL, $forum['forum_id']);
}
// Add forum info to the messages and clean up data.
foreach ($recent as $id => $message) {
Esempio n. 2
0
 if (isset($fetch_user_ids) && count($fetch_user_ids)) {
     $user_info = phorum_api_user_get($fetch_user_ids);
 }
 // URLS which are common for the thread
 if ($PHORUM['DATA']['MODERATOR']) {
     if ($build_move_url) {
         $URLS['move_url'] = str_replace(array('%action_id%', '%message_id%', '%thread_id%'), array(PHORUM_MOVE_THREAD, $thread, $thread), $moderation_url_template);
     }
     $URLS['merge_url'] = str_replace(array('%action_id%', '%message_id%', '%thread_id%'), array(PHORUM_MERGE_THREAD, $thread, $thread), $moderation_url_template);
     $URLS['close_url'] = str_replace(array('%action_id%', '%message_id%', '%thread_id%'), array(PHORUM_CLOSE_THREAD, $thread, $thread), $moderation_url_template);
     $URLS['reopen_url'] = str_replace(array('%action_id%', '%message_id%', '%thread_id%'), array(PHORUM_REOPEN_THREAD, $thread, $thread), $moderation_url_template);
     $URLS['sticky_url'] = str_replace(array('%action_id%', '%message_id%', '%thread_id%'), array(PHORUM_MAKE_STICKY, $thread, $thread), $moderation_url_template);
     $URLS['unsticky_url'] = str_replace(array('%action_id%', '%message_id%', '%thread_id%'), array(PHORUM_MAKE_UNSTICKY, $thread, $thread), $moderation_url_template);
 }
 // Add information about new messages to the thread.
 $data = phorum_api_newflags_apply_to_messages($data);
 // main loop for template setup
 $messages = array();
 $read_messages = array();
 // needed for marking new messages as read later on
 foreach ($data as $key => $row) {
     // should we remove the bodies in threaded view
     if ($remove_threaded_bodies && $row["message_id"] != $thread && $row["message_id"] != $message_id) {
         unset($row["body"]);
         // strip body
     }
     // assign user data to the row
     if ($row["user_id"] && isset($user_info[$row["user_id"]])) {
         if (is_numeric($user_info[$row["user_id"]]["date_added"])) {
             $user_info[$row["user_id"]]["raw_date_added"] = $user_info[$row["user_id"]]["date_added"];
             $user_info[$row["user_id"]]["date_added"] = phorum_api_format_relative_date($user_info[$row["user_id"]]["date_added"]);
Esempio n. 3
0
/**
 * @deprecated Replaced by {@link phorum_api_newflags_apply_to_messages()}.
 */
function phorum_api_newflags_format_messages($messages, $mode = PHORUM_NEWFLAGS_BY_MESSAGE, $fullcount = FALSE)
{
    require_once PHORUM_PATH . '/include/api/newflags.php';
    return phorum_api_newflags_apply_to_messages($messages, $mode, $fullcount ? PHORUM_NEWFLAGS_CHECK : PHORUM_NEWFLAGS_COUNT);
}
Esempio n. 4
0
 // used later if user is moderator
 if ($PHORUM["DATA"]["MODERATOR"]) {
     $delete_url_template = phorum_api_url(PHORUM_MODERATION_URL, PHORUM_DELETE_MESSAGE, '%message_id%', 'ref_message_id=%message_id%');
     $delete_thread_url_template = phorum_api_url(PHORUM_MODERATION_URL, PHORUM_DELETE_TREE, '%message_id%', 'ref_message_id=%message_id%');
     $move_thread_url_template = phorum_api_url(PHORUM_MODERATION_URL, PHORUM_MOVE_THREAD, '%message_id%', 'ref_message_id=%message_id%');
     $merge_thread_url_template = phorum_api_url(PHORUM_MODERATION_URL, PHORUM_MERGE_THREAD, '%message_id%', 'ref_message_id=%message_id%');
     if (isset($row['pages_moderators'])) {
         $recent_page_url_template = phorum_api_url(PHORUM_READ_URL, '%thread_id%', '%message_id%', 'ref_message_id=%message_id%', 'page=%page_num%');
         $recent_url_template = phorum_api_url(PHORUM_READ_URL, '%thread_id%', '%message_id%', 'ref_message_id=%message_id%');
     }
 }
 $mark_thread_read_url_template = phorum_api_url(PHORUM_READ_URL, '%thread_id%', "markthreadread", "list");
 // Add newflags to the messages for authenticated users.
 if ($PHORUM['user']['user_id']) {
     $message_type = $PHORUM['threaded_list'] ? PHORUM_NEWFLAGS_BY_MESSAGE_EXSTICKY : PHORUM_NEWFLAGS_BY_THREAD;
     $rows = phorum_api_newflags_apply_to_messages($rows, $message_type);
 }
 foreach ($rows as $key => $row) {
     if (isset($row['new'])) {
         $rows[$key]["URL"]["MARKTHREADREAD"] = str_replace('%thread_id%', $row['thread'], $mark_thread_read_url_template);
     }
     if ($PHORUM["DATA"]["MODERATOR"]) {
         if ($rows[$key]["threadstart"]) {
             $rows[$key]["URL"]["DELETE_THREAD"] = str_replace('%message_id%', $row['message_id'], $delete_thread_url_template);
             if ($build_move_url) {
                 $rows[$key]["URL"]["MOVE"] = str_replace('%message_id%', $row['message_id'], $move_thread_url_template);
             }
             $rows[$key]["URL"]["MERGE"] = str_replace('%message_id%', $row['message_id'], $merge_thread_url_template);
         } else {
             $rows[$key]["URL"]["DELETE_MESSAGE"] = str_replace('%message_id%', $row['message_id'], $delete_url_template);
         }