Exemplo n.º 1
0
            $GRANTACCESS = TRUE;
        }
    }
    if (!$GRANTACCESS) {
        eval("\$inc[action] = \"" . gettemplate("fail.access.noaccess") . "\";");
    } else {
        if ($ftp->connect($accesscodes[host], $accesscodes[port], $accesscodes[user], $accesscodes[pwd])) {
            if ($load[0] == "/") {
                $load = substr($load, 1, strlen($load));
            }
            if (trim($load) != "") {
                $ftp->cchdir($load);
            }
            if (1) {
                $pwd = $ftp->cpwd();
                $folderfiles = rekursive_load_dirs_ftp($accesscodes[path] . $set[path], $pwd);
                eval("\$inc[action] = \"" . gettemplate("uploader.main") . "\";");
            } else {
                eval("\$fail_connect = \"Coudn't locate Ftp.\";");
            }
        } else {
            eval("\$fail_connect = \"Coudn't connect to Ftp.\";");
        }
    }
}
#########################################
if (!$serverid && !$setid || !$inc[action] || $fail_connect) {
    $fail = $fail_connect;
    if (!is_allowed_upload()) {
        eval("\$inc[action] = \"" . gettemplate("fail.access.noaccess") . "\";");
    } else {
Exemplo n.º 2
0
function rekursive_load_dirs_ftp($p = "", $lfp = "")
{
    global $ftp;
    if (!$p) {
        $p = $ftp->cpwd();
    }
    if ($p != ".") {
        if ($p[0] != "/") {
            $p = "/" . $p;
        }
    }
    if ($p[strlen($p) - 1] != "/") {
        $p .= "/";
    }
    if ($lfp != ".") {
        if ($lfp[0] != "/") {
            $lfp = "/" . $lfp;
        }
    }
    if ($lfp[strlen($lfp) - 1] != "/") {
        $lfp .= "/";
    }
    $folders .= "<option value=\"{$p}\">{$p}</option>\r\n";
    $filelist = $ftp->crawlist($p);
    foreach ($filelist as $line) {
        $preg = "(\\S{10})\\s+";
        $preg .= "(\\d+)\\s+";
        $preg .= "(\\S*)\\s+";
        $preg .= "(\\S*)\\s+";
        $preg .= "(\\d*)\\s+";
        $preg .= "(\\S*)\\s+";
        $preg .= "(\\d*)\\s+";
        $preg .= "(\\d{1,2}:\\d{1,2})\\s+";
        $preg .= "(.*)";
        preg_match("#{$preg}#i", $line, $re);
        $attrib = trim($re[1]);
        $f = trim($re[9]);
        if (strtolower($attrib[0]) == "d" && $f[0] != ".") {
            $init = rekursive_load_dirs_ftp($p . $f, $lfp);
            $folders .= $init[0];
            $files .= $init[1];
        } else {
            if (strtolower($lfp) == strtolower($p)) {
                $files .= "<option value=\"{$p}{$f}\">{$f}</option>\r\n";
            }
        }
    }
    return array($folders, $files);
}