$forum){ if($forum["folder_flag"]){ unset($forums[$forum_id]); } elseif(empty($default_forum_id)) { $default_forum_id = $forum_id; } } $PHORUM["threaded_list"]=false; $PHORUM["float_to_top"]=false; // get the thread set started $rows = array(); $thread = (isset($PHORUM["args"][1])) ? (int)$PHORUM["args"][1] : 0; $rows = phorum_db_get_recent_messages(30, $forum_ids, $thread); unset($rows["users"]); $items = array(); $pub_date=0; foreach($rows as $key => $row){ if(!$PHORUM["forum_id"]){ $row["subject"]="[".$forums[$row["forum_id"]]["name"]."] ".$row["subject"]; } $forum_id = ($row["forum_id"]==0) ? $default_forum_id : $row["forum_id"]; $items[]=array( "pub_date" => date("r",$row["datestamp"]), "url" => phorum_get_url(PHORUM_FOREIGN_READ_URL, $forum_id, $row["thread"], $row["message_id"]), "headline" => $row["subject"], "description" => strip_tags($row["body"]), "author" => $row["author"], "category" => $forums[$row["forum_id"]]["name"] ); $pub_date = max($row["datestamp"], $pub_date); } if (!$PHORUM['locale']) $PHORUM['locale'] ="en"; //if locale not set make it 'en' if($PHORUM["forum_id"]){ $url = phorum_get_url(PHORUM_LIST_URL); $name = $PHORUM["name"]; $description = strip_tags($PHORUM["description"]); } else { $url = phorum_get_url(PHORUM_INDEX_URL); $name = $PHORUM["title"]; $description = ""; } $channel = array( "name" => $name, "url" => $url, "description" => $description, "pub_date" => date("r",$pub_date), "language" => $PHORUM['locale'] ); $data = create_rss_feed($channel, $items); } $charset = ''; if (! empty($GLOBALS["PHORUM"]["DATA"]["CHARSET"])) { $charset = '; charset=' . htmlspecialchars($GLOBALS["PHORUM"]["DATA"]['CHARSET']); } header("Content-Type: text/xml$charset"); echo $data; phorum_cache_put("rss", $cache_key, $data, 300); /*******************************************************/ function create_rss_feed($channel, $items) { if(empty($items)){ return; } $encoding = ''; if (! empty($GLOBALS["PHORUM"]["DATA"]["CHARSET"])) { $encoding = 'encoding="' . htmlspecialchars($GLOBALS["PHORUM"]["DATA"]['CHARSET']) . '"'; } $data ="\n"; $data.="\n"; $data.=" \n"; $data.=" ".htmlspecialchars(strip_tags($channel["name"]))."\n"; $data.=" " . htmlspecialchars($channel["url"]) . "\n"; $data.=" \n"; $data.=" " . htmlspecialchars($channel["language"]) . "\n"; $data.=" $channel[pub_date]\n"; $data.=" $channel[pub_date]\n"; $data.=" ".htmlspecialchars(strip_tags($channel["name"]))."\n"; $data.=" Phorum ".PHORUM."\n"; $data.=" 600\n"; foreach($items as $item){ $data.=" \n"; $data.=" ".htmlspecialchars($item["headline"])."\n"; $data.=" $item[url]\n"; $data.=" ".htmlspecialchars($item["author"])."\n"; $data.=" \n"; $data.=" ".htmlspecialchars(strip_tags($item["category"]))."\n"; $data.=" ".htmlspecialchars($item["url"])."\n"; $data.=" $item[pub_date]\n"; $data.=" \n"; } $data.=" \n"; $data.="\n"; return $data; } ?>