Permalink
Browse files

Merge branch 'w38_MDL-35454_m23_bogusmaxsize' of git://github.com/sko…

…dak/moodle into MOODLE_23_STABLE
  • Loading branch information...
2 parents bde7dee + 28ac357 commit 7056f36f3c2ff720af0ef43fadb3d59e6e1df989 @danpoltawski danpoltawski committed Sep 17, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/moodlelib.php
View
@@ -5959,16 +5959,19 @@ function get_max_upload_sizes($sitebytes = 0, $coursebytes = 0, $modulebytes = 0
return array();
}
+ $filesize = array();
$filesize[intval($maxsize)] = display_size($maxsize);
$sizelist = array(10240, 51200, 102400, 512000, 1048576, 2097152,
5242880, 10485760, 20971520, 52428800, 104857600);
- // If custombytes is given then add it to the list.
- if (!is_null($custombytes)) {
- if (is_number($custombytes)) {
- $custombytes = array((int)$custombytes);
+ // If custombytes is given and is valid then add it to the list.
+ if (is_number($custombytes) and $custombytes > 0) {
+ $custombytes = (int)$custombytes;
+ if (!in_array($custombytes, $sizelist)) {
+ $sizelist[] = $custombytes;
}
+ } else if (is_array($custombytes)) {
$sizelist = array_unique(array_merge($sizelist, $custombytes));
}

0 comments on commit 7056f36

Please sign in to comment.