Commit Graph

140 Commits

Author SHA1 Message Date
Jake Dallimore
612b210d76 MDL-66147 core: add get_time_interval_string()
Returns a formatted string representation of the difference between two
timestamps, defaulting to 'Xd Xh Xm' format, but supporting custom
format strings containing any chars from:
https://www.php.net/manual/en/dateinterval.format.php.
2019-08-12 09:35:51 +08:00
Amaia Anabitarte
c7f88457cd MDL-61649 email: Send plain/html format emails based on user preference 2019-08-07 11:20:02 +08:00
Nicolas Roeser
76a3cf95b7 MDL-64975 moodlelib: fix float formatting if decsep is ~ (tilde)
Commit 637da99edb has introduced changes
for removing trailing zeroes from the output of function format_float.
Due to a small omission, the function causes a PHP warning when the
string decsep is set to a tilde character ('~'). This is rarely the
case.

The bug lies in using PHP function preg_replace with a string that
contains external input (in this case, including decsep), but without
escaping it for PCRE processing.

This commit fixes the function to also support a tilde character in
string decsep. It also adds tests for having tilde as decimal separator.

Thanks-To:  Jake Dallimore <jake@moodle.com>
2019-06-14 13:05:39 +02:00
Shamim Rezaie
13230ed7f3 MDL-53140 core: Introduced PARAM_LOCALISEDFLOAT 2019-04-29 23:43:11 +10:00
Adrian Greeve
48fa567da2 Merge branch 'MDL-29318-master' of git://github.com/junpataleta/moodle 2019-04-18 13:48:33 +08:00
Jun Pataleta
7f90fb5faf MDL-29318 core: More unit tests for get_complete_user_data() 2019-03-29 13:29:48 +08:00
Shamim Rezaie
206ec32890 MDL-59298 auth: Added get_password_change_info to auth plugins 2019-04-08 18:43:22 +10:00
Jun Pataleta
e1d6600fbe MDL-64950 core: Unit tests for get_complete_user_data() 2019-03-06 12:45:27 +08:00
Amaia Anabitarte
696bdd636d MDL-64385 user: Case insensitive comparison for email domains 2019-01-18 10:06:27 +01:00
Andrew Nicols
0616f045c3 MDL-53566 core: Add support for context locking
This chagne adds support for a new feature known as Context Locking.
This allows a context to be locked, thereby removing all write
capabilities for all users (including admin) for that context, and all
child contexts.
2018-11-13 21:17:40 +08:00
Eloy Lafuente (stronk7)
19456c3956 Merge branch 'MDL-62891-master-callable_name' of git://github.com/mudrd8mz/moodle 2018-10-10 23:29:40 +02:00
Damyon Wiese
1bf3a76a59 MDL-61378 forum: Standardize HTML output for posts
Improve the format of the HTML representing a forum post.

1. Use <article> tag to mark it correctly.
2. Use <time> tag to include the real datetime information.
3. Use <address> tag to specify who and when the post came from.
4. Use heading level tags to mark the subject of each post.
5. Properly nest reply posts within their parent <article>
6. Use a header tab for each article to split the metadata from the content.
7. Use CSS to separate links, not text content.

