Exemplo n.º 1
0
<?php

// Raidplaner RSS Feed
// This is a demo implementation of an RSS feed, but it can be used as is, too.
//
// Usage:
// feed.php?token=<private token>&timezone=<timezone>
//
// Timezone is optional and has to be compatible to date_default_timezone_set().
require_once "lib/private/api.php";
require_once "lib/private/out.class.php";
Out::writeHeadersXML();
echo '<rss version="2.0">';
// Build RSS header
$BaseURL = getBaseURL();
$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);