From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- .../geshi/contrib/aliased.php | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php (limited to 'extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php') diff --git a/extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php new file mode 100644 index 00000000..cee31289 --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/geshi/contrib/aliased.php @@ -0,0 +1,123 @@ + + * @version $Id: aliased.php 2533 2012-08-15 18:49:04Z benbe $ + */ + +// Your config here +define("SOURCE_ROOT", "/var/www/your/source/root/"); + +// Assume you've put geshi in the include_path already +require_once("geshi.php"); + +// Get path info +$path = SOURCE_ROOT.$_SERVER['PATH_INFO']; + +// Check for dickheads trying to use '../' to get to sensitive areas +$base_path_len = strlen(SOURCE_ROOT); +$real_path = realpath($path); +if(strncmp($real_path, SOURCE_ROOT, $base_path_len)) { + exit("Access outside acceptable path."); +} + +// Check file exists +if(!file_exists($path)) { + exit("File not found ($path)."); +} + +// Prepare GeSHi instance +$geshi = new GeSHi(); +$geshi->set_language('text'); +$geshi->load_from_file($path); +$geshi->set_header_type(GESHI_HEADER_PRE); +$geshi->enable_classes(); +$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10); +$geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true); +$geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true); +$geshi->set_code_style('color: #000020;', 'color: #000020;'); +$geshi->set_link_styles(GESHI_LINK, 'color: #000060;'); +$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;'); +$geshi->set_header_content('Source code viewer - ' . $path . ' - ' . $geshi->get_language_name()); +$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;'); +$geshi->set_footer_content('Parsed in