- if (count($output) > 0) {
- echo '<tr>' .
- html_tag('td', '<b>' . _("Mailing List") . ': </b>',
- 'right', '', 'valign="middle" width="20%"') . "\n" .
- html_tag('td', '<small>' . implode(' | ', $output) . '</small>',
- 'left', $color[0], 'valign="middle" width="80%"') . "\n" .
- '</tr>';
+
+ // allow non-rfc reply link if admin allows and message is from
+ // non-rfc list the user has configured
+ //
+ if ($listcommands_allow_non_rfc_list_management) {
+
+ $non_rfc_lists = get_non_rfc_lists();
+
+ $recipients = formatRecipientString($message->rfc822_header->to, "to") . ' '
+ . formatRecipientString($message->rfc822_header->cc, "cc") . ' '
+ . formatRecipientString($message->rfc822_header->bcc, "bcc");
+
+ if (!in_array('post', array_keys($links))) {
+
+ foreach ($non_rfc_lists as $non_rfc_list) {
+ if (preg_match('/(^|,|<|\s)' . preg_quote($non_rfc_list) . '($|,|>|\s)/', $recipients)) {
+ $url = 'src/compose.php?'
+ . (isset($startMessage)?'startMessage='.$startMessage.'&':'')
+ . 'send_to=' . str_replace('?','&', $non_rfc_list);
+
+ $links['post'] = makeComposeLink($url, $fieldsdescr['post']);
+
+ break;
+ }
+ }
+
+ }
+
+ if (!in_array('reply', array_keys($links))) {
+
+ foreach ($non_rfc_lists as $non_rfc_list) {
+ if (preg_match('/(^|,|\s)' . preg_quote($non_rfc_list) . '($|,|\s)/', $recipients)) {
+ if (!isset($mailbox))
+ $mailbox = 'INBOX';
+ $url = 'src/compose.php?'
+ . (isset($startMessage)?'startMessage='.$startMessage.'&':'')
+ . 'send_to=' . str_replace('?','&', $non_rfc_list)
+ . '&passed_id='.$passed_id
+ . '&mailbox='.urlencode($mailbox)
+ . (isset($passed_ent_id)?'&passed_ent_id='.$passed_ent_id:'')
+ . '&smaction=reply';
+
+ $links['reply'] = makeComposeLink($url, $fieldsdescr['reply']);
+
+ break;
+ }
+ }
+
+ }
+