From 78d4adf7e22401fa5d8b8db7c8c91ea7c3881c47 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 17 Dec 2019 10:44:32 +0800 Subject: [PATCH 01/23] MDL-70151 assign: Fix bulk change for behat Behat does not play well with confirmation dialogues and in some situations it does not wait for the page to reload before starting the next step. This change adds a pending_js call which is only resolved if the cancel button was pressed, otherwise it remains in-progress until the page reloads resetting the entire state of it. --- mod/assign/module.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mod/assign/module.js b/mod/assign/module.js index 111003ba61d..9b7ad6b3c7e 100644 --- a/mod/assign/module.js +++ b/mod/assign/module.js @@ -76,6 +76,7 @@ M.mod_assign.init_grading_table = function(Y) { var batchform = Y.one('form.gradingbatchoperationsform'); if (batchform) { batchform.on('submit', function(e) { + M.util.js_pending('mod_assign/module.js:batch:submit'); checkboxes = Y.all('td.c0 input'); var selectedusers = []; checkboxes.each(function(node) { @@ -102,8 +103,10 @@ M.mod_assign.init_grading_table = function(Y) { confirmmessage = M.util.get_string('batchoperationconfirm' + operation.get('value'), 'assign'); } if (!confirm(confirmmessage)) { + M.util.js_complete('mod_assign/module.js:batch:submit'); e.preventDefault(); } + // Note: Do not js_complete. The page being reloaded will empty it. } }); } From a6edd14d27db87accca89f1457c79ebff1100e1a Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Mon, 23 Nov 2020 20:45:46 +0000 Subject: [PATCH 02/23] MDL-70285 completion upgrade: fix performance of the MDL-69687 code --- lib/db/upgrade.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index d24a5c29a82..685de9e34da 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2786,11 +2786,12 @@ function xmldb_main_upgrade($oldversion) { if ($oldversion < 2021052500.26) { // Delete orphaned course_modules_completion rows; these were not deleted properly // by remove_course_contents function. - $DB->delete_records_subquery('course_modules_completion', 'id', 'id', - "SELECT cmc.id - FROM {course_modules_completion} cmc - LEFT JOIN {course_modules} cm ON cm.id = cmc.coursemoduleid - WHERE cm.id IS NULL"); + $DB->delete_records_select('course_modules_completion', " + NOT EXISTS ( + SELECT 1 + FROM {course_modules} cm + WHERE cm.id = {course_modules_completion}.coursemoduleid + )"); upgrade_main_savepoint(true, 2021052500.26); } From e1153faace168465001f6b0043b83db7cb71554d Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 25 Nov 2020 20:42:09 +0000 Subject: [PATCH 03/23] MDL-70293 libraries: upgrade to version 1.5.6 of SimplePie. --- lib/simplepie/LICENSE.txt | 2 +- lib/simplepie/README.markdown | 10 +++---- lib/simplepie/autoloader.php | 6 ++-- lib/simplepie/library/SimplePie.php | 28 ++++++++++--------- lib/simplepie/library/SimplePie/Author.php | 6 ++-- lib/simplepie/library/SimplePie/Cache.php | 6 ++-- .../library/SimplePie/Cache/Base.php | 6 ++-- lib/simplepie/library/SimplePie/Cache/DB.php | 6 ++-- .../library/SimplePie/Cache/File.php | 6 ++-- .../library/SimplePie/Cache/Memcache.php | 6 ++-- .../library/SimplePie/Cache/Memcached.php | 6 ++-- .../library/SimplePie/Cache/MySQL.php | 6 ++-- lib/simplepie/library/SimplePie/Caption.php | 6 ++-- lib/simplepie/library/SimplePie/Category.php | 6 ++-- .../SimplePie/Content/Type/Sniffer.php | 8 +++--- lib/simplepie/library/SimplePie/Copyright.php | 6 ++-- lib/simplepie/library/SimplePie/Core.php | 6 ++-- lib/simplepie/library/SimplePie/Credit.php | 6 ++-- .../SimplePie/Decode/HTML/Entities.php | 6 ++-- lib/simplepie/library/SimplePie/Enclosure.php | 6 ++-- lib/simplepie/library/SimplePie/Exception.php | 6 ++-- lib/simplepie/library/SimplePie/File.php | 15 ++++------ .../library/SimplePie/HTTP/Parser.php | 6 ++-- lib/simplepie/library/SimplePie/IRI.php | 10 +++---- lib/simplepie/library/SimplePie/Item.php | 10 +++---- lib/simplepie/library/SimplePie/Locator.php | 8 +++--- lib/simplepie/library/SimplePie/Misc.php | 11 ++++---- lib/simplepie/library/SimplePie/Net/IPv6.php | 8 +++--- .../library/SimplePie/Parse/Date.php | 27 +++++++++++++++--- lib/simplepie/library/SimplePie/Parser.php | 6 ++-- lib/simplepie/library/SimplePie/Rating.php | 6 ++-- lib/simplepie/library/SimplePie/Registry.php | 6 ++-- .../library/SimplePie/Restriction.php | 6 ++-- lib/simplepie/library/SimplePie/Sanitize.php | 15 +++------- lib/simplepie/library/SimplePie/Source.php | 6 ++-- .../SimplePie/XML/Declaration/Parser.php | 6 ++-- lib/simplepie/library/SimplePie/gzdecode.php | 6 ++-- lib/simplepie/readme_moodle.txt | 5 ++-- lib/thirdpartylibs.xml | 2 +- 39 files changed, 159 insertions(+), 150 deletions(-) diff --git a/lib/simplepie/LICENSE.txt b/lib/simplepie/LICENSE.txt index a822a4bd98a..6503e83c13c 100644 --- a/lib/simplepie/LICENSE.txt +++ b/lib/simplepie/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2004-2007, Ryan Parman and Geoffrey Sneddon. +Copyright (c) 2004-2007, Ryan Parman and Sam Sneddon. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are diff --git a/lib/simplepie/README.markdown b/lib/simplepie/README.markdown index c346204d0c0..5522b7b7222 100644 --- a/lib/simplepie/README.markdown +++ b/lib/simplepie/README.markdown @@ -11,9 +11,7 @@ compatibility and standards compliance][what_is]. Requirements ------------ -* PHP 5.3.0+ (5.3.6+ recommended since SimplePie 1.4.2) - * Support for PHP 5.2 stopped in branch `one-dot-three` - * Support for PHP 4 stopped in branch `one-dot-two` +* PHP 5.6+ (Required since SimplePie 1.5.3) * libxml2 (certain 2.7.x releases are too buggy for words, and will crash) * One of iconv, mbstring or intl extensions * cURL or fsockopen() @@ -89,14 +87,14 @@ Authors and contributors ### Alumni * [Ryan McCue][] (developer, support) * [Ryan Parman][] (Creator, developer, evangelism, support) -* [Geoffrey Sneddon][] (Lead developer) +* [Sam Sneddon][] (Lead developer) * [Michael Shipley][] (Submitter of patches, support) * [Steve Minutillo][] (Submitter of patches) -[Malcolm Blaney]: https://unicyclic.com/mal +[Malcolm Blaney]: https://mblaney.xyz [Ryan McCue]: http://ryanmccue.info [Ryan Parman]: http://ryanparman.com -[Geoffrey Sneddon]: http://gsnedders.com +[Sam Sneddon]: https://gsnedders.com [Michael Shipley]: http://michaelpshipley.com [Steve Minutillo]: http://minutillo.com/steve/ diff --git a/lib/simplepie/autoloader.php b/lib/simplepie/autoloader.php index fd7690da2c7..e42f07b3aa0 100644 --- a/lib/simplepie/autoloader.php +++ b/lib/simplepie/autoloader.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie.php b/lib/simplepie/library/SimplePie.php index c4c6f611c8a..a6a5a9e137c 100644 --- a/lib/simplepie/library/SimplePie.php +++ b/lib/simplepie/library/SimplePie.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2017, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2017, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,10 +33,10 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.5.3 - * @copyright 2004-2017 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @version 1.5.6 + * @copyright 2004-2017 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -50,7 +50,7 @@ define('SIMPLEPIE_NAME', 'SimplePie'); /** * SimplePie Version */ -define('SIMPLEPIE_VERSION', '1.5.3'); +define('SIMPLEPIE_VERSION', '1.5.6'); /** * SimplePie Build @@ -665,9 +665,9 @@ class SimplePie */ public function __construct() { - if (version_compare(PHP_VERSION, '5.3', '<')) + if (version_compare(PHP_VERSION, '5.6', '<')) { - trigger_error('Please upgrade to PHP 5.3 or newer.'); + trigger_error('Please upgrade to PHP 5.6 or newer.'); die(); } @@ -706,7 +706,7 @@ class SimplePie */ public function __destruct() { - if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) + if (!gc_enabled()) { if (!empty($this->data['items'])) { @@ -1251,8 +1251,8 @@ class SimplePie /** * Set the handler to enable the display of cached images. * - * @param str $page Web-accessible path to the handler_image.php file. - * @param str $qs The query string that the value should be passed to. + * @param string $page Web-accessible path to the handler_image.php file. + * @param string $qs The query string that the value should be passed to. */ public function set_image_handler($page = false, $qs = 'i') { @@ -1373,7 +1373,8 @@ class SimplePie // Decide whether to enable caching if ($this->cache && $parsed_feed_url['scheme'] !== '') { - $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc')); + $url = $this->feed_url . ($this->force_feed ? '#force_feed' : ''); + $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $url), 'spc')); } // Fetch the data via SimplePie_File into $this->raw_data @@ -1712,8 +1713,8 @@ class SimplePie } $cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc')); } - $this->feed_url = $file->url; } + $this->feed_url = $file->url; $locate = null; } @@ -1911,7 +1912,8 @@ class SimplePie * * When the 'permanent' mode is disabled (default), * may or may not be different from the URL passed to {@see set_feed_url()}, - * depending on whether auto-discovery was used. + * depending on whether auto-discovery was used, and whether there were + * any redirects along the way. * * @since Preview Release (previously called `get_feed_url()` since SimplePie 0.8.) * @todo Support diff --git a/lib/simplepie/library/SimplePie/Author.php b/lib/simplepie/library/SimplePie/Author.php index 14794cf2706..563932f4c62 100644 --- a/lib/simplepie/library/SimplePie/Author.php +++ b/lib/simplepie/library/SimplePie/Author.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Cache.php b/lib/simplepie/library/SimplePie/Cache.php index d98cc651164..9c5577d9566 100644 --- a/lib/simplepie/library/SimplePie/Cache.php +++ b/lib/simplepie/library/SimplePie/Cache.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Cache/Base.php b/lib/simplepie/library/SimplePie/Cache/Base.php index 333fb05cfa5..522ff7e10e8 100644 --- a/lib/simplepie/library/SimplePie/Cache/Base.php +++ b/lib/simplepie/library/SimplePie/Cache/Base.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Cache/DB.php b/lib/simplepie/library/SimplePie/Cache/DB.php index 7e8f7753251..74d57b8da7d 100644 --- a/lib/simplepie/library/SimplePie/Cache/DB.php +++ b/lib/simplepie/library/SimplePie/Cache/DB.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Cache/File.php b/lib/simplepie/library/SimplePie/Cache/File.php index a09dea637f6..03758e923bd 100644 --- a/lib/simplepie/library/SimplePie/Cache/File.php +++ b/lib/simplepie/library/SimplePie/Cache/File.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Cache/Memcache.php b/lib/simplepie/library/SimplePie/Cache/Memcache.php index 5190eef933f..caf785275a9 100644 --- a/lib/simplepie/library/SimplePie/Cache/Memcache.php +++ b/lib/simplepie/library/SimplePie/Cache/Memcache.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Cache/Memcached.php b/lib/simplepie/library/SimplePie/Cache/Memcached.php index 1f73b3890ef..0b40d87c80a 100644 --- a/lib/simplepie/library/SimplePie/Cache/Memcached.php +++ b/lib/simplepie/library/SimplePie/Cache/Memcached.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Cache/MySQL.php b/lib/simplepie/library/SimplePie/Cache/MySQL.php index 061ed043a8c..a684eb83344 100644 --- a/lib/simplepie/library/SimplePie/Cache/MySQL.php +++ b/lib/simplepie/library/SimplePie/Cache/MySQL.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Caption.php b/lib/simplepie/library/SimplePie/Caption.php index 85485760312..3d7bfdd7164 100644 --- a/lib/simplepie/library/SimplePie/Caption.php +++ b/lib/simplepie/library/SimplePie/Caption.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Category.php b/lib/simplepie/library/SimplePie/Category.php index df0f13f9a18..e4dabed8b13 100644 --- a/lib/simplepie/library/SimplePie/Category.php +++ b/lib/simplepie/library/SimplePie/Category.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Content/Type/Sniffer.php b/lib/simplepie/library/SimplePie/Content/Type/Sniffer.php index b86dfa33ce9..027e131ef9c 100644 --- a/lib/simplepie/library/SimplePie/Content/Type/Sniffer.php +++ b/lib/simplepie/library/SimplePie/Content/Type/Sniffer.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -150,7 +150,7 @@ class SimplePie_Content_Type_Sniffer } elseif (preg_match('/[\x00-\x08\x0E-\x1A\x1C-\x1F]/', $this->file->body)) { - return 'application/octect-stream'; + return 'application/octet-stream'; } return 'text/plain'; diff --git a/lib/simplepie/library/SimplePie/Copyright.php b/lib/simplepie/library/SimplePie/Copyright.php index a57f323e686..92f9b09471d 100644 --- a/lib/simplepie/library/SimplePie/Copyright.php +++ b/lib/simplepie/library/SimplePie/Copyright.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Core.php b/lib/simplepie/library/SimplePie/Core.php index c856ba3612b..ffcca46f53d 100644 --- a/lib/simplepie/library/SimplePie/Core.php +++ b/lib/simplepie/library/SimplePie/Core.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Credit.php b/lib/simplepie/library/SimplePie/Credit.php index 064a1b8646b..d6ff07eba65 100644 --- a/lib/simplepie/library/SimplePie/Credit.php +++ b/lib/simplepie/library/SimplePie/Credit.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Decode/HTML/Entities.php b/lib/simplepie/library/SimplePie/Decode/HTML/Entities.php index 773481a8c84..a43c374b384 100644 --- a/lib/simplepie/library/SimplePie/Decode/HTML/Entities.php +++ b/lib/simplepie/library/SimplePie/Decode/HTML/Entities.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Enclosure.php b/lib/simplepie/library/SimplePie/Enclosure.php index ddbbc3c929c..32216d848cb 100644 --- a/lib/simplepie/library/SimplePie/Enclosure.php +++ b/lib/simplepie/library/SimplePie/Enclosure.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Exception.php b/lib/simplepie/library/SimplePie/Exception.php index 53c015e77c4..7a04c560cc7 100644 --- a/lib/simplepie/library/SimplePie/Exception.php +++ b/lib/simplepie/library/SimplePie/Exception.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/File.php b/lib/simplepie/library/SimplePie/File.php index c73e0fbc9ce..90ad8196a67 100644 --- a/lib/simplepie/library/SimplePie/File.php +++ b/lib/simplepie/library/SimplePie/File.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -109,11 +109,6 @@ class SimplePie_File curl_setopt($fp, CURLOPT_REFERER, $url); curl_setopt($fp, CURLOPT_USERAGENT, $useragent); curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); - if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) - { - curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects); - } foreach ($curl_options as $curl_param => $curl_value) { curl_setopt($fp, $curl_param, $curl_value); } @@ -148,7 +143,7 @@ class SimplePie_File $this->redirects++; $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); $previousStatusCode = $this->status_code; - $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); + $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen, $curl_options); $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; return; } @@ -233,7 +228,7 @@ class SimplePie_File $this->redirects++; $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); $previousStatusCode = $this->status_code; - $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); + $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen, $curl_options); $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; return; } diff --git a/lib/simplepie/library/SimplePie/HTTP/Parser.php b/lib/simplepie/library/SimplePie/HTTP/Parser.php index 7d6188dd1b5..1dbe06c3e32 100644 --- a/lib/simplepie/library/SimplePie/HTTP/Parser.php +++ b/lib/simplepie/library/SimplePie/HTTP/Parser.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/IRI.php b/lib/simplepie/library/SimplePie/IRI.php index ffba232b1e3..a02de682c5b 100644 --- a/lib/simplepie/library/SimplePie/IRI.php +++ b/lib/simplepie/library/SimplePie/IRI.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -46,10 +46,10 @@ * * @package SimplePie * @subpackage HTTP - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Steve Minutillo * @author Ryan McCue - * @copyright 2007-2012 Geoffrey Sneddon, Steve Minutillo, Ryan McCue + * @copyright 2007-2012 Sam Sneddon, Steve Minutillo, Ryan McCue * @license http://www.opensource.org/licenses/bsd-license.php */ class SimplePie_IRI diff --git a/lib/simplepie/library/SimplePie/Item.php b/lib/simplepie/library/SimplePie/Item.php index 9b9c1f5db8d..5be6b199409 100644 --- a/lib/simplepie/library/SimplePie/Item.php +++ b/lib/simplepie/library/SimplePie/Item.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -121,7 +121,7 @@ class SimplePie_Item */ public function __destruct() { - if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) + if (!gc_enabled()) { unset($this->feed); } @@ -958,7 +958,7 @@ class SimplePie_Item public function get_link($key = 0, $rel = 'alternate') { $links = $this->get_links($rel); - if ($links[$key] !== null) + if ($links && $links[$key] !== null) { return $links[$key]; } diff --git a/lib/simplepie/library/SimplePie/Locator.php b/lib/simplepie/library/SimplePie/Locator.php index 12bc15e15c7..a207df6feeb 100644 --- a/lib/simplepie/library/SimplePie/Locator.php +++ b/lib/simplepie/library/SimplePie/Locator.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -94,7 +94,7 @@ class SimplePie_Locator $this->registry = $registry; } - public function find($type = SIMPLEPIE_LOCATOR_ALL, &$working) + public function find($type = SIMPLEPIE_LOCATOR_ALL, &$working = null) { if ($this->is_feed($this->file)) { diff --git a/lib/simplepie/library/SimplePie/Misc.php b/lib/simplepie/library/SimplePie/Misc.php index 2a2ecc575bc..a52498ac763 100644 --- a/lib/simplepie/library/SimplePie/Misc.php +++ b/lib/simplepie/library/SimplePie/Misc.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -364,11 +364,12 @@ class SimplePie_Misc } // Check that the encoding is supported - if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) === "\x00\x80") + if (!in_array($input, mb_list_encodings())) { return false; } - if (!in_array($input, mb_list_encodings())) + + if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) === "\x00\x80") { return false; } diff --git a/lib/simplepie/library/SimplePie/Net/IPv6.php b/lib/simplepie/library/SimplePie/Net/IPv6.php index a054e8be579..25c992bd147 100644 --- a/lib/simplepie/library/SimplePie/Net/IPv6.php +++ b/lib/simplepie/library/SimplePie/Net/IPv6.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -53,7 +53,7 @@ * @author Alexander Merz * @author elfrink at introweb dot nl * @author Josh Peck - * @author Geoffrey Sneddon + * @author Sam Sneddon */ class SimplePie_Net_IPv6 { diff --git a/lib/simplepie/library/SimplePie/Parse/Date.php b/lib/simplepie/library/SimplePie/Parse/Date.php index 95843c5e926..cf57437d2e4 100644 --- a/lib/simplepie/library/SimplePie/Parse/Date.php +++ b/lib/simplepie/library/SimplePie/Parse/Date.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -98,12 +98,20 @@ class SimplePie_Parse_Date 'dimanche' => 7, // German 'montag' => 1, + 'mo' => 1, 'dienstag' => 2, + 'di' => 2, 'mittwoch' => 3, + 'mi' => 3, 'donnerstag' => 4, + 'do' => 4, 'freitag' => 5, + 'fr' => 5, 'samstag' => 6, + 'sa' => 6, 'sonnabend' => 6, + // AFAIK no short form for sonnabend + 'so' => 7, 'sonntag' => 7, // Italian 'lunedì' => 1, @@ -215,17 +223,28 @@ class SimplePie_Parse_Date 'décembre' => 12, // German 'januar' => 1, + 'jan' => 1, 'februar' => 2, + 'feb' => 2, 'märz' => 3, + 'mär' => 3, 'april' => 4, - 'mai' => 5, + 'apr' => 4, + 'mai' => 5, // no short form for may 'juni' => 6, + 'jun' => 6, 'juli' => 7, + 'jul' => 7, 'august' => 8, + 'aug' => 8, 'september' => 9, + 'sep' => 9, 'oktober' => 10, + 'okt' => 10, 'november' => 11, + 'nov' => 11, 'dezember' => 12, + 'dez' => 12, // Italian 'gennaio' => 1, 'febbraio' => 2, diff --git a/lib/simplepie/library/SimplePie/Parser.php b/lib/simplepie/library/SimplePie/Parser.php index 3cef2287dba..4efdf41a710 100644 --- a/lib/simplepie/library/SimplePie/Parser.php +++ b/lib/simplepie/library/SimplePie/Parser.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Rating.php b/lib/simplepie/library/SimplePie/Rating.php index 108dd22bfa6..599f75acbbe 100644 --- a/lib/simplepie/library/SimplePie/Rating.php +++ b/lib/simplepie/library/SimplePie/Rating.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Registry.php b/lib/simplepie/library/SimplePie/Registry.php index e0909bb74da..bf3baf17939 100644 --- a/lib/simplepie/library/SimplePie/Registry.php +++ b/lib/simplepie/library/SimplePie/Registry.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Restriction.php b/lib/simplepie/library/SimplePie/Restriction.php index 803d84fde92..950017fae98 100644 --- a/lib/simplepie/library/SimplePie/Restriction.php +++ b/lib/simplepie/library/SimplePie/Restriction.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/Sanitize.php b/lib/simplepie/library/SimplePie/Sanitize.php index 40b06626639..35838032fcb 100644 --- a/lib/simplepie/library/SimplePie/Sanitize.php +++ b/lib/simplepie/library/SimplePie/Sanitize.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License @@ -365,14 +365,7 @@ class SimplePie_Sanitize // Get content node $div = $document->getElementsByTagName('body')->item(0)->firstChild; // Finally, convert to a HTML string - if (version_compare(PHP_VERSION, '5.3.6', '>=')) - { - $data = trim($document->saveHTML($div)); - } - else - { - $data = trim($document->saveXML($div)); - } + $data = trim($document->saveHTML($div)); if ($this->remove_div) { diff --git a/lib/simplepie/library/SimplePie/Source.php b/lib/simplepie/library/SimplePie/Source.php index 8fac13ef7eb..f14e5b220e3 100644 --- a/lib/simplepie/library/SimplePie/Source.php +++ b/lib/simplepie/library/SimplePie/Source.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php b/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php index 18ca1b79b5e..0c857a58689 100644 --- a/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php +++ b/lib/simplepie/library/SimplePie/XML/Declaration/Parser.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/library/SimplePie/gzdecode.php b/lib/simplepie/library/SimplePie/gzdecode.php index f4aeafa2885..9c54f88330b 100644 --- a/lib/simplepie/library/SimplePie/gzdecode.php +++ b/lib/simplepie/library/SimplePie/gzdecode.php @@ -5,7 +5,7 @@ * A PHP-Based RSS and Atom Feed Framework. * Takes the hard work out of managing a complete RSS/Atom solution. * - * Copyright (c) 2004-2016, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors + * Copyright (c) 2004-2016, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are @@ -33,9 +33,9 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue + * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue * @author Ryan Parman - * @author Geoffrey Sneddon + * @author Sam Sneddon * @author Ryan McCue * @link http://simplepie.org/ SimplePie * @license http://www.opensource.org/licenses/bsd-license.php BSD License diff --git a/lib/simplepie/readme_moodle.txt b/lib/simplepie/readme_moodle.txt index a5c0d0ce524..4df2261a895 100644 --- a/lib/simplepie/readme_moodle.txt +++ b/lib/simplepie/readme_moodle.txt @@ -1,10 +1,10 @@ -Description of SimplePie v1.5.3 library import into Moodle +Description of SimplePie v1.5.6 library import into Moodle Obtained from https://github.com/simplepie/simplepie/releases/ To upgrade this library: 1. Download the latest release of SimplePie from https://github.com/simplepie/simplepie/releases/ -2. Remove everything inside lib/simplepie/ directory except README_MOODLE.txt (this file) and moodle_simplepie.php. +2. Remove everything inside lib/simplepie/ directory except readme_moodle.txt (this file) and moodle_simplepie.php. 3. Extract the contents of the release archive into a directory. 4. Move the following files/directories from the extracted directory into lib/simplepie: - library/ @@ -13,6 +13,7 @@ To upgrade this library: - README.markdown 5. That should leave you with just the following. Do not move them. If there is any difference, check if they also need to be moved and update this doc: - idn (This is a third-party library that SimplePie can optionally use. We don't use this in Moodle) + - CHANGELOG.md - composer.json - db.sql diff --git a/lib/thirdpartylibs.xml b/lib/thirdpartylibs.xml index 356cc82341e..3c6e30289de 100644 --- a/lib/thirdpartylibs.xml +++ b/lib/thirdpartylibs.xml @@ -109,7 +109,7 @@ simplepie SimplePie BSD - 1.5.3 + 1.5.6 From 374d3e770085b1f30c066a03d08d78dd750fdc66 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Tue, 24 Nov 2020 17:20:12 +0000 Subject: [PATCH 04/23] MDL-70320 permission overrides: role names were double-escaped --- .../tests/behat/edit_permissions.feature | 38 ++++++++++++++++--- lib/amd/build/permissionmanager.min.js | 2 +- lib/amd/build/permissionmanager.min.js.map | 2 +- lib/amd/src/permissionmanager.js | 2 +- .../permissionmanager_panelcontent.mustache | 7 ++-- lib/templates/permissionmanager_role.mustache | 5 ++- 6 files changed, 42 insertions(+), 14 deletions(-) diff --git a/admin/tool/behat/tests/behat/edit_permissions.feature b/admin/tool/behat/tests/behat/edit_permissions.feature index e3ffc92aef1..52599d31dca 100644 --- a/admin/tool/behat/tests/behat/edit_permissions.feature +++ b/admin/tool/behat/tests/behat/edit_permissions.feature @@ -6,14 +6,18 @@ Feature: Edit capabilities Background: Given the following "users" exist: - | username | firstname | lastname | email | - | teacher1 | Teacher | 1 | teacher1@example.com | + | username | firstname | lastname | + | teacher1 | Teacher | 1 | + | tutor | Teaching | Assistant | + | student | Student | One | And the following "courses" exist: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | + | Course 1 | C1 | And the following "course enrolments" exist: - | user | course | role | - | teacher1 | C1 | editingteacher | + | user | course | role | + | teacher1 | C1 | editingteacher | + | tutor | C1 | teacher | + | student | C1 | student | Scenario: Default system capabilities modification Given I log in as "admin" @@ -60,3 +64,25 @@ Feature: Edit capabilities Then "mod/forum:deleteanypost" capability has "Prohibit" permission And "mod/forum:editanypost" capability has "Prevent" permission And "mod/forum:addquestion" capability has "Allow" permission + + @javascript + Scenario: Edit permissions escapes role names correctly + When I am on the "C1" "Course" page logged in as "admin" + And I navigate to "Edit settings" in current page administration + And I set the following fields to these values: + | Your word for 'Teacher' | Teacher >= editing | + | Your word for 'Non-editing teacher' | Teacher < "editing" | + | Your word for 'Student' | Studier & 'learner' | + And I press "Save and display" + And I navigate to course participants + Then I should see "Teacher >= editing (Teacher)" in the "Teacher 1" "table_row" + And I should see "Teacher < \"editing\" (Non-editing teacher)" in the "Teaching Assistant" "table_row" + And I should see "Studier & 'learner' (Student)" in the "Student One" "table_row" + And I navigate to "Permissions" in current page administration + And I should see "Teacher >= editing" in the "mod/forum:replypost" "table_row" + And I should see "Teacher < \"editing\"" in the "mod/forum:replypost" "table_row" + And I should see "Studier & 'learner'" in the "mod/forum:replypost" "table_row" + And I follow "Prohibit" + And "Teacher >= editing" "button" in the "Prohibit role" "dialogue" should be visible + And "Teacher < \"editing\"" "button" in the "Prohibit role" "dialogue" should be visible + And "Studier & 'learner'" "button" in the "Prohibit role" "dialogue" should be visible diff --git a/lib/amd/build/permissionmanager.min.js b/lib/amd/build/permissionmanager.min.js index f53bd414708..3e200156772 100644 --- a/lib/amd/build/permissionmanager.min.js +++ b/lib/amd/build/permissionmanager.min.js @@ -1,2 +1,2 @@ -define ("core/permissionmanager",["jquery","core/config","core/notification","core/templates","core/yui"],function(a,b,c,d,e){var f={ADDROLE:"a.allowlink, a.prohibitlink",REMOVEROLE:"a.preventlink, a.unprohibitlink",UNPROHIBIT:"a.unprohibitlink"},g=a.Event("rolesloaded"),h,j,k,l,m=null,n=function loadOverideableRoles(){var d={contextid:h,getroles:1,sesskey:b.sesskey};a.post(k+"roles/ajax.php",d,null,"json").done(function(b){try{l=b;n=function loadOverideableRoles(){a("body").trigger(g)};n()}catch(a){c.exception(a)}}).fail(function(a,b,d){c.exception(d)})},o=function(b,e,f){var g={contextid:h,roleid:e,sesskey:M.cfg.sesskey,action:f,capability:b.data("name")};a.post(k+"roles/ajax.php",g,null,"json").done(function(f){var g=f;try{var h={rolename:l[e],roleid:e,adminurl:k,imageurl:M.util.image_url("t/delete","moodle")};switch(g){case"allow":h.spanclass="allowed";h.linkclass="preventlink";h.action="prevent";h.icon="t/delete";h.iconalt=M.util.get_string("deletexrole","core_role",l[e]);break;case"prohibit":h.spanclass="forbidden";h.linkclass="unprohibitlink";h.action="unprohibit";h.icon="t/delete";h.iconalt=M.util.get_string("deletexrole","core_role",l[e]);break;case"prevent":b.find("a[data-role-id=\""+e+"\"]").first().closest(".allowed").remove();return;case"unprohibit":b.find("a[data-role-id=\""+e+"\"]").first().closest(".forbidden").remove();return;default:return;}d.render("core/permissionmanager_role",h).done(function(c){if("allow"==g){a(c).insertBefore(b.find(".allowmore:first"))}else if("prohibit"==g){a(c).insertBefore(b.find(".prohibitmore:first"));var d=b.find(".allowedroles").first().find("a[data-role-id=\""+e+"\"]");if(d){d.first().closest(".allowed").remove()}}m.hide()}).fail(c.exception)}catch(a){c.exception(a)}}).fail(function(a,b,d){c.exception(d)})},p=function(b){b.preventDefault();var g=a(b.currentTarget);a("body").one("rolesloaded",function(){e.use("moodle-core-notification-dialogue",function(){var b=g.data("action"),h=g.closest("tr.rolecap"),k={cap:h.data("humanname"),context:j},n=M.util.get_string("role"+b+"info","core_role",k);if(null===m){m=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,width:"450px"})}m.set("headerContent",M.util.get_string("role"+b+"header","core_role"));var p,e,q=[];switch(b){case"allow":e=h.find(f.REMOVEROLE);break;case"prohibit":e=h.find(f.UNPROHIBIT);break;}for(p in l){var r="",s=e.filter("[data-role-id='"+p+"']").length;if(s){r="disabled"}var t={roleid:p,rolename:l[p],disabled:r};q.push(t)}d.render("core/permissionmanager_panelcontent",{message:n,roles:q}).done(function(c){m.set("bodyContent",c);m.show();a("div.role_buttons").on("click","input",function(c){var d=a(c.currentTarget).data("role-id");o(h,d,b)})}).fail(c.exception)})});n()},q=function(b){b.preventDefault();var d=a(b.currentTarget);a("body").one("rolesloaded",function(){var a=d.data("action"),b=d.data("role-id"),e=d.closest("tr.rolecap"),f={role:l[b],cap:e.data("humanname"),context:j};c.confirm(M.util.get_string("confirmunassigntitle","core_role"),M.util.get_string("confirmrole"+a,"core_role",f),M.util.get_string("confirmunassignyes","core_role"),M.util.get_string("confirmunassignno","core_role"),function(){o(e,b,a)})});n()};return{initialize:function initialize(b){h=b.contextid;j=b.contextname;k=b.adminurl;var c=a("body");c.on("click",f.ADDROLE,p);c.on("click",f.REMOVEROLE,q)}}}); +define ("core/permissionmanager",["jquery","core/config","core/notification","core/templates","core/yui"],function(a,b,c,d,e){var f={ADDROLE:"a.allowlink, a.prohibitlink",REMOVEROLE:"a.preventlink, a.unprohibitlink",UNPROHIBIT:"a.unprohibitlink"},g=a.Event("rolesloaded"),h,j,k,l,m=null,n=function loadOverideableRoles(){var d={contextid:h,getroles:1,sesskey:b.sesskey};a.post(k+"roles/ajax.php",d,null,"json").done(function(b){try{l=b;n=function loadOverideableRoles(){a("body").trigger(g)};n()}catch(a){c.exception(a)}}).fail(function(a,b,d){c.exception(d)})},o=function(b,e,f){var g={contextid:h,roleid:e,sesskey:M.cfg.sesskey,action:f,capability:b.data("name")};a.post(k+"roles/ajax.php",g,null,"json").done(function(f){var g=f;try{var h={rolename:l[e],roleid:e,adminurl:k,imageurl:M.util.image_url("t/delete","moodle")};switch(g){case"allow":h.spanclass="allowed";h.linkclass="preventlink";h.action="prevent";h.icon="t/delete";h.iconalt=M.util.get_string("deletexrole","core_role",l[e]);break;case"prohibit":h.spanclass="forbidden";h.linkclass="unprohibitlink";h.action="unprohibit";h.icon="t/delete";h.iconalt=M.util.get_string("deletexrole","core_role",l[e]);break;case"prevent":b.find("a[data-role-id=\""+e+"\"]").first().closest(".allowed").remove();return;case"unprohibit":b.find("a[data-role-id=\""+e+"\"]").first().closest(".forbidden").remove();return;default:return;}d.render("core/permissionmanager_role",h).done(function(c){if("allow"==g){a(c).insertBefore(b.find(".allowmore:first"))}else if("prohibit"==g){a(c).insertBefore(b.find(".prohibitmore:first"));var d=b.find(".allowedroles").first().find("a[data-role-id=\""+e+"\"]");if(d){d.first().closest(".allowed").remove()}}m.hide()}).fail(c.exception)}catch(a){c.exception(a)}}).fail(function(a,b,d){c.exception(d)})},p=function(b){b.preventDefault();var g=a(b.currentTarget);a("body").one("rolesloaded",function(){e.use("moodle-core-notification-dialogue",function(){var b=g.data("action"),h=g.closest("tr.rolecap"),k={cap:h.data("humanname"),context:j},n=M.util.get_string("role"+b+"info","core_role",k);if(null===m){m=new M.core.dialogue({draggable:!0,modal:!0,closeButton:!0,width:"450px"})}m.set("headerContent",M.util.get_string("role"+b+"header","core_role"));var p,e,q=[];switch(b){case"allow":e=h.find(f.REMOVEROLE);break;case"prohibit":e=h.find(f.UNPROHIBIT);break;}for(p in l){var r="",s=e.filter("[data-role-id='"+p+"']").length;if(s){r="disabled"}var t={roleid:p,rolename:l[p],disabled:r};q.push(t)}d.render("core/permissionmanager_panelcontent",{message:n,roles:q}).done(function(c){m.set("bodyContent",c);m.show();a("div.role_buttons").on("click","button",function(c){var d=a(c.currentTarget).data("role-id");o(h,d,b)})}).fail(c.exception)})});n()},q=function(b){b.preventDefault();var d=a(b.currentTarget);a("body").one("rolesloaded",function(){var a=d.data("action"),b=d.data("role-id"),e=d.closest("tr.rolecap"),f={role:l[b],cap:e.data("humanname"),context:j};c.confirm(M.util.get_string("confirmunassigntitle","core_role"),M.util.get_string("confirmrole"+a,"core_role",f),M.util.get_string("confirmunassignyes","core_role"),M.util.get_string("confirmunassignno","core_role"),function(){o(e,b,a)})});n()};return{initialize:function initialize(b){h=b.contextid;j=b.contextname;k=b.adminurl;var c=a("body");c.on("click",f.ADDROLE,p);c.on("click",f.REMOVEROLE,q)}}}); //# sourceMappingURL=permissionmanager.min.js.map diff --git a/lib/amd/build/permissionmanager.min.js.map b/lib/amd/build/permissionmanager.min.js.map index 8413c766c4f..63e284bc594 100644 --- a/lib/amd/build/permissionmanager.min.js.map +++ b/lib/amd/build/permissionmanager.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/permissionmanager.js"],"names":["define","$","config","notification","templates","Y","SELECTORS","ADDROLE","REMOVEROLE","UNPROHIBIT","rolesloadedevent","Event","contextid","contextname","adminurl","overideableroles","panel","loadOverideableRoles","params","getroles","sesskey","post","done","data","trigger","err","exception","fail","jqXHR","status","error","changePermissions","row","roleid","action","M","cfg","capability","templatedata","rolename","imageurl","util","image_url","spanclass","linkclass","icon","iconalt","get_string","find","first","closest","remove","render","content","insertBefore","allowedLink","hide","handleAddRole","e","preventDefault","link","currentTarget","one","use","confirmationDetails","cap","context","message","core","dialogue","draggable","modal","closeButton","width","set","i","existingrolelinks","roles","disabled","disable","filter","length","roledetails","push","show","on","handleRemoveRole","questionDetails","role","confirm","initialize","args","body"],"mappings":"AAyBAA,OAAM,0BAAC,CAAC,QAAD,CAAW,aAAX,CAA0B,mBAA1B,CAA+C,gBAA/C,CAAiE,UAAjE,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAAoBC,CAApB,CAAkCC,CAAlC,CAA6CC,CAA7C,CAAgD,IAM5CC,CAAAA,CAAS,CAAG,CACZC,OAAO,CAAE,6BADG,CAEZC,UAAU,CAAE,iCAFA,CAGZC,UAAU,CAAE,kBAHA,CANgC,CAW5CC,CAAgB,CAAGT,CAAC,CAACU,KAAF,CAAQ,aAAR,CAXyB,CAY5CC,CAZ4C,CAa5CC,CAb4C,CAc5CC,CAd4C,CAe5CC,CAf4C,CAgB5CC,CAAK,CAAG,IAhBoC,CAwB5CC,CAAoB,CAAG,+BAAW,CAClC,GAAIC,CAAAA,CA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ACsF,OAAb,CAAqBtD,CAAC,CAACM,IAAF,CAAOM,UAAP,CAAkB,sBAAlB,CAA0C,WAA1C,CAArB,CACIZ,CAAC,CAACM,IAAF,CAAOM,UAAP,CAAkB,cAAgBb,CAAlC,CAA0C,WAA1C,CAAuDqD,CAAvD,CADJ,CAEIpD,CAAC,CAACM,IAAF,CAAOM,UAAP,CAAkB,oBAAlB,CAAwC,WAAxC,CAFJ,CAGIZ,CAAC,CAACM,IAAF,CAAOM,UAAP,CAAkB,mBAAlB,CAAuC,WAAvC,CAHJ,CAII,UAAW,CACRhB,CAAiB,CAACC,CAAD,CAAMC,CAAN,CAAcC,CAAd,CACnB,CANL,CAQF,CAlBF,EAmBAjB,CAAoB,EACvB,CA9N+C,CAgOhD,MAAmD,CAM/CyE,UAAU,CAAE,oBAASC,CAAT,CAAe,CACvB/E,CAAS,CAAG+E,CAAI,CAAC/E,SAAjB,CACAC,CAAW,CAAG8E,CAAI,CAAC9E,WAAnB,CACAC,CAAQ,CAAG6E,CAAI,CAAC7E,QAAhB,CACA,GAAI8E,CAAAA,CAAI,CAAG3F,CAAC,CAAC,MAAD,CAAZ,CACA2F,CAAI,CAACP,EAAL,CAAQ,OAAR,CAAiB/E,CAAS,CAACC,OAA3B,CAAoCkD,CAApC,EACAmC,CAAI,CAACP,EAAL,CAAQ,OAAR,CAAiB/E,CAAS,CAACE,UAA3B,CAAuC8E,CAAvC,CACH,CAb8C,CAetD,CAhPK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n/*\n * @package core\n * @class permissionmanager\n * @copyright 2015 Martin Mastny \n * @since 3.0\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n /**\n * @module admin/permissionmanager\n */\ndefine(['jquery', 'core/config', 'core/notification', 'core/templates', 'core/yui'],\n function($, config, notification, templates, Y) {\n\n /**\n * Used CSS selectors\n * @access private\n */\n var SELECTORS = {\n ADDROLE: 'a.allowlink, a.prohibitlink',\n REMOVEROLE: 'a.preventlink, a.unprohibitlink',\n UNPROHIBIT: 'a.unprohibitlink'\n };\n var rolesloadedevent = $.Event('rolesloaded');\n var contextid;\n var contextname;\n var adminurl;\n var overideableroles;\n var panel = null;\n\n /**\n * Load all possible roles, which could be assigned from server\n *\n * @access private\n * @method loadOverideableRoles\n */\n var loadOverideableRoles = function() {\n var params = {\n contextid: contextid,\n getroles: 1,\n sesskey: config.sesskey\n };\n\n // Need to tell jQuery to expect JSON as the content type may not be correct (MDL-55041).\n $.post(adminurl + 'roles/ajax.php', params, null, 'json')\n .done(function(data) {\n try {\n overideableroles = data;\n loadOverideableRoles = function() {\n $('body').trigger(rolesloadedevent);\n };\n loadOverideableRoles();\n } catch (err) {\n notification.exception(err);\n }\n })\n .fail(function(jqXHR, status, error) {\n notification.exception(error);\n });\n };\n\n /**\n * Perform the UI changes after server change\n *\n * @access private\n * @method changePermissions\n * @param {JQuery} row\n * @param {int} roleid\n * @param {string} action\n */\n var changePermissions = function(row, roleid, action) {\n var params = {\n contextid: contextid,\n roleid: roleid,\n sesskey: M.cfg.sesskey,\n action: action,\n capability: row.data('name')\n };\n $.post(adminurl + 'roles/ajax.php', params, null, 'json')\n .done(function(data) {\n var action = data;\n try {\n var templatedata = {rolename: overideableroles[roleid],\n roleid: roleid,\n adminurl: adminurl,\n imageurl: M.util.image_url('t/delete', 'moodle')\n };\n switch (action) {\n case 'allow':\n templatedata.spanclass = 'allowed';\n templatedata.linkclass = 'preventlink';\n templatedata.action = 'prevent';\n templatedata.icon = 't/delete';\n templatedata.iconalt = M.util.get_string('deletexrole', 'core_role', overideableroles[roleid]);\n break;\n case 'prohibit':\n templatedata.spanclass = 'forbidden';\n templatedata.linkclass = 'unprohibitlink';\n templatedata.action = 'unprohibit';\n templatedata.icon = 't/delete';\n templatedata.iconalt = M.util.get_string('deletexrole', 'core_role', overideableroles[roleid]);\n break;\n case 'prevent':\n row.find('a[data-role-id=\"' + roleid + '\"]').first().closest('.allowed').remove();\n return;\n case 'unprohibit':\n row.find('a[data-role-id=\"' + roleid + '\"]').first().closest('.forbidden').remove();\n return;\n default:\n return;\n }\n templates.render('core/permissionmanager_role', templatedata)\n .done(function(content) {\n if (action == 'allow') {\n $(content).insertBefore(row.find('.allowmore:first'));\n } else if (action == 'prohibit') {\n $(content).insertBefore(row.find('.prohibitmore:first'));\n // Remove allowed link\n var allowedLink = row.find('.allowedroles').first().find('a[data-role-id=\"' + roleid + '\"]');\n if (allowedLink) {\n allowedLink.first().closest('.allowed').remove();\n }\n }\n panel.hide();\n })\n .fail(notification.exception);\n } catch (err) {\n notification.exception(err);\n }\n })\n .fail(function(jqXHR, status, error) {\n notification.exception(error);\n });\n };\n\n /**\n * Prompts user for selecting a role which is permitted\n *\n * @access private\n * @method handleAddRole\n * @param {event} e\n */\n var handleAddRole = function(e) {\n e.preventDefault();\n\n var link = $(e.currentTarget);\n\n // TODO: MDL-57778 Convert to core/modal.\n $('body').one('rolesloaded', function() {\n Y.use('moodle-core-notification-dialogue', function() {\n var action = link.data('action');\n var row = link.closest('tr.rolecap');\n var confirmationDetails = {\n cap: row.data('humanname'),\n context: contextname\n };\n var message = M.util.get_string('role' + action + 'info', 'core_role', confirmationDetails);\n if (panel === null) {\n panel = new M.core.dialogue({\n draggable: true,\n modal: true,\n closeButton: true,\n width: '450px'\n });\n }\n panel.set('headerContent', M.util.get_string('role' + action + 'header', 'core_role'));\n\n var i, existingrolelinks;\n\n var roles = [];\n switch (action) {\n case 'allow':\n existingrolelinks = row.find(SELECTORS.REMOVEROLE);\n break;\n case 'prohibit':\n existingrolelinks = row.find(SELECTORS.UNPROHIBIT);\n break;\n }\n for (i in overideableroles) {\n var disabled = '';\n var disable = existingrolelinks.filter(\"[data-role-id='\" + i + \"']\").length;\n if (disable) {\n disabled = 'disabled';\n }\n var roledetails = {roleid: i, rolename: overideableroles[i], disabled: disabled};\n roles.push(roledetails);\n }\n\n templates.render('core/permissionmanager_panelcontent', {message: message, roles: roles})\n .done(function(content) {\n panel.set('bodyContent', content);\n panel.show();\n $('div.role_buttons').on('click', 'input', function(e) {\n var roleid = $(e.currentTarget).data('role-id');\n changePermissions(row, roleid, action);\n });\n })\n .fail(notification.exception);\n\n });\n });\n loadOverideableRoles();\n };\n\n /**\n * Prompts user when removing permission\n *\n * @access private\n * @method handleRemoveRole\n * @param {event} e\n */\n var handleRemoveRole = function(e) {\n e.preventDefault();\n var link = $(e.currentTarget);\n $('body').one('rolesloaded', function() {\n var action = link.data('action');\n var roleid = link.data('role-id');\n var row = link.closest('tr.rolecap');\n var questionDetails = {\n role: overideableroles[roleid],\n cap: row.data('humanname'),\n context: contextname\n };\n\n notification.confirm(M.util.get_string('confirmunassigntitle', 'core_role'),\n M.util.get_string('confirmrole' + action, 'core_role', questionDetails),\n M.util.get_string('confirmunassignyes', 'core_role'),\n M.util.get_string('confirmunassignno', 'core_role'),\n function() {\n changePermissions(row, roleid, action);\n }\n );\n });\n loadOverideableRoles();\n };\n\n return /** @alias module:core/permissionmanager */ {\n /**\n * Initialize permissionmanager\n * @access public\n * @param {Object} args\n */\n initialize: function(args) {\n contextid = args.contextid;\n contextname = args.contextname;\n adminurl = args.adminurl;\n var body = $('body');\n body.on('click', SELECTORS.ADDROLE, handleAddRole);\n body.on('click', SELECTORS.REMOVEROLE, handleRemoveRole);\n }\n };\n});\n"],"file":"permissionmanager.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/permissionmanager.js"],"names":["define","$","config","notification","templates","Y","SELECTORS","ADDROLE","REMOVEROLE","UNPROHIBIT","rolesloadedevent","Event","contextid","contextname","adminurl","overideableroles","panel","loadOverideableRoles","params","getroles","sesskey","post","done","data","trigger","err","exception","fail","jqXHR","status","error","changePermissions","row","roleid","action","M","cfg","capability","templatedata","rolename","imageurl","util","image_url","spanclass","linkclass","icon","iconalt","get_string","find","first","closest","remove","render","content","insertBefore","allowedLink","hide","handleAddRole","e","preventDefault","link","currentTarget","one","use","confirmationDetails","cap","context","message","core","dialogue","draggable","modal","closeButton","width","set","i","existingrolelinks","roles","disabled","disable","filter","length","roledetails","push","show","on","handleRemoveRole","questionDetails","role","confirm","initialize","args","body"],"mappings":"AAyBAA,OAAM,0BAAC,CAAC,QAAD,CAAW,aAAX,CAA0B,mBAA1B,CAA+C,gBAA/C,CAAiE,UAAjE,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAAoBC,CAApB,CAAkCC,CAAlC,CAA6CC,CAA7C,CAAgD,IAM5CC,CAAAA,CAAS,CAAG,CACZC,OAAO,CAAE,6BADG,CAEZC,UAAU,CAAE,iCAFA,CAGZC,UAAU,CAAE,kBAHA,CANgC,CAW5CC,CAAgB,CAAGT,CAAC,CAACU,KAAF,CAAQ,aAAR,CAXyB,CAY5CC,CAZ4C,CAa5CC,CAb4C,CAc5CC,CAd4C,CAe5CC,CAf4C,CAgB5CC,CAAK,CAAG,IAhBoC,CAwB5CC,CAAoB,CAAG,+BAAW,CAClC,GAAIC,CAAAA,CAAM,CAAG,CACTN,SAAS,CAAEA,CADF,CAETO,QAAQ,CAAE,CAFD,CAGTC,OAAO,CAAElB,CAAM,CAACkB,OAHP,CAAb,CAOAnB,CAAC,CAACoB,IAAF,CAAOP,CAAQ,CAAG,gBAAlB,CAAoCI,CAApC,CAA4C,IAA5C,CAAkD,MAAlD,EACKI,IADL,CACU,SAASC,CAAT,CAAe,CACnB,GAAI,CACAR,CAAgB,CAAGQ,CAAnB,CACAN,CAAoB,CAAG,+BAAW,CAC9BhB,CAAC,CAAC,MAAD,CAAD,CAAUuB,OAAV,CAAkBd,CAAlB,CACH,CAFD,CA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C,CAAN,CAAcC,CAAd,CACnB,CANL,CAQF,CAlBF,EAmBAjB,CAAoB,EACvB,CA9N+C,CAgOhD,MAAmD,CAM/CyE,UAAU,CAAE,oBAASC,CAAT,CAAe,CACvB/E,CAAS,CAAG+E,CAAI,CAAC/E,SAAjB,CACAC,CAAW,CAAG8E,CAAI,CAAC9E,WAAnB,CACAC,CAAQ,CAAG6E,CAAI,CAAC7E,QAAhB,CACA,GAAI8E,CAAAA,CAAI,CAAG3F,CAAC,CAAC,MAAD,CAAZ,CACA2F,CAAI,CAACP,EAAL,CAAQ,OAAR,CAAiB/E,CAAS,CAACC,OAA3B,CAAoCkD,CAApC,EACAmC,CAAI,CAACP,EAAL,CAAQ,OAAR,CAAiB/E,CAAS,CAACE,UAA3B,CAAuC8E,CAAvC,CACH,CAb8C,CAetD,CAhPK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n/*\n * @package core\n * @class permissionmanager\n * @copyright 2015 Martin Mastny \n * @since 3.0\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n /**\n * @module admin/permissionmanager\n */\ndefine(['jquery', 'core/config', 'core/notification', 'core/templates', 'core/yui'],\n function($, config, notification, templates, Y) {\n\n /**\n * Used CSS selectors\n * @access private\n */\n var SELECTORS = {\n ADDROLE: 'a.allowlink, a.prohibitlink',\n REMOVEROLE: 'a.preventlink, a.unprohibitlink',\n UNPROHIBIT: 'a.unprohibitlink'\n };\n var rolesloadedevent = $.Event('rolesloaded');\n var contextid;\n var contextname;\n var adminurl;\n var overideableroles;\n var panel = null;\n\n /**\n * Load all possible roles, which could be assigned from server\n *\n * @access private\n * @method loadOverideableRoles\n */\n var loadOverideableRoles = function() {\n var params = {\n contextid: contextid,\n getroles: 1,\n sesskey: config.sesskey\n };\n\n // Need to tell jQuery to expect JSON as the content type may not be correct (MDL-55041).\n $.post(adminurl + 'roles/ajax.php', params, null, 'json')\n .done(function(data) {\n try {\n overideableroles = data;\n loadOverideableRoles = function() {\n $('body').trigger(rolesloadedevent);\n };\n loadOverideableRoles();\n } catch (err) {\n notification.exception(err);\n }\n })\n .fail(function(jqXHR, status, error) {\n notification.exception(error);\n });\n };\n\n /**\n * Perform the UI changes after server change\n *\n * @access private\n * @method changePermissions\n * @param {JQuery} row\n * @param {int} roleid\n * @param {string} action\n */\n var changePermissions = function(row, roleid, action) {\n var params = {\n contextid: contextid,\n roleid: roleid,\n sesskey: M.cfg.sesskey,\n action: action,\n capability: row.data('name')\n };\n $.post(adminurl + 'roles/ajax.php', params, null, 'json')\n .done(function(data) {\n var action = data;\n try {\n var templatedata = {rolename: overideableroles[roleid],\n roleid: roleid,\n adminurl: adminurl,\n imageurl: M.util.image_url('t/delete', 'moodle')\n };\n switch (action) {\n case 'allow':\n templatedata.spanclass = 'allowed';\n templatedata.linkclass = 'preventlink';\n templatedata.action = 'prevent';\n templatedata.icon = 't/delete';\n templatedata.iconalt = M.util.get_string('deletexrole', 'core_role', overideableroles[roleid]);\n break;\n case 'prohibit':\n templatedata.spanclass = 'forbidden';\n templatedata.linkclass = 'unprohibitlink';\n templatedata.action = 'unprohibit';\n templatedata.icon = 't/delete';\n templatedata.iconalt = M.util.get_string('deletexrole', 'core_role', overideableroles[roleid]);\n break;\n case 'prevent':\n row.find('a[data-role-id=\"' + roleid + '\"]').first().closest('.allowed').remove();\n return;\n case 'unprohibit':\n row.find('a[data-role-id=\"' + roleid + '\"]').first().closest('.forbidden').remove();\n return;\n default:\n return;\n }\n templates.render('core/permissionmanager_role', templatedata)\n .done(function(content) {\n if (action == 'allow') {\n $(content).insertBefore(row.find('.allowmore:first'));\n } else if (action == 'prohibit') {\n $(content).insertBefore(row.find('.prohibitmore:first'));\n // Remove allowed link\n var allowedLink = row.find('.allowedroles').first().find('a[data-role-id=\"' + roleid + '\"]');\n if (allowedLink) {\n allowedLink.first().closest('.allowed').remove();\n }\n }\n panel.hide();\n })\n .fail(notification.exception);\n } catch (err) {\n notification.exception(err);\n }\n })\n .fail(function(jqXHR, status, error) {\n notification.exception(error);\n });\n };\n\n /**\n * Prompts user for selecting a role which is permitted\n *\n * @access private\n * @method handleAddRole\n * @param {event} e\n */\n var handleAddRole = function(e) {\n e.preventDefault();\n\n var link = $(e.currentTarget);\n\n // TODO: MDL-57778 Convert to core/modal.\n $('body').one('rolesloaded', function() {\n Y.use('moodle-core-notification-dialogue', function() {\n var action = link.data('action');\n var row = link.closest('tr.rolecap');\n var confirmationDetails = {\n cap: row.data('humanname'),\n context: contextname\n };\n var message = M.util.get_string('role' + action + 'info', 'core_role', confirmationDetails);\n if (panel === null) {\n panel = new M.core.dialogue({\n draggable: true,\n modal: true,\n closeButton: true,\n width: '450px'\n });\n }\n panel.set('headerContent', M.util.get_string('role' + action + 'header', 'core_role'));\n\n var i, existingrolelinks;\n\n var roles = [];\n switch (action) {\n case 'allow':\n existingrolelinks = row.find(SELECTORS.REMOVEROLE);\n break;\n case 'prohibit':\n existingrolelinks = row.find(SELECTORS.UNPROHIBIT);\n break;\n }\n for (i in overideableroles) {\n var disabled = '';\n var disable = existingrolelinks.filter(\"[data-role-id='\" + i + \"']\").length;\n if (disable) {\n disabled = 'disabled';\n }\n var roledetails = {roleid: i, rolename: overideableroles[i], disabled: disabled};\n roles.push(roledetails);\n }\n\n templates.render('core/permissionmanager_panelcontent', {message: message, roles: roles})\n .done(function(content) {\n panel.set('bodyContent', content);\n panel.show();\n $('div.role_buttons').on('click', 'button', function(e) {\n var roleid = $(e.currentTarget).data('role-id');\n changePermissions(row, roleid, action);\n });\n })\n .fail(notification.exception);\n\n });\n });\n loadOverideableRoles();\n };\n\n /**\n * Prompts user when removing permission\n *\n * @access private\n * @method handleRemoveRole\n * @param {event} e\n */\n var handleRemoveRole = function(e) {\n e.preventDefault();\n var link = $(e.currentTarget);\n $('body').one('rolesloaded', function() {\n var action = link.data('action');\n var roleid = link.data('role-id');\n var row = link.closest('tr.rolecap');\n var questionDetails = {\n role: overideableroles[roleid],\n cap: row.data('humanname'),\n context: contextname\n };\n\n notification.confirm(M.util.get_string('confirmunassigntitle', 'core_role'),\n M.util.get_string('confirmrole' + action, 'core_role', questionDetails),\n M.util.get_string('confirmunassignyes', 'core_role'),\n M.util.get_string('confirmunassignno', 'core_role'),\n function() {\n changePermissions(row, roleid, action);\n }\n );\n });\n loadOverideableRoles();\n };\n\n return /** @alias module:core/permissionmanager */ {\n /**\n * Initialize permissionmanager\n * @access public\n * @param {Object} args\n */\n initialize: function(args) {\n contextid = args.contextid;\n contextname = args.contextname;\n adminurl = args.adminurl;\n var body = $('body');\n body.on('click', SELECTORS.ADDROLE, handleAddRole);\n body.on('click', SELECTORS.REMOVEROLE, handleRemoveRole);\n }\n };\n});\n"],"file":"permissionmanager.min.js"} \ No newline at end of file diff --git a/lib/amd/src/permissionmanager.js b/lib/amd/src/permissionmanager.js index 07721043e58..3f350d30fce 100644 --- a/lib/amd/src/permissionmanager.js +++ b/lib/amd/src/permissionmanager.js @@ -204,7 +204,7 @@ define(['jquery', 'core/config', 'core/notification', 'core/templates', 'core/yu .done(function(content) { panel.set('bodyContent', content); panel.show(); - $('div.role_buttons').on('click', 'input', function(e) { + $('div.role_buttons').on('click', 'button', function(e) { var roleid = $(e.currentTarget).data('role-id'); changePermissions(row, roleid, action); }); diff --git a/lib/templates/permissionmanager_panelcontent.mustache b/lib/templates/permissionmanager_panelcontent.mustache index dc74d2497e4..da3825cd839 100644 --- a/lib/templates/permissionmanager_panelcontent.mustache +++ b/lib/templates/permissionmanager_panelcontent.mustache @@ -27,17 +27,18 @@ Context variables required for this template: * confirmation Confirmation text - * roles array of role details + * roles array of role details. Note: in this array, rolename must have been + prepared for output with format_string, or more likely one of the role API functions like role_fix_names. Example context (json): { "message": "Do you really want to remove Non-editing teacher from the list of allowed roles for capability View added and updated modules in recent activity block?", - "roles": [{"roleid": 1, "rolename": "manager", "disabled":"disabled"}]} + "roles": [{"roleid": 1, "rolename": "Manager", "disabled": "disabled"}]} }} diff --git a/lib/templates/permissionmanager_role.mustache b/lib/templates/permissionmanager_role.mustache index d2a1652dc38..b30865371b8 100644 --- a/lib/templates/permissionmanager_role.mustache +++ b/lib/templates/permissionmanager_role.mustache @@ -27,7 +27,8 @@ * action Context variables required for this template: - * rolename Name of the role rendered + * rolename Name of the role rendered - must have been prepared for output with format_string, + or more likely one of the role API functions like role_fix_names. * roleid Id of the role * action WEhich action is done on click * spanclass class attribute of span @@ -43,7 +44,7 @@ "linkclass": "preventlink", "adminurl" : "http://localhost/moodle/admin/"} }} - {{rolename}}  + {{{rolename}}}  {{#icon}} {{#pix}}{{icon}}, core, {{iconalt}}{{/pix}} From 1e3449ca28e94f556cbb4caae7aa7b6f40080056 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 25 Nov 2020 21:35:14 +0000 Subject: [PATCH 05/23] MDL-70295 libraries: upgrade to version 4.3.1 of Html2Text. --- lib/html2text/Html2Text.php | 61 ++++++++++++++++++++++++--------- lib/html2text/readme_moodle.txt | 9 ++--- lib/thirdpartylibs.xml | 2 +- 3 files changed, 50 insertions(+), 22 deletions(-) diff --git a/lib/html2text/Html2Text.php b/lib/html2text/Html2Text.php index f279879d6f8..9fd91235927 100644 --- a/lib/html2text/Html2Text.php +++ b/lib/html2text/Html2Text.php @@ -28,14 +28,14 @@ class Html2Text /** * Contains the HTML content to convert. * - * @type string + * @var string $html */ protected $html; /** * Contains the converted, formatted text. * - * @type string + * @var string $text */ protected $text; @@ -43,7 +43,7 @@ class Html2Text * List of preg* regular expression patterns to search for, * used in conjunction with $replace. * - * @type array + * @var array $search * @see $replace */ protected $search = array( @@ -54,6 +54,7 @@ class Html2Text '/]*>.*?<\/style>/i', //