diff options
| author | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2025-02-20 14:19:41 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2025-02-20 14:19:41 +0000 |
| commit | 4511272cd09af9506e9c65cc253918712142aabb (patch) | |
| tree | a6f1d5f97366612fd30251e0e6195846c4fa5056 /app/controllers/vips | |
| parent | f3915d78f86fe2fdd8620139388dfc95cd92925e (diff) | |
pass range_type explicitly instead of using null course_id, fixes #5261
Closes #5261
Merge request studip/studip!3950
Diffstat (limited to 'app/controllers/vips')
| -rw-r--r-- | app/controllers/vips/sheets.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/vips/sheets.php b/app/controllers/vips/sheets.php index 62d4180..714e9cf 100644 --- a/app/controllers/vips/sheets.php +++ b/app/controllers/vips/sheets.php @@ -1751,6 +1751,9 @@ class Vips_SheetsController extends AuthenticatedController CSRFProtection::verifyUnsafeRequest(); $course_id = Context::getId(); + $user_id = $GLOBALS['user']->id; + $range_id = $course_id ?: $user_id; + $range_type = $course_id ? 'course' : 'user'; if ($course_id) { VipsModule::requireStatus('tutor', $course_id); @@ -1775,12 +1778,12 @@ class Vips_SheetsController extends AuthenticatedController $text = file_get_contents($_FILES['upload']['tmp_name'][$i]); if (str_contains($text, '<?xml')) { - $assignment = VipsAssignment::importXML($text, $GLOBALS['user']->id, $course_id); + $assignment = VipsAssignment::importXML($text, $user_id, $range_id, $range_type); } else { // convert from windows-1252 if legacy text format $text = mb_decode_numericentity(mb_convert_encoding($text, 'UTF-8', 'WINDOWS-1252'), [0x100, 0xffff, 0, 0xffff], 'UTF-8'); $test_title = trim(basename($_FILES['upload']['name'][$i], '.txt')); - $assignment = VipsAssignment::importText($test_title, $text, $GLOBALS['user']->id, $course_id); + $assignment = VipsAssignment::importText($test_title, $text, $user_id, $range_id, $range_type); } $num_assignments += 1; |
