Forráskód Böngészése

Should fix moddle file names in questions see BT#12050

jmontoyaa 8 éve
szülő
commit
f413b2535f
1 módosított fájl, 5 hozzáadás és 4 törlés
  1. 5 4
      main/inc/lib/MoodleImport.php

+ 5 - 4
main/inc/lib/MoodleImport.php

@@ -627,10 +627,11 @@ class MoodleImport
     {
     {
         if ($importedFiles) {
         if ($importedFiles) {
             foreach ($importedFiles as $old => $new) {
             foreach ($importedFiles as $old => $new) {
-                $text = str_replace($old, $new, $text);
-                $old = str_replace(' ', '%20', $old);
-                $text = str_replace($old, $new, $text);
-                //$text = utf8_encode($text);
+                // Ofaj fix moodle file names
+                // In some questions moodle text contains file with name like:
+                // Bild%20Check-In-Formular%20Ausfu%CC%88llen.jpg"
+                // rawurlencode function transforms '' (whitespace) to %20 and so on
+                $text = str_replace(rawurlencode($old), $new, $text);
             }
             }
         }
         }