MDL-50794 workshop: Improve the file type restricting implementation
authorDavid Mudrák <david@moodle.com>
Wed, 24 Feb 2016 15:49:32 +0000 (16:49 +0100)
committerDavid Mudrák <david@moodle.com>
Thu, 25 Feb 2016 17:03:18 +0000 (18:03 +0100)
commit996f7e8228f7547ad006ceb1489d3f841bb00433
treee7cc6ef14fa088d694d2599f09a831f576eb13ce
parent1a282212c18cea304f6759e163f4821d2268cd3d
MDL-50794 workshop: Improve the file type restricting implementation

This is basically a clean up and what I think improved version of the
original Mahmoud's patch.

The actual checking for allowed file extensions has been re-implemented
and is now covered by unit tests. The list of allowed extensions is now
also assed to the filemanager element's accepted_types option to prevent
picking other files (we still need the in-place validation though). The
form validation is simplified a bit. The custom validation of file size
introduced in the previous patch has been removed as not related to this
issue (also I believe it should not be done at this level).
mod/workshop/db/upgrade.php
mod/workshop/exsubmission.php
mod/workshop/form/assessment_form.php
mod/workshop/lang/en/workshop.php
mod/workshop/lib.php
mod/workshop/locallib.php
mod/workshop/mod_form.php
mod/workshop/submission.php
mod/workshop/submission_form.php
mod/workshop/tests/locallib_test.php