From: moodler Date: Sat, 26 Oct 2002 03:33:07 +0000 (+0000) Subject: OK, this should be better ... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a8afb411a0fba881d56bf12068a15778b4facf2f;p=moodle.git OK, this should be better ... --- 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)."
"; }