Commit 8fbf3b44 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

Fix html export tumbnail replacement filter compatibility issues (bug #784313)

This patch updates the filter the way it could handle all possible ampersand
notations. It effectively replaces patch 858f1b9a

 with more approprate
approach suggested by Richard.

Change-Id: I084fb04b5d1cad22006e390509ea610e2aec3e78
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent 73c51873
...@@ -654,7 +654,7 @@ class HtmlExportOutputFilter { ...@@ -654,7 +654,7 @@ class HtmlExportOutputFilter {
// Thumbnails // Thumbnails
require_once('file.php'); require_once('file.php');
$html = preg_replace_callback( $html = preg_replace_callback(
'#(?<=[\'"])(' . $wwwroot . ')?/?thumb\.php\?type=([a-z]+)((&amp;[a-z]+=[x0-9]+)+)*#', '#(?<=[\'"])(' . $wwwroot . ')?/?thumb\.php\?type=([a-z]+)((?:(?:&amp;|&|%26)[a-z]+=[x0-9]+)+)*#',
array($this, 'replace_thumbnail_link'), array($this, 'replace_thumbnail_link'),
$html $html
); );
...@@ -753,7 +753,8 @@ class HtmlExportOutputFilter { ...@@ -753,7 +753,8 @@ class HtmlExportOutputFilter {
if (isset($matches[3])) { if (isset($matches[3])) {
$type = $matches[2]; $type = $matches[2];
$parts = explode('&amp;', substr($matches[3], 5)); $parts = preg_split('/(&amp;|&|%26)/', $matches[3]);
array_shift($parts);
foreach ($parts as $part) { foreach ($parts as $part) {
list($key, $value) = explode('=', $part); list($key, $value) = explode('=', $part);
$options[$key] = $value; $options[$key] = $value;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment