comparison index.php @ 188:658422c83b49

Change the class setting request parameter and cookie from "luokka" to "class", but also support the old one for backwards compatibility for now.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 13 Jan 2016 08:17:10 +0200
parents 3fca160af8a5
children bc0d7a5d7b8e
comparison
equal deleted inserted replaced
187:3fca160af8a5 188:658422c83b49
496 if (in_array($tmp, $pageLanguages)) 496 if (in_array($tmp, $pageLanguages))
497 $pageLang = $tmp; 497 $pageLang = $tmp;
498 } 498 }
499 499
500 500
501 // Check class setting 501 // Check class setting (check "luokka" for backwards compatibility also)
502 if (($classID = stGetRequestItem("luokka", FALSE, TRUE)) !== FALSE && lukCheckClassID($classID)) 502 if ((($classID = stGetRequestItem("class", FALSE, TRUE)) !== FALSE ||
503 { 503 ($classID = stGetRequestItem("luokka", FALSE, TRUE)) !== FALSE) && lukCheckClassID($classID))
504 setcookie("lukluokka", $classID, time() + 365*24*60*60); // expire in a year 504 {
505 setcookie("lukclass", $classID, time() + 365*24*60*60); // expire in a year
505 } 506 }
506 else 507 else
507 if (isset($_COOKIE["lukluokka"])) 508 if (isset($_COOKIE["lukclass"]))
508 { 509 {
509 $classID = $_COOKIE["lukluokka"]; 510 $classID = $_COOKIE["lukclass"];
510 lukCheckClassID($classID); 511 lukCheckClassID($classID);
511 } 512 }
512 else 513 else
513 { 514 {
514 stError(cmQM("class_not_set", $classDefaultID)); 515 stError(cmQM("class_not_set", $classDefaultID));
629 echo 630 echo
630 "<form id=\"controls\" action=\"".$baseURI."\" method=\"get\">\n". 631 "<form id=\"controls\" action=\"".$baseURI."\" method=\"get\">\n".
631 " <table>\n". 632 " <table>\n".
632 " <tr>\n". 633 " <tr>\n".
633 " <th>\n". 634 " <th>\n".
634 " <select name=\"luokka\">\n"; 635 " <select name=\"class\">\n";
635 636
636 if ($classIDs !== FALSE) 637 if ($classIDs !== FALSE)
637 { 638 {
638 foreach ($classIDs as $id) 639 foreach ($classIDs as $id)
639 { 640 {
658 659
659 if ($haveData) 660 if ($haveData)
660 { 661 {
661 echo 662 echo
662 " <th><a id=\"orig\" class=\"textctrl\" href=\"".$origBaseURI.$classID.$origBaseExt."\" title=\"".cmQM("expl_link_original_data")."\">".cmQM("link_original_data")."</a></th>\n"; 663 " <th><a id=\"orig\" class=\"textctrl\" href=\"".$origBaseURI.$classID.$origBaseExt."\" title=\"".cmQM("expl_link_original_data")."\">".cmQM("link_original_data")."</a></th>\n";
663 //" <th><a id=\"xml\" class=\"textctrl\" href=\"".$baseURI.$cachePath."/".$luokka.".xml\">XML</a></th>\n"; 664 //" <th><a id=\"xml\" class=\"textctrl\" href=\"".$baseURI.$cachePath."/".$class.".xml\">XML</a></th>\n";
664 } 665 }
665 666
666 echo 667 echo
667 " <th><a class=\"textctrl mobile\" href=\"http://tnsp.org/mluk/\" title=\"".cmQM("expl_link_mobile_version")."\">".cmQM("link_mobile_version")."</a></th>\n"; 668 " <th><a class=\"textctrl mobile\" href=\"http://tnsp.org/mluk/\" title=\"".cmQM("expl_link_mobile_version")."\">".cmQM("link_mobile_version")."</a></th>\n";
668 } 669 }
669 670
670 $currURL = $baseURI."?luokka=".$classID."&amp;lang=".$pageLang. 671 $currURL = $baseURI."?class=".$classID."&amp;lang=".$pageLang.
671 (isset($pageCSSIndex) ? "&amp;css=".$pageCSSIndex : ""). 672 (isset($pageCSSIndex) ? "&amp;css=".$pageCSSIndex : "").
672 ($nextPeriod ? "&amp;next" : ""); 673 ($nextPeriod ? "&amp;next" : "");
673 674
674 echo 675 echo
675 " <th><a href=\"".$currURL."\" class=\"textctrl\" title=\"".cmQM("expl_link_current_settings")."\">".cmQM("link_current_settings")."</a></th>\n". 676 " <th><a href=\"".$currURL."\" class=\"textctrl\" title=\"".cmQM("expl_link_current_settings")."\">".cmQM("link_current_settings")."</a></th>\n".