Because posts are now nested properly, the heading for each one refers to it's own article
and we don't need to generate arbitrary heading level tags depending on how deep the post
is nested.
2018-10-09 09:34:57 +08:00
David Mudrák
905d02f458 MDL-62891 core: Introduce new get_callable_name() function 2018-10-05 09:10:16 +02:00
David Mudrák
6808227b1f MDL-59847 core: Fix display of hidden identity fields in user lists
Places that display list of users (such as course participants page)
with additional identifier fields now respect the user's permission to
view other users' hidden profile fields.
2018-07-27 09:55:22 +02:00
Sara Arjona
7a3707797d MDL-62240 privacy: Avoid error when path is higher than allowed
A new method shorten_filenames has been added to moodlelib.
2018-05-03 09:16:13 +02:00
Andrew Nicols
76cb5a56ea MDL-62240 file: Add includehash to shorten_filename + unit tests 2018-05-03 08:27:12 +02:00
Mihail Geshoski
d609207c3e MDL-61724 resource: Unable to view or download file resource 2018-03-26 11:14:46 +08:00
Andrew Nicols
d7ff2fc28b Merge branch 'MDL-60398-master' of git://github.com/mihailges/moodle 2018-03-14 10:33:03 +08:00
Andrew Nicols
431a3bb674 MDL-61307 core: Add component_class_callback functionality 2018-03-09 10:01:18 +08:00
Mihail Geshoski
757a889b24 MDL-60398 resource: Unable to download folder resource 2018-02-26 16:49:21 +08:00
Eloy Lafuente (stronk7)
801a372dad MDL-60611 phpunit: switch to namespaced phunit classes 2017-11-02 23:45:34 +01:00
John Okely
b58764ff99 MDL-42834 admin: Remove loginhttps 2017-10-23 12:25:35 +08:00
Ruslan Kabalin
e5ece45e84 MDL-59273 core: Remove mailto links support in clean_param. 2017-07-24 16:51:55 +01:00
Ruslan Kabalin
362be64a2b MDL-59255 core: Extend test_clean_param_url.
Add rtmp:// test and some more URL validity tests since we made changes in
validateUrlSyntax function.
2017-07-18 10:29:07 +01:00
David Monllao
ac0553aa64 Merge branch 'MDL-54901' of git://github.com/stronk7/moodle 2017-04-19 11:30:03 +08:00
Eloy Lafuente (stronk7)
55946a892a MDL-54901 phpunit: Change phpunit wwwroot to HTTPS and fix tests
This includes:

- Changing PHPUnit's bootstrap to use https://www...
- Modify all existing expectations to the new wwwroot.
- Amend some tests now with different defaults because of is_https()
- Added a note to main upgrade.php about the change.
2017-04-18 03:40:17 +02:00
Tim Hunt
2524990d09 MDL-58486 user_prefs: always update $USER cache when applicable
set_user_preference and unset_user_preference let you pass the user to
set preferences for as an id. Previously, if you passed $USER->id there,
those methods did not update the Cache in $USER, which was surprising,
and not easy to debug.

Now, we always update the preference cache in $USER if the preference is
being changed for the current user.
2017-04-04 16:20:26 +01:00
Jake Dallimore
62b482938b MDL-58121 email: ensure support user is defined in email_to_user 2017-03-17 09:08:45 +08:00
Marina Glancy
6e65554ea1 MDL-58010 user: allow to update only whitelisted user preferences 2017-03-10 18:04:47 +00:00
Jake Dallimore
9e44cec27f MDL-58038 email: make sure all allowedemaildomain entries are respected
Fixes a bug with exploding the config var, in which trailing carriage
returns were causing string matches to fail.
2017-02-28 12:17:52 +08:00
David Mudrák
7620746f67 MDL-57531 mail: Make validate_email return actual boolean as expected
It was discovered by unit tests that the return value is not a real
boolean as was intuitively expected and documented. To avoid potential
issues with the truthyness in the future, we explicitly cast the return
value to boolean now.
2017-01-04 13:16:07 +01:00
David Mudrák
61367eb639 MDL-57531 mail: Validate the sender's email address
The patch adds validation for the noreplyaddress setting variable, for
the explicit $replyto parameter and for the sender's email. In case of
misconfigured noreplyaddress setting, it falls back to the default
noreply address value. In case of invalid email in the user's record,
the email is not sent.

The patch also adds unit test for the value returned by the function
generate_email_processing_address() so that it can be considered as a
valid email, too.

