$row["attachments"][$key]["size"] = phorum_api_format_filesize($file["size"]); $row["attachments"][$key]["name"] = htmlspecialchars($file['name'], ENT_COMPAT, $PHORUM["DATA"]["HCHARSET"]); $safe_file = preg_replace('/[^\\w\\_\\-\\.]/', '_', $file['name']); $safe_file = preg_replace('/_+/', '_', $safe_file); $row["attachments"][$key]["url"] = str_replace(array('%file_id%', '%file_name%'), array($file['file_id'], $safe_file), $attachment_url_template); $row["attachments"][$key]["download_url"] = str_replace(array('%file_id%', '%file_name%'), array($file['file_id'], $safe_file), $attachment_download_url_template); } } $messages[$row["message_id"]] = $row; } if ($PHORUM["threaded_read"]) { // run read-threads mods if (isset($PHORUM["hooks"]["readthreads"])) { $messages = phorum_api_hook("readthreads", $messages); } $messages = phorum_api_thread_sort($messages); // we have to loop again and create the urls for the Next and Previous links. foreach ($messages as $key => $row) { if ($PHORUM["count_views"]) { // show viewcount if enabled if ($PHORUM["count_views"] == 2) { // viewcount as column $PHORUM["DATA"]["VIEWCOUNT_COLUMN"] = true; $messages[$key]["viewcount"] = $row['viewcount']; } else { // viewcount added to the subject $messages[$key]["subject"] = $row["subject"] . " ({$row['viewcount']} {$PHORUM['DATA']['LANG']['Views']})"; } } $messages[$key]["URL"]["NEXT"] = $PHORUM["DATA"]["URL"]["NEWERTHREAD"]; if (empty($last_key)) {
} else { // viewcount added to the subject $rows[$key]["subject"] = $row["subject"] . " ({$row['viewcount']} " . $PHORUM['DATA']['LANG']['Views_Subject'] . ")"; } } $rows[$key]["raw_datestamp"] = $row["datestamp"]; $rows[$key]["datestamp"] = phorum_api_format_date($PHORUM["short_date_time"], $row["datestamp"]); $rows[$key]["URL"]["READ"] = str_replace(array('%thread_id%', '%message_id%'), array($row['thread'], $row['message_id']), $read_url_template); if ($row["message_id"] == $row["thread"]) { $rows[$key]["threadstart"] = true; } else { $rows[$key]["threadstart"] = false; } $rows[$key]["new"] = ""; } $rows = phorum_api_thread_sort($rows); } else { $read_url_template = phorum_api_url(PHORUM_READ_URL, '%thread_id%'); $newpost_url_template = phorum_api_url(PHORUM_READ_URL, '%thread_id%', 'gotonewpost'); $read_page_url_template = phorum_api_url(PHORUM_READ_URL, '%thread_id%', 'page=%page_num%'); $recent_page_url_template = phorum_api_url(PHORUM_READ_URL, '%thread_id%', '%message_id%', 'page=%page_num%'); $recent_url_template = phorum_api_url(PHORUM_READ_URL, '%thread_id%', '%message_id%'); // loop through and read all the data in. foreach ($rows as $key => $row) { $rows[$key]["raw_lastpost"] = $row["modifystamp"]; $rows[$key]["raw_datestamp"] = $row["datestamp"]; $rows[$key]["lastpost"] = phorum_api_format_date($PHORUM["short_date_time"], $row["modifystamp"]); $rows[$key]["datestamp"] = phorum_api_format_date($PHORUM["short_date_time"], $row["datestamp"]); $rows[$key]["URL"]["READ"] = str_replace('%thread_id%', $row['thread'], $read_url_template); $rows[$key]["URL"]["NEWPOST"] = str_replace('%thread_id%', $row['thread'], $newpost_url_template); $rows[$key]["threadstart"] = true;