changeset 87:8743ff5302ce

Add some comments, check language setting first to have the proper language set up for translations.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Oct 2012 01:01:32 +0300
parents 4a2082f19626
children d78a063b2053
files index.php
diffstat 1 files changed, 23 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Thu Oct 25 00:58:56 2012 +0300
+++ b/index.php	Thu Oct 25 01:01:32 2012 +0300
@@ -237,6 +237,27 @@
 
 
 // Check given parameters
+// Language must be the first setting to be validated,
+// so that the translation support works properly.
+if (isset($_GET["lang"]))
+{
+  $tmp = strtolower($_GET["lang"]);
+  if (in_array($tmp, $pageLanguages))
+  {
+    $pageLang = $tmp;
+    setcookie("luklang", $tmp, time() + 365*24*60*60); // expire in a year
+  }
+}
+else
+if (isset($_COOKIE["luklang"]))
+{
+  $tmp = $_COOKIE["luklang"];
+  if (in_array($tmp, $pageLanguages))
+    $pageLang = $tmp;
+}
+
+
+// Check if we are using mobile mode
 $mobileMode = FALSE;
 if (isset($_GET["m"]))
 {
@@ -255,6 +276,7 @@
 }
 
 
+// Check class setting
 if (isset($_GET["luokka"]))
 {
   $luokka = $_GET["luokka"];
@@ -276,25 +298,7 @@
 }
 
 
-if (isset($_GET["lang"]))
-{
-  $tmp = strtolower($_GET["lang"]);
-  if (in_array($tmp, $pageLanguages))
-  {
-    $pageLang = $tmp;
-    setcookie("luklang", $tmp, time() + 365*24*60*60); // expire in a year
-  }
-}
-else
-if (isset($_COOKIE["luklang"]))
-{
-  $tmp = $_COOKIE["luklang"];
-  if (in_array($tmp, $pageLanguages))
-    $pageLang = $tmp;
-}
-
-
-
+// Check next period flag
 if (isset($_GET["next"]))
 {
   $nextPeriod = TRUE;