<?php
-set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/../src/');
-$fullUri = $_SERVER['REQUEST_URI'];
-if (isset($_SERVER['REDIRECT_URL'])) {
- $path = $_SERVER['REDIRECT_URL'];
-} else {
- $path = '/';
-}
-$dataDir = __DIR__ . '/../data/';
-$varDir = realpath(__DIR__ . '/../var') . '/';
-$host1 = 'http://radio567.vtuner.com/';
-$host2 = 'http://radio5672.vtuner.com/';
-if ($_SERVER['HTTP_HOST'] !== '') {
- $host1 = 'http://' . $_SERVER['HTTP_HOST'] . '/';
- $host2 = 'http://' . $_SERVER['HTTP_HOST'] . '/';
-}
-$cfgFile = $dataDir . 'config.php';
-if (file_exists($cfgFile)) {
- include $cfgFile;
-}
+require_once __DIR__ . '/../src/header.php';
if (strtolower($fullUri) == '/setupapp/radio567/asp/browsexpa/loginxml.asp?token=0'
|| $fullUri == '/RadioNativeLogin.php'
if (substr($path, 0, 14) == 'internetradio/') {
require_once 'mediatomb.php';
- handleRequestMediatomb($path, 'internetradio/');
+ handleMediatomb('browse', $path, 'internetradio/');
+ return;
+ } else if (substr($path, 0, 11) == '.mt-single/') {
+ require_once 'mediatomb.php';
+ handleMediatomb('single', $path, '.mt-single/');
return;
}
sendPodcast($path);
} else if ($ext == 'txt') {
sendTextFile($path);
- } else if ($ext == 'sh') {
+ } else if (is_executable($fullPath)) {
sendScript($path);
} else {
sendMessage('Unknown file type');
//podcast
++$count;
$listItems[] = getPodcastItem(basename($titleBase, '.url'), $urlPath);
- } else if (substr($entry, -8) == '.auto.sh') {
+ } else if (is_executable($entry)
+ && strpos(basename($entry), '.auto') !== false
+ ) {
//automatically execute script while listing this directory
addScriptOutput($listItems, $entry);
- } else if ($ext == 'txt' || $ext == 'sh') {
+ } else if ($ext == 'txt' || is_executable($entry)) {
//plain text file
++$count;
$listItems[] = getDirItem(basename($titleBase, '.' . $ext), $urlPath);
$line = preg_replace('#\s+#', ' ', $line);
return '<Item>'
. '<ItemType>Display</ItemType>'
- . '<Display>' . utf8_decode(htmlspecialchars($line)) . '</Display>'
+ . '<Display>' . nox_esc($line) . '</Display>'
. '</Item>';
}
global $host1, $host2;
return '<Item>'
. '<ItemType>Dir</ItemType>'
- . '<Title>' . utf8_decode(htmlspecialchars($title)) . '</Title>'
- . '<UrlDir>' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '</UrlDir>'
- . '<UrlDirBackUp>' . $host2 . utf8_decode(htmlspecialchars($urlPath)) . '</UrlDirBackUp>'
+ . '<Title>' . nox_esc($title) . '</Title>'
+ . '<UrlDir>' . $host1 . nox_esc($urlPath) . '</UrlDir>'
+ . '<UrlDirBackUp>' . $host2 . nox_esc($urlPath) . '</UrlDirBackUp>'
. '</Item>';
}
{
return '<Item>'
. '<ItemType>ShowEpisode</ItemType>'
- . '<ShowEpisodeName>' . utf8_decode(htmlspecialchars($title)) . '</ShowEpisodeName>'
- . '<ShowEpisodeURL>' . $fullUrl . '</ShowEpisodeURL>'
- . '<ShowDesc>' . utf8_decode(htmlspecialchars($desc)) . '</ShowDesc>'
+ . '<ShowEpisodeName>' . nox_esc($title) . '</ShowEpisodeName>'
+ . '<ShowEpisodeURL>' . htmlspecialchars($fullUrl) . '</ShowEpisodeURL>'
+ . '<ShowDesc>' . nox_esc($desc) . '</ShowDesc>'
. '<ShowMime>' . $type . '</ShowMime>'
. '</Item>';
}
global $host1;
return '<Item>'
. '<ItemType>ShowOnDemand</ItemType>'
- . '<ShowOnDemandName>' . utf8_decode(htmlspecialchars($title)) . '</ShowOnDemandName>'
- . '<ShowOnDemandURL>' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '</ShowOnDemandURL>'
+ . '<ShowOnDemandName>' . nox_esc($title) . '</ShowOnDemandName>'
+ . '<ShowOnDemandURL>' . $host1 . nox_esc($urlPath) . '</ShowOnDemandURL>'
. '</Item>';
}
{
return '<Item>'
. '<ItemType>Message</ItemType>'
- . '<Message>' . utf8_decode(htmlspecialchars($msg)) . '</Message>'
+ . '<Message>' . nox_esc($msg) . '</Message>'
. '</Item>';
}
global $host1, $host2;
return '<Item>'
. '<ItemType>Previous</ItemType>'
- . '<UrlPrevious>' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '</UrlPrevious>'
- . '<UrlPreviousBackUp>' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '</UrlPreviousBackUp>'
+ . '<UrlPrevious>' . $host1 . nox_esc($urlPath) . '</UrlPrevious>'
+ . '<UrlPreviousBackUp>' . $host1 . nox_esc($urlPath) . '</UrlPreviousBackUp>'
. '</Item>';
}
$listItems[] = getPreviousItem($parentDir);
}
+function nox_esc($string)
+{
+ return utf8_decode(htmlspecialchars($string));
+}
+
function sendMessage($msg)
{
sendListItems(array(getMessageItem($msg)));
}
$xml .= "</ListOfItems>\n";
- header('Content-type: text/xml');
+ header('Content-type: text/xml; charset=iso-8859-1');
echo $xml;
}
?>