Skip to content

Commit bc7d8ff

Browse files
committed
fix SQL concatenation
1 parent a755d46 commit bc7d8ff

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib_his.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ function get_courses_by_veranstids($veranstids) {
146146
return [];
147147
}
148148

149-
$veranstids_string = implode(',', $veranstids);
150-
$q = pg_query(
151-
$pgDB->connection,
152-
"SELECT veranstid, veranstnr, semester, semestertxt, veranstaltungsart, titel, urlveranst
153-
FROM " .
154-
HIS_VERANSTALTUNG . " as veranst where veranstid in (" . $veranstids_string .
155-
") AND " . "(CURRENT_DATE - CAST(veranst.zeitstempel AS date)) < " .
156-
get_config('local_lsf_unification', 'max_import_age') .
157-
"order by semester,titel;"
158-
);
149+
$veranstids_string = implode(',', array_map('intval', $veranstids));
150+
$max_age = intval(get_config('local_lsf_unification', 'max_import_age'));
151+
152+
$sql = "SELECT veranstid, veranstnr, semester, semestertxt, veranstaltungsart, titel, urlveranst
153+
FROM " . HIS_VERANSTALTUNG . " as veranst
154+
WHERE veranstid in (" . $veranstids_string . ")
155+
AND (CURRENT_DATE - CAST(veranst.zeitstempel AS date)) < " . $max_age . "
156+
ORDER BY semester, titel;";
157+
158+
$q = pg_query($pgDB->connection, $sql);
159159
$result_list = [];
160160
while ($course = pg_fetch_object($q)) {
161161
$result = new stdClass();

0 commit comments

Comments
 (0)