[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/joomla/client/ -> ftp.php (summary)

(no description)

Copyright: Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
License: GNU/GPL, see LICENSE.php
Version: $Id: ftp.php 14401 2010-01-26 14:10:00Z louis $
File Size: 1467 lines (42 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

JFTP:: (29 methods):
  __construct()
  __destruct()
  getInstance()
  setOptions()
  connect()
  isConnected()
  login()
  quit()
  pwd()
  syst()
  chdir()
  reinit()
  rename()
  chmod()
  delete()
  mkdir()
  restart()
  create()
  read()
  get()
  store()
  write()
  listNames()
  listDetails()
  _putCmd()
  _verifyResponse()
  _passive()
  _findMode()
  _mode()


Class: JFTP  - X-Ref

FTP client class

__construct($options=array()   X-Ref
JFTP object constructor

param: array $options Associative array of options to set

__destruct()   X-Ref
JFTP object destructor

Closes an existing connection, if we have one


getInstance($host = '127.0.0.1', $port = '21', $options = null, $user = null, $pass = null)   X-Ref
Returns a reference to the global FTP connector object, only creating it
if it doesn't already exist.

This method must be invoked as:
<pre>  $ftp = &JFTP::getInstance($host);</pre>

You may optionally specify a username and password in the parameters. If you do so,
you may not login() again with different credentials using the same object.
If you do not use this option, you must quit() the current connection when you
are done, to free it for use by others.

param: string    $host        Host to connect to
param: string    $port        Port to connect to
param: array    $options    Array with any of these options: type=>[FTP_AUTOASCII|FTP_ASCII|FTP_BINARY], timeout=>(int)
param: string    $user        Username to use for a connection
param: string    $pass        Password to use for a connection
return: JFTP    The FTP Client object.

setOptions($options)   X-Ref
Set client options

param: array $options Associative array of options to set
return: boolean True if successful

connect($host = '127.0.0.1', $port = 21)   X-Ref
Method to connect to a FTP server

param: string $host Host to connect to [Default: 127.0.0.1]
param: string $port Port to connect on [Default: port 21]
return: boolean True if successful

isConnected()   X-Ref
Method to determine if the object is connected to an FTP server

return: boolean    True if connected

login($user = 'anonymous', $pass = 'jftp@joomla.org')   X-Ref
Method to login to a server once connected

param: string $user Username to login to the server
param: string $pass Password to login to the server
return: boolean True if successful

quit()   X-Ref
Method to quit and close the connection

return: boolean True if successful

pwd()   X-Ref
Method to retrieve the current working directory on the FTP server

return: string Current working directory

syst()   X-Ref
Method to system string from the FTP server

return: string System identifier string

chdir($path)   X-Ref
Method to change the current working directory on the FTP server

param: string $path Path to change into on the server
return: boolean True if successful

reinit()   X-Ref
Method to reinitialize the server, ie. need to login again

NOTE: This command not available on all servers

return: boolean True if successful

rename($from, $to)   X-Ref
Method to rename a file/folder on the FTP server

param: string $from Path to change file/folder from
param: string $to Path to change file/folder to
return: boolean True if successful

chmod($path, $mode)   X-Ref
Method to change mode for a path on the FTP server

param: string        $path    Path to change mode on
param: string/int    $mode    Octal value to change mode to, e.g. '0777', 0777 or 511
return: boolean        True if successful

delete($path)   X-Ref
Method to delete a path [file/folder] on the FTP server

param: string $path Path to delete
return: boolean True if successful

mkdir($path)   X-Ref
Method to create a directory on the FTP server

param: string $path Directory to create
return: boolean True if successful

restart($point)   X-Ref
Method to restart data transfer at a given byte

param: int $point Byte to restart transfer at
return: boolean True if successful

create($path)   X-Ref
Method to create an empty file on the FTP server

param: string $path Path local file to store on the FTP server
return: boolean True if successful

read($remote, &$buffer)   X-Ref
Method to read a file from the FTP server's contents into a buffer

param: string $remote Path to remote file to read on the FTP server
param: string $buffer Buffer variable to read file contents into
return: boolean True if successful

get($local, $remote)   X-Ref
Method to get a file from the FTP server and save it to a local file

param: string $local Path to local file to save remote file as
param: string $remote Path to remote file to get on the FTP server
return: boolean True if successful

store($local, $remote = null)   X-Ref
Method to store a file to the FTP server

param: string $local Path to local file to store on the FTP server
param: string $remote FTP path to file to create
return: boolean True if successful

write($remote, $buffer)   X-Ref
Method to write a string to the FTP server

param: string $remote FTP path to file to write to
param: string $buffer Contents to write to the FTP server
return: boolean True if successful

listNames($path = null)   X-Ref
Method to list the filenames of the contents of a directory on the FTP server

Note: Some servers also return folder names. However, to be sure to list folders on all
servers, you should use listDetails() instead, if you also need to deal with folders

param: string $path Path local file to store on the FTP server
return: string Directory listing

listDetails($path = null, $type = 'all')   X-Ref
Method to list the contents of a directory on the FTP server

param: string $path Path local file to store on the FTP server
param: string $type Return type [raw|all|folders|files]
param: boolean $search Recursively search subdirectories
return: mixed : if $type is raw: string Directory listing, otherwise array of string with file-names

_putCmd($cmd, $expectedResponse)   X-Ref
Send command to the FTP server and validate an expected response code

param: string $cmd Command to send to the FTP server
param: mixed $expected Integer response code or array of integer response codes
return: boolean True if command executed successfully

_verifyResponse($expected)   X-Ref
Verify the response code from the server and log response if flag is set

param: mixed $expected Integer response code or array of integer response codes
return: boolean True if response code from the server is expected

_passive()   X-Ref
Set server to passive mode and open a data port connection

return: boolean True if successful

_findMode($fileName)   X-Ref
Method to find out the correct transfer mode for a specific file

param: string    $fileName    Name of the file
return: integer    Transfer-mode for this filetype [FTP_ASCII|FTP_BINARY]

_mode($mode)   X-Ref
Set transfer mode

param: int $mode Integer representation of data transfer mode [1:Binary|0:Ascii]
return: boolean True if successful



Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1