The syntax highlighted source is automatically generated by PHP from
the plaintext script.
If you\'re interested in what\'s behind the several functions we
used, you can always take a look at the source of the following files:
Of course, if you want to see the source of this page, have a look
here.
You can also browse the cvs repository for this website on
cvs.php.net.
';
site_header("Show Source");
// No file param specified
if (!isset($_GET['url'])) {
echo "No page URL specified
";
site_footer();
exit;
}
echo "Source of: " . htmlentities($_GET['url']) . "
";
// Get dirname of the specified URL part
$dir = dirname($_GET['url']);
// Some dir was present in the filename
if (!empty($dir) && !preg_match("!^(\\.|/)$!", $dir)) {
// Check if the specified dir is valid
$legal_dirs = array(
"/manual" => 1,
"/include" => 1,
"/stats" => 1,
"/error" => 1,
"/license" => 1
);
if ((preg_match("!^/manual/!", $dir) || isset($legal_dirs[$dir])) && strpos($dir, "..") === FALSE) {
$page_name = $_SERVER['DOCUMENT_ROOT'] . $_GET['url'];
} else { $page_name = FALSE; }
} else {
$page_name = $_SERVER['DOCUMENT_ROOT'] . '/' . basename($_GET['url']);
}
// Provide some feedback based on the file found
if (!$page_name || @is_dir($page_name)) {
echo "Invalid file or folder specified
\n";
} elseif (file_exists($page_name)) {
highlight_php(join("", file($page_name)));
} else {
echo "This file does not exist.
\n";
}
site_footer();
?>