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);
}
Example #2
0
    parent.sidebar.document.getElementById('clipboard').innerHTML = '<div class="box"><div class="boxd" style="border-bottom: 1px dotted #1e395b;padding:5px 10px;"><div style="float:right;color:#888;"><?php 
                                    echo count($_SESSION['clip']);
                                    ?>
 file<?php 
                                    if (count($_SESSION['clip']) !== 1) {
                                        echo 's';
                                    }
                                    ?>
</div><strong><?php 
                                    echo $_SESSION['cliptype'] == 'm' ? 'Move to...' : 'Copy to...';
                                    ?>
</strong></div><div class="boxd"><?php 
                                    foreach ($_SESSION['clip'] as $clipfile) {
                                        ?>
<div class="overflowable"><img src="images/icons/<?php 
                                        echo fticon(fext($clipfile));
                                        ?>
.gif" /> <?php 
                                        echo filefrompath($clipfile);
                                        ?>
</div><?php 
                                    }
                                    ?>
<div style="text-align:right;"><input type="button" value="<?php 
                                    echo $_SESSION['cliptype'] == 'm' ? 'Move here' : 'Copy here';
                                    ?>
" onclick="f_pastehere()" /></div><div style="text-align:right;"><input type="button" value="Cancel" onclick="f_declipall()" /></div></div></div><br />';
    parent.sidebar.document.getElementById('clipboard').style.display = 'block';
<?php 
                                } else {
                                    ?>
Example #3
0
if (fm_isfile($d)) {
    ?>
        <div style="float:right;"><iframe src="textedit.php?frame<?php 
    echo $hasid;
    ?>
" name="fmframe" height="20" width="20" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe></div>
<?php 
}
?>
        <div id="flocbar"><?php 
if (isset($_GET['p'])) {
    echo '&nbsp;';
} else {
    ?>
<div id="dir" class="dir" style="background-image: url(images/icons/<?php 
    echo fticon($fileext);
    ?>
.gif)"><?php 
    echo $fullurl;
    ?>
</div><?php 
}
?>
</div></div>
        <div id="valbar"><textarea name="val" onkeyup="change(event)" id="val" rows="30" cols="80"<?php 
if (fm_isfile($d)) {
    echo ($writable ? '>' : ' disabled="disabled">
Warning: This file is read-only. You will not be able to edit it unless you CHMOD it to something like 644.

================================
') . str_replace('\\n', '\\r\\n', str_replace('\\r\\n', '\\n', htmlentities(isset($filecontents) ? $filecontents : ($filecontents = fm_contents($d)))));
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;
}