nlopess Sat May 1 07:01:35 2004 EDT
Modified files: /livedocs error.php Log: improved language chooser http://cvs.php.net/diff.php/livedocs/error.php?r1=1.9&r2=1.10&ty=u Index: livedocs/error.php diff -u livedocs/error.php:1.9 livedocs/error.php:1.10 --- livedocs/error.php:1.9 Thu Feb 19 09:38:05 2004 +++ livedocs/error.php Sat May 1 07:01:34 2004 @@ -18,7 +18,7 @@ // | Handles the 404 error and try to redirect to the good place. | // +----------------------------------------------------------------------+ // -// $Id: error.php,v 1.9 2004/02/19 14:38:05 nlopess Exp $ +// $Id: error.php,v 1.10 2004/05/01 11:01:34 nlopess Exp $ /* handle IIS style 404 handler */ if (strncmp($_SERVER['SERVER_SOFTWARE'], "Microsoft", 9) == 0 && @@ -36,19 +36,7 @@ if (!empty($_SERVER['REDIRECT_URL'])) { // This is the requested page that caused the error $current_page = substr($_SERVER['REDIRECT_URL'], strlen(WEBBASE)); - if ($current_page === FALSE) { // This is the manual index ! - echo index_page_header(); - $languages = preg_split('|[\s]+|', LANGUAGES); - sort($languages); - echo 'Choose a language !'; - echo '<ul>'; - foreach ($languages as $language) { - echo '<li><a href="' . WEBBASE . '?l=' . $language . '&q=manual">' . $language . '</a></li>'; - } - echo '</ul>'; - echo index_page_footer(); - exit; - } + if (strncmp(substr($current_page, -5), ".html", 5)) { if (preg_match('|([A-Za-z_]{2,5})/(.*)|', $current_page, $m)) { $current_page = $m[2]; @@ -105,6 +93,26 @@ } else { $current_page = 'manual'; } +} else { + + /* TODO: Add all languages here */ + $langs = array('en' => 'English', + 'de' => 'German', + 'fr' => 'French', + 'pt_BR' => 'Portuguese (Brazilian)'); + + echo index_page_header(); + $languages = preg_split('|[\s]+|', LANGUAGES); + sort($languages); + echo 'Choose a language:'; + echo '<ul>'; + foreach ($languages as $language) { + $link = FORCE_DYNAMIC ? "?l=$language&q=manual" : "$language/manual.html"; + echo '<li><a href="' . WEBBASE . $link . '">' . $langs[$language] . '</a></li>'; + } + echo '</ul>'; + echo index_page_footer(); + exit; } if (empty($current_page)) {