diff --git a/common.php b/common.php index cb92ff8..2051b62 100644 --- a/common.php +++ b/common.php @@ -1,7 +1,34 @@ NB_CHAR) + define("RGXP_NB", NB_CHAR.",".ALLOW_NB_MIN); + else + define("RGXP_NB", ALLOW_NB_MIN.",".NB_CHAR); + } +else + define("RGXP_NB", NB_CHAR); + ?> \ No newline at end of file diff --git a/htdocs/index.php b/htdocs/index.php index 462ccda..c6fa1ce 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -12,34 +12,60 @@ require_once("../common.php"); foreach ($_GET as $k => $t) { - if (preg_match("#^[a-zA-Z0-9]{5}$#", $k) && is_file(DESTINATION . "/" . $k . ".xml")) + if (preg_match("#^[a-zA-Z0-9]{".RGXP_NB."}$#", $k) + && is_file(DESTINATION . "/" . $k . ".xml")) { require_once("../geshi/geshi.php"); $doc = new DOMDocument(); $doc->load(DESTINATION . "/" . $k . ".xml"); - $lang = $doc->getElementsByTagName("language")->item(0)->textContent; + $lang = strtolower($doc->getElementsByTagName("language")->item(0)->textContent); if (empty($lang) || !is_file(GESHI_DIR.$lang.".php")) - $lang = "whitespace"; + $lang = "text"; $geshi = new GeSHi( $doc->getElementsByTagName("content")->item(0)->textContent, $lang); + $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5); + ?>