509 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
d66a5316ae MDL-73826 phpunit: Allow curl mock responses to handle empty strings
Before this commit, is_empty() was being applied before returning
the mock response. But we want to be able to mock the empty response
for some tests, hence moving the condition to null/isset, that is
the value that array_pop() returns where there aren't more elements
in the array.

With that change performed, we can test lti_load_cartridge() with
empty responses, hence adding a new test for that.
2022-02-11 23:50:05 +01:00
Frode Petterson
080105c6d3 MDL-73588 curl: Fix expected CURLOPT_FILE behavior
After cbf9dfb the CURLOPT_FILE no longer behaves as expected. All
redirect responses are appended to the same stream resource.  This fix
reverts back to the old behavior by setting the stream pointer back to
the beginning for each subsequent redirect.
2022-01-24 17:08:25 +01:00
Michael Hawkins
2a2ece647a MDL-72316 filelib: Add ability for modules to directly load SVG images
This also implements the functionality for SCORM packages, which may
have SVG images embedded within their content which require loading
directly (and are only created by users with appropriate risk flag).
2021-10-28 12:56:52 +08:00
Eloy Lafuente (stronk7)
5307bd2930 Merge branch 'MDL-72242-master-svgforcedfilter' of git://github.com/mudrd8mz/moodle 2021-08-11 11:39:52 +02:00
David Mudrák
079c0b75ee MDL-72242 files: Do not force text filtering of SVG files
It was a mistake to force filtering of SVG files in MDL-55243. It can
easily lead to corrupted SVG files.

The patch removes that forced filtering and clarifies the inline comment
of what and why we need to do.
2021-08-02 15:19:45 +02:00
Tim Hunt
e756c7f73d MDL-72254 filesapi: reject itemid=false in file_save_draft_area_files
This should never happen, and if it does, it causes many files to be deleted.
2021-07-29 12:12:05 +01:00
David Mudrák
92b066bdaf MDL-72203 curl: Check each URL in redirect chain to see if it is blocked
The security problem here was that only the first and the last URL in
the redirect chain was checked by the security helper. This patch forces
the curl wrapper to always emulate cURL redirects and check every
redirect URL in the chain before actually visiting it.
2021-07-27 21:30:16 +08:00
Paul Holden
4f343bd359 MDL-70638 user: correct access checks when serving profile files.
Requests for files from a users profile file area should follow
the same access checks as for the profile itself.
2021-07-06 10:28:24 +01:00
Huong Nguyen
816aa7aec2 MDL-55243 files: Make is_valid_image support SVG files 2021-06-24 09:02:05 +07:00
Shamim Rezaie
9c11ceac1f MDL-69028 repository: Put a rate limit on draft file uploads 2021-05-04 17:23:11 +02:00
Xuan Gui
ed046b8eb1 MDL-70649 files: Alternative security helper
Augument all installed plugin's security helper if there is any.
Plugins function has to be defined as plugintype_pluginname_security_helper in pluginname/lib.php file.
2021-04-14 21:21:35 +10:00
Sara Arjona
134c45e9ee Merge branch 'MDL-69355-master-filebuffer' of git://github.com/mudrd8mz/moodle into master 2020-10-05 18:33:34 +02:00
David Mudrák
801ee23427 MDL-69050 lang: Improve the wording of the comments
Stop using the terms whitelist/blacklist when used to allow/deny things.
2020-09-24 19:41:58 +02:00
David Mudrák
dbaeeeb0ec MDL-69050 lang: Fix variables and methods names in curl_security_helper
The code has been using terms that were found exclusive and potentially
derogatory. Fixing the terms and making the variables and methods
consistent with the related admin settings.
2020-09-24 19:41:57 +02:00
David Mudrák
af30f18a19 MDL-69355 file: Do not attempt to set headers after output started
It was found out that in certain situations there may be some content
in to output handlers buffers. Let's allow that to happen given that:

* default handler's buffer is not sent as a part of the file and an
  error is reported into the server log.
* other handlers' buffer is sent with the assumption that it is required
  for the correct serving of the file.
2020-09-17 17:37:43 +02:00
Sara Arjona
c6bd7bd0ab MDL-61215 core_files: add new optimised_image group
Currently, PHP getimagesize method doesn't support SVG images.
As some features, such as badges, processs and optimise the images
before using them, a new filetype group has been created to exclude
SVG from there: optimised_image.
SVG can't be removed from web_image because then users won't be
able to add SVG images to their courses using labels, pages...
2020-08-14 17:06:23 +02:00
Brendan Heywood
5bf5a7aaeb MDL-68342 files: Add a faster xsendfile method to avoid db lookups 2020-04-27 16:11:34 +10:00
Amaia Anabitarte
33b8ca26f9 MDL-67786 core_contentbank: New content bank contenttype plugin type
Co-authored by: Ferran Recio <ferran@moodle.com>
2020-04-15 23:45:08 +02:00
Brendan Heywood
1fef1de592 MDL-58281 files: Correctly handle missing files in readfile_accel 2019-12-30 17:18:49 +11:00
Brendan Heywood
d46dba32d4 MDL-65693 files: Honor http HEAD requests for files 2019-11-30 16:02:23 +11:00
sam marshall
225eb7b27e MDL-66679 Forms: Submit button remains disabled after file download
When you download a file directly from a Moodle form submit button,
the submit button disables when you click it, but you remain on that
page so we need to re-enable the button.

This commit causes it to re-enable once the file download finishes,
setting a temporary cookie to indicate this to the JavaScript code.

