private function addPageToDB($eid, $slug, $title)
 {
     $link = "podcast/" . $slug . "/" . $eid;
     $queryPodcast = new queryPodcast();
     $description = json_decode($queryPodcast->getPodcastData($slug), true);
     $description = $description["description"];
     $page = new page();
     $page->addPage($link, $title, $description, "Podcast", "Podcast");
 }
}
require_once dirname(__FILE__) . '/../inc/class.queryPodcast.php';
$query = new queryPodcast();
function autolink($text)
{
    $reg_exUrl = "/((http|https|ftp|ftps)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?)/";
    if (preg_match($reg_exUrl, $text)) {
        return preg_replace($reg_exUrl, '<a href="${1}">${1}</a> ', $text);
    } else {
        return $text;
    }
}
$ROOT_URL = "https://www.rolandoislas.com/podcast/" . $_GET["podcast"] . "/";
$slug = $_GET['podcast'];
$episodeData = json_decode($query->query($slug), true);
$podcastData = json_decode($query->getPodcastData($slug), true);
header('Content-Type: application/xml; charset=utf-8');
$xml = '<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">';
$title = $podcastData["title"];
$description = $podcastData["description"];
$xml .= "\n<channel>\n<title>{$title}</title>\n<link>https://www.rolandoislas.com/podcast/{$slug}/</link>\n<description>{$description}</description>";
foreach ($episodeData as $episode) {
    $title = $episode["title"];
    $link = $ROOT_URL . $episode["id"];
    $guid = $episode["url"];
    $description = "<![CDATA[" . stripslashes(nl2br(autolink($episode["description"]))) . "]]>";
    date_default_timezone_set("America/Phoenix");
    $pubdate = date(DATE_RFC2822, strtotime($episode["pubdate"]));
    $xml .= "\n<item>\n<title>{$title}</title>\n<link>{$link}</link>\n<guid>{$guid}</guid>\n<description>{$description}</description>\n<pubDate>{$pubdate}</pubDate>\n</item>";
}