' . 'Display' . '' . utf8_decode(htmlspecialchars(trim($line))) . '' . ''; } function getDirItem($title, $urlPath) { global $host1, $host2; return '' . 'Dir' . '' . utf8_decode(htmlspecialchars($title)) . '' . '' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '' . '' . $host2 . utf8_decode(htmlspecialchars($urlPath)) . '' . ''; } function getPodcastItem($title, $urlPath) { global $host1; return '' . 'ShowOnDemand' . '' . utf8_decode(htmlspecialchars($title)) . '' . '' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '' . ''; } function getMessageItem($msg) { return '' . 'Message' . '' . utf8_decode(htmlspecialchars($msg)) . '' . ''; } function getPreviousItem($urlPath) { global $host1, $host2; return '' . 'Previous' . '' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '' . '' . $host1 . utf8_decode(htmlspecialchars($urlPath)) . '' . ''; } function addPreviousItem(&$listItems, $urlPath) { $parentDir = dirname($urlPath) . '/'; if ($parentDir == '/') { return; } $listItems[] = getPreviousItem($parentDir); } function getFinalUrl($url) { $ctx = stream_context_set_default( array('http' => array('method' => 'HEAD')) ); //get_headers follows redirects automatically $headers = get_headers($url, 1); if ($headers !== false && isset($headers['Location'])) { return end($headers['Location']); } return $url; } function sendMessage($msg) { sendListItems(array(getMessageItem($msg))); } function sendListItems($listItems) { $startitems = 1; $enditems = 10; if (isset($_GET['startitems'])) { $startitems = (int) $_GET['startitems']; } if (isset($_GET['enditems'])) { $enditems = (int) $_GET['enditems']; } //TODO: limit list $xml = '' . "\n"; $xml .= '' . "\n"; $xml .= '' . "\n"; foreach ($listItems as $item) { $xml .= $item . "\n"; } $xml .= "\n"; header('Content-type: text/xml'); echo $xml; } ?>