]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3912 checking that the upload succeeded before resizing
authorCash Costello <cash.costello@gmail.com>
Sat, 1 Oct 2011 23:53:37 +0000 (19:53 -0400)
committerCash Costello <cash.costello@gmail.com>
Sat, 1 Oct 2011 23:53:37 +0000 (19:53 -0400)
actions/avatar/upload.php

index 19976ea873b076eb4ed7f366d17f3d5970c1e25a..885a165578c2c670aa74d2e959064ce311cb54ce 100644 (file)
@@ -11,6 +11,11 @@ if (!$owner || !($owner instanceof ElggUser) || !$owner->canEdit()) {
        forward(REFERER);
 }
 
+if ($_FILES['avatar']['error'] != 0) {
+       register_error(elgg_echo('avatar:upload:fail'));
+       forward(REFERER);
+}
+
 //@todo make this configurable?
 $icon_sizes = array(
        'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE),
@@ -42,7 +47,7 @@ foreach ($icon_sizes as $name => $size_info) {
                        $file->delete();
                }
 
-               system_message(elgg_echo('avatar:resize:fail'));
+               register_error(elgg_echo('avatar:resize:fail'));
                forward(REFERER);
        }
 }