| | |
| | | if (!empty($addr_part['mailto']) |
| | | && !in_array($addr_part['mailto'], $sa_recipients) |
| | | && (!$MESSAGE->compose_from |
| | | || !in_array($addr_part['mailto'], $MESSAGE->compose_from) |
| | | || !in_array_nocase($addr_part['mailto'], $MESSAGE->compose_from) |
| | | || count($to_addresses)==1)) // allow reply to yourself |
| | | { |
| | | $fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string']; |
| | |
| | | foreach ($a_to as $addr) |
| | | { |
| | | if (!empty($addr['mailto'])) |
| | | $a_recipients[] = $addr['mailto']; |
| | | $a_recipients[] = rc_strtolower($addr['mailto']); |
| | | } |
| | | |
| | | if (!empty($MESSAGE->headers->cc)) |
| | |
| | | foreach ($a_cc as $addr) |
| | | { |
| | | if (!empty($addr['mailto'])) |
| | | $a_recipients[] = $addr['mailto']; |
| | | $a_recipients[] = rc_strtolower($addr['mailto']); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // set identity if it's one of the reply-message recipients |
| | | if (in_array($sql_arr['email'], $a_recipients)) |
| | | $from_id = $sql_arr['identity_id']; |
| | | |
| | | if ($compose_mode == RCUBE_COMPOSE_REPLY && is_array($MESSAGE->compose_from)) |
| | | $MESSAGE->compose_from[] = $sql_arr['email']; |
| | | |
| | | if ($compose_mode == RCUBE_COMPOSE_DRAFT && strstr($MESSAGE->headers->from, $sql_arr['email'])) |
| | | $from_id = $sql_arr['identity_id']; |
| | | if (empty($_POST['_from'])) |
| | | { |
| | | // set draft's identity |
| | | if ($compose_mode == RCUBE_COMPOSE_DRAFT && strstr($MESSAGE->headers->from, $sql_arr['email'])) |
| | | $from_id = $sql_arr['identity_id']; |
| | | // set identity if it's one of the reply-message recipients (with prio for default identity) |
| | | else if (in_array(rc_strtolower($sql_arr['email']), $a_recipients) && (empty($from_id) || $sql_arr['standard'])) |
| | | $from_id = $sql_arr['identity_id']; |
| | | } |
| | | } |
| | | |
| | | // overwrite identity selection with post parameter |
| | | if (isset($_POST['_from'])) |
| | | if (!empty($_POST['_from'])) |
| | | $from_id = get_input_value('_from', RCUBE_INPUT_POST); |
| | | |
| | | $out = $select_from->show($from_id); |
| | |
| | | |
| | | if (! $bodyIsHtml) |
| | | { |
| | | // soft-wrap message first |
| | | $body = rcmail_wrap_quoted($body, 75); |
| | | |
| | | // split body into single lines |
| | | $a_lines = preg_split('/\r?\n/', $body); |
| | | |
| | | // add > to each line |
| | | for($n=0; $n<sizeof($a_lines); $n++) |
| | | { |
| | | if (strpos($a_lines[$n], '>')===0) |
| | | $a_lines[$n] = '>'.$a_lines[$n]; |
| | | else |
| | | $a_lines[$n] = '> '.$a_lines[$n]; |
| | | } |
| | | |
| | | $body = join("\n", $a_lines); |
| | | |
| | | // add title line |
| | | $prefix = sprintf("On %s, %s wrote:\n", |
| | | $MESSAGE->headers->date, |
| | | $MESSAGE->get_header('from')); |
| | | |
| | | // try to remove the signature |
| | | if ($sp = strrpos($body, '-- ')) |
| | | if (($sp = strrpos($body, '-- ')) !== false && ($sp == 0 || $body{$sp-1} == "\n")) |
| | | { |
| | | if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r") |
| | | $body = substr($body, 0, $sp-1); |
| | | $body = substr($body, 0, max(0, $sp-1)); |
| | | } |
| | | |
| | | // soft-wrap message first |
| | | $body = rcmail_wrap_quoted($body, 75); |
| | | |
| | | $body = rtrim($body, "\r\n"); |
| | | |
| | | if ($body) { |
| | | // split body into single lines |
| | | $a_lines = preg_split('/\r?\n/', $body); |
| | | |
| | | // add > to each line |
| | | for($n=0; $n<sizeof($a_lines); $n++) { |
| | | if (strpos($a_lines[$n], '>')===0) |
| | | $a_lines[$n] = '>'.$a_lines[$n]; |
| | | else |
| | | $a_lines[$n] = '> '.$a_lines[$n]; |
| | | } |
| | | |
| | | $body = join("\n", $a_lines); |
| | | } |
| | | |
| | | // add title line(s) |
| | | $prefix = wordwrap(sprintf("On %s, %s wrote:\n", |
| | | $MESSAGE->headers->date, |
| | | $MESSAGE->get_header('from')), 76); |
| | | |
| | | $suffix = ''; |
| | | } |
| | | else |
| | |
| | | $button = html::img(array( |
| | | 'src' => $CONFIG['skin_path'] . $attrib['deleteicon'], |
| | | 'alt' => rcube_label('delete'), |
| | | 'style' => "border:0;padding-right:2px;vertical-align:middle")); |
| | | 'style' => "padding-right:2px;vertical-align:middle")); |
| | | else |
| | | $button = Q(rcube_label('delete')); |
| | | |