<?php
$allowed =  array("nav.xml", "main.xsl", "xslt.php", "htaccess", "vostro.xml");
$fname = dirname(__FILE__)."/highlighted/".$_GET["f"].".html";

if (in_array($_GET["f"], $allowed)) {
	echo file_get_contents($fname); }
else if (!file_exists($fname)) {
	header("HTTP/1.1 404 Not Found", true, 404);
	echo fourofour(); }
else {
	header("HTTP/1.1 404 Not Found", true, 404);
	echo fourofour(); }

function fourofour() {
	$xml = new DOMDocument;
	$xml->load($_SERVER["DOCUMENT_ROOT"]."/404.xml");
	$stylesheet = new DOMDocument;
	$stylesheet->load($_SERVER["DOCUMENT_ROOT"]."/main.xsl");
	$xsl = new XSLTProcessor();
	$xsl->importStyleSheet($stylesheet);
	$output = $xsl->transformToXML($xml);
	$output = preg_replace("/(\n|\t)+/", "\n", html_entity_decode($output));
	return $output; }
?>
