MDL-26277 grade import: validate file pointer before reading

This commit is contained in:
Charles Fulton 2012-05-06 20:14:55 -07:00
parent e16e2300c5
commit 280b223d84

View File

@ -125,7 +125,9 @@ if ($formdata = $mform->get_data()) {
fwrite($fp,$text);
fclose($fp);
$fp = fopen($filename, "r");
if (!$fp = fopen($filename, "r")) {
print_error('cannotopenfile');
}
// --- get header (field names) ---
$header = explode($csv_delimiter, fgets($fp, GRADE_CSV_LINE_LENGTH));