$Out = new Out(); $Out->pushValue("title", "Raidplaner RSS feed"); $Out->pushValue("link", $BaseURL . "index.php"); $Out->pushValue("description", "Upcoming raids for the next 2 weeks."); $Out->pushValue("language", "en-en"); $Out->pushValue("copyright", "packedpixel"); $Out->pushValue("pubDate", date(DATE_RSS)); // Requires private token to be visible $Token = isset($_REQUEST["token"]) ? $_REQUEST["token"] : null; if (Api::testPrivateToken($Token)) { // Setting the correct timezones $Timezone = isset($_REQUEST["timezone"]) ? $_REQUEST["timezone"] : date_default_timezone_get(); // Query API date_default_timezone_set("UTC"); $Parameters = array("start" => time() - 24 * 60 * 60, "end" => time() + 14 * 24 * 60 * 60, "limit" => 0, "closed" => true, "canceled" => true); $Locations = Api::queryLocation(null); $Raids = Api::queryRaid($Parameters); $LocationName = array(); foreach ($Locations as $Location) { $LocationName[$Location["Id"]] = $Location["Name"]; } // Generate RSS content date_default_timezone_set($Timezone); foreach ($Raids as $Raid) { $Start = date("H:i", intval($Raid["Start"])); $End = date("H:i", intval($Raid["End"])); $Out->pushValue("item", array("title" => $LocationName[$Raid["LocationId"]] . " (" . $Raid["Size"] . ")", "description" => "Status: " . $Raid["Status"] . "\nFrom " . $Start . " to " . $End . "\n" . $Raid["Description"], "link" => $BaseURL . "index.php#raid," . $Raid["RaidId"], "author" => "Raidplaner", "guid" => $Raid["RaidId"], "pubDate" => date(DATE_RSS, intval($Raid["Start"])))); } } $Out->flushXML("channel"); echo '</rss>';