Fix to allow quiz import to deal with Macintosh OS files (from Paul Shew)

This commit is contained in:
moodler
2003-12-09 02:00:48 +00:00
parent be3737bfc0
commit 2657d7cb46
+8 -2
View File
@@ -78,12 +78,18 @@ class quiz_default_format {
/// Returns complete file with an array, one item per line
if (is_readable($filename)) {
return file($filename);
$filearray = file($filename);
/// Check for Macintosh OS line returns (ie file on one line), and fix
if (ereg("\r", $filearray[0]) AND !ereg("\n", $filearray[0])) {
return explode("\r", $filearray[0]);
} else {
return $filearray;
}
}
return false;
}
function readquestions($lines) {
/// Parses an array of lines into an array of questions,
/// where each item is a question object as defined by