示例#1
0
 function __construct()
 {
     $options = EzGA::getAllOptions();
     if (empty($options['ftp_server'])) {
         $this->status = "FTP Server not verified.";
         return;
     } else {
         $this->_server = $options['ftp_server'];
     }
     if (false && function_exists('ftp_ssl_connect')) {
         $this->_connId = ftp_ssl_connect($this->_server);
     } else {
         $this->_connId = ftp_connect($this->_server);
     }
     if (!$this->_connId) {
         $this->status = "Cannot reach FTP server.";
         return;
     }
     if (empty($options['ftp_user'])) {
         $this->status = "FTP User ID not verified.";
         return;
     } else {
         $this->_user = $options['ftp_user'];
     }
     if (empty($options['ftp_password'])) {
         $this->status = "FTP Password not verified.";
         return;
     } else {
         $this->_password = $options['ftp_password'];
     }
     $this->_loggedIn = @ftp_login($this->_connId, $this->_user, $this->_password);
     if (!$this->_loggedIn) {
         $this->status = "FTP login fails";
         return;
     }
     if (empty($options['ftp_rootdir'])) {
         if (!$this->guessDir()) {
             $this->status = "FTP Root Directory needed.";
             $this->_showRootDir = true;
             return;
         }
     } else {
         $this->_dir = $options['ftp_rootdir'];
         ftp_chdir($this->_connId, $this->_dir);
     }
     $this->isReady = true;
 }