protected function _getFileManager() { $oFile = null; if ($this->_bUseFtp) { $oFile = new BxDolFtp(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost', getParam('sys_ftp_login'), getParam('sys_ftp_password'), getParam('sys_ftp_dir')); if (!$oFile->connect()) { return null; } if (!$oFile->isTrident()) { return null; } } else { $oFile = BxDolFile::getInstance(); } return $oFile; }
protected function performCopy($sPackagePath, &$sHomePath) { if ($this->bUseFtp) { $sLogin = getParam('sys_ftp_login'); $sPassword = getParam('sys_ftp_password'); $sPath = getParam('sys_ftp_dir'); if (empty($sLogin) || empty($sPassword) || empty($sPath)) { return _t('_adm_str_err_no_ftp_info'); } $oFile = new BxDolFtp($_SERVER['HTTP_HOST'], $sLogin, $sPassword, $sPath); if (!$oFile->connect()) { return _t('_adm_str_err_cannot_connect_to_ftp'); } if (!$oFile->isTrident()) { return _t('_adm_str_err_destination_not_valid'); } } else { $oFile = BxDolFile::getInstance(); } $aConfig = self::getModuleConfig($sPackagePath . 'install/config.php'); if (empty($aConfig) || !is_array($aConfig) || empty($aConfig['home_dir'])) { return _t('_adm_str_err_wrong_package_format'); } $sHomePath = $aConfig['home_dir']; if (!$oFile->copy($sPackagePath, 'modules/' . $sHomePath)) { return _t('_adm_str_err_files_copy_failed'); } return true; }