Browse Source

Only add extra "points" for a subject with entities when the entities are
within the remaining range after trimming. This prevents entities at the end
which are cut off anyway to influence the cut-off-point for the subject.

Thijs Kinkhorst 22 years ago
parent
commit
478af4b1c6
1 changed files with 4 additions and 3 deletions
  1. 4 3
      functions/mailbox_display.php

+ 4 - 3
functions/mailbox_display.php

@@ -1121,7 +1121,7 @@ function processSubject($subject, $threadlevel = 0) {
 
     $trim_at = 55;
 
-    /* if this is threaded, substract two chars per indentlevel */
+    /* if this is threaded, subtract two chars per indentlevel */
     if($threadlevel > 0 && $threadlevel <= 10)
         $trim_at -= (2*$threadlevel);
 
@@ -1137,8 +1137,9 @@ function processSubject($subject, $threadlevel = 0) {
      * the real number of characters, and if more
      * than 55, substr with an updated trim value.
      */
-    while ( (($ent_loc = strpos($subject, '&', $ent_offset)) !== false) &&
-            (($ent_loc_end = strpos($subject, ';', $ent_loc)) !== false) ) {
+
+    while ( (($ent_loc = strpos(substr($subject,0,$trim_val), '&', $ent_offset)) !== false) &&
+            (($ent_loc_end = strpos(substr($subject,0,$trim_val+5), ';', $ent_loc)) !== false) ) {
         $trim_val   += ($ent_loc_end-$ent_loc)+1;
         $ent_strlen -= $ent_loc_end-$ent_loc;
         $ent_offset  = $ent_loc_end+1;