public function connect($host, $login, $password)
 {
     if (!parent::connect($host, $login, $password)) {
         return false;
     }
     require_once litepublisher::$paths->libinclude . 'class-ftp.php';
     $this->ftp = new ftp();
     $this->ftp->setTimeout($this->timeout);
     if ($this->ftp->SetServer($this->host, $this->port) && $this->ftp->connect() && $this->ftp->login($this->login, $this->password)) {
         $this->ftp->SetType(FTP_BINARY);
         $this->ftp->Passive(true);
         $this->ftp->setTimeout($this->timeout);
         $this->connected = true;
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 public function connect($host, $login, $password)
 {
     if (!parent::connect($host, $login, $password)) {
         return false;
     }
     if (empty($this->port)) {
         $this->port = 21;
     }
     $this->handle = $this->ssl && function_exists('ftp_ssl_connect') ? @ftp_ssl_connect($this->host, $this->port, $this->timeout) : @ftp_connect($this->host, $this->port, $this->timeout);
     if ($this->handle && @ftp_login($this->handle, $this->login, $this->password)) {
         @ftp_pasv($this->handle, true);
         if (@ftp_get_option($this->handle, FTP_TIMEOUT_SEC) < $this->timeout) {
             @ftp_set_option($this->handle, FTP_TIMEOUT_SEC, $this->timeout);
         }
         $this->connected = true;
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
 public function connect($host, $login, $password)
 {
     if (!parent::connect($host, $login, $password)) {
         return false;
     }
     if (empty($this->port)) {
         $this->port = 22;
     }
     $this->handle = empty($this->key) ? @ssh2_connect($this->host, $this->port) : @ssh2_connect($this->host, $this->port, $this->hostkey);
     if ($this->handle) {
         $authresult = $this->public_key && $this->private_key ? @ssh2_auth_pubkey_file($this->handle, $this->login, $this->public_key, $this->private_key, $this->password) : @ssh2_auth_password($this->handle, $this->login, $this->password);
         if ($authresult) {
             $this->sftp = ssh2_sftp($this->handle);
             $this->connected = true;
             return true;
         }
     }
     return false;
 }