3 require_once 'Pman/Ftp/List.php';
5 class Pman_Ftp_View extends Pman_Ftp_List
7 //getAuth = covered by list
9 function get($v = '', $opts = array())
12 $ext = pathinfo($_SERVER['PATH_INFO'], PATHINFO_EXTENSION);
16 $fp = $this->clean($v);
18 require_once 'File/MimeType.php';
19 $fm = new File_MimeType();
20 $mt = $fm->fromExt($ext);
22 if (!isset($_REQUEST['html'])) {
23 header("Content-type: $mt");
33 case 'application/xml':
34 $fc = file_get_contents($fp);
36 if (preg_match('#^\s*<\?xml.*encoding="([^"]+)"#mi', $fc, $matches)) {
37 $fc = iconv($matches[1], "UTF8//IGNORE", $fc);
41 if ($mt == 'application/xml') {
44 //if (class_exists('Tidy')) {
48 $tidy->parseString($fc, array('indent'=>true,'output-xml' => true,'input-xml' => true), 'utf8');
49 // $tidy->cleanRepair();
53 echo '<PRE>'. htmlspecialchars($fc) . '</PRE>';
57 echo '<img src="'. $this->baseURL.'/Ftp/View/'.$v . '">';
63 require_once 'File/Convert.php';
64 $f = new File_Convert($fp, $mt);
65 $f->convert("application/pdf"); // does no conversion (as it's the same.
67 $f->serve('attachment');
72 die("Can not handle " . $mt . " yet");