function fm_fileinfo($d) { global $ftp, $ftp_prepath; if (!$d) { return array('name' => '/', 'bname' => '', 'id' => file2id('/'), 'isdir' => true, 'size' => 0, 'tsize' => '-', 'modified' => 0, 'tmodified' => '-', 'tdmodified' => '-', 'perms' => 0, 'owner' => '', 'group' => '', 'ext' => '/', 'img' => fticon('/'), 'type' => textfiletype('/'), 'ft' => 1, 'writable' => true, 'isvimg' => false, 'imgsize' => false); } $up = upOne($ftp_prepath . $d); if (is_array($filecache[$up]['raw'])) { $cfiles = $filecache[$up]['raw']; } else { if (!fm_ftpconnect()) { return false; } ftp_chdir($ftp, $up); $cfiles = ftp_rawlist($ftp, '.'); ftp_chdir($ftp, '/'); $filecache[$up]['raw'] = $cfiles; } $file = basename($d); foreach ($cfiles as $cfile) { $info = array(); $cinfo = preg_split('/[\\s]+/', $cfile, 9); if ($cinfo[0] !== 'total' && $cinfo[8] != '.' && $cinfo[8] != '..' && $cinfo[8] == $file) { $cfilen = $cinfo[8] . ($cinfo[0][0] == 'd' ? '/' : ''); $ext = fext($cfilen); $info = array('name' => $cfilen, 'bname' => $cinfo[8], 'id' => file2id($cfilen), 'isdir' => $cinfo[0][0] == 'd' ? '/' : '', 'size' => intval($cinfo[4]), 'tsize' => textfilesize(intval($cinfo[4])), 'modified' => 0, 'tmodified' => $cinfo[5] . ' ' . $cinfo[6] . ' ' . $cinfo[7], 'tdmodified' => $cinfo[5] . ' ' . $cinfo[6], 'perms' => permconvert($cinfo[0]), 'owner' => $cinfo[2], 'group' => $cinfo[3], 'ext' => $ext, 'img' => fticon($ext), 'type' => textfiletype($ext), 'ft' => ft($ext), 'writable' => true, 'isvimg' => false, 'imgsize' => false); return $info; } } return false; }
function fm_fileinfo($d) { $path = $GLOBALS['prepath'] . $d; $file = filefrompath($path); if (!fm_exists($d)) { return FALSE; } $size = filesize($path); $modified = filemtime($path); $ext = fext($file); return array('name' => $file, 'bname' => endsWith($file, '/') ? substr($file, 0, -1) : $file, 'id' => file2id($file), 'isdir' => filetype($path) == 'dir', 'size' => $size, 'tsize' => textfilesize($size), 'modified' => $modified, 'tmodified' => date("M j, Y g:i:s A", $modified), 'tdmodified' => date("M j, Y", $modified), 'perms' => substr(sprintf('%o', fileperms($path)), -3), 'owner' => fileowner($path), 'group' => filegroup($path), 'ext' => $ext, 'img' => fticon($ext), 'type' => textfiletype($ext), 'ft' => ft($ext), 'writable' => fm_iswritable($d), 'isvimg' => isvimg($ext), 'imgsize' => (isvimg($ext) || $ext == 'psd' || $ext == 'bmp') && $size <= 5242880 ? @getimagesize($path) : FALSE); }
function fileinfo($path) { $file = filefrompath($path); if (!file_exists($path)) { return FALSE; } $size = filesize($path); $modified = filemtime($path); $ext = getfext($file); return array('name' => $file, 'id' => filetype($path) == 'dir' ? 'fold_' . substr($file, 0, -1) : 'file_' . $file, 'isdir' => filetype($path) == 'dir', 'size' => $size, 'tsize' => textfilesize($size), 'modified' => $modified, 'tmodified' => date("F j, Y g:i:s A", $modified), 'perms' => substr(sprintf('%o', fileperms($path)), -4), 'ext' => $ext, 'img' => textfileimg($ext), 'type' => textfiletype($ext), 'ft' => ft($ext), 'extac' => getfextac($ext), 'isvimg' => isvimg($ext), 'imgsize' => (isvimg($ext) || $ext == 'psd' || $ext == 'bmp') && $size <= 5242880 ? $imgsize = @getimagesize($path . $file) : FALSE); }