parselisting

Recommend this page to a friend!

      Advanced FTP client class  >  All threads  >  parselisting  >  (Un) Subscribe thread alerts  
Subject:parselisting
Summary:parselisting example
Messages:4
Author:punknroll
Date:2005-04-25 08:01:29
Update:2007-07-23 07:19:05
 

  1. parselisting   Reply   Report abuse  
Picture of punknroll punknroll - 2005-04-25 08:01:29
hey there!

your class is nice, but i can't get make the parselisting function work. can you post an example?

  2. Re: parselisting   Reply   Report abuse  
Picture of Alexey Dotsenko 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();

  3. Re: parselisting   Reply   Report abuse  
Picture of Karl Masche Karl Masche - 2007-07-21 15:39:17 - In reply to message 2 from Alexey Dotsenko
the makeerror function is missing!

  4. Re: parselisting   Reply   Report abuse  
Picture of Alexey Dotsenko Alexey Dotsenko - 2007-07-23 07:19:05 - In reply to message 3 from Karl Masche
Yes, makeError is my custom error processing function

 

For more information send a message to info at phpclasses dot org.