コード例 #1
0
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);
}
コード例 #2
0
ファイル: index.php プロジェクト: mehulsbhatt/filecharger
    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 {
                                    ?>
コード例 #3
0
ファイル: echo.php プロジェクト: mehulsbhatt/filecharger
<?php

/*
 *
 * Filecharger
 * by Zarel of Novawave
 *
 */
include_once 'config.inc.php';
require_once 'fileman.lib.php';
if ($ftpmode) {
    include_once 'ftpsession.lib.php';
} else {
    include_once 'session.lib.php';
}
if (fm_contenttype(fext($d))) {
    header('Content-Type: ' . fm_contenttype(fext($d)));
}
echo fm_contents($d);
コード例 #4
0
$ftp_username = $user['name'];
$ftp_password = $user['pass'];
$ftp_prepath = '/';
$ftp_ftps = $user['ftps'];
//====================
// Parse GET strings
//====================
if ($d === false) {
    $d = '';
}
$postsub = substr($d, strlen($presub));
while (startsWith($postsub, '/')) {
    $postsub = substr($postsub, 1);
}
if (!endsWith($postsub, '/')) {
    if (strrpos($postsub, '/') === false) {
        $file = $postsub;
        $postsub = '';
    } else {
        $file = substr($postsub, strrpos($postsub, '/') + 1);
        $postsub = substr($postsub, 0, strrpos($postsub, '/') + 1);
    }
}
$fullpath = $prepath . $presub . $postsub . $file;
$fullurl = $preurl . $presub . $postsub . $file;
$fileext = fext($file);
$d = $presub . $postsub . $file;
$hd = urlencode($d ? $d : './');
//====================
// Account?
//====================
コード例 #5
0
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;
}
コード例 #6
0
function aphp(&$file)
{
    if (isadmin()) {
        return;
    }
    if (!$GLOBALS['allow_php'] && ft(fext($file)) == 3) {
        $file .= substr($file, -4) == '.php' ? 's' : '.txt';
    }
    if (substr(basename($file), 0, 1) == '.') {
        $file = substr($file, 0, -strlen(basename($file))) . 'new' . basename($file);
    }
    if (!$GLOBALS['allow_php']) {
        // Turns out Apache has a rather insecure file handler system, so
        $splitfile = explode('.', preg_replace('/[^A-Za-z0-9.]+/', '', strtr($file, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')));
        if (!endsWith($file, '.txt') && !endsWith($file, '.phps') && array_intersect($splitfile, array('php', 'inc', 'asp', 'cgi', 'jsp', 'pl', 'py', 'shtml', 'ssi', 'phtml', 'php1', 'php2', 'php3', 'php4', 'php5', 'php6', 'php7', 'php8'))) {
            $file .= '.txt';
        }
    }
}