This is supposed to significantly minimise the risk of exploiting the
vulnerability in PHPMailer's Sender field.
2017-01-04 12:35:19 +01:00
John Okely
a6db4a68e2 MDL-57278 signup: Unit tests covering confirmation link generation 2016-12-08 10:16:29 +08:00
Andrew Nicols
ea10a0319b MDL-56602 core: Lock themerev during upgrade
This also changes install to use a fixed themerev.
2016-11-11 14:15:00 +08:00
Andrew Nicols
9d75a519f3 MDL-56602 themes: Use version number as base themerev 2016-11-10 08:02:31 +08:00
Adrian Greeve
e0789335ee MDL-44467 lib: Unit test updates. 2016-10-28 13:27:00 +08:00
Eloy Lafuente (stronk7)
8dcc999d96 Merge branch 'wip-MDL-55827-master' of git://github.com/marinaglancy/moodle 2016-09-20 01:02:06 +02:00
Dan Poltawski
054da30ba9 MDL-48766 moodlelib: introduce ip_is_public()
For determining if an IP is publicly addressable
2016-09-15 14:53:14 +01:00
Marina Glancy
308ce5b46f MDL-55827 tests: @ does not suppress wrong number of arguments in php7.1 2016-09-06 15:37:30 +08:00
Russell Smith
6a3acc84de MDL-55272 lib: Improve test course create performance
Use core functions that are faster for test file creation.
To support large requests for hashes, the core hash function
must support large hashes without recursion.  PHP has a default
recursion depth of 100 and long hashes don't support this.

Remove transactions as they create performance problems for larger
courses and doesn't introduce significant benefit for developers.

Performance changes meant the times were much faster, a reasonable
guess was taken on performance of an average machine.
2016-08-16 12:00:21 +10:00
Frederic Massart
048f8073d1 Revert "Merge branch 'MDL-54110_master' of https://github.com/marxjohnson/moodle"
This reverts commit 016e0abfbc, reversing
changes made to 58a2f0ac40.
2016-06-23 11:51:44 +08:00
Frederic Massart
796f86f753 Revert "MDL-54110 repositories: Whitespace, Typo + unit test fixes"
This reverts commit 7e4d43e1a2.
2016-06-23 11:51:44 +08:00
Andrew Nicols
7e4d43e1a2 MDL-54110 repositories: Whitespace, Typo + unit test fixes 2016-05-11 10:39:40 +08:00
Andrew Nicols
016e0abfbc Merge branch 'MDL-54110_master' of https://github.com/marxjohnson/moodle 2016-05-11 10:10:57 +08:00
Mark Johnson
121b67411f MDL-54110 repositories: Allow repositories to ignore post_max_size
Repositories can now override usespost() if they don't upload using POST
requests. This restores the ability of users with
moodle/course:ignorefilesizelimits to upload files of unlimited size
lost in MDL-44626.
2016-05-10 16:10:24 +01:00
Frederic Massart
88474db22f MDL-50704 date: Fix invalid timezone mapping for +14
The value Etc/GMT-14 was added to the list of known timezones,
and Etc/GMT+13 & Etc/GMT+14 were removed as they are not valid.

Tests were added to ensure that legacy user timezones are mapped
to known timezones. Other tests were changed to reflect the changes
with regards to Etc/GMT+13 and +-14.
2016-05-09 17:28:38 +08:00
Brendan Heywood
344178035d MDL-53102 tests: corrected phpdocs in email diversion tests
(Introduced by previous patch MDL-52818)
2016-03-14 14:20:10 +11:00
Brendan Heywood
54dceeed88 MDL-53102 email: Ensure all emails generate consistent Message-ID URLs 2016-03-14 14:20:10 +11:00
Brendan Heywood
eca8cf67dc MDL-52818 core: Added CFG->divertallemailsexcept config option
When $CFG->divertallemailsto is specified, this allows a list of email
or domain exceptions to be whitelisted enabling easier testing by groups
of testers who don't share a single email address.
2016-02-09 09:59:20 +00:00
Eloy Lafuente (stronk7)
6e38f41d8e MDL-52567 Core: amend existing test to new counting rules 2016-01-29 10:15:24 +08:00