<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Code Igniter
 *
 * An open source application development framework for PHP 4.3.2 or newer
 *
 * @package		CodeIgniter
 * @author		Rick Ellis
 * @copyright	Copyright (c) 2006, pMachine, Inc.
 * @license		http://www.codeignitor.com/user_guide/license.html 
 * @link		http://www.codeigniter.com
 * @since		Version 1.0
 * @filesource
 */
 
// ------------------------------------------------------------------------

/**
 * Zip Compression Class
 *
 * This class is based on a library I found at Zend:
 * http://www.zend.com/codex.php?id=696&single=1
 *
 * The original library is a little rough around the edges so I 
 * refactored it and added several additional methods -- Rick Ellis
 * 
 * @package		CodeIgniter
 * @subpackage	Libraries
 * @category	Encryption
 * @author		Rick Ellis
 * @link		http://www.codeigniter.com/user_guide/general/encryption.html
 */
class CI_Zip  {  

	var $zipfile	= '';	
	var $zipdata	= array();
	var $directory	= array();
	var $offset		= 0;

	function CI_Zip()
	{
		log_message('debug', "Zip Compression Class Initialized");
	}
	

	/**
	 * Add Directory
	 *
	 * Lets you add a virtual directory into which you can place files.
	 *
	 * @access	public
	 * @param	mixed	the directory name. Can be string or array
	 * @return	void
	 */
	function add_dir($directory) 
	{
		foreach ((array)$directory as $dir)
		{
			if ( ! preg_match("|.+/$|", $dir))
			{
				$dir .= '/';
			}
		
			$this->_add_dir($dir);
		}
	}

	// --------------------------------------------------------------------

	/**
	 * Add Directory
	 *
	 * @access	private
	 * @param	string	the directory name
	 * @return	void
	 */
	function _add_dir($dir) 
	{
		$dir = str_replace("\\", "/", $dir);  
		
		$this->zipdata[] = "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00"
							.pack('V', 0)
							.pack('V', 0)
							.pack('V', 0)
							.pack('v', strlen($dir))
							.pack('v', 0)
							.$dir
							.pack('V', 0)
							.pack('V', 0)
							.pack('V', 0); 
		
		$newoffset = strlen(implode('', $this->zipdata));
		
		$record = "\x50\x4b\x01\x02\x00\x00\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00"
					.pack('V',0)
					.pack('V',0)
					.pack('V',0)
					.pack('v', strlen($dir))
					.pack('v', 0)
					.pack('v', 0)
					.pack('v', 0)
					.pack('v', 0)
					.pack('V', 16)
					.pack('V', $this->offset)
					.$dir;
		
		$this->offset = $newoffset;
		$this->directory[] = $record;  
	}
	
	// --------------------------------------------------------------------

	/**
	 * Add Data to Zip
	 *
	 * Lets you add files to the archive. If the path is included
	 * in the filename it will be placed within a directory.  Make
	 * sure you use add_dir() first to create the folder.
	 *
	 * @access	public
	 * @param	mixed
	 * @param	string
	 * @return	void
	 */	
	function add_data($filepath, $data = NULL)
	{
		if (is_array($filepath))
		{
			foreach ($filepath as $path => $data)
			{
				$this->_add_data($path, $data);
			}
		}
		else
		{
			$this->_add_data($filepath, $data);
		}
	}
	
	// --------------------------------------------------------------------

