diff --git a/CHANGELOG.md b/CHANGELOG.md index d3fb0c0..b7e6032 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ## [Unreleased] +### Breaking Changes +- added $config['locale']. See config.sample.php - you have to set it. + +### Changed +- new layout & design with more whitespace and more explanations. + + ## [0.2.0] - 2018-06-16 ### Changed diff --git a/composer.json b/composer.json index 96f3636..dcb87c9 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,8 @@ "require": { "php-imap/php-imap": "~2.0", "gnugat/PronounceableWord": "*", - "ezyang/htmlpurifier": "^4.9" + "ezyang/htmlpurifier": "^4.9", + "fightbulc/moment": "*" }, "config": { "vendor-dir": "src/backend-libs" diff --git a/composer.lock b/composer.lock index 6cd2c8c..ee3aa14 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "c071b40be7f9bdf56a06a9e52d220684", - "content-hash": "31df20b392f8545dda12635a78572bf7", + "hash": "1175b971ed4569a8c9f93646384529e7", + "content-hash": "4b2136dccba636ec0370e8547b0a738e", "packages": [ { "name": "ezyang/htmlpurifier", - "version": "v4.9.3", + "version": "v4.10.0", "source": { "type": "git", "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "95e1bae3182efc0f3422896a3236e991049dac69" + "reference": "d85d39da4576a6934b72480be6978fb10c860021" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/95e1bae3182efc0f3422896a3236e991049dac69", - "reference": "95e1bae3182efc0f3422896a3236e991049dac69", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021", + "reference": "d85d39da4576a6934b72480be6978fb10c860021", "shasum": "" }, "require": { @@ -52,7 +52,70 @@ "keywords": [ "html" ], - "time": "2017-06-03 02:28:16" + "time": "2018-02-23 01:58:20" + }, + { + "name": "fightbulc/moment", + "version": "1.26.10", + "source": { + "type": "git", + "url": "https://github.com/fightbulc/moment.php.git", + "reference": "2fe6607fdbbd45b48708f539c70fde89ca9d10e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fightbulc/moment.php/zipball/2fe6607fdbbd45b48708f539c70fde89ca9d10e6", + "reference": "2fe6607fdbbd45b48708f539c70fde89ca9d10e6", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Moment\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ashish Tilara", + "email": "ashish@itcutives.com", + "role": "developer" + }, + { + "name": "Jaroslaw Kozak", + "email": "jaroslaw.kozak68@gmail.com", + "role": "developer" + }, + { + "name": "Tino Ehrich", + "email": "tino@bigpun.me", + "role": "developer" + } + ], + "description": "Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js", + "keywords": [ + "date", + "display", + "format", + "i18n", + "locale", + "manipulate", + "moment", + "parse", + "time", + "translation", + "validate" + ], + "time": "2017-08-14 05:06:04" }, { "name": "gnugat/PronounceableWord", diff --git a/src/backend-libs/composer/autoload_psr4.php b/src/backend-libs/composer/autoload_psr4.php index 80607ee..67c3497 100644 --- a/src/backend-libs/composer/autoload_psr4.php +++ b/src/backend-libs/composer/autoload_psr4.php @@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname(dirname($vendorDir)); return array( + 'Moment\\' => array($vendorDir . '/fightbulc/moment/src'), ); diff --git a/src/backend-libs/composer/autoload_static.php b/src/backend-libs/composer/autoload_static.php index cd798df..cfc9eeb 100644 --- a/src/backend-libs/composer/autoload_static.php +++ b/src/backend-libs/composer/autoload_static.php @@ -10,6 +10,20 @@ class ComposerStaticInit125dddd280a32cf75b181166154246ec '2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', ); + public static $prefixLengthsPsr4 = array ( + 'M' => + array ( + 'Moment\\' => 7, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Moment\\' => + array ( + 0 => __DIR__ . '/..' . '/fightbulc/moment/src', + ), + ); + public static $prefixesPsr0 = array ( 'P' => array ( @@ -34,6 +48,8 @@ class ComposerStaticInit125dddd280a32cf75b181166154246ec public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInit125dddd280a32cf75b181166154246ec::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit125dddd280a32cf75b181166154246ec::$prefixDirsPsr4; $loader->prefixesPsr0 = ComposerStaticInit125dddd280a32cf75b181166154246ec::$prefixesPsr0; }, null, ClassLoader::class); diff --git a/src/backend-libs/composer/installed.json b/src/backend-libs/composer/installed.json index b5f614a..e893071 100644 --- a/src/backend-libs/composer/installed.json +++ b/src/backend-libs/composer/installed.json @@ -90,17 +90,17 @@ }, { "name": "ezyang/htmlpurifier", - "version": "v4.9.3", - "version_normalized": "4.9.3.0", + "version": "v4.10.0", + "version_normalized": "4.10.0.0", "source": { "type": "git", "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "95e1bae3182efc0f3422896a3236e991049dac69" + "reference": "d85d39da4576a6934b72480be6978fb10c860021" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/95e1bae3182efc0f3422896a3236e991049dac69", - "reference": "95e1bae3182efc0f3422896a3236e991049dac69", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021", + "reference": "d85d39da4576a6934b72480be6978fb10c860021", "shasum": "" }, "require": { @@ -109,7 +109,7 @@ "require-dev": { "simpletest/simpletest": "^1.1" }, - "time": "2017-06-03 02:28:16", + "time": "2018-02-23 01:58:20", "type": "library", "installation-source": "dist", "autoload": { @@ -136,5 +136,70 @@ "keywords": [ "html" ] + }, + { + "name": "fightbulc/moment", + "version": "1.26.10", + "version_normalized": "1.26.10.0", + "source": { + "type": "git", + "url": "https://github.com/fightbulc/moment.php.git", + "reference": "2fe6607fdbbd45b48708f539c70fde89ca9d10e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fightbulc/moment.php/zipball/2fe6607fdbbd45b48708f539c70fde89ca9d10e6", + "reference": "2fe6607fdbbd45b48708f539c70fde89ca9d10e6", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.2.*" + }, + "time": "2017-08-14 05:06:04", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Moment\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ashish Tilara", + "email": "ashish@itcutives.com", + "role": "developer" + }, + { + "name": "Jaroslaw Kozak", + "email": "jaroslaw.kozak68@gmail.com", + "role": "developer" + }, + { + "name": "Tino Ehrich", + "email": "tino@bigpun.me", + "role": "developer" + } + ], + "description": "Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js", + "keywords": [ + "date", + "display", + "format", + "i18n", + "locale", + "manipulate", + "moment", + "parse", + "time", + "translation", + "validate" + ] } ] diff --git a/src/backend-libs/ezyang/htmlpurifier/NEWS b/src/backend-libs/ezyang/htmlpurifier/NEWS index fd5d56c..9b6e102 100644 --- a/src/backend-libs/ezyang/htmlpurifier/NEWS +++ b/src/backend-libs/ezyang/htmlpurifier/NEWS @@ -9,6 +9,20 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier . Internal change ========================== +4.10.0, released 2018-02-22 +# PHP 5.3 is no longer officially supported by HTML Purifier + (we did not specifically break support, but we are no longer + testing on PHP 5.3) +! Relative CSS length units are now supported +- A few PHP 7.2 compatibility fixes, thanks John Flatness + +- Improve portability with old versions of libxml which don't + support accessing the data of a node +- IDNA2008 is now used for converting domains to ASCII, fixing + some rather strange bugs with international domains +- Fix race condition resulting in E_WARNING when creating + directories with Serializer + 4.9.3, released 2017-06-02 - Workaround PHP 7.1 infinite loop when opcode cache is enabled. Thanks @Xiphin (#134, #135) diff --git a/src/backend-libs/ezyang/htmlpurifier/README.md b/src/backend-libs/ezyang/htmlpurifier/README.md index b321f2b..37715c6 100644 --- a/src/backend-libs/ezyang/htmlpurifier/README.md +++ b/src/backend-libs/ezyang/htmlpurifier/README.md @@ -2,7 +2,7 @@ HTML Purifier [![Build Status](https://secure.travis-ci.org/ezyang/htmlpurifier. ============= HTML Purifier is an HTML filtering solution that uses a unique combination -of robust whitelists and agressive parsing to ensure that not only are +of robust whitelists and aggressive parsing to ensure that not only are XSS attacks thwarted, but the resulting HTML is standards compliant. HTML Purifier is oriented towards richly formatted documents from @@ -26,4 +26,4 @@ Package available on [Composer](https://packagist.org/packages/ezyang/htmlpurifi If you're using Composer to manage dependencies, you can use - $ composer require "ezyang/htmlpurifier": "dev-master" + $ composer require "ezyang/htmlpurifier":"dev-master" diff --git a/src/backend-libs/ezyang/htmlpurifier/VERSION b/src/backend-libs/ezyang/htmlpurifier/VERSION index e94f14f..1910ba9 100644 --- a/src/backend-libs/ezyang/htmlpurifier/VERSION +++ b/src/backend-libs/ezyang/htmlpurifier/VERSION @@ -1 +1 @@ -4.9.3 \ No newline at end of file +4.10.0 \ No newline at end of file diff --git a/src/backend-libs/ezyang/htmlpurifier/extras/HTMLPurifierExtras.autoload-legacy.php b/src/backend-libs/ezyang/htmlpurifier/extras/HTMLPurifierExtras.autoload-legacy.php new file mode 100644 index 0000000..d1485bf --- /dev/null +++ b/src/backend-libs/ezyang/htmlpurifier/extras/HTMLPurifierExtras.autoload-legacy.php @@ -0,0 +1,15 @@ +generateDirectoryPath($config); $chmod = $config->get('Cache.SerializerPermissions'); if ($chmod === null) { - // TODO: This races - if (is_dir($directory)) return true; - return mkdir($directory); + if (!@mkdir($directory) && !is_dir($directory)) { + trigger_error( + 'Could not create directory ' . $directory . '', + E_USER_WARNING + ); + return false; + } + return true; } if (!is_dir($directory)) { $base = $this->generateBaseDirectoryPath($config); @@ -233,7 +238,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac } elseif (!$this->_testPermissions($base, $chmod)) { return false; } - if (!mkdir($directory, $chmod)) { + if (!@mkdir($directory, $chmod) && !is_dir($directory)) { trigger_error( 'Could not create directory ' . $directory . '', E_USER_WARNING diff --git a/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Injector.php b/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Injector.php index 5060eef..116b470 100644 --- a/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Injector.php +++ b/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Injector.php @@ -157,11 +157,13 @@ abstract class HTMLPurifier_Injector return false; } // check for exclusion - for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) { - $node = $this->currentNesting[$i]; - $def = $this->htmlDefinition->info[$node->name]; - if (isset($def->excludes[$name])) { - return false; + if (!empty($this->currentNesting)) { + for ($i = count($this->currentNesting) - 2; $i >= 0; $i--) { + $node = $this->currentNesting[$i]; + $def = $this->htmlDefinition->info[$node->name]; + if (isset($def->excludes[$name])) { + return false; + } } } return true; diff --git a/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Length.php b/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Length.php index bbfbe66..e70da55 100644 --- a/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Length.php +++ b/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Length.php @@ -26,12 +26,14 @@ class HTMLPurifier_Length protected $isValid; /** - * Array Lookup array of units recognized by CSS 2.1 + * Array Lookup array of units recognized by CSS 3 * @type array */ protected static $allowedUnits = array( 'em' => true, 'ex' => true, 'px' => true, 'in' => true, - 'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true + 'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true, + 'ch' => true, 'rem' => true, 'vw' => true, 'vh' => true, + 'vmin' => true, 'vmax' => true ); /** diff --git a/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php b/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php index 22ab582..6238a99 100644 --- a/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php +++ b/src/backend-libs/ezyang/htmlpurifier/library/HTMLPurifier/Lexer/DOMLex.php @@ -126,6 +126,41 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer } while ($level > 0); } + /** + * Portably retrieve the tag name of a node; deals with older versions + * of libxml like 2.7.6 + * @param DOMNode $node + */ + protected function getTagName($node) + { + if (property_exists($node, 'tagName')) { + return $node->tagName; + } else if (property_exists($node, 'nodeName')) { + return $node->nodeName; + } else if (property_exists($node, 'localName')) { + return $node->localName; + } + return null; + } + + /** + * Portably retrieve the data of a node; deals with older versions + * of libxml like 2.7.6 + * @param DOMNode $node + */ + protected function getData($node) + { + if (property_exists($node, 'data')) { + return $node->data; + } else if (property_exists($node, 'nodeValue')) { + return $node->nodeValue; + } else if (property_exists($node, 'textContent')) { + return $node->textContent; + } + return null; + } + + /** * @param DOMNode $node DOMNode to be tokenized. * @param HTMLPurifier_Token[] $tokens Array-list of already tokenized tokens. @@ -141,7 +176,10 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer // but we're not getting the character reference nodes because // those should have been preprocessed if ($node->nodeType === XML_TEXT_NODE) { - $tokens[] = $this->factory->createText($node->data); + $data = $this->getData($node); // Handle variable data property + if ($data !== null) { + $tokens[] = $this->factory->createText($data); + } return false; } elseif ($node->nodeType === XML_CDATA_SECTION_NODE) { // undo libxml's special treatment of + - - -