コード例 #1
0
ファイル: textedit.php プロジェクト: mehulsbhatt/filecharger
?>
" target="fmframe" method="post" class="textedit">
        <div id="tetopbar"><div id="btnbar">
          <!--input type="button" value="File" id="fmenu" class="bbbtn" onmouseup="cmenuon(event)" />
          <input type="submit" value="Save" id="fsave" onclick="return save();" class="bbbtnd" /-->
          <input type="submit" value="Save" id="fsave" class="bbbtnd" />
          <script type="text/javascript">
          <!--
            document.getElementById('fsave').style.display = 'none';
            document.write('<span id="fmenu" class="bbbtn" onmouseup="cmenuon(event)">File</span> <span id="save" onclick="return save();" class="bbbtnd">Save</span>');
          -->
          </script>
          <input type="hidden" name="act" value="textedit" />
        </div>
<?php 
$writable = fm_iswritable($d);
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 
コード例 #2
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);
}
コード例 #3
0
include 'config.inc.php';
include 'fileman.lib.php';
if ($ftpmode) {
    include_once 'ftpsession.lib.php';
} else {
    include_once 'session.lib.php';
}
//====================
// Frame
//====================
//if it's being used as a frame, we'll need to do some more stuff.
if (isset($_REQUEST['frame'])) {
    if (isset($_POST['act'])) {
        switch ($_POST['act']) {
            case 'textedit':
                if (fm_iswritable($d)) {
                    if (!is_string($_POST['val'])) {
                        die('<!DOCTYPE html><script language="javascript">parent.fmf_error("Malformed request.");</script>');
                    }
                    if (strpos(fm_contents($d), "\r\n") === false) {
                        $_POST['val'] = str_replace("\r\n", "\n", $_POST['val']);
                    }
                    if (!fm_editfile($d, $_POST['val'])) {
                        fm_close();
                        die('<!DOCTYPE html><script language="javascript">parent.fmf_error("Cannot edit file \'' . basename($d) . '\'.");</script>');
                    }
                } else {
                    die('<!DOCTYPE html><script language="javascript">parent.fmf_error("File \'' . basename($d) . '\' is not writable.");</script>');
                }
        }
    }