Skip to content

Commit

Permalink
[#564] Escape area names in project evaluation report.
Browse files Browse the repository at this point in the history
We need to use json_encode to properly escape user-entered names in
generated JS code, which might contain special characters.
  • Loading branch information
jaragunde committed Apr 19, 2022
1 parent 473c7ff commit a4bf9d4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions web/projectsEvaluation.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@
data : [
<?php

foreach((array)$areas as $area)
echo "[{$area->getId()}, '{$area->getName()}'],";

?>]});
foreach((array)$areas as $area) {
$areaName = json_encode($area->getName());
echo "[{$area->getId()}, {$areaName}],";
}
?>
]});

function areas(val){

Expand Down

0 comments on commit a4bf9d4

Please sign in to comment.