} // main loop for template setup $messages = array(); $read_messages = array(); // needed for newinfo 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_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"]); } if (!($PHORUM["threaded_read"] == 1) && $PHORUM["DATA"]["LOGGEDIN"] && $row['message_id'] > $PHORUM['user']['newinfo']['min_id'] && !isset($PHORUM['user']['newinfo'][$row['message_id']])) { // set this message as read $read_messages[] = array("id" => $row['message_id'], "forum" => $row['forum_id']); } // is the message unapproved? $row["is_unapproved"] = $row['status'] < 0 ? 1 : 0; // all stuff that makes only sense for moderators or admin
if (count($arr["rows"])) { $match_number = $start + 1; $forums = phorum_db_get_forums(0, NULL, $PHORUM["vroot"]); if (!$raw_body) { $arr["rows"] = phorum_format_messages($arr["rows"]); } foreach ($arr["rows"] as $key => $row) { $arr["rows"][$key]["number"] = $match_number; $arr["rows"][$key]["URL"]["READ"] = phorum_get_url(PHORUM_FOREIGN_READ_URL, $row["forum_id"], $row["thread"], $row["message_id"]); // strip HTML & BB Code if (!$raw_body) { $body = phorum_strip_body($arr["rows"][$key]["body"]); $arr["rows"][$key]["short_body"] = substr($body, 0, 400); } $arr["rows"][$key]["raw_datestamp"] = $row["datestamp"]; $arr["rows"][$key]["datestamp"] = phorum_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_get_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; if ($pages <= 5) {