# HG changeset patch # User Matti Hamalainen # Date 1331184659 -7200 # Node ID 2195ede068c88f360f7af6f61761a7622e868ecd # Parent 3ba4feff55cb0fb0c12b5937cbebd24880f3d341 Add chentities() helper function and use it. diff -r 3ba4feff55cb -r 2195ede068c8 index.php --- a/index.php Thu Mar 08 07:25:01 2012 +0200 +++ b/index.php Thu Mar 08 07:30:59 2012 +0200 @@ -1,6 +1,7 @@ (.+?)\s+(\d+)\s*op\s*#", $data, $m)) { // Add data to cache $cache[$id] = array("desc" => $m[1], "op" => intval($m[2])); @@ -113,10 +122,10 @@ } if (isset($cache[$id])) - return "".htmlentities($cache[$id]["desc"]).""; + return "".chentities($cache[$id]["desc"]).""; else - return htmlentities($id); + return chentities($id); } @@ -165,7 +174,7 @@ $dataFile = "cache/".$luokka.".data"; if (!file_exists($dataFile)) { - errorMsg("Luokan ".htmlentities($luokka)." tietoja ei löytynyt! Jos luokkakoodi on uusi, ilmestyy se järjestelmään seuraavan päivityksen aikana. Luokkatiedot päivitetään 2 kertaa vuorokaudessa."); + errorMsg("Luokan ".chentities($luokka)." tietoja ei löytynyt! Jos luokkakoodi on uusi, ilmestyy se järjestelmään seuraavan päivityksen aikana. Luokkatiedot päivitetään 2 kertaa vuorokaudessa."); $haveData = FALSE; } else { require($dataFile); @@ -221,14 +230,14 @@ "".matchCourse($d[0])."".matchCourse($d[1]).""; for ($j = 2; $j < count($d); $j += 2) - $out .= "".htmlentities($d[$j])."".(isset($d[$j+1]) ? htmlentities($d[$j+1]) : "").""; + $out .= "".chentities($d[$j])."".(isset($d[$j+1]) ? chentities($d[$j+1]) : "").""; return $out.""; } else { $out = matchCourse($d[0])."
"; for ($j = 1; $j < count($d); $j++) - $out .= htmlentities($d[$j])."
"; + $out .= chentities($d[$j])."
"; return $out; } @@ -401,7 +410,7 @@ "; foreach ($classes as $class) { - echo " \n"; + echo " \n"; } echo "