include_once("./common.php"); //change to match your file system
include_once("./include/format_functions.php");
if(!phorum_check_read_common()) {
return;
}
// set all our URL's
phorum_build_common_urls();
if(isset($PHORUM['args']['num']))
$nums=$PHORUM['args']['num'];
else
$nums=25;
$rows=phorum_db_get_recent_messages($nums,$PHORUM['forum_id']);
unset($rows['users']);
$forums=array();
// loop through and read all the data in.
foreach($rows as $key => $row){
if(empty($first_thread)){
$first_thread=$row["thread"];
}
$rows[$key]["datestamp"] = phorum_date($PHORUM["short_date"], $row["datestamp"]);
$rows[$key]["url"] = phorum_get_url(PHORUM_FOREIGN_READ_URL,$row['forum_id'] , $row["thread"], $row["message_id"]);
// find out which forums are involved
$forums[$row['forum_id']]=1;
if ($row["user_id"]){
$url = phorum_get_url(PHORUM_PROFILE_URL, $row["user_id"]);
$rows[$key]["profile_url"] = $url;
$rows[$key]["linked_author"] = "$row[author]";
}else{
$rows[$key]["profile_url"] = "";
if(!empty($row['email'])) {
$email_url = phorum_html_encode("mailto:$row[email]");
// we don't normally put HTML in this code, but this makes it easier on template builders
$rows[$key]["linked_author"] = "".htmlspecialchars($row["author"])."";
} else {
$rows[$key]["linked_author"] = $row["author"];
}
}
}
$forum_data = phorum_db_get_forums(array_keys($forums));
$newflags=array();
if ($PHORUM["DATA"]["LOGGEDIN"]){ // retrieving newflags if logged in
foreach($forums as $forumid => $none) {
$newflags[$forumid]=phorum_db_newflag_get_flags($forumid);
}
}
// going through them again for forumname, -link and newflags
foreach($rows as $key => $row){
if($PHORUM['forum_id'] == 0 || $PHORUM['folder_flag']==1) {
$rows[$key]["forum_url"] = phorum_get_url(PHORUM_LIST_URL, $row["forum_id"]);
$rows[$key]["forum_name"] = $forum_data[$row["forum_id"]]["name"];
}
// newflag, if its NOT in newinfo AND newer (min than min_id, then its a new message
$rows[$key]["new"] = "";
if (!isset($newflags[$row['forum_id']][$row['message_id']]) && $row['message_id'] > $newflags[$row['forum_id']]['min_id']) {
$rows[$key]["new"]=$PHORUM["DATA"]["LANG"]["newflag"];
}
}
$PHORUM["DATA"]["ROWS"] = $rows;
include phorum_get_template("header");
phorum_hook("after_header");
// include the correct template
include phorum_get_template("derniers");
phorum_hook("before_footer");
include phorum_get_template("footer");
?>