Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
ftp.api.php
Go to the documentation of this file.
1 <?php
2  if (!function_exists("ftp_connect")) {
3 
4  require_once "ftp.class.php";
5 
6  function ftp_connect($host,$port=21,$timeout=0) { // Opens an FTP connection
7  if ($timeout<1) $timeout = 90;
8  $ftp = new FTP();
9  if (!$ftp->connect($host,$port,$timeout)) return false;
10  return $ftp;
11  }
12  function ftp_login($ftp,$user,$pass) { // Logs in to an FTP connection
13  return $ftp->login($user,$pass);
14  }
15  function ftp_close($ftp) { // Closes an FTP connection
16  $ftp->disconnect();
17  }
18 
19  function ftp_cdup($ftp) { // Changes to the parent directory
20  return $ftp->cdup();
21  }
22  function ftp_chdir($ftp,$directory) { // Changes directories on a FTP server
23  return $ftp->chdir($directory);
24  }
25  function ftp_chmod($ftp,$mode,$filename) { // Set permissions on a file via FTP
26  return $ftp->chmod($mode,$filename);
27  }
28  function ftp_delete($ftp,$path) { // Deletes a file on the FTP server
29  return $ftp->delete($path);
30  }
31  function ftp_exec($ftp,$command) { // Requests execution of a program on the FTP server
32  return $ftp->exec($command);
33  }
34  function ftp_fget($ftp,$handle,$remote_file,$mode,$resumepos=0) { // Downloads a file from the FTP server and saves to an open file
35  return $ftp->fget($handle,$remote_file,$mode,$resumepos);
36  }
37  function ftp_fput($ftp,$remote_file,$handle,$mode,$startpos=0) { // Uploads from an open file to the FTP server
38  return $ftp->fput($remote_file,$handle,$mode,$startpos);
39  }
40  function ftp_get_option($ftp,$option) { // Retrieves various runtime behaviours of the current FTP stream
41  return $ftp->get_option($option);
42  }
43  function ftp_get($ftp,$local_file,$remote_file,$mode,$resumepos=0) { // Downloads a file from the FTP server
44  return $ftp->get($local_file,$remote_file,$mode,$resumepos);
45  }
46  function ftp_mdtm($ftp,$remote_file) { // Returns the last modified time of the given file
47  return $ftp->mdtm($remote_file);
48  }
49  function ftp_mkdir($ftp,$directory) { // Creates a directory
50  return $ftp->mkdir($directory);
51  }
52  function ftp_nb_continue($ftp) { // Continues retrieving/sending a file (non-blocking)
53  return $ftp->nb_continue();
54  }
55  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)
56  return $ftp->nb_fget($handle,$remote_file,$mode,$resumepos);
57  }
58  function ftp_nb_fput($ftp,$remote_file,$handle,$mode,$startpos=0) { // Stores a file from an open file to the FTP server (non-blocking)
59  return $ftp->nb_fput($remote_file,$handle,$mode,$startpos);
60  }
61  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)
62  return $ftp->nb_get($local_file,$remote_file,$mode,$resumepos);
63  }
64  function ftp_nb_put($ftp,$remote_file,$local_file,$mode,$startpos=0) { // Stores a file on the FTP server (non-blocking)
65  return $ftp->nb_put($remote_file,$local_file,$mode,$startpos);
66  }
67  function ftp_nlist($ftp,$directory="") { // Returns a list of files in the given directory
68  return $ftp->nlist($directory);
69  }
70  function ftp_pasv($ftp,$pasv) { // Turns passive mode on or off
71  return $ftp->pasv($pasv);
72  }
73  function ftp_put($ftp,$remote_file,$local_file,$mode,$startpos=0) { // Uploads a file to the FTP server
74  return $ftp->put($remote_file,$local_file,$mode,$startpos);
75  }
76  function ftp_pwd($ftp) { // Returns the current directory name
77  return $ftp->pwd();
78  }
79  function ftp_quit($ftp) { // Alias of ftp_close
80  return $ftp->quit();
81  }
82  function ftp_raw($ftp,$command) { // Sends an arbitrary command to an FTP server
83  return $ftp->raw($command);
84  }
85  function ftp_rawlist($ftp,$directory="") { // Returns a detailed list of files in the given directory
86  return $ftp->rawlist($directory);
87  }
88  function ftp_rename($ftp,$from,$to) { // Renames a file on the FTP server
89  return $ftp->rename($from,$to);
90  }
91  function ftp_rmdir($ftp,$directory) { // Removes a directory
92  return $ftp->rmdir($directory);
93  }
94  function ftp_set_option($ftp,$option,$value) { // Set miscellaneous runtime FTP options
95  return $ftp->set_option($option,$value);
96  }
97  function ftp_site($ftp,$cmd) { // Sends a SITE command to the server
98  return $ftp->site($cmd);
99  }
100  function ftp_size($ftp,$remote_file) { // Returns the size of the given file
101  return $ftp->size($remote_file);
102  }
103  function ftp_ssl_connect($host,$port=21,$timeout=0) { // Opens an Secure SSL-FTP connection
104  if ($timeout<1) $timeout = 90;
105  $ftp = new FTP();
106  if (!$ftp->ssl_connect($host,$port,$timeout)) return false;
107  return $ftp;
108  }
109  function ftp_systype($ftp) { // Returns the system type identifier of the remote FTP server
110  return $ftp->systype();
111  }
112  }
113 ?>