aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_content.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_content.php')
-rw-r--r--phpBB/includes/functions_content.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 630f4105d0..de5df37299 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -250,6 +250,11 @@ function get_context($text, $words, $length = 400)
// first replace all whitespaces with single spaces
$text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' '));
+ // we need to turn the entities back into their original form, to not cut the message in between them
+ $entities = array('<', '>', '[', ']', '.', ':', ':');
+ $characters = array('<', '>', '[', ']', '.', ':', ':');
+ $text = str_replace($entities, $characters, $text);
+
$word_indizes = array();
if (sizeof($words))
{
@@ -345,13 +350,13 @@ function get_context($text, $words, $length = 400)
}
}
}
- return $final_text;
+ return str_replace($characters, $entities, $final_text);
}
}
if (!sizeof($words) || !sizeof($word_indizes))
{
- return (utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text;
+ return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text));
}
}