<?php

set_time_limit(0);
$root = $_POST['root'];
$fs = new \PFC\Editor\Sources($root);
$dirs = explode('/', $_SERVER['REQUEST_URI']);
$actualDir = $dirs[count($dirs) - 2];
$dir = $_POST['dir'];
if ($fs->fileExists($dir) && $fs->isDir($dir)) {
    $files = $fs->scandir($dir);
    if (count($files) > 2) {
        /* The 2 accounts for . and .. */
        echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
        // All dirs
        foreach ($files as $file) {
            if ($file != '.' && $file != '..' && $fs->fileExists($dir . $file) && $fs->isDir($dir . $file) && !($root == 'public' && $file == $actualDir)) {
                echo "<li class=\"directory collapsed\"><a href=\"#\"  lastModification=\"" . $fs->getLastModificationTime($dir . $file) . "\" rel=\"" . htmlentities($dir . $file) . "/\">" . htmlentities($file) . "</a></li>";
            }
        }
        // All files
        foreach ($files as $file) {
            if ($file != '.' && $file != '..' && $fs->fileExists($dir . $file) && !$fs->isDir($dir . $file)) {
                $ext = preg_replace('/^.*\\./', '', $file);
                echo "<li class=\"file ext_{$ext}\"><a extension=\"{$ext}\" lastModification=\"" . $fs->getLastModificationTime($dir . $file) . "\" href=\"#\" rel=\"" . htmlentities($dir . $file) . "\">" . htmlentities($file) . "</a></li>";
            }
        }
        echo "</ul>";
    }
}
<?php

set_time_limit(0);
$root = $_GET['root'];
$path = $_GET['path'];
$fs = new \PFC\Editor\Sources($root);
if ($fs->fileExists($path) && !$fs->isDir($path)) {
    $fs->readFile($path);
} elseif ($fs->fileExists($path)) {
    //pack to zip
    //serve
} else {
    echo "NOT EXISTiNG FLESYSTEM PATH {$root} {$path}";
}
<?php

$succ = 'no';
$msg = "";
$fs = new \PFC\Editor\Sources($_POST['root']);
$foldername = $_POST['path'] . $_POST['foldername'];
if ($fs->isDir($foldername)) {
    $msg = 'Folder already exists';
} else {
    if ($fs->createNewFolder($foldername)) {
        $succ = 'yes';
        $msg = 'Folder succesfully created';
    } else {
        $msg = 'Fail create folder';
    }
}
echo json_encode(array('succ' => $succ, 'msg' => $msg));