Alexey Dotsenko - 2005-04-25 09:08:59 -
In reply to message 1 from punknroll
include_once "ftp/ftp_class.php";
$ftp = new ftp();
$ftp->LocalEcho = TRUE;
if(!$ftp->SetServer($conf["ftp"]["host"], (int)$conf["ftp"]["port"])) {
trigger_error(makeError(ED_FTP_CONNECT), E_USER_WARNING);
unset($ftp);
break;
}
if (!$ftp->connect()) {
trigger_error(makeError(ED_FTP_CONNECT), E_USER_WARNING);
unset($ftp);
break;
}
if (!$ftp->login($t["login"], $t["password"])) {
trigger_error(makeError(ED_FTP_LOGIN), E_USER_WARNING);
$ftp->quit();
unset($ftp);
break;
}
if(!$ftp->chdir("/".$cs["dir"])) {
trigger_error(makeError(ED_FTP_CHDIR, "/".$cs["dir"]), E_USER_WARNING);
$ftp->quit();
unset($ftp);
break;
}
$d=$ftp->rawlist("-lA");
if($d===false) {
trigger_error(makeError(ED_FTP_LIST, "/".$cs["dir"]), E_USER_WARNING);
$ftp->quit();
unset($ftp);
break;
}
foreach($d as $dv) {
$dv=$ftp->parselisting($dv);
if($dv["type"]=="f") {
$pinfo=pathinfo($dv["name"]);
if(!in_array(strtolower($pinfo["extension"]), $conf["common"][$cs["type"]."_ext"])) trigger_error(makeError(ND_BAD_EXT, $dv["name"]), E_USER_NOTICE);
else {
if(($dv["perms"] & 00400) != 00400) trigger_error(makeError(ND_FTP_READ_PERMS, $dv["name"]), E_USER_WARNING);
if(($dv["perms"] & 00200) != 00200) trigger_error(makeError(ND_FTP_WRITE_PERMS, $dv["name"]), E_USER_NOTICE);
}
}
}
$ftp->quit();