--- /dev/null
+<?php
+
+require_once 'Pman/Ftp/List.php';
+
+class Pman_Ftp_View extends Pman_Ftp_List
+{
+ //getAuth = covered by list
+
+ function get($v)
+ {
+
+ $ext = pathinfo($_SERVER['PATH_INFO'], PATHINFO_EXTENSION);
+ $v .= '.'. $ext;
+
+ $v = urldecode($v);
+ $fp = $this->clean($v);
+
+ require_once 'File/MimeType.php';
+ $fm = new File_MimeType();
+ $mt = $fm->fromExt($ext);
+
+ if (!isset($_REQUEST['html'])) {
+ header("Content-type: $mt");
+ $fh = fopen($fp,'r');
+ fpassthru($fh);
+ fclose($fh);
+ exit;
+ }
+
+
+ switch($mt) {
+ case 'text/plain':
+ case 'application/xml':
+ $fc = file_get_contents($fp);
+ $matches = array();
+ if (preg_match('#^\s*<\?xml.*encoding="([^"]+)"#mi', $fc, $matches)) {
+ $fc = iconv($matches[1], "UTF8//IGNORE", $fc);
+ }
+
+
+
+ echo '<PRE>'. htmlspecialchars($fc) . '</PRE>';
+ exit;
+
+ case 'image/jpeg':
+ echo '<img src="'. $this->baseURL.'/Ftp/View/'.$v . '">';
+ exit;
+
+
+ default:
+ die("Can not handle " . $mt . " yet");
+ }
+
+
+
+ var_dump($fp);
+
+ die("done");
+ exit;
+ }
+
+
+
+
+}
\ No newline at end of file