aboutsummaryrefslogtreecommitdiff
path: root/lib/evaluation
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-03-08 11:28:11 +0000
committerElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2023-03-08 11:28:11 +0000
commit9beb0e6d479b1937d310aa41aa84b87f26f9c0a2 (patch)
treed4320f7494cea3a32351e14049d9eb7132f0f92f /lib/evaluation
parent5655e10ff2983579e750c20cdb86be1174339ba3 (diff)
fix sql query, fixes #2285
Closes #2285 Merge request studip/studip!1511
Diffstat (limited to 'lib/evaluation')
-rw-r--r--lib/evaluation/classes/db/EvaluationQuestionDB.class.php28
1 files changed, 10 insertions, 18 deletions
diff --git a/lib/evaluation/classes/db/EvaluationQuestionDB.class.php b/lib/evaluation/classes/db/EvaluationQuestionDB.class.php
index 9c7ce46..b6cea24 100644
--- a/lib/evaluation/classes/db/EvaluationQuestionDB.class.php
+++ b/lib/evaluation/classes/db/EvaluationQuestionDB.class.php
@@ -280,26 +280,18 @@ class EvaluationQuestionDB extends EvaluationObjectDB
{
$db = DBManager::get();
- if (EvaluationObjectDB::getGlobalPerm() == "root") {
- $sql =
- "SELECT" .
- " evalquestion_id " .
- "FROM" .
- " evalquestion " .
- "WHERE" .
- " parent_id = '0' ORDER BY text";
+ if (EvaluationObjectDB::getGlobalPerm() === 'root') {
+ $sql = "SELECT evalquestion_id
+ FROM evalquestion
+ WHERE parent_id = '0'
+ ORDER BY text";
return $db->fetchFirst($sql);
} else {
- $sql =
- "SELECT" .
- " evalquestion_id " .
- "FROM" .
- " evalquestion " .
- "WHERE" .
- " parent_id = '" . $userID . "' " .
- "OR " .
- " parent_id = '0' ORDER BY text";
- $sql .= " ";
+ $sql = "SELECT evalquestion_id
+ FROM evalquestion
+ WHERE parent_id = ?
+ OR parent_id = '0'
+ ORDER BY text";
return $db->fetchFirst($sql, [$userID]);
}
}