diff --git a/htdocs/application/libraries/geshi/contrib/aliased.php b/htdocs/application/libraries/geshi/contrib/aliased.php index 0d4b283..fb8c4fb 100644 --- a/htdocs/application/libraries/geshi/contrib/aliased.php +++ b/htdocs/application/libraries/geshi/contrib/aliased.php @@ -18,11 +18,23 @@ // 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"); +if (file_exists(__DIR__ . '/../vendor/autoload.php')) { + //composer install + require __DIR__ . '/../vendor/autoload.php'; +} else if (file_exists(__DIR__ . '/../src/geshi.php')) { + //git checkout + require __DIR__ . '/../src/geshi.php'; +} else { + // Assume you've put geshi in the include_path already + require_once("geshi.php"); +} + +if (!isset($_SERVER['PATH_INFO'])) { + die("No file name given.\n"); +} // Get path info -$path = SOURCE_ROOT.$_SERVER['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); diff --git a/htdocs/application/libraries/geshi/contrib/cssgen.php b/htdocs/application/libraries/geshi/contrib/cssgen.php index d0dac0f..6de4346 100644 --- a/htdocs/application/libraries/geshi/contrib/cssgen.php +++ b/htdocs/application/libraries/geshi/contrib/cssgen.php @@ -4,7 +4,7 @@ * ---------- * Author: Nigel McNie (nigel@geshi.org) * Copyright: (c) 2004 Nigel McNie - * Release Version: 1.0.8.12 + * Release Version: 1.0.9.0 * Date Started: 2004/05/20 * * Application to generate custom CSS files for GeSHi (based on an idea by Andreas @@ -30,7 +30,6 @@ * ************************************************************************************/ -set_magic_quotes_runtime(0); // // Functions // @@ -165,21 +164,23 @@ if ( !$step || $step == 1 ) $geshi_lang_path = get_var('geshi-lang-path'); if(strstr($geshi_path, '..')) { - unset($geshi_path); + $geshi_path = null; } if(strstr($geshi_lang_path, '..')) { - unset($geshi_lang_path); + $geshi_lang_path = null; } if ( !$geshi_path ) { - $geshi_path = '../geshi.php'; + $geshi_path = '../src/geshi.php'; } if ( !$geshi_lang_path ) { - $geshi_lang_path = '../geshi/'; + $geshi_lang_path = '../src/geshi/'; } + $no_geshi_dot_php_error = false; + $no_lang_dir_error = false; if ( is_file($geshi_path) && is_readable($geshi_path) ) { // Get file contents and see if GeSHi is in here diff --git a/htdocs/application/libraries/geshi/contrib/cssgen2.php b/htdocs/application/libraries/geshi/contrib/cssgen2.php index cc3c39c..72a2b0f 100644 --- a/htdocs/application/libraries/geshi/contrib/cssgen2.php +++ b/htdocs/application/libraries/geshi/contrib/cssgen2.php @@ -28,19 +28,19 @@ * */ -require dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'geshi.php'; -$geshi = new GeSHi; - -$languages = array(); -if ($handle = opendir($geshi->language_path)) { - while (($file = readdir($handle)) !== false) { - $pos = strpos($file, '.'); - if ($pos > 0 && substr($file, $pos) == '.php') { - $languages[] = substr($file, 0, $pos); - } - } - closedir($handle); +if (file_exists(__DIR__ . '/../vendor/autoload.php')) { + //composer install + require __DIR__ . '/../vendor/autoload.php'; +} else if (file_exists(__DIR__ . '/../src/geshi.php')) { + //git checkout + require __DIR__ . '/../src/geshi.php'; +} else { + // Assume you've put geshi in the include_path already + require_once "geshi.php"; } + +$geshi = new GeSHi(); +$languages = $geshi->get_supported_languages(); sort($languages); header('Content-Type: application/octet-stream'); diff --git a/htdocs/application/libraries/geshi/contrib/example.php b/htdocs/application/libraries/geshi/contrib/example.php index 1ad923d..c5c1cc1 100644 --- a/htdocs/application/libraries/geshi/contrib/example.php +++ b/htdocs/application/libraries/geshi/contrib/example.php @@ -15,14 +15,16 @@ error_reporting(E_ALL); // Rudimentary checking of where GeSHi is. In a default install it will be in ../, but // it could be in the current directory if the include_path is set. There's nowhere else // we can reasonably guess. -if (is_readable('../geshi.php')) { - $path = '../'; -} elseif (is_readable('geshi.php')) { - $path = './'; +if (file_exists(__DIR__ . '/../vendor/autoload.php')) { + //composer install + require __DIR__ . '/../vendor/autoload.php'; +} else if (file_exists(__DIR__ . '/../src/geshi.php')) { + //git checkout + require __DIR__ . '/../src/geshi.php'; } else { - die('Could not find geshi.php - make sure it is in your include path!'); + // Assume you've put geshi in the include_path already + require_once("geshi.php"); } -require $path . 'geshi.php'; $fill_source = false; if (isset($_POST['submit'])) { @@ -94,6 +96,7 @@ if (isset($_POST['submit'])) { } else { // make sure we don't preselect any language $_POST['language'] = null; + $geshi = new GeSHi(); } ?>