Example #1
0
include "loudblog/inc/database/adodb.inc.php";
include "loudblog/inc/connect.php";
include "loudblog/inc/functions.php";
cleanmygets();
//create some important globals
if (!isset($db['host'])) {
    die("<br /><br />Cannot find a valid configuration file! <a href=\"install.php\">Install Loudblog now!</a>");
}
$GLOBALS['prefix'] = $db['pref'];
$GLOBALS['path'] = $lb_path;
$GLOBALS['audiopath'] = $lb_path . "/audio/";
global $cat_table;
//getting basic data
$settings = getsettings();
dumpdata();
itunescats();
// here comes bad behavior (COMMENTED OUT)...
//require_once $lb_path . '/loudblog/inc/bad_behavior.php';
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
//getting data from postings-table
$dosql = "SELECT * FROM {$GLOBALS['prefix']}lb_postings WHERE ";
//do we have only a single posting to show?
if (isset($_GET['id'])) {
    $requested_id = (int) $_GET['id'];
    $dosql .= "id = '" . $requested_id . "' AND ";
}
//posting must be "live" to be displayed
$dosql .= "status = '3' ";
//posting must not be published in the future
$dosql .= "AND posted < '" . date("Y-m-d H:i:s") . "' ";
//if category is set, filter postings which don't fit
echo "</image>\n";
//huge iTunes-image
echo "<itunes:link rel=\"image\" type=\"video/jpeg\" href=\"" . $settings['url'] . "/audio/itunescover.jpg\">" . str_replace("&", "&amp;", $settings['sitename']) . "</itunes:link>\n\n";
echo "<pubDate>" . date("r") . "</pubDate>\n";
echo "<lastBuildDate>" . date("r", $lasttime) . "</lastBuildDate>\n";
echo "<generator>Loudblog</generator>\n\n";
//explicit or not?
if ($settings['itunes_explicit'] == "1") {
    $setexpl = "yes";
}
if ($settings['itunes_explicit'] == "0") {
    $setexpl = "no";
}
echo "<itunes:explicit>" . $setexpl . "</itunes:explicit>\n\n";
//iTunes categories!
$cat_table = itunescats();
$allcats = array($settings['feedcat1'], $settings['feedcat2'], $settings['feedcat3'], $settings['feedcat4']);
foreach ($allcats as $thiscat) {
    $main = false;
    if ($thiscat != "00-00") {
        if (substr($thiscat, 3) != "00") {
            $maincat = substr($thiscat, 0, 2) . "-00";
            echo "<itunes:category text=\"" . $cat_table[$maincat] . "\">\n";
            $main = true;
        }
        echo "<itunes:category text=\"" . $cat_table[$thiscat] . "\" />\n";
        if ($main) {
            echo "</itunes:category>\n";
        }
    }
}