english/administrator/components/com_installer/models/install.php
/**
	 * Works out an installation package from a HTTP upload
	 *
	 * @return package definition or false on failure
	 */
Works out an installation package from a HTTP upload
@return package definition or false on failure
Works out an installation package from a HTTP upload @return package definition or false on failure
protected function _getPackageFromUpload()
	{
		$userfile = JRequest::getVar('install_package', null, 'files', 'array');
		if (!(bool) ini_get('file_uploads')) {
			JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLFILE'));
			return false;
		}
		if (!extension_loaded('zlib')) {
			JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB'));
			return false;
		}
		if (!is_array($userfile)) {
			JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED'));
			return false;
		}
		if ($userfile['error'] || $userfile['size'] < 1) {
			JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR'));
			return false;
		}
		$config		= JFactory::getConfig();
		$tmp_dest	= $config->get('tmp_path') . '/' . $userfile['name'];
		$tmp_src	= $userfile['tmp_name'];
		jimport('joomla.filesystem.file');
		$uploaded = JFile::upload($tmp_src, $tmp_dest);
		$package = JInstallerHelper::unpack($tmp_dest);
		return $package;
	}
protected function _getPackageFromUpload ( ) { $ userfile = JRequest :: getVar ( 'install_package' , null , 'files' , 'array' ) ; if ( ! ( bool ) ini_get ( 'file_uploads' ) ) { JError :: raiseWarning ( '' , JText :: _ ( 'COM_INSTALLER_MSG_INSTALL_WARNINSTALLFILE' ) ) ; return false ; } if ( ! extension_loaded ( 'zlib' ) ) { JError :: raiseWarning ( '' , JText :: _ ( 'COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB' ) ) ; return false ; } if ( ! is_array ( $ userfile ) ) { JError :: raiseWarning ( '' , JText :: _ ( 'COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED' ) ) ; return false ; } if ( $ userfile [ 'error' ] || $ userfile [ 'size' ] < 1 ) { JError :: raiseWarning ( '' , JText :: _ ( 'COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR' ) ) ; return false ; } $ config = JFactory :: getConfig ( ) ; $ tmp_dest = $ config -> get ( 'tmp_path' ) . '/' . $ userfile [ 'name' ] ; $ tmp_src = $ userfile [ 'tmp_name' ] ; jimport ( 'joomla.filesystem.file' ) ; $ uploaded = JFile :: upload ( $ tmp_src , $ tmp_dest ) ; $ package = JInstallerHelper :: unpack ( $ tmp_dest ) ; return $ package ; }
Works out an installation package from a HTTP upload
 @return package definition or false on failure
Works out an installation package from a HTTP upload @return package definition or false on failure
// Get the uploaded file information // Make sure that file uploads are enabled in php // Make sure that zlib is loaded so that the package can be unpacked // If there is no uploaded file, we have a problem... // Check if there was a problem uploading the file. // Build the appropriate paths // Move uploaded file // Unpack the downloaded package file