summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/aur.inc54
-rw-r--r--web/lib/translator.inc22
2 files changed, 70 insertions, 6 deletions
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
new file mode 100644
index 00000000..c45e1dd2
--- /dev/null
+++ b/web/lib/aur.inc
@@ -0,0 +1,54 @@
+<?
+# common header
+#
+function html_header() {
+ print "<html>\n";
+ print "<head>\n";
+ print "<title>AUR</title>\n";
+ print "<link rel='stylesheet' type='text/css' href='/css/fonts.css'/>\n";
+ print "<link rel='stylesheet' type='text/css' href='/css/containers.css'/>\n";
+ print "<link rel='shortcut icon' href='/favicon.ico'/>\n";
+ print "</head>\n";
+ print "<body bgcolor='white'>\n";
+ print "<table cellspacing='0' ";
+ print "style='background-color: #000; width: 100%;'>\n";
+ print " <tr>\n";
+ print " <td class='preHeader'><span class='preHeader'>AUR: An ";
+ print "ArchLinux project</span></td>\n";
+ print " </tr>\n";
+ print " <tr>\n";
+ print " <td class='headerFill'>\n";
+ print " <table width='100%'>\n";
+ print " <tr>\n";
+ print " <td class='headerDisplay'><a href='";
+ print $_SERVER['PHP_SELF']."'>";
+ print "<img src='/images/aur.png' border='0'></a></td>\n";
+ print " <td class='headerDisplay' align='right'>";
+ print "<span class='fix'>ArchLinux User-community Repository</span></td>\n";
+ print " </tr>\n";
+ print " </table>\n";
+ print " </tr>\n";
+ print "</table>\n";
+ print "<!-- Start of main content -->\n\n";
+
+ return;
+}
+
+# common footer
+#
+function html_footer($ver="") {
+ print "\n\n<!-- End of main content -->";
+ print "<p>\n";
+ if ($ver) {
+ print "<table border='0' cellpadding='0' cellspacing='0' width='90%'>\n";
+ print "<tr><td align='right'>";
+ print "<span class='fix'>".$ver."<span/>\n";
+ print "</td></tr>\n";
+ print "</table>\n";
+ }
+ print "</body>\n</html>";
+ return;
+}
+
+# vim: ts=2 sw=2 noet ft=php
+?>
diff --git a/web/lib/translator.inc b/web/lib/translator.inc
index 2d45f2ab..79eb39c7 100644
--- a/web/lib/translator.inc
+++ b/web/lib/translator.inc
@@ -24,20 +24,30 @@ include_once("common_po.inc");
function _($tag, $args=array()) {
global $_t;
+ global $_REQUEST;
global $LANG;
- # default to English if the lang hasn't been provided
+ $supported_langs = array(
+ "en" => 1, # English
+ "es" => 1, # Español
+ "de" => 1, # Deutsch
+ "fr" => 1, # Français
+ );
+
+ # default to English if the lang hasn't been provided or isn't supported
#
- if (!$LANG) {
- $lang = "en";
- } else {
- $lang = $LANG;
+ $LANG = $_REQUEST['LANG'];
+ if (!$LANG || !array_key_exists($LANG, $supported_langs)) {
+ $LANG = "en";
}
# create the translation, if it doesn't exist, highlight it
#
- $translated = $_t[$lang][$tag];
+ $translated = $_t[$LANG][$tag];
if (!$translated) {
+ # if it's a supported language, but there isn't a translation,
+ # alert the visitor to the missing translation.
+ #
$translated = "<blink><b>_" . $tag . "_</b></blink>";
}