<?php
$BASEDIR = "/scripts";
$LANGUAGE_SHEET = array(
'pl' => 'perl',
'php' => 'php',
'c' => 'c',
'cpp' => 'c',
'css' => 'css',
'java' => 'java',
'xml' => 'xml',
'rb' => 'ruby'
);
include("../inc/geshi/geshi.php");
$file = str_replace('../', '', $_REQUEST['file']);
if (!$file) $file = "highlight.php";
preg_match("/\.(.+)$/", $file, $matches);
$lang = $LANGUAGE_SHEET[$matches[1]];
if (!$lang) $lang = $matches[1];
if (!$lang) $lang = "php";
if (!file_exists($file))
{
header("Location: $BASEDIR");
return;
}
elseif ($_SERVER['QUERY_STRING'] == "download")
{
header("Content-type: text/plain");
echo file_get_contents($file);
return;
}
$geshi = new GeSHi(file_get_contents($file), $lang, "../inc/geshi/geshi");
$geshi->enable_classes();
//$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
?>
<html>
<head>
<title>Viewing script file: <?=$file?></title>
<style>
/* GeSHi Stylesheet */
<?=$geshi->get_stylesheet();?>
/* End GeSHi Stylesheet */
/* highlight.php styles */
body {
font-family: Georgia;
font-size: 12px;
}
pre {
background: #FAFAFA;
padding: 20px;
line-height: 14px;
}
.copyright {
margin-top: 20px;
padding: 20px;
text-align: center;
font-size: 14px;
line-height: 20px;
background: #DEDEDE;
}
a:link {
text-decoration: none;
border-bottom: 1px dashed #92CEDE;
border-top: 0;
color: #00B0DA;
}
a:visited {
text-decoration: none;
border-bottom: 1px dashed #92CEDE;
border-top: 0;
color: #00B0DA;
}
a:hover {
text-decoration: none;
border-bottom: 1px dashed #1396CB;
border-top: 1px dashed #1396CB;
color: #1396CB;
}
a:active {
text-decoration: none;
border-bottom: 1px dashed #92CEDE;
border-top: 0;
color: #00B0DA;
}
small {
font-size: 11px;
font-weight: normal;
}
ol {
margin-left: 15px;
list-style-position: outside;
marker-offset: 20px;
}
/* end highlight.php styles */
</style>
</head>
<body>
<h4 class='header'>
Viewing file: <strong><?=$file?></strong> | <a href="./" title="Go back to directory listing">Back to directory listing</a>
<br />
<small>Author: <strong>Loren Segal</strong> | Last modified: <?=date("F d Y h:i a", filemtime($file))?> | <a href="<?=$BASEDIR?>/<?=$file?>?download">Download</a></small>
</h4>
<?=$geshi->parse_code();?>
<div class='copyright'>Powered by <a href="http://qbnz.com/highlighter" title="GeSHi Syntax Highlighter">GeSHi Syntax Highlighting</a> software.<br />
Author of all (other) material unless otherwise specified: <strong>Loren Segal</strong>. Copyright 2005.
</div>
</body>
</html> Powered by
GeSHi Syntax Highlighting software.
Author of all (other) material unless otherwise specified:
Loren Segal. Copyright 2005.