&1', $output, $retVal); if ($retVal == 0) { addTextLines($listItems, $output); } else { $listItems[] = getMessageItem('Error executing script'); addTextLines($listItems, $output); } } function sendTextFile($path) { global $varDir; $listItems = array(); $lines = file($varDir . $path); addTextLines($listItems, $lines); sendListItems($listItems, buildPreviousItem($path)); } function addTextLines(&$listItems, $lines) { foreach ($lines as $line) { $line = trim($line); if ($line != '') { $listItems[] = getDisplayItem($line); } } } function getDisplayItem($line) { $line = preg_replace('#\s+#', ' ', $line); return '' . 'Display' . '' . nox_esc($line) . '' . ''; } function getDirItem($title, $urlPath) { global $host1, $host2; return '' . 'Dir' . '' . nox_esc($title) . '' . '' . $host1 . nox_esc($urlPath) . '' . '' . $host2 . nox_esc($urlPath) . '' . ''; } function getEpisodeItem($title, $fullUrl, $desc, $type) { return '' . 'ShowEpisode' . '' . nox_esc($title) . '' . '' . htmlspecialchars($fullUrl) . '' . '' . nox_esc($desc) . '' . '' . $type . '' . ''; } function getPodcastItem($title, $urlPath) { global $host1; return '' . 'ShowOnDemand' . '' . nox_esc($title) . '' . '' . $host1 . nox_esc($urlPath) . '' . ''; } function getMessageItem($msg) { return '' . 'Message' . '' . nox_esc($msg) . '' . ''; } function getPreviousItem($urlPath) { global $host1, $host2; return '' . 'Previous' . '' . $host1 . nox_esc($urlPath) . '' . '' . $host1 . nox_esc($urlPath) . '' . ''; } function buildPreviousItem($urlPath) { $parentDir = dirname($urlPath) . '/'; if ($parentDir == '/') { return null; } return getPreviousItem($parentDir); } function nox_esc($string) { return utf8_decode(htmlspecialchars($string)); } function sendMessage($msg) { sendListItems(array(getMessageItem($msg))); } function sendListItems( $listItems, $previous = null, $enablePaging = true, $noCache = false ) { $startitems = 1; $enditems = 100000; if (isset($_GET['startitems'])) { $startitems = (int) $_GET['startitems']; } if (isset($_GET['enditems'])) { $enditems = (int) $_GET['enditems']; } if ($enablePaging) { $itemCount = count($listItems); } else { $itemCount = -1; } if ($previous !== null) { $previous .= "\n"; } $xml = '' . "\n"; $xml .= '' . "\n"; $xml .= '' . "\n"; if ($noCache) { $xml .= "1\n"; } $xml .= '' . $itemCount . '' . "\n"; $xml .= $previous; $num = 0; foreach ($listItems as $item) { ++$num; if (!$enablePaging || ($num >= $startitems && $num <= $enditems)) { $xml .= $item . "\n"; } } $xml .= "\n"; header('Content-type: text/xml; charset=iso-8859-1'); echo $xml; } ?>