Пример #1
0
function Folder_to_not_remove($folder)
{
    if (Folders_interdis($folder)) {
        return true;
    }
    $l["/home"] = true;
    if (!$l[$folder]) {
        return false;
    } else {
        return true;
    }
}
Пример #2
0
function browseFolder()
{
    $root = base64_decode($_GET["startpath"]);
    writelogs("Checking: {$root} \"{$_GET["root"]}\"", __FUNCTION__, __FILE__, __LINE__);
    $tpl = new templates();
    $used = $tpl->javascript_parse_text("{used}");
    $f[] = "[";
    if ($root == "disks" && $_GET["root"] == "source") {
        $harddrive = new harddrive();
        $disks = $harddrive->getDiskList();
        while (list($disk, $ARRAY_FINAL) = each($disks)) {
            $acc = array();
            if (Folders_interdis($ARRAY_FINAL["MOUNTED"])) {
                continue;
            }
            $path = base64_encode($ARRAY_FINAL["MOUNTED"]);
            $size = $ARRAY_FINAL["SIZE"];
            $pourc = $ARRAY_FINAL["POURC"];
            $pathencurl = urlencode($path);
            $acc[] = "{";
            $acc[] = "\t\"text\": \"{$disk} {$size} {$pourc}% {$used}\",";
            $acc[] = "\t\"classes\": \"disk\",";
            $acc[] = "\t\"id\": \"{$path}\",";
            $acc[] = "\t\"click\": \"BrowserExpand('{$pathencurl}')\",";
            $acc[] = "\t\"hasChildren\": true";
            $acc[] = "}";
            $accolades[] = @implode("\n", $acc);
        }
        $f[] = @implode(",", $accolades);
        $f[] = "]";
        echo @implode("\n", $f);
        return;
    }
    if ($_GET["root"] == "source") {
        $_GET["root"] = base64_encode($root);
    }
    $sock = new sockets();
    $_GET["root"] = base64_decode($_GET["root"]);
    $_GET["root"] = str_replace("//", "/", $_GET["root"]);
    $mount_point = $_GET["root"];
    writelogs("Checking: \"{$_GET["root"]}\"", __FUNCTION__, __FILE__, __LINE__);
    $start_root = urlencode($_GET["root"]);
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?dirdirEncoded={$start_root}")));
    if (is_array($datas)) {
        ksort($datas);
        while (list($num, $val) = each($datas)) {
            if (Folders_interdis($num)) {
                continue;
            }
            $num = basename($num);
            $path = "{$mount_point}/{$num}";
            $path = str_replace("//", "/", $path);
            $pathenc = base64_encode($path);
            $pathencurl = urlencode($pathenc);
            $acc = array();
            $acc[] = "{";
            $acc[] = "\t\"text\": \"{$num}\",";
            $acc[] = "\t\"classes\": \"folder\",";
            $acc[] = "\t\"id\": \"{$pathenc}\",";
            $acc[] = "\t\"hasChildren\": true,";
            $acc[] = "\t\"click\": \"BrowserExpand('{$pathencurl}')\"";
            $acc[] = "}";
            $accolades[] = @implode("\n", $acc);
        }
        $f[] = @implode(",", $accolades);
        $f[] = "]";
        echo @implode("\n", $f);
        return;
    } else {
        writelogs("Checking: dirdir={$start_root} not an array", __FUNCTION__, __FILE__, __LINE__);
    }
    echo "[]";
}