Exemplo n.º 1
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;
 }
 public function __construct()
 {
     parent::__construct();
     $this->connected = true;
 }
Exemplo n.º 3
0
 public function mkdir($path, $chmod)
 {
     if (!ftp_mkdir($this->handle, $path)) {
         return false;
     }
     return parent::mkdir($path, $chmod);
 }
 public function mkdir($path, $chmod)
 {
     if (!$this->ftp->mkdir($path)) {
         return false;
     }
     return parent::mkdir($path, $chmod);
 }