Beispiel #1
0
 /**
  * Default Constructor.
  *
  * Connects to an SFTP server
  *
  * @param String $host
  * @param optional Integer $port
  * @param optional Integer $timeout
  * @return Net_SFTP
  * @access public
  */
 function __construct($host, $port = 22, $timeout = 10)
 {
     parent::__construct($host, $port, $timeout);
     $this->packet_types = array(1 => 'NET_SFTP_INIT', 2 => 'NET_SFTP_VERSION', 3 => 'NET_SFTP_OPEN', 4 => 'NET_SFTP_CLOSE', 5 => 'NET_SFTP_READ', 6 => 'NET_SFTP_WRITE', 7 => 'NET_SFTP_LSTAT', 9 => 'NET_SFTP_SETSTAT', 11 => 'NET_SFTP_OPENDIR', 12 => 'NET_SFTP_READDIR', 13 => 'NET_SFTP_REMOVE', 14 => 'NET_SFTP_MKDIR', 15 => 'NET_SFTP_RMDIR', 16 => 'NET_SFTP_REALPATH', 17 => 'NET_SFTP_STAT', 18 => 'NET_SFTP_RENAME', 101 => 'NET_SFTP_STATUS', 102 => 'NET_SFTP_HANDLE', 103 => 'NET_SFTP_DATA', 104 => 'NET_SFTP_NAME', 105 => 'NET_SFTP_ATTRS', 200 => 'NET_SFTP_EXTENDED');
     $this->status_codes = array(0 => 'NET_SFTP_STATUS_OK', 1 => 'NET_SFTP_STATUS_EOF', 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE', 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED', 4 => 'NET_SFTP_STATUS_FAILURE', 5 => 'NET_SFTP_STATUS_BAD_MESSAGE', 6 => 'NET_SFTP_STATUS_NO_CONNECTION', 7 => 'NET_SFTP_STATUS_CONNECTION_LOST', 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED');
     // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1
     // the order, in this case, matters quite a lot - see Net_SFTP::_parseAttributes() to understand why
     $this->attributes = array(0x1 => 'NET_SFTP_ATTR_SIZE', 0x2 => 'NET_SFTP_ATTR_UIDGID', 0x4 => 'NET_SFTP_ATTR_PERMISSIONS', 0x8 => 'NET_SFTP_ATTR_ACCESSTIME', -1 << 31 => 'NET_SFTP_ATTR_EXTENDED');
     // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3
     // the flag definitions change somewhat in SFTPv5+.  if SFTPv5+ support is added to this library, maybe name
     // the array for that $this->open5_flags and similarily alter the constant names.
     $this->open_flags = array(0x1 => 'NET_SFTP_OPEN_READ', 0x2 => 'NET_SFTP_OPEN_WRITE', 0x8 => 'NET_SFTP_OPEN_CREATE', 0x10 => 'NET_SFTP_OPEN_TRUNCATE');
     // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2
     // see Net_SFTP::_parseLongname() for an explanation
     $this->file_types = array(1 => 'NET_SFTP_TYPE_REGULAR', 2 => 'NET_SFTP_TYPE_DIRECTORY', 3 => 'NET_SFTP_TYPE_SYMLINK', 4 => 'NET_SFTP_TYPE_SPECIAL');
     $this->_define_array($this->packet_types, $this->status_codes, $this->attributes, $this->open_flags, $this->file_types);
 }
Beispiel #2
0
 /**
  * Default Constructor.
  *
  * Connects to an SFTP server
  *
  * @param String $host
  * @param optional Integer $port
  * @param optional Integer $timeout
  * @return Net_SFTP
  * @access public
  */
 function __construct($host, $port = 22, $timeout = 10)
 {
     parent::__construct($host, $port, $timeout);
     $this->max_sftp_packet = 1 << 15;
     $this->packet_types = array(1 => 'NET_SFTP_INIT', 2 => 'NET_SFTP_VERSION', 3 => 'NET_SFTP_OPEN', 4 => 'NET_SFTP_CLOSE', 5 => 'NET_SFTP_READ', 6 => 'NET_SFTP_WRITE', 7 => 'NET_SFTP_LSTAT', 9 => 'NET_SFTP_SETSTAT', 11 => 'NET_SFTP_OPENDIR', 12 => 'NET_SFTP_READDIR', 13 => 'NET_SFTP_REMOVE', 14 => 'NET_SFTP_MKDIR', 15 => 'NET_SFTP_RMDIR', 16 => 'NET_SFTP_REALPATH', 17 => 'NET_SFTP_STAT', 18 => 'NET_SFTP_RENAME', 19 => 'NET_SFTP_READLINK', 20 => 'NET_SFTP_SYMLINK', 101 => 'NET_SFTP_STATUS', 102 => 'NET_SFTP_HANDLE', 103 => 'NET_SFTP_DATA', 104 => 'NET_SFTP_NAME', 105 => 'NET_SFTP_ATTRS', 200 => 'NET_SFTP_EXTENDED');
     $this->status_codes = array(0 => 'NET_SFTP_STATUS_OK', 1 => 'NET_SFTP_STATUS_EOF', 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE', 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED', 4 => 'NET_SFTP_STATUS_FAILURE', 5 => 'NET_SFTP_STATUS_BAD_MESSAGE', 6 => 'NET_SFTP_STATUS_NO_CONNECTION', 7 => 'NET_SFTP_STATUS_CONNECTION_LOST', 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED', 9 => 'NET_SFTP_STATUS_INVALID_HANDLE', 10 => 'NET_SFTP_STATUS_NO_SUCH_PATH', 11 => 'NET_SFTP_STATUS_FILE_ALREADY_EXISTS', 12 => 'NET_SFTP_STATUS_WRITE_PROTECT', 13 => 'NET_SFTP_STATUS_NO_MEDIA', 14 => 'NET_SFTP_STATUS_NO_SPACE_ON_FILESYSTEM', 15 => 'NET_SFTP_STATUS_QUOTA_EXCEEDED', 16 => 'NET_SFTP_STATUS_UNKNOWN_PRINCIPAL', 17 => 'NET_SFTP_STATUS_LOCK_CONFLICT', 18 => 'NET_SFTP_STATUS_DIR_NOT_EMPTY', 19 => 'NET_SFTP_STATUS_NOT_A_DIRECTORY', 20 => 'NET_SFTP_STATUS_INVALID_FILENAME', 21 => 'NET_SFTP_STATUS_LINK_LOOP', 22 => 'NET_SFTP_STATUS_CANNOT_DELETE', 23 => 'NET_SFTP_STATUS_INVALID_PARAMETER', 24 => 'NET_SFTP_STATUS_FILE_IS_A_DIRECTORY', 25 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_CONFLICT', 26 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_REFUSED', 27 => 'NET_SFTP_STATUS_DELETE_PENDING', 28 => 'NET_SFTP_STATUS_FILE_CORRUPT', 29 => 'NET_SFTP_STATUS_OWNER_INVALID', 30 => 'NET_SFTP_STATUS_GROUP_INVALID', 31 => 'NET_SFTP_STATUS_NO_MATCHING_BYTE_RANGE_LOCK');
     // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1
     // the order, in this case, matters quite a lot - see Net_SFTP::_parseAttributes() to understand why
     $this->attributes = array(0x1 => 'NET_SFTP_ATTR_SIZE', 0x2 => 'NET_SFTP_ATTR_UIDGID', 0x4 => 'NET_SFTP_ATTR_PERMISSIONS', 0x8 => 'NET_SFTP_ATTR_ACCESSTIME', -1 << 31 => 'NET_SFTP_ATTR_EXTENDED');
     // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3
     // the flag definitions change somewhat in SFTPv5+.  if SFTPv5+ support is added to this library, maybe name
     // the array for that $this->open5_flags and similarily alter the constant names.
     $this->open_flags = array(0x1 => 'NET_SFTP_OPEN_READ', 0x2 => 'NET_SFTP_OPEN_WRITE', 0x4 => 'NET_SFTP_OPEN_APPEND', 0x8 => 'NET_SFTP_OPEN_CREATE', 0x10 => 'NET_SFTP_OPEN_TRUNCATE', 0x20 => 'NET_SFTP_OPEN_EXCL');
     // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2
     // see Net_SFTP::_parseLongname() for an explanation
     $this->file_types = array(1 => 'NET_SFTP_TYPE_REGULAR', 2 => 'NET_SFTP_TYPE_DIRECTORY', 3 => 'NET_SFTP_TYPE_SYMLINK', 4 => 'NET_SFTP_TYPE_SPECIAL', 5 => 'NET_SFTP_TYPE_UNKNOWN', 6 => 'NET_SFTP_TYPE_SOCKET', 7 => 'NET_SFTP_TYPE_CHAR_DEVICE', 8 => 'NET_SFTP_TYPE_BLOCK_DEVICE', 9 => 'NET_SFTP_TYPE_FIFO');
     $this->_define_array($this->packet_types, $this->status_codes, $this->attributes, $this->open_flags, $this->file_types);
     if (!defined('NET_SFTP_QUEUE_SIZE')) {
         define('NET_SFTP_QUEUE_SIZE', 50);
     }
 }