Пример #1
0
 $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"]);
         }
         if (strlen($user_info[$row["user_id"]]["posts"]) > 3 && !strstr($user_info[$row["user_id"]]["posts"], $PHORUM["thous_sep"])) {
             $user_info[$row["user_id"]]["posts"] = number_format($user_info[$row["user_id"]]["posts"], 0, "", $PHORUM["thous_sep"]);
         }
         $row["user"] = $user_info[$row["user_id"]];
         unset($row["user"]["password"]);
         unset($row["user"]["password_tmp"]);
     }
     // Keep track of unread messages that we have to mark as read.
     // When we are in threaded mode, then we only have to mark the
     // currently viewed message as read. While hybrid mode is a
     // form of threaded reading too, we have to mark all the messages
     // read since they are all visible.
     if (!empty($row['new']) && ($PHORUM['threaded_read'] != PHORUM_THREADED_ON || $row['message_id'] == $message_id)) {
         $read_messages[] = $row['message_id'];
Пример #2
0
/**
 * @deprecated Replaced by {@link phorum_api_format_relative_date()}.
 */
function phorum_relative_date($ts)
{
    return phorum_api_format_relative_date($ts);
}
Пример #3
0
 if (count($arr["rows"])) {
     $match_number = $start + 1;
     $forums = phorum_api_forums_by_vroot($PHORUM["vroot"], PHORUM_FLAG_INCLUDE_INACTIVE);
     if (!$raw_body) {
         $arr["rows"] = phorum_api_format_messages($arr["rows"]);
     }
     foreach ($arr["rows"] as $key => $row) {
         $arr["rows"][$key]["number"] = $match_number;
         $arr["rows"][$key]["URL"]["READ"] = phorum_api_url(PHORUM_FOREIGN_READ_URL, $row["forum_id"], $row["thread"], $row["message_id"]);
         // strip HTML & BB Code
         if (!$raw_body) {
             $body = phorum_api_format_strip($arr["rows"][$key]["body"]);
             $arr["rows"][$key]["short_body"] = mb_substr($body, 0, 400, $PHORUM["DATA"]["HCHARSET"]);
         }
         $arr["rows"][$key]["raw_datestamp"] = $row["datestamp"];
         $arr["rows"][$key]["datestamp"] = phorum_api_format_relative_date($row["datestamp"]);
         $forum_ids[$row["forum_id"]] = $row["forum_id"];
         $match_number++;
     }
     foreach ($arr["rows"] as $key => $row) {
         $arr["rows"][$key]["URL"]["LIST"] = phorum_api_url(PHORUM_LIST_URL, $row["forum_id"]);
         $arr["rows"][$key]["forum_name"] = $forums[$row["forum_id"]]["name"];
     }
     $PHORUM["DATA"]["RANGE_START"] = $start + 1;
     $PHORUM["DATA"]["RANGE_END"] = $start + count($arr["rows"]);
     $PHORUM["DATA"]["TOTAL"] = $arr["count"];
     $PHORUM["DATA"]["SEARCH"]["showresults"] = true;
     // figure out paging
     $pages = ceil($arr["count"] / $PHORUM["list_length"]);
     $page = $offset + 1;
     $pages_shown = isset($PHORUM["TMP"]["search_pages_shown"]) ? $PHORUM["TMP"]["search_pages_shown"] : 5;