It also adds a method to disable the system on a given form by
setting data-double-submit-protection="off".
2019-10-30 16:36:28 +00:00
Brendan Heywood
d6f5fbb720 MDL-66493 filelib: readstring_accel should never use xsendfile 2019-10-24 21:30:46 +11:00
Eloy Lafuente (stronk7)
25494613f4 Merge branch 'MDL-66304' of https://github.com/golenkovm/moodle 2019-10-14 10:53:24 +02:00
Brendan Heywood
3bc082dd07 MDL-66166 core_useragent: Update MoodleBot UA and treat as web crawler 2019-09-30 23:30:20 +10:00
Mikhail Golenkov
1a15925240 MDL-66304 files: Allow xsendfile support in alternative file system. 2019-09-30 09:00:57 +10:00
Juan Leyva
418a86c660 MDL-66468 file: Return text content when using IGNORE_FILE_MERGE 2019-08-22 13:10:39 +01:00
Matteo Scaramuccia
69a1afd9b9 MDL-65686 setuplib: Fix missing round brackets 2019-05-30 22:41:37 +02:00
Juan Leyva
26e778d1b7 MDL-60680 file: Support any user id when creating tokens for files.
$includetoken parameter type has been changed. Now supports:
   boolean: False indicates to not include the token, true indicates to generate a token for the current user ($USER).
   integer: Indicates to generate a token for the user whose id is the integer value.
2019-04-23 13:16:15 +02:00
Marina Glancy
beff3806d6 MDL-10965 courses: capability to browse course list 2019-04-10 12:35:28 +02:00
Eloy Lafuente (stronk7)
73dd6dea3f Merge branch 'MDL-65038_master' of https://github.com/maksudr/moodle 2019-04-04 20:30:40 +02:00
Juan Leyva
e0695f8764 MDL-64658 files: Support constant to avoid file merging
... in file_save_draft_area_files
2019-03-25 14:57:18 +01:00
maksudr
2ae0c9c7bc MDL-65038 core_files: Fix typo in function mock_response 2019-03-20 20:56:23 +00:00
Mark Nelson
80b6fb7a79 MDL-27520 core_grades: make constant names clearer
Also using them in more locations.
2018-10-17 15:57:27 +08:00
Mark Nelson
c9f6ca1142 MDL-27520 core: allow retrieval of files from grade files areas
Also added 'history' filearea for the history report where files
will be copied to if the site has enabled this feature.

We will also be storing files in the module context, not course,
so that check was removed.
2018-10-17 13:15:45 +08:00
Andrew Nicols
2e8d476165 MDL-36754 core_files: Add back missing baseurl line 2018-08-14 15:54:12 +08:00
Andrew Nicols
91f1f28233 MDL-36754 core_files: Support tokens when rewriting text
Support use of a token for access to pluginfile.php when rewriting text
content.

This is primarily intended for notifications where the user is unlikely
to be logged into Moodle when receiving the notification.
2018-08-14 06:57:32 +08:00
Jun Pataleta
c353ad20c3 MDL-45170 core: Integration review fixes
* Pass $forcehttps parameter to call extract_draft_file_urls_from_text()
 call in \core_weblib_testcase::test_extract_draft_file_urls_from_text()
* Style fixes
2018-08-08 16:17:32 +08:00
Charles Fulton
7d7d3b1731 MDL-45170 files: check other draftfile areas when processing 2018-08-08 16:15:23 +08:00
Adrian Greeve
f38766e166 MDL-62849 files lib: Add method to return all files.
Added a function which returns all the files from all directories
in the draftarea.
2018-07-17 10:25:11 +08:00
Jake Dallimore
4d5046b0eb MDL-51419 core_files: Support for utf8 in file names in MS Edge 2018-06-22 10:29:23 +08:00
Eloy Lafuente (stronk7)
6663f615ed Merge branch 'wip-MDL-60161-master-test' of git://github.com/abgreeve/moodle 2017-12-18 16:09:51 +01:00
Adrian Greeve
48a9856da8 MDL-52100 filelib: Files that are oversized are checked with user.
Files that are oversized could have been uploaded by a user who
can ignore the file size limits. These files should not be deleted
in these situations.
2017-12-18 13:12:22 +08:00
Carson Tam
7d4a3d1d07 MDL-60161 class curl in filelib: Cleaned up doc block. 2017-12-13 11:07:58 +08:00
Carson Tam
a2b66c7833 MDL-60161 class curl in filelib: Avoid duplicate params in http header 2017-12-13 11:07:58 +08:00
Sara Arjona
6820f36bda MDL-57569 core_files: Fix to let show generated f3 image 2017-11-24 11:48:32 +01:00
John Okely
672f483670 MDL-42834 admin: Removal of httpswwwroot 2017-10-23 12:25:36 +08:00
Eloy Lafuente (stronk7)
39dce3073f Merge branch 'MDL-60320' of git://github.com/aolley/moodle 2017-10-17 00:05:54 +02:00
Adam Olley
d12ac53512 MDL-60320 icons: Use PNG icons as the preview thumbnails
Without this change, Moodle fails to provide any data when requesting a
thumbnail for a non-image file as its looking to provide a SVG file that
doesn't exist.
2017-10-10 09:57:17 +10:30
Jake Dallimore
521d900f06 MDL-35429 restore: fixed downloading of automated backup files 2017-10-09 10:29:07 +08:00
Jake Dallimore
7a170fad85 MDL-35290 files: File manager reports files which can't be read 2017-08-29 11:15:30 +08:00