예제 #1
0
            $treemsgs[] = $msg["message_id"];
            $parent = $treemsgs[array_rand($treemsgs)];
        }
        phorum_api_thread_update_metadata($thread);
        $tcount--;
    }
    print "\n";
    foreach ($forum_ids as $id) {
        $PHORUM["forum_id"] = $id;
        $PHORUM['DB']->update_forum_stats(true);
    }
}
if ($ncount) {
    print "\nSetting {$ncount} newflags for " . count($users) . " users:\n\n";
    $recent = $PHORUM['DB']->get_recent_messages($ncount);
    $markread = array();
    foreach ($recent as $id => $msg) {
        if ($id == 'users') {
            continue;
        }
        $markread[] = array("id" => $id, "forum" => $msg["forum_id"]);
    }
    foreach ($users as $user_id => $stuff) {
        print ".";
        $PHORUM["user"]["user_id"] = $user_id;
        phorum_api_newflags_markread($markread, PHORUM_MARKREAD_MESSAGES);
    }
    print "\n";
}
print "\nDone!\n\n";
exit(0);
예제 #2
0
파일: index.php 프로젝트: samuell/Core
    // parameters in the URL. This way we prevent users from bookmarking
    // the mark read URL.
    if (!empty($PHORUM["args"][2])) {
        phorum_api_redirect(PHORUM_INDEX_URL, (int) $PHORUM['args'][2]);
    } else {
        phorum_api_redirect(PHORUM_INDEX_URL);
    }
}
// Handle "mark all read" clicks for marking a full vroot as read.
// The arguments are:
// [0] => The id of the folder to which the user should be redirected after
//        the markread action (stored in $PHORUM['forum_id']).
// [1] => The string "markallread"
if (isset($PHORUM['args'][1]) && $PHORUM['args'][1] === 'markallread' && !empty($PHORUM['user']['user_id'])) {
    // Mark all posts in the current vroot as read.
    phorum_api_newflags_markread($PHORUM['vroot'], PHORUM_MARKREAD_FORUMS);
    // Redirect to a fresh list of the current forums without the mark read
    // parameters in the URL. This way we prevent users from bookmarking
    // the mark all read URL.
    phorum_api_redirect(PHORUM_INDEX_URL, (int) $PHORUM['forum_id']);
}
// Somehow we arrived at a forum instead of a folder.
// Redirect the user to the message list for that forum.
if (!empty($PHORUM["forum_id"]) && $PHORUM["folder_flag"] == 0) {
    phorum_api_redirect(PHORUM_LIST_URL);
}
// Setup the "mark all read" URL.
if ($PHORUM["DATA"]["LOGGEDIN"]) {
    $PHORUM["DATA"]["URL"]["MARKVROOTREAD"] = phorum_api_url(PHORUM_INDEX_URL, $PHORUM["forum_id"], "markallread");
}
// Setup the syndication feed URLs for this folder.
예제 #3
0
파일: read.php 프로젝트: samuell/Core
     // one for the page-links
     $PHORUM["DATA"]["URL"]["FEED"] = phorum_api_url(PHORUM_FEED_URL, $PHORUM["forum_id"], $thread, "type=" . $PHORUM["default_feed"]);
     // and again for the header-links
     $PHORUM['DATA']['FEEDS'] = array(array('TITLE' => $PHORUM['DATA']['FEED'], 'URL' => $PHORUM["DATA"]["URL"]["FEED"]));
 }
 // include the correct template
 $templates = array();
 if ($PHORUM["threaded_read"] == 1) {
     $templates[] = "read_threads";
 } elseif ($PHORUM["threaded_read"] == 2) {
     $templates[] = "read_hybrid";
 } else {
     $templates[] = "read";
 }
 if ($PHORUM["DATA"]["LOGGEDIN"] && count($read_messages)) {
     phorum_api_newflags_markread($read_messages, PHORUM_MARKREAD_MESSAGES);
 }
 // {REPLY_ON_READ} is set when message replies are done on
 // the read page. The template can use this to add the
 // #REPLY anchor to the page. This way, the browser can jump
 // to the editor when clicking a reply link.
 $PHORUM["DATA"]["REPLY_ON_READ"] = !empty($PHORUM["reply_on_read_page"]);
 if (isset($PHORUM["reply_on_read_page"]) && $PHORUM["reply_on_read_page"]) {
     // Never show the reply box if the message is closed.
     if ($thread_is_closed) {
         $PHORUM["DATA"]["OKMSG"] = $PHORUM["DATA"]["LANG"]["ThreadClosed"];
         $templates[] = "message";
     } else {
         // Prepare the arguments for the posting.php script.
         $goto_mode = "reply";
         if (isset($PHORUM["args"]["quote"]) && $PHORUM["args"]["quote"]) {
예제 #4
0
    Mark a couple of threads and messages read:
        { "call": "markread",
          "threads": [ 4, 13, 96 ],
          "messages": [ 1, 55, 321 ] }
RETURN VALUE
    A true value in case marking the items read was successful.
ERRORS
    The call will return an error if the messages / threads
    array is not in the right format.
AUTHOR
    Maurice Makaay <*****@*****.**>
*/
if (!defined('PHORUM')) {
    return;
}
// This call only makes sense for logged in users.
// For anonymous users, we'll ignore the call and pretend it was successful.
if (!$PHORUM['DATA']['LOGGEDIN']) {
    ajax_return(TRUE);
}
// Load the newflags API, which handles marking messages as read.
require_once './include/api/newflags.php';
// Mark messages, threads and/or forums as read.
foreach (array('messages' => PHORUM_MARKREAD_MESSAGES, 'threads' => PHORUM_MARKREAD_THREADS, 'forums' => PHORUM_MARKREAD_FORUMS) as $arg => $mode) {
    $items = phorum_ajax_getarg($arg, 'array:int>0', array());
    if (!empty($items)) {
        phorum_api_newflags_markread($items, $mode);
    }
}
// We return TRUE (unless some error occured in the previous code).
phorum_ajax_return(TRUE);
예제 #5
0
파일: list.php 프로젝트: samuell/Core
phorum_build_common_urls();
if (!phorum_check_read_common()) {
    return;
}
// No forum_id in the request.
if (empty($PHORUM["forum_id"])) {
    phorum_api_redirect(PHORUM_INDEX_URL);
}
// Somehow we got to a folder in list.php.
if ($PHORUM["folder_flag"]) {
    phorum_api_redirect(PHORUM_INDEX_URL, $PHORUM["forum_id"]);
}
// Handle "mark read" clicks.
if (!empty($PHORUM["args"][1]) && $PHORUM["args"][1] == 'markread' && $PHORUM['user']['user_id']) {
    // Mark all posts in the current forum as read.
    phorum_api_newflags_markread($PHORUM['forum_id'], PHORUM_MARKREAD_FORUMS);
    // Redirect to a fresh list of the current folder without the mark read
    // parameters in the URL. This way we prevent users from bookmarking
    // the mark read URL.
    phorum_api_redirect(PHORUM_LIST_URL);
}
// figure out what page we are on
if (empty($PHORUM["args"]["page"]) || !is_numeric($PHORUM["args"]["page"]) || $PHORUM["args"]["page"] < 0) {
    $page = 1;
} else {
    $page = intval($PHORUM["args"]["page"]);
}
$offset = $page - 1;
// Check if the current user is allowed to moderate messages.
$PHORUM["DATA"]["MODERATOR"] = phorum_api_user_check_access(PHORUM_USER_ALLOW_MODERATE_MESSAGES);
// Find out how many forums this user can moderate. If the user can moderate