Web components
File detail
Source code
<?php
// Load configuration
require_once('../config.php');
$config = Config::instance();
$webRoot = $config->webRoot();
// Read requset for DTD
$name = @$_GET['name'];
if (!isNameValid($name)) {
// Script not found
ClassFactory::importClass('Redirect');
header('Content-type: text/html', true, 404);
Redirect::redirect($webRoot.'/NavigationError-UnknownDTD', LangSelect::singleton()->getLang());
}
Header('Content-type: text/plain');
Header('Content-length: '.filesize($name));
readfile($name);
/**
* @return Return true if request for DTD is valid.
*/
function isNameValid($name) {
if (false === ereg('^[A-Za-z_][A-Za-z0-9_]*.dtd$', $name))
return false;
if (!file_exists($name))
return false;
return true;
}
?>