![]() |
Xataface 2.0
Xataface Application Framework
|
00001 <?php 00002 if (!function_exists("ftp_connect")) { 00003 00004 require_once "ftp.class.php"; 00005 00006 function ftp_connect($host,$port=21,$timeout=0) { // Opens an FTP connection 00007 if ($timeout<1) $timeout = 90; 00008 $ftp = new FTP(); 00009 if (!$ftp->connect($host,$port,$timeout)) return false; 00010 return $ftp; 00011 } 00012 function ftp_login($ftp,$user,$pass) { // Logs in to an FTP connection 00013 return $ftp->login($user,$pass); 00014 } 00015 function ftp_close($ftp) { // Closes an FTP connection 00016 $ftp->disconnect(); 00017 } 00018 00019 function ftp_cdup($ftp) { // Changes to the parent directory 00020 return $ftp->cdup(); 00021 } 00022 function ftp_chdir($ftp,$directory) { // Changes directories on a FTP server 00023 return $ftp->chdir($directory); 00024 } 00025 function ftp_chmod($ftp,$mode,$filename) { // Set permissions on a file via FTP 00026 return $ftp->chmod($mode,$filename); 00027 } 00028 function ftp_delete($ftp,$path) { // Deletes a file on the FTP server 00029 return $ftp->delete($path); 00030 } 00031 function ftp_exec($ftp,$command) { // Requests execution of a program on the FTP server 00032 return $ftp->exec($command); 00033 } 00034 function ftp_fget($ftp,$handle,$remote_file,$mode,$resumepos=0) { // Downloads a file from the FTP server and saves to an open file 00035 return $ftp->fget($handle,$remote_file,$mode,$resumepos); 00036 } 00037 function ftp_fput($ftp,$remote_file,$handle,$mode,$startpos=0) { // Uploads from an open file to the FTP server 00038 return $ftp->fput($remote_file,$handle,$mode,$startpos); 00039 } 00040 function ftp_get_option($ftp,$option) { // Retrieves various runtime behaviours of the current FTP stream 00041 return $ftp->get_option($option); 00042 } 00043 function ftp_get($ftp,$local_file,$remote_file,$mode,$resumepos=0) { // Downloads a file from the FTP server 00044 return $ftp->get($local_file,$remote_file,$mode,$resumepos); 00045 } 00046 function ftp_mdtm($ftp,$remote_file) { // Returns the last modified time of the given file 00047 return $ftp->mdtm($remote_file); 00048 } 00049 function ftp_mkdir($ftp,$directory) { // Creates a directory 00050 return $ftp->mkdir($directory); 00051 } 00052 function ftp_nb_continue($ftp) { // Continues retrieving/sending a file (non-blocking) 00053 return $ftp->nb_continue(); 00054 } 00055 function ftp_nb_fget($ftp,$handle,$remote_file,$mode,$resumepos=0) { // Retrieves a file from the FTP server and writes it to an open file (non-blocking) 00056 return $ftp->nb_fget($handle,$remote_file,$mode,$resumepos); 00057 } 00058 function ftp_nb_fput($ftp,$remote_file,$handle,$mode,$startpos=0) { // Stores a file from an open file to the FTP server (non-blocking) 00059 return $ftp->nb_fput($remote_file,$handle,$mode,$startpos); 00060 } 00061 function ftp_nb_get($ftp,$local_file,$remote_file,$mode,$resumepos=0) { // Retrieves a file from the FTP server and writes it to a local file (non-blocking) 00062 return $ftp->nb_get($local_file,$remote_file,$mode,$resumepos); 00063 } 00064 function ftp_nb_put($ftp,$remote_file,$local_file,$mode,$startpos=0) { // Stores a file on the FTP server (non-blocking) 00065 return $ftp->nb_put($remote_file,$local_file,$mode,$startpos); 00066 } 00067 function ftp_nlist($ftp,$directory="") { // Returns a list of files in the given directory 00068 return $ftp->nlist($directory); 00069 } 00070 function ftp_pasv($ftp,$pasv) { // Turns passive mode on or off 00071 return $ftp->pasv($pasv); 00072 } 00073 function ftp_put($ftp,$remote_file,$local_file,$mode,$startpos=0) { // Uploads a file to the FTP server 00074 return $ftp->put($remote_file,$local_file,$mode,$startpos); 00075 } 00076 function ftp_pwd($ftp) { // Returns the current directory name 00077 return $ftp->pwd(); 00078 } 00079 function ftp_quit($ftp) { // Alias of ftp_close 00080 return $ftp->quit(); 00081 } 00082 function ftp_raw($ftp,$command) { // Sends an arbitrary command to an FTP server 00083 return $ftp->raw($command); 00084 } 00085 function ftp_rawlist($ftp,$directory="") { // Returns a detailed list of files in the given directory 00086 return $ftp->rawlist($directory); 00087 } 00088 function ftp_rename($ftp,$from,$to) { // Renames a file on the FTP server 00089 return $ftp->rename($from,$to); 00090 } 00091 function ftp_rmdir($ftp,$directory) { // Removes a directory 00092 return $ftp->rmdir($directory); 00093 } 00094 function ftp_set_option($ftp,$option,$value) { // Set miscellaneous runtime FTP options 00095 return $ftp->set_option($option,$value); 00096 } 00097 function ftp_site($ftp,$cmd) { // Sends a SITE command to the server 00098 return $ftp->site($cmd); 00099 } 00100 function ftp_size($ftp,$remote_file) { // Returns the size of the given file 00101 return $ftp->size($remote_file); 00102 } 00103 function ftp_ssl_connect($host,$port=21,$timeout=0) { // Opens an Secure SSL-FTP connection 00104 if ($timeout<1) $timeout = 90; 00105 $ftp = new FTP(); 00106 if (!$ftp->ssl_connect($host,$port,$timeout)) return false; 00107 return $ftp; 00108 } 00109 function ftp_systype($ftp) { // Returns the system type identifier of the remote FTP server 00110 return $ftp->systype(); 00111 } 00112 } 00113 ?>