function fm_chmod($file, $perms) { global $ftp, $ftp_prepath; if (!fm_ftpconnect()) { return false; } $ofile = $file; aphp($file); if ($ofile !== $file) { fm_copy($ofile, $file); } return @ftp_chmod($ftp, octdec($perms), $ftp_prepath . $file); }
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; }