From 845c2ae1104baff6fda278cc85fe33e7b3b01b0d Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Mon, 11 Jun 2012 17:21:46 +0700 Subject: [PATCH] MDL-27156 repositories: switched the file manager and the file picker over to using get_user_max_upload_file_size() --- lib/form/filemanager.php | 8 ++++---- lib/form/filepicker.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/form/filemanager.php b/lib/form/filemanager.php index 1f2ce25cc24..f6d968d2841 100644 --- a/lib/form/filemanager.php +++ b/lib/form/filemanager.php @@ -69,7 +69,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element { } } if (!empty($options['maxbytes'])) { - $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']); + $this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $options['maxbytes']); } if (empty($options['return_types'])) { $this->_options['return_types'] = (FILE_INTERNAL | FILE_REFERENCE); @@ -129,8 +129,8 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element { * @param int $maxbytes file size */ function setMaxbytes($maxbytes) { - global $CFG; - $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $maxbytes); + global $CFG, $PAGE; + $this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $maxbytes); } /** @@ -354,7 +354,7 @@ class form_filemanager implements renderable { if (!empty($this->options->maxbytes) && $this->options->maxbytes > 0) { $maxbytes = $this->options->maxbytes; } - $this->options->maxbytes = get_max_upload_file_size($CFG->maxbytes, $coursebytes, $maxbytes); + $this->options->maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes, $coursebytes, $maxbytes); // building file picker options $params = new stdClass(); diff --git a/lib/form/filepicker.php b/lib/form/filepicker.php index c3fad282485..bcee75d22a8 100644 --- a/lib/form/filepicker.php +++ b/lib/form/filepicker.php @@ -79,7 +79,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input { if (!empty($PAGE->course)) { $coursemaxbytes = $PAGE->course->maxbytes; } - $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $coursemaxbytes, $fpmaxbytes); + $this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $coursemaxbytes, $fpmaxbytes); $this->_type = 'filepicker'; parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); }