diff options
author | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-03-24 17:45:04 +0000 |
---|---|---|
committer | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-03-24 17:45:04 +0000 |
commit | 1b7fd5e67bb77455131a1cb62f46dbf45b7d7b32 (patch) | |
tree | 271af50ef2311962ab81f2585c43e518233d509d /modules/upload | |
parent | f005101afdf61818dc95ca46177544709d719fb0 (diff) | |
download | brdo-1b7fd5e67bb77455131a1cb62f46dbf45b7d7b32.tar.gz brdo-1b7fd5e67bb77455131a1cb62f46dbf45b7d7b32.tar.bz2 |
#54913, problem with checking filesize during uploading if user belongs into more than one role, patch by dopry
Diffstat (limited to 'modules/upload')
-rw-r--r-- | modules/upload/upload.module | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/upload/upload.module b/modules/upload/upload.module index a5f624ab6..000c5ae15 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -285,16 +285,22 @@ function _upload_validate(&$node) { $error['usersize']++; } } - if ($error['extension'] == count($user->roles) && $user->uid != 1) { + + $user_roles = count($user->roles); + $valid = TRUE; + if ($error['extension'] == $user_roles) { form_set_error('upload', t('The selected file %name can not be attached to this post, because it is only possible to attach files with the following extensions: %files-allowed.', array('%name' => theme('placeholder', $file->filename), '%files-allowed' => theme('placeholder', $extensions)))); + $valid = FALSE; } - elseif ($error['uploadsize'] == count($user->roles) && $user->uid != 1) { + elseif ($error['uploadsize'] == $user_roles) { form_set_error('upload', t('The selected file %name can not be attached to this post, because it exceeded the maximum filesize of %maxsize.', array('%name' => theme('placeholder', $file->filename), '%maxsize' => theme('placeholder', format_size($uploadsize))))); + $valid = FALSE; } - elseif ($error['usersize'] == count($user->roles) && $user->uid != 1) { + elseif ($error['usersize'] == $user_roles) { form_set_error('upload', t('The selected file %name can not be attached to this post, because the disk quota of %quota has been reached.', array('%name' => theme('placeholder', $file->filename), '%quota' => theme('placeholder', format_size($usersize))))); + $valid = FALSE; } - if (count($error)) { + if (!$valid) { unset($node->files[$fid], $_SESSION['file_previews'][$fid]); file_delete($file->filepath); } |