aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-03-13 14:48:21 +0100
committerMarc Alexander <admin@m-a-styles.de>2016-03-13 14:48:21 +0100
commit17b8e93a5350e297f9be0925120f0b6cf34f5ffe (patch)
tree48d26addd11f8c3f267e63580997ca7bf3370dea
parentdad531e4b2c19dd22b8dd6a15e410e187a67fe46 (diff)
downloadforums-17b8e93a5350e297f9be0925120f0b6cf34f5ffe.tar
forums-17b8e93a5350e297f9be0925120f0b6cf34f5ffe.tar.gz
forums-17b8e93a5350e297f9be0925120f0b6cf34f5ffe.tar.bz2
forums-17b8e93a5350e297f9be0925120f0b6cf34f5ffe.tar.xz
forums-17b8e93a5350e297f9be0925120f0b6cf34f5ffe.zip
[ticket/14527] Decode automatically generated postlink without prefix
The http prefix gets automatically added and should be removed prior to outputting the post to the user. PHPBB3-14527
-rw-r--r--phpBB/includes/functions.php1
-rw-r--r--phpBB/includes/functions_content.php2
-rw-r--r--tests/text_processing/decode_message_test.php2
3 files changed, 3 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index d984f41b08..8d727fb414 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2745,6 +2745,7 @@ function get_preg_expression($mode)
return array(
'#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
'#<!\-\- l \-\-><a (?:class="[\w-]+" )?href="(.*?)(?:(&amp;|\?)sid=[0-9a-f]{32})?">.*?</a><!\-\- l \-\->#',
+ '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="http://(.*?)">\2</a><!\-\- \1 \-\->#',
'#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->#',
'#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#',
'#<!\-\- .*? \-\->#s',
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index cfa713daab..df4a51db98 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -469,7 +469,7 @@ function decode_message(&$message, $bbcode_uid = '')
$message = str_replace($match, $replace, $message);
$match = get_preg_expression('bbcode_htm');
- $replace = array('\1', '\1', '\2', '\1', '', '');
+ $replace = array('\1', '\1', '\2', '\2', '\1', '', '');
$message = preg_replace($match, $replace, $message);
}
diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php
index 6ee5f91578..fd1719fedc 100644
--- a/tests/text_processing/decode_message_test.php
+++ b/tests/text_processing/decode_message_test.php
@@ -49,7 +49,7 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case
),
array(
'<!-- w --><a class="postlink" href="http://www.phpbb.com">www.phpbb.com</a><!-- w -->',
- 'http://www.phpbb.com'
+ 'www.phpbb.com'
),
array(
'<!-- m --><a class="postlink" href="http://www.phpbb.com">http://www.phpbb.com</a><!-- m -->',