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
This commit is contained in:
Sazpaimon committed 2009-05-28 11:49:13 +00:00
1 parent 15b1faf8a5
commit 5bb2edf96e
2 files changed
+7 -2

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ class Parse {
function MakeClickable($txt) {
/* Make http:// urls in posts clickable */
$txt = preg_replace('#(http://|https://|ftp://)([^(\s<)]*)#', '<a href="\\1\\2">\\1\\2</a>', $txt);
$txt = preg_replace('#(http://|https://|ftp://)([^(\s<|\[)]*)#', '<a href="\\1\\2">\\1\\2</a>', $txt);
return $txt;
}
+6 -1
View File
@@ -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 . '<div class="abbrev">' . "\n" .
' ' . sprintf(_gettext('Message too long. Click %shere%s to view the full text.'), '<a href="' . KU_BOARDSFOLDER . $board . '/res/' . $threadid . '.html">', '</a>') . "\n" .
'</div>' . "\n";