Commit ccac02a3 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

profileicons: Missing file check for viruses and upload errors (bug #636985)


Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent e7282b7c
......@@ -149,6 +149,14 @@ $filesize = 0;
function upload_validate(Pieform $form, $values) {
global $USER, $filesize;
require_once('file.php');
require_once('uploadmanager.php');
$um = new upload_manager('file');
if ($error = $um->preprocess_file()) {
$form->set_error('file', $error);
return false;
}
$imageinfo = getimagesize($values['file']['tmp_name']);
if (!$imageinfo || !is_image_type($imageinfo[2])) {
$form->set_error('file', get_string('filenotimage'));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment