From a8afb411a0fba881d56bf12068a15778b4facf2f Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 26 Oct 2002 03:33:07 +0000 Subject: [PATCH] OK, this should be better ... --- mod/forum/lib.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 1018c63658..64acaf71e9 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -724,7 +724,7 @@ function forum_shorten_post($message) { $truncate = 0; for ($i=0; $i<$length; $i++) { - $char = $string[$i]; + $char = $message[$i]; switch ($char) { case "<": @@ -737,12 +737,13 @@ function forum_shorten_post($message) { if (!$tag) { if ($stopzone) { if ($char == " " or $char == ".") { - $truncate = $i; + $truncate = $i+1; break 2; } } $count++; } + break; } if (!$stopzone) { if ($count > FORUM_SHORT_POST) { @@ -752,14 +753,10 @@ function forum_shorten_post($message) { } if (!$truncate) { - if ($i < FORUM_LONG_POST) { - $truncate = $i; - } else { - $truncate = FORUM_LONG_POST; - } + $truncate = $i; } - return substr($message, 0, $truncate); + return substr($message, 0, $truncate)."
"; } -- 2.39.5