Phpfox_Ftp

Description

Handles FTP (File Transfer Protocol).

We mainly use this in the AdminCP to make things easier on Admins to upload new plug-ins or themes without the need to open an FTP client and instead upload a archive and with the access details provided we can use FTP commands to do tasks which normally cant be done via HTTP.

Example:

  1.  // Connect to the FTP server
  2.  Phpfox::getLib('ftp')->connect('192.168.0.2''user''pass');
  3.  
  4.  // Upload a file tot he server
  5.  Phpfox::getLib('ftp')->put('/var/www/sample.jpg''/home/site/public_html/sample.jpg');

Located in /include/library/phpfox/ftp/ftp.class.php (line 30)


	
			
Variable Summary
 resource $_oFtp
Method Summary
 mixed __construct ()
 void chmod (string $sFile, string $iPerm)
 bool connect (string $sHost, string $sUsername, string $sPassword)
 mixed getPath ()
 void mkdir (string $sDir, [bool $bRecurse = false])
 bool move (string $sOld, string $sNew)
 bool put (string $sOld, string $sNew)
 bool rmdir (string $sPath)
 bool test ([mixed $sPage = null])
 bool unlink (string $sFile)
Variables
resource $_oFtp = null (line 39)

Holds FTP resource

  • see: ftp_connect()
  • see: self::__construct()
  • access: private
Methods
Constructor __construct (line 46)

Class constructor. Connects to FTP server.

  • return: Returns TRUE on success, FALSE on failure and NULL if we are to skip the login.
  • access: public
mixed __construct ()
chmod (line 179)

Changes permission on a file/folder

  • see: ftp_chmod()
  • access: public
void chmod (string $sFile, string $iPerm)
  • string $sFile: Full path to the file we are working with
  • string $iPerm: Permission to change the file to
connect (line 87)

Performs a connection to a FTP server

  • return: TRUE on success, FALSE on failure
  • see: ftp_connect()
  • see: ftp_login()
  • access: public
bool connect (string $sHost, string $sUsername, string $sPassword)
  • string $sHost: Host to connect to
  • string $sUsername: User name to use to log into the server
  • string $sPassword: Password to use to log into the server
getPath (line 285)

Try to find the full path of where we are currently located based on the relative position we are allowed to access on the FTP server.

  • return: FALSE if we cannot find where we are, STRING if we can; which is the full path to where we are
  • access: public
mixed getPath ()
mkdir (line 191)

Makes a directory on the server. There is also support to make directories recursively.

  • see: ftp_mkdir()
  • access: public
void mkdir (string $sDir, [bool $bRecurse = false])
  • string $sDir: Full path to the directory to create
  • bool $bRecurse: TRUE will recursively create directories based on the full path and FALSE will not
move (line 161)

Moves a file from one location to another on the FTP server.

  • return: TRUE on success, FALSE on failure
  • see: ftp_rename()
  • access: public
bool move (string $sOld, string $sNew)
  • string $sOld: Full path to the file we are going to move
  • string $sNew: Full path to where we are going to place the file
put (line 132)

Uploads a file from your computer to the server.

  • return: TRUE on success, FALSE on failure
  • see: ftp_put()
  • access: public
bool put (string $sOld, string $sNew)
  • string $sOld: Full path to the file on your computer
  • string $sNew: Full path to where to place the file on the server
rmdir (line 240)

Removes a directory from the FTP server

  • return: TRUE on success, FALSE on failure
  • access: public
bool rmdir (string $sPath)
  • string $sPath: Full path to the directory we should remove
test (line 110)

Tests the current directory if this is where phpFox is installed.

  • return: TRUE if we found phpFox, and FALSE if we didn't
  • access: public
bool test ([mixed $sPage = null])
  • mixed $sPage: NULL is passed by default and we then find the base directory, however if you know where phpFox is installed you can pass the full path here.
unlink (line 229)

Deletes a file on the FTP server

  • return: TRUE on success, FALSE on failure
  • see: ftp_delete()
  • access: public
bool unlink (string $sFile)
  • string $sFile: Full path of the file to delete.

Documentation generated on Tue, 28 Sep 2010 10:36:39 +0200 by phpDocumentor 1.4.0a2