	/**
	 * Add Data to Zip
	 *
	 * @access	private
	 * @param	string	the file name/path
	 * @param	string	the data to be encoded
	 * @return	void
	 */	
	function _add_data($filepath, $data)
	{	
		$filepath = str_replace("\\", "/", $filepath);  
			
		$oldlen	= strlen($data);  
		$crc32	= crc32($data);  
		
		$gzdata = gzcompress($data);
		$gzdata = substr(substr($gzdata, 0, strlen($gzdata) - 4), 2); 	
		$newlen = strlen($gzdata);  
	
		$this->zipdata[] = "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00\x00\x00\x00\x00"
							.pack('V', $crc32)
							.pack('V', $newlen)
							.pack('V', $oldlen)
							.pack('v', strlen($filepath))
							.pack('v', 0)
							.$filepath
							.$gzdata
							.pack('V', $crc32)
							.pack('V', $newlen)
							.pack('V', $oldlen); 
			
		$newoffset = strlen(implode("", $this->zipdata));
		
		$record = "\x50\x4b\x01\x02\x00\x00\x14\x00\x00\x00\x08\x00\x00\x00\x00\x00"
					.pack('V', $crc32)
					.pack('V', $newlen)
					.pack('V', $oldlen)
					.pack('v', strlen($filepath))
					.pack('v', 0)
					.pack('v', 0)
					.pack('v', 0)
					.pack('v', 0)
					.pack('V', 32)
					.pack('V', $this->offset); 
		
		$this->offset = $newoffset;
		$this->directory[] = $record.$filepath;  
	}
	
	// --------------------------------------------------------------------

	/**
	 * Get the Zip file
	 *
	 * @access	public
	 * @return	binary string
	 */	
	function get_zip()
	{ 
		// We cache the zip data so multiple calls
		// do not require recompiling
		if ($this->zipfile != '')
		{
			return $this->zipfile;
		}
	
		// Is there any data to return?
		if (count($this->zipdata) == 0)
		{
			return FALSE;
		}
	
		$data	= implode('', $this->zipdata);  
		$dir	= implode('', $this->directory);  
				
		$this->zipfile = $data.$dir."\x50\x4b\x05\x06\x00\x00\x00\x00"
						.pack('v', sizeof($this->directory))
						.pack('v', sizeof($this->directory))
						.pack('V', strlen($dir))
						.pack('V', strlen($data))
						."\x00\x00";
		
		return $this->zipfile;
	}
	
	// --------------------------------------------------------------------

	/**
	 * Write File
	 *
	 * Lets you write a file
	 *
	 * @access	public
	 * @param	string	the file name
	 * @param	string	the data to be encoded
	 * @return	bool
	 */	
	function write_zip($filepath)
	{
		if ( ! ($fp = fopen($filepath, "wb")))
		{
			return FALSE;
		}
		
		flock($fp, LOCK_EX);	
		fwrite($fp, $this->get_zip());
		flock($fp, LOCK_UN);
		fclose($fp);

		return TRUE;	
	}

	// --------------------------------------------------------------------

	/**
	 * Download
	 *
	 * @access	public
	 * @param	string	the file name
	 * @param	string	the data to be encoded
	 * @return	bool
	 */		
	function download($filename = 'backup.zip')
	{
		if ( ! preg_match("|.+?\.zip$|", $filename))
		{
			$filename .= '.zip';
		}
	
		if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
		{
			header('Content-Type: application/x-zip');
			header('Content-Disposition: inline; filename="'.$filename.'"');
			header('Expires: 0');
			header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
			header("Content-Transfer-Encoding: binary");
			header('Pragma: public');
			header("Content-Length: ".strlen($this->get_zip()));
		} 
		else 
		{
			header('Content-Type: application/x-zip');
			header('Content-Disposition: attachment; filename="'.$filename.'"');
			header("Content-Transfer-Encoding: binary");
			header('Expires: 0');
			header('Pragma: no-cache');
			header("Content-Length: ".strlen($this->get_zip()));
		}
	
		echo $this->get_zip();
	}

	// --------------------------------------------------------------------

	/**
	 * Initialize Data
	 *
	 * Lets you clear current zip data.  Useful if you need to create 
	 * multiple zips with different data.
	 *
	 * @access	public
	 * @return	void
	 */		
	function clear_data()
	{
		$this->zipfile		= '';
		$this->zipdata 		= array();
		$this->directory	= array();
		$this->offset		= array();
	}
	
}
?>