[RCU] German - Reply - Tag

Michael Orlitzky michael at orlitzky.com
Thu Nov 11 21:32:27 CET 2010


On 11/11/2010 02:37 PM, Ulli Heist wrote:
> 
>  For this I did a code-change in program/steps/mail/compose.php
>  starting at line 905
>  <snip>
>    else if ($compose_mode == RCUBE_COMPOSE_REPLY)
>    {
>     $MESSAGE->subject = ltrim($MESSAGE->subject, "RE:");
>     $MESSAGE->subject = ltrim($MESSAGE->subject, "Betreff:");
>     $MESSAGE->subject = ltrim($MESSAGE->subject, "Re:");
>     $MESSAGE->subject = ltrim($MESSAGE->subject, "AW:");
>     $MESSAGE->subject = ltrim($MESSAGE->subject, "WG:");
>     $MESSAGE->subject = ltrim($MESSAGE->subject, "Antwort:");
> 
>      if (preg_match('/^re:/i', $MESSAGE->subject))
>  </snip>
> 
>  But sometimes are too many characters deleted - I don't know why!

The ltrim function doesn't do what you think it does. The second
parameter is a list (string) of characters that will be trimmed from the
left side of $MESSAGE->subject.

So,

  ltrim("Betreff:the funniest cat video", "Betreff:")

would get trimmed to,

  he funniest cat video

because the leading 't' in "the" is in the list of characters to remove.

You probably want preg_replace instead:

  http://www.php.net/manual/en/function.preg-replace.php
_______________________________________________
List info: http://lists.roundcube.net/users/
BT/9b404e9e



More information about the users mailing list