From 8d2512f5ab3278bb4191de8e5da07e38b4fa966e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 13 Sep 2007 08:13:43 +0000 Subject: [PATCH] fixed two mail2infolog problems: 1. instead of default status of email type done was used, 2. long lines of line-chars (-_+=~) stalled the infolog layout, they get now truncated to 40 of these chars --- infolog/inc/class.boinfolog.inc.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/infolog/inc/class.boinfolog.inc.php b/infolog/inc/class.boinfolog.inc.php index 518ea9bc35..d06d319062 100644 --- a/infolog/inc/class.boinfolog.inc.php +++ b/infolog/inc/class.boinfolog.inc.php @@ -125,6 +125,13 @@ class boinfolog * @var infolog_tracking */ var $tracking; + /** + * Maximum number of line characters (-_+=~) allowed in a mail, to not stall the layout. + * Longer lines / biger number of these chars are truncated to that max. number or chars. + * + * @var int + */ + var $max_line_chars = 40; /** * Constructor Infolog BO @@ -874,15 +881,19 @@ class boinfolog trim($address->host)); $name[] = !empty($address->personal) ? $address->personal : $emailadr; } + // shorten long (> $this->max_line_chars) lines of "line" chars (-_+=~) in mails + $_message = preg_replace_callback('/[-_+=~]{'.$this->max_line_chars.',}/m', + create_function('$matches',"return substr(\$matches[0],0,$this->max_line_chars);"),$_message); + $type = isset($this->enums['type']['email']) ? 'email' : 'note'; $info = array( 'info_id' => 0, - 'info_type' => isset($this->enums['type']['email']) ? 'email' : 'note', + 'info_type' => $type, 'info_from' => implode(',',$name), 'info_addr' => implode(',',$email), 'info_subject' => $_subject, 'info_des' => $_message, 'info_startdate' => $_date, - 'info_status' => 'done', + 'info_status' => isset($this->status['defaults'][$type]) ? $this->status['defaults'][$type] : 'done', 'info_priority' => 1, 'info_percent' => 100, 'referer' => false,