All pastes #640182 Raw Edit

Mine

public php v1 · immutable
#640182 ·published 2007-07-31 05:24 UTC
rendered paste body
<?phprequire("constants.php");class SophEngine{	private function __construct() { }	function __destruct() { }		public static $instance;		private $authtype;	private $authgroups;	private $appsettings;		public static function Initialize($config) {		if (!isset(self::$instance)) {			$c = __CLASS__;			self::$instance = new $c;		}				XmlConfigurator::Load($config);	}		public function AddApplicationSetting($key, $value) {		self::$instance->appsettings[$key] = $value;	}		private function SetAuthenticationLevel($type, $groups) {		self::$instance->authtype = $type;		self::$instance->authgroups = $groups;	}		private function RunScript($source) {		include(self::$instance->appsettings['RootDirectory'] . $source);	}		public function ProcessClientRequest($path) {		if (preg_match("(/login)", $path)) {			self::$instance->RunScript("/content/src/login.php");			return;		}		$path = substr($path, 1);		$path = substr($path, strpos($path, '/') + 1);		include($path);	}}class XmlConfigurator{	public static function Load($config) {		$file = $config;		$depth = array();		function startElement($parser, $name, $attrs) {			global $tagname;			$tagname = $name;		}				function dataHandler($parser, $data) {			global $tagname;			if ($tagname != "" && $tagname != "Configuration")				SophEngine::AddApplicationSetting($tagname, $data);		}				function endElement($parser, $name) {			global $tagname;			$tagname = "";		}				$xml_parser = xml_parser_create();		xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false);		xml_set_element_handler($xml_parser, "startElement", "endElement");		xml_set_character_data_handler($xml_parser, "dataHandler");				if (!($fp = fopen($file, "r"))) {		    die("could not open XML input");		}		while ($data = fread($fp, 4096)) {		    if (!xml_parse($xml_parser, $data, feof($fp))) {        		die(sprintf("XML error: %s at line %d",                		    xml_error_string(xml_get_error_code($xml_parser)),		                    xml_get_current_line_number($xml_parser)));		    }		}		xml_parser_free($xml_parser);	}}?>