* * Last Modified: 3rd March 2003 * */ error_reporting(0); if (!(include("./modules/header.lib.php"))) { die("
There was an error loading the header module
"); } $file = rawurldecode(param("f", "GET")); if (eregi("win", PHP_OS) == TRUE) { // Check for and replace / in the URL if the system is Windows $file = str_replace("/", "\\", $file); } $file = cleanpath($file); $path = $params["root"] . $file; $hidden = str_replace(basename($file), $hide, $file); if ($file == "") { // The user didn't select a file $source["source"] = $source["no_file"]; $source["file"] = $source["err_caption"]; } else if (file_exists($path) == FALSE) { // The file does not exist $source["source"] = $source["no_such_file"]; $source["file"] = $source["err_caption"]; } else if (file_exists($params["root"] . $hidden) == TRUE || eregi("\.fileman$", basename($file)) == TRUE) { // The admin has disabled access to this directory $source["source"] = $operate["dot_hide"]; $source["file"] = $source["err_caption"]; } else if (filesize($path) == 0) { // The file contains no data $source["source"] = $source["empty"]; $source["file"] = $slash . $file; } else { // Read the file $fp = fopen($path, "r"); $fdata = fread($fp, filesize($path)); fclose($fp); $fdata = str_replace("\\", "\\\\", $fdata); ob_start(); // Start the output buffer highlight_string(trim($fdata)); // Highlight the file $source["source"] = ob_get_contents(); // Collect the content of the buffer ob_end_clean(); // Empty the buffer, and end // Remove the code tags $source["source"] = preg_replace("//i", "", $source["source"]);
$source["source"] = preg_replace("/<\/code>/i", "", $source["source"]);
$source["file"] = get_icon($path) . " " . $slash . $file;
}
// Finish up by outputting the completed page
$source["copyright"] = $copyright;
$source["charset"] = $charset;
$source["gzip"] = preg_replace("/%g/i", $gzip, $misc["gzip"]);
$source["stats"] = preg_replace("/%s/i", endtime($starttime), $misc["stats"]);
echo template($source, $script_dir . "/settings/templates/source.tpl");
// We don't parse the global template for this window.
?>