]> git.mjollnir.org Git - moodle.git/commitdiff
OK, this should be better ...
authormoodler <moodler>
Sat, 26 Oct 2002 03:33:07 +0000 (03:33 +0000)
committermoodler <moodler>
Sat, 26 Oct 2002 03:33:07 +0000 (03:33 +0000)
mod/forum/lib.php

index 1018c63658fcd2ed9e496fd2392fa3238e9147d5..64acaf71e9e5e10bb8aec1fd38a2832a84807c98 100644 (file)
@@ -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)."<BR>";
 }