diff options
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | langs.inc.php | 25 |
2 files changed, 27 insertions, 0 deletions
@@ -5,6 +5,8 @@ require_once 'langs.inc.php'; +if (isset($_GET['langs'])) { die(show_langs($langs)); } + if (isset($_GET['flang'])) { $lang = array_key_exists($_GET['flang'], $langs) ? $_GET['flang'] : 'en'; diff --git a/langs.inc.php b/langs.inc.php index f5d7d9654..e64913c30 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -46,4 +46,29 @@ function relocate($langs, $page = '', $default_locale = 'en') $page )); die; +} + +/** +*/ +function show_langs($langs) +{ + header('Content-Type: text/html; charset=utf-8'); + $count = count($langs); + $s = <<<S +<!DOCTYPE html> +<html lang="en"> +<head> + <charset="utf-8"> + <meta name="robots" content="noindex,nosnippet"> + <title>Mageia</title> +</head> +<body> +<p><a href="/">Mageia.org</a> is available in {$count} languages:</p> +<ul> +S; + foreach ($langs as $k => $v) { + $s .= sprintf('<li><a href="/%s/" hreflang="%s">%s</a></li>', + $k, $k, $v); + } + echo $s, '</ul><hr /></body></html>'; }
\ No newline at end of file |