526 Commits

Author SHA1 Message Date
Meirza
97ff68fd6b MDL-78159 lib: Added missing properties for core libraries
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-06-21 15:39:53 +07:00
Srdjan
5813741877 MDL-75372 core: url_blocked event
Triggered with check_securityhelper_blocklist(). The event is
also emitting a debugging() message.
2023-05-09 14:11:50 +10:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Laurent David
4281b6e859 MDL-70976 core_files: Allow for draft files url inserted in content
* The file file_remove_editor_orphaned_files should take into account URL that
have been embedded in a tag content instead of an attribute (like src attribute)
* This will fix issue with inserting H5P content in calendar events.
2023-03-29 09:09:56 +02:00
Juan Leyva
27be439eb7 MDL-73708 course: Return geo pattern generated course images via WS 2023-03-22 17:39:07 -03:00
Paul Holden
21bd0c3430 Merge branch 'MDL-76370-publicpaths-proxying' of https://github.com/jaydn/moodle 2023-02-06 11:02:41 +00:00
Marina Glancy
b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
Jaydn Cunningham
6ad6b28a34 MDL-76370 curl: suppress CONNECT header when using HTTP proxy 2023-01-20 14:26:30 +10:30
Mathew May
fbe1ac8e13 MDL-71920 core: update filelib opt name definition 2022-11-11 12:53:24 +08:00
Daniel Neis Araujo
3f83f35a5c MDL-73119 contentbank: Add pluginfile callback to content type plugins 2022-08-16 14:23:33 -03:00
Christina Thee Roperto
de07d85f23 MDL-72349 filelib: update strip_double_headers function 2022-07-19 19:19:46 +10:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Brendan Heywood
9fa26ed911 MDL-72486 core: Add unsafe log and fix options to proxy settings 2022-06-20 11:18:42 +10:00
Andrew Nicols
5aae67880d MDL-73013 filelib: Fix code lint 2022-06-10 13:12:35 +02:00
Andrew Nicols
0b305d9330 MDL-73013 filelib: Address coding style violations 2022-06-10 13:12:35 +02:00
Paul Holden
5215a02444 MDL-73013 calendar: fix serving of files added to category events. 2022-05-12 16:12:15 +01:00
Brendan Heywood
34efb9a19e MDL-59681 file: Stop recursive file serving 2022-03-21 17:50:20 +11:00
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