3 require_once 'Pman.php';
4 class Pman_Ftp_List extends Pman
8 $au = $this->getAuthUser();
10 $this->jerr("Not authenticated", array('authFailure' => true));
12 $this->authUser = $au;
13 // check that it's a supplier!!!!
17 var $root = '/home/ftp';
23 $base = isset($f) ? $f: '/' ;
24 $base = ltrim($base,'/');
25 $base = empty($base) ? '' : '/'. $base;
29 // non hanlding of aliases.
33 $this->jerr("invalid path");
39 function get($base = '', $opts = array())
43 $type = !empty($_REQUEST['type']) && $_REQUEST['type'] == 'files' ? 'files' : 'dir';
45 $fp = $this->clean(isset($_REQUEST['name']) ? $_REQUEST['name'] : '');
50 require_once 'File/MimeType.php';
51 $fm = new File_MimeType();
54 while(false !== ($f = readdir($dh))) {
55 if (!strlen($f) || $f[0] =='.') {
62 if ($type == 'dir' && !$idr) {
65 if ($type == 'files' && $idr) {
68 $s = (object) stat($ff);
69 $s->id = substr($ff, strlen($root));
72 $s->mtime= date('Y-m-d H:i:s', $s->mtime);
73 $s->mimetype = $fm->fromFilename($f);
79 $this->jdata(array_values($ret));