Mercurial > hg > lukkari
comparison index.php @ 137:657b0b7bf409
More merging with mobile version.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 27 Aug 2014 20:40:46 +0300 |
parents | 48c3012c89d7 |
children | 01c3784d3a90 |
comparison
equal
deleted
inserted
replaced
136:48c3012c89d7 | 137:657b0b7bf409 |
---|---|
4 // (C) Copyright 2010 - 2014 Matti 'ccr' Hämäläinen <ccr@tnsp.org> | 4 // (C) Copyright 2010 - 2014 Matti 'ccr' Hämäläinen <ccr@tnsp.org> |
5 // Yes, this code is rather horrible. :| | 5 // Yes, this code is rather horrible. :| |
6 // | 6 // |
7 // Include framework | 7 // Include framework |
8 require "mcommon.inc.php"; | 8 require "mcommon.inc.php"; |
9 | |
10 // Default settings | |
9 $pageVersion = "2.3"; | 11 $pageVersion = "2.3"; |
10 | 12 $mobileMode = FALSE; |
11 // Default settings | |
12 $baseURI = "http://example.com/"; | 13 $baseURI = "http://example.com/"; |
13 | 14 |
14 $pageLanguages = array("fi", "en"); | 15 $pageLanguages = array("fi", "en"); |
15 $pageCSSData = array("cookie" => "lukcss", "prefix" => "luk"); | 16 $pageCSSData = array("cookie" => "lukcss", "prefix" => "luk"); |
16 $pageCSSAlts = array("blue" => "1", "old" => "2", "purple" => "3", "dark" => "4"); | |
17 | 17 |
18 $classDefaultID = "DEFAULT"; | 18 $classDefaultID = "DEFAULT"; |
19 $classIDFile = "classes.txt"; | 19 $classIDFile = "classes.txt"; |
20 $courseCacheFile = "coursecache.txt"; | 20 $courseCacheFile = "coursecache.txt"; |
21 | 21 |
151 } | 151 } |
152 | 152 |
153 | 153 |
154 function lukMatchCourse($id) | 154 function lukMatchCourse($id) |
155 { | 155 { |
156 global $cache, $cacheDirty, $pageCharset, $pageLang; | 156 global $cache, $cacheDirty, $pageCharset, $pageLang, $mobileMode; |
157 | 157 |
158 $uri = "http://www.oamk.fi/opiskelijalle/rakenne/opinto-opas/koulutusohjelmat/?sivu=oj&kieli=".strtoupper($pageLang)."&koodi1=".$id; | 158 $uri = "http://www.oamk.fi/opiskelijalle/rakenne/opinto-opas/koulutusohjelmat/?sivu=oj&kieli=".strtoupper($pageLang)."&koodi1=".$id; |
159 | 159 |
160 // Create the index | 160 // Create the index |
161 if (!isset($cache[$id])) | 161 if (!isset($cache[$id])) |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 if (isset($cache[$id]) && isset($cache[$id][$pageLang])) | 181 if (isset($cache[$id]) && isset($cache[$id][$pageLang])) |
182 { | 182 { |
183 return "<a target=\"_blank\" title=\"".chentities($id." - ".$cache[$id][$pageLang]["op"]." op"). | 183 if ($mobileMode) |
184 "\" href=\"".chentities($uri)."\">".chentities($cache[$id][$pageLang]["desc"])."</a>"; | 184 { |
185 return "<b>".chentities($cache[$id][$pageLang]["desc"])."</b>"; | |
186 } | |
187 else | |
188 { | |
189 return | |
190 "<a target=\"_blank\" title=\"".chentities($id." - ".$cache[$id][$pageLang]["op"]." op"). | |
191 "\" href=\"".chentities($uri)."\">".chentities($cache[$id][$pageLang]["desc"])."</a>"; | |
192 } | |
185 } | 193 } |
186 else | 194 else |
187 return chentities($id); | 195 return chentities($id); |
188 } | 196 } |
189 | 197 |
391 $pageLang = $tmp; | 399 $pageLang = $tmp; |
392 } | 400 } |
393 | 401 |
394 | 402 |
395 // Check if we are using mobile mode | 403 // Check if we are using mobile mode |
396 $mobileMode = FALSE; | |
397 /* | 404 /* |
398 if (isset($_GET["m"])) | 405 if (isset($_GET["m"])) |
399 { | 406 { |
400 $mobileMode = intval($_GET["m"]); | 407 $mobileMode = intval($_GET["m"]); |
401 setcookie("lukmobile", $mobileMode, time() + 365*24*60*60); // expire in a year | 408 setcookie("lukmobile", $mobileMode, time() + 365*24*60*60); // expire in a year |