Skip to content
Snippets Groups Projects
Commit 91cf274f authored by Dries Buytaert's avatar Dries Buytaert
Browse files

Issue #1468210 by marthinal, Eric_A, quicksketch: remove special ->uid == 1...

Issue #1468210 by marthinal, Eric_A, quicksketch: remove special ->uid == 1 check in filefield_validate_size().
parent 83a8e3af
No related branches found
No related tags found
No related merge requests found
......@@ -527,17 +527,17 @@ function file_validate_extensions(File $file, $extensions) {
*/
function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) {
global $user;
$errors = array();
if ($file_limit && $file->filesize > $file_limit) {
$errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit)));
$errors[] = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($file->filesize), '%maxsize' => format_size($file_limit)));
}
// Save a query by only calling file_space_used() when a limit is provided.
// Save a query by only calling file_space_used() when a limit is provided.
if ($user_limit && (file_space_used($user->uid) + $file->filesize) > $user_limit) {
$errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit)));
$errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->filesize), '%quota' => format_size($user_limit)));
}
return $errors;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment