# HG changeset patch # User Matti Hamalainen # Date 1351116092 -10800 # Node ID 8743ff5302ce5d99c11b796aa9be8fd79431e16c # Parent 4a2082f196263aee583508da838cb4f4b403cef0 Add some comments, check language setting first to have the proper language set up for translations. diff -r 4a2082f19626 -r 8743ff5302ce index.php --- 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;