From 5bb2edf96ebcedfdfb0377618672ff7e619a9904 Mon Sep 17 00:00:00 2001 From: Sazpaimon Date: Thu, 28 May 2009 11:49:13 +0000 Subject: [PATCH] Fix a bug where a link would not be properly parsed if the character immediately after it isn't a space (for example, [spoiler]http://www.google.com[/spoiler]) Fixed an extremely rare bug where a tag would be partially opened on the board page due to it being cut off by the log message filter. You'll probably never have this happen anyway. Thanks to Anonymo for both of these. git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@180 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee --- inc/classes/parse.class.php | 2 +- inc/func/stringformatting.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/inc/classes/parse.class.php b/inc/classes/parse.class.php index 8351c9b..b5bd630 100644 --- a/inc/classes/parse.class.php +++ b/inc/classes/parse.class.php @@ -29,7 +29,7 @@ class Parse { function MakeClickable($txt) { /* Make http:// urls in posts clickable */ - $txt = preg_replace('#(http://|https://|ftp://)([^(\s<)]*)#', '\\1\\2', $txt); + $txt = preg_replace('#(http://|https://|ftp://)([^(\s<|\[)]*)#', '\\1\\2', $txt); return $txt; } diff --git a/inc/func/stringformatting.php b/inc/func/stringformatting.php index e5c7e17..0fc02f4 100644 --- a/inc/func/stringformatting.php +++ b/inc/func/stringformatting.php @@ -199,7 +199,12 @@ function formatLongMessage($message, $board, $threadid, $page) { $message_shortened = substr($message_shortened, 0, KU_LINELENGTH); } $message_shortened = closeOpenTags($message_shortened); - + + if (strrpos($message_shortened,"<") > strrpos($message_shortened,">")) { + //We have a partially opened tag we need to get rid of. + $message_shortened = substr($message_shortened, 0, strrpos($message_shortened,"<")); + } + $output = $message_shortened . '
' . "\n" . ' ' . sprintf(_gettext('Message too long. Click %shere%s to view the full text.'), '', '') . "\n" . '
' . "\n";