Mercurial > hg > lukkari
comparison index.php @ 106:e7bd58dec4f3
Update for newer framework, add some translations.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 11 Dec 2013 02:03:32 +0200 |
parents | 102816757b86 |
children | 9f976ae7a3e2 |
comparison
equal
deleted
inserted
replaced
105:102816757b86 | 106:e7bd58dec4f3 |
---|---|
62 "en" => "Data for class %1 was not found. If the class code is new, it ". | 62 "en" => "Data for class %1 was not found. If the class code is new, it ". |
63 "should appear in this system during the next update. The data is updated ". | 63 "should appear in this system during the next update. The data is updated ". |
64 "once per week.", | 64 "once per week.", |
65 ), | 65 ), |
66 | 66 |
67 "classListNotFound" => array( | |
68 "fi" => "Luokkien listaa ei löytynyt. Kokeile ladata sivu uudelleen hetken kuluttua.", | |
69 "en" => "Class list not found. An update may be in progress, try reloading in a minute.", | |
70 ), | |
71 | |
72 "classFormatError" => array( | |
73 "fi" => "Virhe! Luokan täytyy olla muotoa <b>XXXnXXX</b>, käytetään vakioarvoa <b>%1</b>.", | |
74 "en" => "Error! Class code must be of format <b>XXXnXXX</b>, using default value of <b>%1</b>.", | |
75 ), | |
76 | |
67 "Style" => array("fi" => "Tyyli"), | 77 "Style" => array("fi" => "Tyyli"), |
68 // "" => array("fi" => ), | 78 // "" => array("fi" => ), |
69 ); | 79 ); |
70 | 80 |
71 | 81 |
72 // Include framework | 82 // Include framework |
73 require "mcommon.inc.php"; | 83 require "mcommon.inc.php"; |
74 require "merrors.inc.php"; | |
75 | 84 |
76 | 85 |
77 function lukGetDayName($day) | 86 function lukGetDayName($day) |
78 { | 87 { |
79 global $lukDayNames, $pageLang; | 88 global $lukDayNames, $pageLang; |
97 global $classDefault; | 106 global $classDefault; |
98 if (preg_match("#^([A-Z]{3}\d[A-Za-z0-9_]{1,6}|ccr|Ryh_[A-Z]{3}\d[A-Za-z0-9_]{1,6})$#", $id, $m)) { | 107 if (preg_match("#^([A-Z]{3}\d[A-Za-z0-9_]{1,6}|ccr|Ryh_[A-Z]{3}\d[A-Za-z0-9_]{1,6})$#", $id, $m)) { |
99 $id = $m[1]; | 108 $id = $m[1]; |
100 return TRUE; | 109 return TRUE; |
101 } else { | 110 } else { |
102 errorMsg("Virhe! Luokan täytyy olla muotoa <b>XXXnXXX</b>, käytetään vakioarvoa <b>".$classDefault."</b>."); | 111 stError(cmQM("classFormatError", $classDefault)); |
103 $id = $classDefault; | 112 $id = $classDefault; |
104 return FALSE; | 113 return FALSE; |
105 } | 114 } |
106 } | 115 } |
107 | 116 |
290 $luokka = $_COOKIE["lukluokka"]; | 299 $luokka = $_COOKIE["lukluokka"]; |
291 lukCheckClassID($luokka); | 300 lukCheckClassID($luokka); |
292 } | 301 } |
293 else | 302 else |
294 { | 303 { |
295 errorMsg(cmQM("classNotSet", $classDefault)); | 304 stError(cmQM("classNotSet", $classDefault)); |
296 $luokka = $classDefault; | 305 $luokka = $classDefault; |
297 } | 306 } |
298 | 307 |
299 | 308 |
300 // Check next period flag | 309 // Check next period flag |
332 } | 341 } |
333 | 342 |
334 | 343 |
335 // Read classfile | 344 // Read classfile |
336 $classes = array(); | 345 $classes = array(); |
337 $fp = @fopen($classIDFile, "rb"); | 346 if (($fp = @fopen($classIDFile, "rb")) !== false) |
338 if ($fp) | |
339 { | 347 { |
340 if (flock($fp, LOCK_SH)) | 348 if (flock($fp, LOCK_SH)) |
341 { | 349 { |
342 while (!feof($fp)) | 350 while (!feof($fp)) |
343 { | 351 { |
349 } | 357 } |
350 fclose($fp); | 358 fclose($fp); |
351 } | 359 } |
352 else | 360 else |
353 { | 361 { |
354 errorMsg("Luokkien listaa ei löytynyt. Kokeile ladata sivu uudelleen hetken kuluttua."); | 362 stError(stQM("classListNotFound")); |
355 } | 363 } |
356 | 364 |
357 | 365 |
358 $dataFile = $cachePath.$luokka.".data"; | 366 $dataFile = $cachePath.$luokka.".data"; |
359 if (!file_exists($dataFile)) | 367 if (!file_exists($dataFile)) |
360 { | 368 { |
361 errorMsg(cmQM("classDataNotFound", lukChEntities($luokka))); | 369 stError(cmQM("classDataNotFound", lukChEntities($luokka))); |
362 $haveData = FALSE; | 370 $haveData = FALSE; |
363 } | 371 } |
364 else | 372 else |
365 { | 373 { |
366 require($dataFile); | 374 require($dataFile); |