Merge branch 'MDL-70290-311' of git://github.com/peterRd/moodle into MOODLE_311_STABLE

This commit is contained in:
Sara Arjona 2021-01-18 09:23:40 +01:00
commit d6fa4e499e
14 changed files with 38 additions and 55 deletions

View file

@ -19,7 +19,7 @@
*/ */
/* /*
HTML Purifier 4.12.0 - Standards Compliant HTML Filtering HTML Purifier 4.13.0 - Standards Compliant HTML Filtering
Copyright (C) 2006-2008 Edward Z. Yang Copyright (C) 2006-2008 Edward Z. Yang
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
@ -58,12 +58,12 @@ class HTMLPurifier
* Version of HTML Purifier. * Version of HTML Purifier.
* @type string * @type string
*/ */
public $version = '4.12.0'; public $version = '4.13.0';
/** /**
* Constant with version of HTML Purifier. * Constant with version of HTML Purifier.
*/ */
const VERSION = '4.12.0'; const VERSION = '4.13.0';
/** /**
* Global configuration object. * Global configuration object.
@ -240,6 +240,7 @@ class HTMLPurifier
public function purifyArray($array_of_html, $config = null) public function purifyArray($array_of_html, $config = null)
{ {
$context_array = array(); $context_array = array();
$array = array();
foreach($array_of_html as $key=>$value){ foreach($array_of_html as $key=>$value){
if (is_array($value)) { if (is_array($value)) {
$array[$key] = $this->purifyArray($value, $config); $array[$key] = $this->purifyArray($value, $config);

View file

@ -69,7 +69,13 @@ class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
return false; return false;
} }
$left = ltrim($left, '0'); // Remove leading zeros until positive number or a zero stays left
if (ltrim($left, '0') != '') {
$left = ltrim($left, '0');
} else {
$left = '0';
}
$right = rtrim($right, '0'); $right = rtrim($right, '0');
if ($right === '') { if ($right === '') {

View file

@ -21,7 +21,7 @@ class HTMLPurifier_Config
* HTML Purifier's version * HTML Purifier's version
* @type string * @type string
*/ */
public $version = '4.12.0'; public $version = '4.13.0';
/** /**
* Whether or not to automatically finalize * Whether or not to automatically finalize
@ -408,7 +408,7 @@ class HTMLPurifier_Config
* maybeGetRawHTMLDefinition, which is more explicitly * maybeGetRawHTMLDefinition, which is more explicitly
* named, instead. * named, instead.
* *
* @return HTMLPurifier_HTMLDefinition * @return HTMLPurifier_HTMLDefinition|null
*/ */
public function getHTMLDefinition($raw = false, $optimized = false) public function getHTMLDefinition($raw = false, $optimized = false)
{ {
@ -427,7 +427,7 @@ class HTMLPurifier_Config
* maybeGetRawCSSDefinition, which is more explicitly * maybeGetRawCSSDefinition, which is more explicitly
* named, instead. * named, instead.
* *
* @return HTMLPurifier_CSSDefinition * @return HTMLPurifier_CSSDefinition|null
*/ */
public function getCSSDefinition($raw = false, $optimized = false) public function getCSSDefinition($raw = false, $optimized = false)
{ {
@ -446,7 +446,7 @@ class HTMLPurifier_Config
* maybeGetRawURIDefinition, which is more explicitly * maybeGetRawURIDefinition, which is more explicitly
* named, instead. * named, instead.
* *
* @return HTMLPurifier_URIDefinition * @return HTMLPurifier_URIDefinition|null
*/ */
public function getURIDefinition($raw = false, $optimized = false) public function getURIDefinition($raw = false, $optimized = false)
{ {
@ -468,7 +468,7 @@ class HTMLPurifier_Config
* maybe semantics is the "right thing to do." * maybe semantics is the "right thing to do."
* *
* @throws HTMLPurifier_Exception * @throws HTMLPurifier_Exception
* @return HTMLPurifier_Definition * @return HTMLPurifier_Definition|null
*/ */
public function getDefinition($type, $raw = false, $optimized = false) public function getDefinition($type, $raw = false, $optimized = false)
{ {
@ -647,7 +647,7 @@ class HTMLPurifier_Config
} }
/** /**
* @return HTMLPurifier_HTMLDefinition * @return HTMLPurifier_HTMLDefinition|null
*/ */
public function maybeGetRawHTMLDefinition() public function maybeGetRawHTMLDefinition()
{ {
@ -655,7 +655,7 @@ class HTMLPurifier_Config
} }
/** /**
* @return HTMLPurifier_CSSDefinition * @return HTMLPurifier_CSSDefinition|null
*/ */
public function maybeGetRawCSSDefinition() public function maybeGetRawCSSDefinition()
{ {
@ -663,7 +663,7 @@ class HTMLPurifier_Config
} }
/** /**
* @return HTMLPurifier_URIDefinition * @return HTMLPurifier_URIDefinition|null
*/ */
public function maybeGetRawURIDefinition() public function maybeGetRawURIDefinition()
{ {

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,11 @@
HTML.Forms
TYPE: bool
VERSION: 4.13.0
DEFAULT: false
--DESCRIPTION--
<p>
Whether or not to permit form elements in the user input, regardless of
%HTML.Trusted value. Please be very careful when using this functionality, as
enabling forms in untrusted documents may allow for phishing attacks.
</p>
--# vim: et sw=4 sts=4

View file

View file

@ -28,6 +28,10 @@ class HTMLPurifier_HTMLModule_Forms extends HTMLPurifier_HTMLModule
*/ */
public function setup($config) public function setup($config)
{ {
if ($config->get('HTML.Forms')) {
$this->safe = true;
}
$form = $this->addElement( $form = $this->addElement(
'form', 'form',
'Form', 'Form',

View file

@ -96,6 +96,7 @@ class HTMLPurifier_HTMLModule_Tidy_XHTMLAndHTML4 extends HTMLPurifier_HTMLModule
// @bgcolor for table, tr, td, th --------------------------------- // @bgcolor for table, tr, td, th ---------------------------------
$r['table@bgcolor'] = $r['table@bgcolor'] =
$r['tr@bgcolor'] =
$r['td@bgcolor'] = $r['td@bgcolor'] =
$r['th@bgcolor'] = $r['th@bgcolor'] =
new HTMLPurifier_AttrTransform_BgColor(); new HTMLPurifier_AttrTransform_BgColor();

View file

@ -1,9 +0,0 @@
<?php
// private class for unit testing
class HTMLPurifier_Language_en_x_test extends HTMLPurifier_Language
{
}
// vim: et sw=4 sts=4

View file

@ -1,13 +0,0 @@
<?php
// private language message file for unit testing purposes
$fallback = 'en';
$messages = array(
'HTMLPurifier' => 'HTML Purifier X'
);
$errorNames = array();
// vim: et sw=4 sts=4

View file

@ -1,14 +0,0 @@
<?php
// private language message file for unit testing purposes
// this language file has no class associated with it
$fallback = 'en';
$messages = array(
'HTMLPurifier' => 'HTML Purifier XNone'
);
$errorNames = array();
// vim: et sw=4 sts=4

View file

@ -14,8 +14,3 @@ Description of HTML Purifier v4.12.0 library import into Moodle
HTMLPurifier.path.php HTMLPurifier.path.php
* add locallib.php with Moodle specific extensions to /lib/htmlpurifier/ * add locallib.php with Moodle specific extensions to /lib/htmlpurifier/
* add this readme_moodle.txt to /lib/htmlpurifier/ * add this readme_moodle.txt to /lib/htmlpurifier/
Modifications:
(verify if we need to apply them on every upgrade, remove when not needed)
* MDL-67115 applied https://github.com/ezyang/htmlpurifier/pull/243 towards
php74 compatibility.

View file

@ -46,7 +46,7 @@
<location>htmlpurifier</location> <location>htmlpurifier</location>
<name>HTML Purifier</name> <name>HTML Purifier</name>
<license>LGPL</license> <license>LGPL</license>
<version>4.12.0</version> <version>4.13.0</version>
<licenseversion>2.1+</licenseversion> <licenseversion>2.1+</licenseversion>
</library> </library>
<library> <library>

View file

@ -15,6 +15,7 @@ information provided here is intended especially for developers.
* Behat timeout constants behat_base::TIMEOUT, EXTENDED_TIMEOUT, and REDUCED_TIMEOUT, which were deprecated in 3.7, have been removed. * Behat timeout constants behat_base::TIMEOUT, EXTENDED_TIMEOUT, and REDUCED_TIMEOUT, which were deprecated in 3.7, have been removed.
* \core_table\local\filter\filterset::JOINTYPE_DEFAULT is being changed from 1 (ANY) to 2 (ALL). Filterset implementations * \core_table\local\filter\filterset::JOINTYPE_DEFAULT is being changed from 1 (ANY) to 2 (ALL). Filterset implementations
can override the default filterset join type by overriding \core_table\local\filter\filterset::get_join_type() instead. can override the default filterset join type by overriding \core_table\local\filter\filterset::get_join_type() instead.
* HTMLPurifier has been upgraded to the latest version - 4.13.0
=== 3.10 === === 3.10 ===
* PHPUnit has been upgraded to 8.5. That comes with a few changes: * PHPUnit has been upgraded to 8.5. That comes with a few changes: