Beispiel #1
0
function plugin_listcommands_menu()
{
    global $passed_id, $passed_ent_id, $color, $mailbox, $message, $compose_new_win, $startMessage;
    /**
     * Array of commands we can deal with from the header. The Reply option
     * is added later because we generate it using the Post information.
     */
    $fieldsdescr = array('post' => _("Post to List"), 'reply' => _("Reply to List"), 'subscribe' => _("Subscribe"), 'unsubscribe' => _("Unsubscribe"), 'archive' => _("List Archives"), 'owner' => _("Contact Listowner"), 'help' => _("Help"));
    $output = array();
    foreach ($message->rfc822_header->mlist as $cmd => $actions) {
        /* I don't know this action... skip it */
        if (function_exists('array_key_exists') && !array_key_exists($cmd, $fieldsdescr) || function_exists('key_exists') && !key_exists($cmd, $fieldsdescr)) {
            continue;
        }
        /* proto = {mailto,href} */
        $aActionKeys = array_keys($actions);
        $proto = array_shift($aActionKeys);
        $act = array_shift($actions);
        if ($proto == 'mailto') {
            if ($cmd == 'post' || $cmd == 'owner') {
                $url = 'src/compose.php?' . (isset($startMessage) ? 'startMessage=' . $startMessage . '&' : '');
            } else {
                $url = "plugins/listcommands/mailout.php?action={$cmd}&";
            }
            $url .= 'send_to=' . str_replace('?', '&', $act);
            $output[] = makeComposeLink($url, $fieldsdescr[$cmd]);
            if ($cmd == 'post') {
                $url .= '&passed_id=' . $passed_id . '&mailbox=' . urlencode($mailbox) . (isset($passed_ent_id) ? '&passed_ent_id=' . $passed_ent_id : '');
                $url .= '&smaction=reply';
                $output[] = makeComposeLink($url, $fieldsdescr['reply']);
            }
        } else {
            if ($proto == 'href') {
                $output[] = '<a href="' . $act . '" target="_blank">' . $fieldsdescr[$cmd] . '</a>';
            }
        }
    }
    if (count($output) > 0) {
        echo '<tr>';
        echo html_tag('td', '<b>' . _("Mailing List") . ':&nbsp;&nbsp;</b>', 'right', '', 'valign="middle" width="20%"') . "\n";
        echo html_tag('td', '<small>' . implode('&nbsp;|&nbsp;', $output) . '</small>', 'left', $color[0], 'valign="middle" width="80%"') . "\n";
        echo '</tr>';
    }
}
/**
 * Outputs a complete SquirrelMail page header, starting with <!doctype> and
 * including the default menu bar. Uses displayHtmlHeader and takes
 * JavaScript and locale settings into account.
 *
 * @param array color the array of theme colors
 * @param string mailbox the current mailbox name to display
 * @param string xtra extra html code to add
 * @param bool session
 * @return void
 */
function displayPageHeader($color, $mailbox, $xtra = '', $session = false)
{
    global $hide_sm_attributions, $PHP_SELF, $frame_top, $compose_new_win, $compose_width, $compose_height, $attachemessages, $provider_name, $provider_uri, $javascript_on, $default_use_mdn, $mdn_user_support, $startMessage;
    sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    $module = substr($PHP_SELF, (strlen($PHP_SELF) - strlen($base_uri)) * -1);
    if ($qmark = strpos($module, '?')) {
        $module = substr($module, 0, $qmark);
    }
    if (!isset($frame_top)) {
        $frame_top = '_top';
    }
    if ($session) {
        $compose_uri = $base_uri . 'src/compose.php?mailbox=' . urlencode($mailbox) . '&amp;attachedmessages=true&amp;session=' . "{$session}";
    } else {
        $compose_uri = $base_uri . 'src/compose.php?newmessage=1';
        $session = 0;
    }
    if ($javascript_on) {
        switch ($module) {
            case 'src/read_body.php':
                $js = '';
                // compose in new window code
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new_form(comp_uri, button, myform) {\n" . '   if (!comp_uri) {' . "\n" . '       comp_uri = "' . $compose_uri . "\";\n" . '   }' . "\n" . '   comp_uri += "&" + button.name + "=1";' . "\n" . '   for ( var i=0; i < myform.elements.length; i++ ) {' . "\n" . '      if ( myform.elements[i].type == "checkbox"  && myform.elements[i].checked )' . "\n" . '         comp_uri += "&" + myform.elements[i].name + "=1";' . "\n" . '   }' . "\n" . '   var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                // javascript for sending read receipts
                if ($default_use_mdn && $mdn_user_support) {
                    $js .= 'function sendMDN() {' . "\n" . "    mdnuri=window.location+'&sendreceipt=1'; " . "var newwin = window.open(mdnuri,'right');" . "\n}\n\n";
                }
                // if any of the above passes, add the JS tags too.
                if ($js) {
                    $js = "\n" . '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . $js . "// -->\n</script>\n";
                }
                displayHtmlHeader('SquirrelMail', $js);
                $onload = $xtra;
                break;
            case 'src/compose.php':
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "function checkForm() {\n";
                global $action, $reply_focus;
                if (strpos($action, 'reply') !== FALSE && $reply_focus) {
                    if ($reply_focus == 'select') {
                        $js .= "document.forms['compose'].body.select();}\n";
                    } else {
                        if ($reply_focus == 'focus') {
                            $js .= "document.forms['compose'].body.focus();}\n";
                        } else {
                            if ($reply_focus == 'none') {
                                $js .= "}\n";
                            }
                        }
                    }
                } else {
                    if ($reply_focus == 'none') {
                        $js .= "}\n";
                    } else {
                        $js .= "var f = document.forms.length;\n" . "var i = 0;\n" . "var pos = -1;\n" . "while( pos == -1 && i < f ) {\n" . "var e = document.forms[i].elements.length;\n" . "var j = 0;\n" . "while( pos == -1 && j < e ) {\n" . "if ( document.forms[i].elements[j].type == 'text' ) {\n" . "pos = j;\n" . "}\n" . "j++;\n" . "}\n" . "i++;\n" . "}\n" . "if( pos >= 0 ) {\n" . "document.forms[i-1].elements[pos].focus();\n" . "}\n" . "}\n";
                    }
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader('SquirrelMail', $js);
                break;
            default:
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "function checkForm() {\n" . "var f = document.forms.length;\n" . "var i = 0;\n" . "var pos = -1;\n" . "while( pos == -1 && i < f ) {\n" . "var e = document.forms[i].elements.length;\n" . "var j = 0;\n" . "while( pos == -1 && j < e ) {\n" . "if ( document.forms[i].elements[j].type == 'text' " . "|| document.forms[i].elements[j].type == 'password' ) {\n" . "pos = j;\n" . "}\n" . "j++;\n" . "}\n" . "i++;\n" . "}\n" . "if( pos >= 0 ) {\n" . "document.forms[i-1].elements[pos].focus();\n" . "}\n" . "{$xtra}\n" . "}\n";
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader('SquirrelMail', $js);
                break;
        }
    } else {
        /* do not use JavaScript */
        displayHtmlHeader('SquirrelMail');
        $onload = '';
    }
    echo "<body text=\"{$color['8']}\" bgcolor=\"{$color['4']}\" link=\"{$color['7']}\" vlink=\"{$color['7']}\" alink=\"{$color['7']}\" {$onload}>\n\n";
    /** Here is the header and wrapping table **/
    $shortBoxName = htmlspecialchars(imap_utf7_decode_local(readShortMailboxName($mailbox, $delimiter)));
    if ($shortBoxName == 'INBOX') {
        $shortBoxName = _("INBOX");
    }
    echo "<a name=\"pagetop\"></a>\n" . html_tag('table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"') . "\n" . html_tag('tr', '', '', $color[9]) . "\n" . html_tag('td', '', 'left') . "\n";
    if ($shortBoxName != '' && strtolower($shortBoxName) != 'none') {
        echo '         ' . _("Current Folder") . ": <b>{$shortBoxName}&nbsp;</b>\n";
    } else {
        echo '&nbsp;';
    }
    echo "      </td>\n" . html_tag('td', '', 'right') . "<b>\n";
    displayInternalLink('src/signout.php', _("Sign Out"), $frame_top);
    echo "</b></td>\n" . "   </tr>\n" . html_tag('tr', '', '', $color[4]) . "\n" . ($hide_sm_attributions ? html_tag('td', '', 'left', '', 'colspan="2"') : html_tag('td', '', 'left')) . "\n";
    $urlMailbox = urlencode($mailbox);
    echo makeComposeLink('src/compose.php?mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage);
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/addressbook.php', _("Addresses"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/folders.php', _("Folders"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/options.php', _("Options"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink("src/search.php?mailbox={$urlMailbox}", _("Search"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/help.php', _("Help"));
    echo "&nbsp;&nbsp;\n";
    do_hook('menuline');
    echo "      </td>\n";
    if (!$hide_sm_attributions) {
        echo html_tag('td', '', 'right') . "\n";
        if (!isset($provider_uri)) {
            $provider_uri = 'http://www.squirrelmail.org/';
        }
        if (!isset($provider_name)) {
            $provider_name = 'SquirrelMail';
        }
        echo '<a href="' . $provider_uri . '" target="_blank">' . $provider_name . '</a>';
        echo "</td>\n";
    }
    echo "   </tr>\n" . "</table><br />\n\n";
}
/**
 * Parses a body and converts all found URLs to clickable links.
 *
 * @param string body the body to process, by ref
 * @return void
 */
function parseUrl(&$body)
{
    global $url_parser_poss_ends, $url_parser_url_tokens;
    $start = 0;
    $blength = strlen($body);
    while ($start < $blength) {
        $target_token = '';
        $target_pos = $blength;
        /* Find the first token to replace */
        foreach ($url_parser_url_tokens as $the_token) {
            $pos = strpos(strtolower($body), $the_token, $start);
            if (is_int($pos) && $pos < $target_pos) {
                $target_pos = $pos;
                $target_token = $the_token;
            }
        }
        /* Look for email addresses between $start and $target_pos */
        $check_str = substr($body, $start, $target_pos - $start);
        if (parseEmail($check_str)) {
            replaceBlock($body, $check_str, $start, $target_pos);
            $blength = strlen($body);
            $target_pos = strlen($check_str) + $start;
        }
        /* If there was a token to replace, replace it */
        if ($target_token == 'mailto:') {
            // rfc 2368 (mailto URL)
            $target_pos += 7;
            //skip mailto:
            $end = $blength;
            $mailto = substr($body, $target_pos, $end - $target_pos);
            global $MailTo_PReg_Match;
            if (preg_match($MailTo_PReg_Match, $mailto, $regs) && $regs[0] != '') {
                //sm_print_r($regs);
                $mailto_before = $target_token . $regs[0];
                $mailto_params = $regs[10];
                if ($regs[1]) {
                    //if there is an email addr before '?', we need to merge it with the params
                    $to = 'to=' . $regs[1];
                    if (strpos($mailto_params, 'to=') > -1) {
                        //already a 'to='
                        $mailto_params = str_replace('to=', $to . '%2C%20', $mailto_params);
                    } else {
                        if ($mailto_params) {
                            //already some params, append to them
                            $mailto_params .= '&amp;' . $to;
                        } else {
                            $mailto_params .= '?' . $to;
                        }
                    }
                }
                $url_str = str_replace(array('to=', 'cc=', 'bcc='), array('send_to=', 'send_to_cc=', 'send_to_bcc='), $mailto_params);
                $comp_uri = makeComposeLink('src/compose.php' . $url_str, $mailto_before);
                replaceBlock($body, $comp_uri, $target_pos - 7, $target_pos + strlen($regs[0]));
                $target_pos += strlen($comp_uri) - 7;
            }
        } else {
            if ($target_token != '') {
                /* Find the end of the URL */
                $end = $blength;
                foreach ($url_parser_poss_ends as $val) {
                    $enda = strpos($body, $val, $target_pos);
                    if (is_int($enda) && $enda < $end) {
                        $end = $enda;
                    }
                }
                /* Extract URL */
                $url = substr($body, $target_pos, $end - $target_pos);
                /* Needed since lines are not passed with \n or \r */
                while (ereg("[,\\.]\$", $url)) {
                    $url = substr($url, 0, -1);
                    $end--;
                }
                /* Replace URL with HyperLinked Url, requires 1 char in link */
                if ($url != '' && $url != $target_token) {
                    $url_str = "<a href=\"{$url}\" target=\"_blank\">{$url}</a>";
                    replaceBlock($body, $url_str, $target_pos, $end);
                    $target_pos += strlen($url_str);
                } else {
                    // Not quite a valid link, skip ahead to next chance
                    $target_pos += strlen($target_token);
                }
            }
        }
        /* Move forward */
        $start = $target_pos;
        $blength = strlen($body);
    }
}
Beispiel #4
0
                    echo html_tag('td', '<small>' . addCheckBox('sel[' . $count . ']', $selected, $row['backend'] . ':' . $row['nickname'], ' id="' . $row['backend'] . '_' . urlencode($row['nickname']) . '"') . '</small>', 'center', '', 'valign="top" width="1%"');
                } else {
                    echo html_tag('td', '&nbsp;', 'center', '', 'valign="top" width="1%"');
                }
                echo html_tag('td', '&nbsp;<label for="' . $row['backend'] . '_' . urlencode($row['nickname']) . '">' . htmlspecialchars($row['nickname']) . '</label>&nbsp;', 'left', '', 'valign="top" width="10%" nowrap') . html_tag('td', '&nbsp;<label for="' . $row['backend'] . '_' . urlencode($row['nickname']) . '">' . htmlspecialchars($row['lastname']) . ' ' . htmlspecialchars($row['firstname']) . '</label>&nbsp;', 'left', '', 'valign="top" width="10%" nowrap') . html_tag('td', '', 'left', '', 'valign="top" width="10%" nowrap') . '&nbsp;';
            } else {
                echo html_tag('tr', '', '', $tr_bgcolor);
                if ($abook->backends[$row['backend']]->writeable) {
                    echo html_tag('td', '<small>' . addCheckBox('sel[' . $count . ']', $selected, $row['backend'] . ':' . $row['nickname'], ' id="' . $row['backend'] . '_' . urlencode($row['nickname']) . '"') . '</small>', 'center', '', 'valign="top" width="1%"');
                } else {
                    echo html_tag('td', '&nbsp;', 'center', '', 'valign="top" width="1%"');
                }
                echo html_tag('td', '&nbsp;<label for="' . $row['backend'] . '_' . urlencode($row['nickname']) . '">' . htmlspecialchars($row['nickname']) . '</label>&nbsp;', 'left', '', 'valign="top" width="10%" nowrap') . html_tag('td', '&nbsp;<label for="' . $row['backend'] . '_' . urlencode($row['nickname']) . '">' . htmlspecialchars($row['name']) . '</label>&nbsp;', 'left', '', 'valign="top" width="10%" nowrap') . html_tag('td', '', 'left', '', 'valign="top" width="10%" nowrap') . '&nbsp;';
            }
            $email = $abook->full_address($row);
            echo addHidden($row['backend'] . ':' . $row['nickname'], rawurlencode($email)) . makeComposeLink('src/compose.php?send_to=' . rawurlencode($email), htmlspecialchars($row['email'])) . '&nbsp;</td>' . "\n" . html_tag('td', '&nbsp;<label for="' . $row['backend'] . '_' . urlencode($row['nickname']) . '">' . htmlspecialchars($row['label']) . '</label>&nbsp;', 'left', '', 'valign="top" width="10%"');
            // add extra column if third party backend needs it
            if ($abook->add_extra_field) {
                echo html_tag('td', '&nbsp;' . (isset($row['extra']) ? $row['extra'] : '') . '&nbsp;', 'left', '', 'valign="top" width="10%"');
            }
            echo "</tr>\n";
            $line++;
            $count++;
        }
        /* End of list. Close table. */
        if ($headerprinted) {
            echo html_tag('tr', html_tag('td', addSubmit(_("Edit selected"), 'editaddr') . addSubmit(_("Delete selected"), 'deladdr') . addSubmit(_("Compose to selected"), 'compose_to', $javascript_on && $compose_new_win ? $compose_to_in_new_window_javascript : ''), 'center', '', "colspan=\"{$abook_fields}\""));
        }
        echo '</table></form>';
    }
}
Beispiel #5
0
function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response)
{
    global $base_uri, $draft_folder, $where, $what, $color, $sort, $startMessage, $PHP_SELF, $save_as_draft, $enable_forward_as_attachment;
    $topbar_delimiter = '&nbsp;|&nbsp;';
    $urlMailbox = urlencode($mailbox);
    $s = '<table width="100%" cellpadding="3" cellspacing="0" align="center"' . ' border="0" bgcolor="' . $color[9] . '"><tr>' . html_tag('td', '', 'left', '', 'width="33%"') . '<small>';
    $msgs_url = $base_uri . 'src/';
    if (isset($where) && isset($what)) {
        $msgs_url .= 'search.php?where=' . urlencode($where) . '&amp;what=' . urlencode($what) . '&amp;mailbox=' . $urlMailbox;
        $msgs_str = _("Search Results");
    } else {
        $msgs_url .= 'right_main.php?sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;mailbox=' . $urlMailbox;
        $msgs_str = _("Message List");
    }
    $s .= '<a href="' . $msgs_url . '">' . $msgs_str . '</a>';
    $delete_url = $base_uri . 'src/delete_message.php?mailbox=' . $urlMailbox . '&amp;message=' . $passed_id . '&amp;';
    if (!(isset($passed_ent_id) && $passed_ent_id)) {
        if ($where && $what) {
            $delete_url .= 'where=' . urlencode($where) . '&amp;what=' . urlencode($what);
        } else {
            $delete_url .= 'sort=' . $sort . '&amp;startMessage=' . $startMessage;
        }
        $s .= $topbar_delimiter;
        $s .= '<a href="' . $delete_url . '">' . _("Delete") . '</a>';
    }
    $comp_uri = 'src/compose.php' . '?passed_id=' . $passed_id . '&amp;mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage . (isset($passed_ent_id) ? '&amp;passed_ent_id=' . urlencode($passed_ent_id) : '');
    if ($mailbox == $draft_folder && $save_as_draft) {
        $comp_alt_uri = $comp_uri . '&amp;smaction=draft';
        $comp_alt_string = _("Resume Draft");
    } else {
        if (handleAsSent($mailbox)) {
            $comp_alt_uri = $comp_uri . '&amp;smaction=edit_as_new';
            $comp_alt_string = _("Edit Message as New");
        }
    }
    if (isset($comp_alt_uri)) {
        $s .= $topbar_delimiter;
        $s .= makeComposeLink($comp_alt_uri, $comp_alt_string);
    }
    $s .= '</small></td><td align="center" width="33%"><small>';
    if (!(isset($where) && isset($what)) && !$passed_ent_id) {
        $prev = findPreviousMessage($mbx_response['EXISTS'], $passed_id);
        $next = findNextMessage($passed_id);
        if ($prev != -1) {
            $uri = $base_uri . 'src/read_body.php?passed_id=' . $prev . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
            $s .= '<a href="' . $uri . '">' . _("Previous") . '</a>';
        } else {
            $s .= _("Previous");
        }
        $s .= $topbar_delimiter;
        if ($next != -1) {
            $uri = $base_uri . 'src/read_body.php?passed_id=' . $next . '&amp;mailbox=' . $urlMailbox . '&amp;sort=' . $sort . '&amp;startMessage=' . $startMessage . '&amp;show_more=0';
            $s .= '<a href="' . $uri . '">' . _("Next") . '</a>';
        } else {
            $s .= _("Next");
        }
    } else {
        if (isset($passed_ent_id) && $passed_ent_id) {
            /* code for navigating through attached message/rfc822 messages */
            $url = set_url_var($PHP_SELF, 'passed_ent_id', 0);
            $s .= '<a href="' . $url . '">' . _("View Message") . '</a>';
            $entities = array();
            $entity_count = array();
            $c = 0;
            foreach ($message->parent->entities as $ent) {
                if ($ent->type0 == 'message' && $ent->type1 == 'rfc822') {
                    $c++;
                    $entity_count[$c] = $ent->entity_id;
                    $entities[$ent->entity_id] = $c;
                }
            }
            $prev_link = _("Previous");
            if (!empty($entities[$passed_ent_id]) && $entities[$passed_ent_id] > 1) {
                $prev_ent_id = $entity_count[$entities[$passed_ent_id] - 1];
                $prev_link = '<a href="' . set_url_var($PHP_SELF, 'passed_ent_id', $prev_ent_id) . '">' . $prev_link . '</a>';
            }
            $next_link = _("Next");
            if (!empty($entities[$passed_ent_id]) && $entities[$passed_ent_id] < $c) {
                $next_ent_id = $entity_count[$entities[$passed_ent_id] + 1];
                $next_link = '<a href="' . set_url_var($PHP_SELF, 'passed_ent_id', $next_ent_id) . '">' . $next_link . '</a>';
            }
            $s .= $topbar_delimiter . $prev_link;
            $par_ent_id = $message->parent->entity_id;
            if ($par_ent_id) {
                $par_ent_id = substr($par_ent_id, 0, -2);
                $s .= $topbar_delimiter;
                $url = set_url_var($PHP_SELF, 'passed_ent_id', $par_ent_id);
                $s .= '<a href="' . $url . '">' . _("Up") . '</a>';
            }
            $s .= $topbar_delimiter . $next_link;
        }
    }
    $s .= '</small></td>' . "\n" . html_tag('td', '', 'right', '', 'width="33%" nowrap') . '<small>';
    $comp_action_uri = $comp_uri . '&amp;smaction=forward';
    $s .= makeComposeLink($comp_action_uri, _("Forward"));
    if ($enable_forward_as_attachment) {
        $comp_action_uri = $comp_uri . '&amp;smaction=forward_as_attachment';
        $s .= $topbar_delimiter;
        $s .= makeComposeLink($comp_action_uri, _("Forward as Attachment"));
    }
    $comp_action_uri = $comp_uri . '&amp;smaction=reply';
    $s .= $topbar_delimiter;
    $s .= makeComposeLink($comp_action_uri, _("Reply"));
    $comp_action_uri = $comp_uri . '&amp;smaction=reply_all';
    $s .= $topbar_delimiter;
    $s .= makeComposeLink($comp_action_uri, _("Reply All"));
    $s .= '</small></td></tr></table>';
    $ret = concat_hook_function('read_body_menu_top', $s);
    if ($ret != '') {
        $s = $ret;
    }
    echo $s;
    do_hook('read_body_menu_bottom');
}
Beispiel #6
0
        $vcard_nice['email;internet'] = $vcard_nice['email;pref;internet'];
    }
} else {
    echo '<tr><td align="center">' . sprintf(_("vCard Version %s is not supported. Some information might not be converted correctly."), htmlspecialchars($vcard_nice['version'])) . "</td></tr>\n";
    $vcard_nice['firstname'] = '';
    $vcard_nice['lastname'] = '';
}
foreach ($vcard_nice as $k => $v) {
    $v = htmlspecialchars($v);
    $v = trim($v);
    $vcard_safe[$k] = trim(nl2br($v));
}
$ShowValues = array('fn' => _("Name"), 'title' => _("Title"), 'email;internet' => _("Email"), 'url' => _("Web Page"), 'org' => _("Organization / Department"), 'adr' => _("Address"), 'tel;work' => _("Work Phone"), 'tel;home' => _("Home Phone"), 'tel;cell' => _("Cellular Phone"), 'tel;fax' => _("Fax"), 'note' => _("Note"));
echo '<tr><td><br />' . '<table border="0" cellpadding="2" cellspacing="0" align="center">' . "\n";
if (isset($vcard_safe['email;internet'])) {
    $vcard_safe['email;internet'] = makeComposeLink('src/compose.php?send_to=' . urlencode($vcard_safe['email;internet']), $vcard_safe['email;internet']);
}
if (isset($vcard_safe['url'])) {
    $vcard_safe['url'] = '<a href="' . $vcard_safe['url'] . '">' . $vcard_safe['url'] . '</a>';
}
foreach ($ShowValues as $k => $v) {
    if (isset($vcard_safe[$k]) && $vcard_safe[$k]) {
        echo "<tr><td align=\"right\" valign=\"top\"><b>{$v}:</b></td><td>" . $vcard_safe[$k] . "</td><tr>\n";
    }
}
?>
</table>
<br />
</td></tr></table>
<table width="100%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr><td bgcolor="<?php 
/**
 * Create a link to compose an email to the email address given.
 * 
 * @param array $row contact as given to the addressbook_list.tpl template
 * @author Steve Brown
 * @since 1.5.2
 */
function composeLink($row)
{
    return makeComposeLink('src/compose.php?send_to=' . rawurlencode($row['RawFullAddress']), sm_encode_html_special_chars($row['Email']));
}
Beispiel #8
0
function displayPageHeader($color, $mailbox, $xtra = '', $session = false)
{
    global $hide_sm_attributions, $frame_top, $compose_new_win, $compose_width, $compose_height, $attachemessages, $provider_name, $provider_uri, $javascript_on, $default_use_mdn, $mdn_user_support, $startMessage, $org_title;
    sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
    sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
    if (!isset($frame_top)) {
        $frame_top = '_top';
    }
    if ($session) {
        $compose_uri = $base_uri . 'src/compose.php?mailbox=' . urlencode($mailbox) . '&amp;session=' . "{$session}";
    } else {
        $compose_uri = $base_uri . 'src/compose.php?newmessage=1';
        $session = 0;
    }
    // only output JavaScript if actually turned on
    if ($javascript_on || strpos($xtra, 'new_js_autodetect_results.value')) {
        if (!defined('PAGE_NAME')) {
            define('PAGE_NAME', NULL);
        }
        switch (PAGE_NAME) {
            case 'read_body':
                $js = '';
                // compose in new window code
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                // javascript for sending read receipts
                if ($default_use_mdn && $mdn_user_support) {
                    $js .= "function sendMDN() {\n" . "    mdnuri=window.location+'&sendreceipt=1';\n" . "    window.location = mdnuri;\n" . "\n}\n\n";
                }
                // if any of the above passes, add the JS tags too.
                if ($js) {
                    $js = "\n" . '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . $js . "// -->\n</script>\n";
                }
                displayHtmlHeader($org_title, $js);
                $onload = $xtra;
                break;
            case 'compose':
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "var alreadyFocused = false;\n" . "function checkForm() {\n" . "\n    if (alreadyFocused) return;\n";
                global $action, $reply_focus;
                if (strpos($action, 'reply') !== FALSE && $reply_focus) {
                    if ($reply_focus == 'select') {
                        $js .= "document.forms['compose'].body.select();}\n";
                    } else {
                        if ($reply_focus == 'focus') {
                            $js .= "document.forms['compose'].body.focus();}\n";
                        } else {
                            if ($reply_focus == 'none') {
                                $js .= "}\n";
                            }
                        }
                    }
                } else {
                    if ($reply_focus == 'none') {
                        $js .= "}\n";
                    } else {
                        $js .= "    var f = document.forms.length;\n" . "    var i = 0;\n" . "    var pos = -1;\n" . "    while( pos == -1 && i < f ) {\n" . "        var e = document.forms[i].elements.length;\n" . "        var j = 0;\n" . "        while( pos == -1 && j < e ) {\n" . "            if ( document.forms[i].elements[j].type == 'text' ) {\n" . "                pos = j;\n" . "            }\n" . "            j++;\n" . "        }\n" . "        i++;\n" . "    }\n" . "    if( pos >= 0 ) {\n" . "        document.forms[i-1].elements[pos].focus();\n" . "    }\n" . "}\n";
                    }
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader($org_title, $js);
                break;
            default:
                $js = '<script language="JavaScript" type="text/javascript">' . "\n<!--\n" . "function checkForm() {\n" . "   var f = document.forms.length;\n" . "   var i = 0;\n" . "   var pos = -1;\n" . "   while( pos == -1 && i < f ) {\n" . "       var e = document.forms[i].elements.length;\n" . "       var j = 0;\n" . "       while( pos == -1 && j < e ) {\n" . "           if ( document.forms[i].elements[j].type == 'text' " . "           || document.forms[i].elements[j].type == 'password' ) {\n" . "               pos = j;\n" . "           }\n" . "           j++;\n" . "       }\n" . "   i++;\n" . "   }\n" . "   if( pos >= 0 ) {\n" . "       document.forms[i-1].elements[pos].focus();\n" . "   }\n" . "   {$xtra}\n" . "}\n";
                if ($compose_new_win == '1') {
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_width)) {
                        $compose_width = '640';
                    }
                    if (!preg_match("/^[0-9]{3,4}\$/", $compose_height)) {
                        $compose_height = '550';
                    }
                    $js .= "function comp_in_new(comp_uri) {\n" . "       if (!comp_uri) {\n" . '           comp_uri = "' . $compose_uri . "\";\n" . '       }' . "\n" . '    var newwin = window.open(comp_uri' . ', "_blank",' . '"width=' . $compose_width . ',height=' . $compose_height . ',scrollbars=yes,resizable=yes,status=yes");' . "\n" . "}\n\n";
                }
                $js .= "// -->\n" . "</script>\n";
                $onload = 'onload="checkForm();"';
                displayHtmlHeader($org_title, $js);
        }
        // end switch module
    } else {
        // JavaScript off
        displayHtmlHeader($org_title);
        $onload = '';
    }
    $google = "\n<script type=\"text/javascript\"><!--\ngoogle_ad_client = \"pub-0768633782379013\";\n//ehcp-webmail-468x60\ngoogle_ad_slot = \"6865422642\";\ngoogle_ad_width = 468;\ngoogle_ad_height = 60;\n//--></script>\n<script type=\"text/javascript\"\nsrc=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\n</script>\n";
    echo "<body text=\"{$color['8']}\" bgcolor=\"{$color['4']}\" link=\"{$color['7']}\" vlink=\"{$color['7']}\" alink=\"{$color['7']}\" {$onload}>\n\n {$google} ";
    /** Here is the header and wrapping table **/
    $shortBoxName = htmlspecialchars(imap_utf7_decode_local(readShortMailboxName($mailbox, $delimiter)));
    if ($shortBoxName == 'INBOX') {
        $shortBoxName = _("INBOX");
    }
    echo "<a name=\"pagetop\"></a>\n" . html_tag('table', '', '', $color[4], 'border="0" width="100%" cellspacing="0" cellpadding="2"') . "\n" . html_tag('tr', '', '', $color[9]) . "\n" . html_tag('td', '', 'left') . "\n";
    if ($shortBoxName != '' && strtolower($shortBoxName) != 'none') {
        echo '         ' . _("Current Folder") . ": <b>{$shortBoxName}&nbsp;</b>\n";
    } else {
        echo '&nbsp;';
    }
    echo "      </td>\n" . html_tag('td', '', 'right') . "<b>\n";
    displayInternalLink('src/signout.php', _("Sign Out"), $frame_top);
    echo "</b></td>\n" . "   </tr>\n" . html_tag('tr', '', '', $color[4]) . "\n" . ($hide_sm_attributions ? html_tag('td', '', 'left', '', 'colspan="2"') : html_tag('td', '', 'left')) . "\n";
    $urlMailbox = urlencode($mailbox);
    $startMessage = (int) $startMessage;
    echo makeComposeLink('src/compose.php?mailbox=' . $urlMailbox . '&amp;startMessage=' . $startMessage);
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/addressbook.php', _("Addresses"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/folders.php', _("Folders"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/options.php', _("Options"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink("src/search.php?mailbox={$urlMailbox}", _("Search"));
    echo "&nbsp;&nbsp;\n";
    displayInternalLink('src/help.php', _("Help"));
    echo "&nbsp;&nbsp;\n";
    do_hook('menuline');
    echo "      </td>\n";
    if (!$hide_sm_attributions) {
        echo html_tag('td', '', 'right') . "\n";
        if (!isset($provider_uri)) {
            $provider_uri = 'http://squirrelmail.org/';
        }
        if (!isset($provider_name)) {
            $provider_name = 'SquirrelMail';
        }
        echo '<a href="' . $provider_uri . '" target="_blank">' . $provider_name . '</a>';
        echo "</td>\n";
    }
    echo "   </tr>\n" . "</table><br>\n\n";
}
                    echo html_tag('td', '<small>' . addCheckBox('sel[]', $selected, $row['backend'] . ':' . $row['nickname']) . '</small>', 'center', '', 'valign="top" width="1%"');
                } else {
                    echo html_tag('td', '&nbsp;', 'center', '', 'valign="top" width="1%"');
                }
                echo html_tag('td', '&nbsp;' . htmlspecialchars($row['nickname']) . '&nbsp;', 'left', '', 'valign="top" width="1%" nowrap') . html_tag('td', '&nbsp;' . htmlspecialchars($row['lastname']) . ' ' . htmlspecialchars($row['firstname']) . '&nbsp;', 'left', '', 'valign="top" width="1%" nowrap') . html_tag('td', '', 'left', '', 'valign="top" width="1%" nowrap') . '&nbsp;';
            } else {
                echo html_tag('tr', '', '', $tr_bgcolor);
                if ($abook->backends[$row['backend']]->writeable) {
                    echo html_tag('td', '<small>' . addCheckBox('sel[]', $selected, $row['backend'] . ':' . $row['nickname']) . '</small>', 'center', '', 'valign="top" width="1%"');
                } else {
                    echo html_tag('td', '&nbsp;', 'center', '', 'valign="top" width="1%"');
                }
                echo html_tag('td', '&nbsp;' . htmlspecialchars($row['nickname']) . '&nbsp;', 'left', '', 'valign="top" width="1%" nowrap') . html_tag('td', '&nbsp;' . htmlspecialchars($row['name']) . '&nbsp;', 'left', '', 'valign="top" width="1%" nowrap') . html_tag('td', '', 'left', '', 'valign="top" width="1%" nowrap') . '&nbsp;';
            }
            $email = $abook->full_address($row);
            echo makeComposeLink('src/compose.php?send_to=' . rawurlencode($email), htmlspecialchars($row['email'])) . '&nbsp;</td>' . "\n" . html_tag('td', '&nbsp;' . htmlspecialchars($row['label']) . '&nbsp;', 'left', '', 'valign="top" width="1%"');
            // add extra column if third party backend needs it
            if ($abook->add_extra_field) {
                echo html_tag('td', '&nbsp;' . (isset($row['extra']) ? $row['extra'] : '') . '&nbsp;', 'left', '', 'valign="top" width="1%"');
            }
            echo "</tr>\n";
            $line++;
        }
        /* End of list. Close table. */
        if ($headerprinted) {
            echo html_tag('tr', html_tag('td', addSubmit(_("Edit selected"), 'editaddr') . addSubmit(_("Delete selected"), 'deladdr'), 'center', '', "colspan=\"{$abook_fields}\""));
        }
        echo '</table></form>';
    }
}
/* end of addresslist */
Beispiel #10
0
/**
 * This is a wrapper function to call html sanitizing routines.
 *
 * @param  $body  the body of the message
 * @param  $id    the id of the message
 * @param  $message
 * @param  $mailbox
 * @param  boolean $take_mailto_links When TRUE, converts mailto: links
 *                                    into internal SM compose links
 *                                    (optional; default = TRUE)
 * @return        a string with html safe to display in the browser.
 */
function magicHTML($body, $id, $message, $mailbox = 'INBOX', $take_mailto_links = true)
{
    // require_once(SM_PATH . 'functions/url_parser.php');  // for $MailTo_PReg_Match
    global $attachment_common_show_images, $view_unsafe_images, $has_unsafe_images;
    /**
     * Don't display attached images in HTML mode.
     *
     * SB: why?
     */
    $attachment_common_show_images = false;
    $tag_list = array(false, "object", "meta", "html", "head", "base", "link", "frame", "iframe", "plaintext", "marquee");
    $rm_tags_with_content = array("script", "applet", "embed", "title", "frameset", "xmp", "xml");
    $self_closing_tags = array("img", "br", "hr", "input", "outbind");
    $force_tag_closing = true;
    $rm_attnames = array("/.*/" => array("/target/i", "/^on.*/i", "/^dynsrc/i", "/^data.*/i", "/^lowsrc.*/i"));
    global $use_transparent_security_image;
    if ($use_transparent_security_image) {
        $secremoveimg = '../images/spacer.png';
    } else {
        $secremoveimg = '../images/' . _("sec_remove_eng.png");
    }
    $bad_attvals = array("/.*/" => array("/^src|background/i" => array(array("/^([\\'\"])\\s*\\S+script\\s*:.*([\\'\"])/si", "/^([\\'\"])\\s*mocha\\s*:*.*([\\'\"])/si", "/^([\\'\"])\\s*about\\s*:.*([\\'\"])/si"), array("\\1{$secremoveimg}\\2", "\\1{$secremoveimg}\\2", "\\1{$secremoveimg}\\2")), "/^href|action/i" => array(array("/^([\\'\"])\\s*\\S+script\\s*:.*([\\'\"])/si", "/^([\\'\"])\\s*mocha\\s*:*.*([\\'\"])/si", "/^([\\'\"])\\s*about\\s*:.*([\\'\"])/si"), array("\\1#\\1", "\\1#\\1", "\\1#\\1")), "/^style/i" => array(array("/\\/\\*.*\\*\\//", "/expression/i", "/binding/i", "/behaviou*r/i", "/include-source/i", "/position\\s*:/i", "/(\\\\)?u(\\\\)?r(\\\\)?l(\\\\)?/i", "/url\\s*\\(\\s*([\\'\"])\\s*\\S+script\\s*:.*([\\'\"])\\s*\\)/si", "/url\\s*\\(\\s*([\\'\"])\\s*mocha\\s*:.*([\\'\"])\\s*\\)/si", "/url\\s*\\(\\s*([\\'\"])\\s*about\\s*:.*([\\'\"])\\s*\\)/si", "/(.*)\\s*:\\s*url\\s*\\(\\s*([\\'\"]*)\\s*\\S+script\\s*:.*([\\'\"]*)\\s*\\)/si"), array("", "idiocy", "idiocy", "idiocy", "idiocy", "idiocy", "url", "url(\\1#\\1)", "url(\\1#\\1)", "url(\\1#\\1)", "\\1:url(\\2#\\3)"))));
    // If there's no "view_unsafe_images" variable in the URL, turn unsafe
    // images off by default.
    sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET, FALSE);
    if (!$view_unsafe_images) {
        /**
         * Remove any references to http/https if view_unsafe_images set
         * to false.
         */
        array_push($bad_attvals['/.*/']['/^src|background/i'][0], '/^([\'\\"])\\s*https*:.*([\'\\"])/si');
        array_push($bad_attvals['/.*/']['/^src|background/i'][1], "\\1{$secremoveimg}\\1");
        array_push($bad_attvals['/.*/']['/^style/i'][0], '/url\\([\'\\"]?https?:[^\\)]*[\'\\"]?\\)/si');
        array_push($bad_attvals['/.*/']['/^style/i'][1], "url(\\1{$secremoveimg}\\1)");
    }
    $add_attr_to_tag = array("/^a\$/i" => array('target' => '"_blank"', 'title' => '"' . _("This external link will open in a new window") . '"'));
    $trusted = sq_sanitize($body, $tag_list, $rm_tags_with_content, $self_closing_tags, $force_tag_closing, $rm_attnames, $bad_attvals, $add_attr_to_tag, $message, $id, $mailbox);
    if (strpos($trusted, $secremoveimg)) {
        $has_unsafe_images = true;
    }
    // we want to parse mailto's in HTML output, change to SM compose links
    // this is a modified version of code from url_parser.php... but Marc is
    // right: we need a better filtering implementation; adding this randomly
    // here is not a great solution
    //
    if ($take_mailto_links) {
        // parseUrl($trusted);   // this even parses URLs inside of tags... too aggressive
        global $MailTo_PReg_Match;
        $MailTo_PReg_Match = '/mailto:' . substr($MailTo_PReg_Match, 1);
        if (preg_match_all($MailTo_PReg_Match, $trusted, $regs) && $regs[0][0] != '') {
            foreach ($regs[0] as $i => $mailto_before) {
                $mailto_params = $regs[10][$i];
                // get rid of any tailing quote since we have to add send_to to the end
                //
                if (substr($mailto_before, strlen($mailto_before) - 1) == '"') {
                    $mailto_before = substr($mailto_before, 0, strlen($mailto_before) - 1);
                }
                if (substr($mailto_params, strlen($mailto_params) - 1) == '"') {
                    $mailto_params = substr($mailto_params, 0, strlen($mailto_params) - 1);
                }
                if ($regs[1][$i]) {
                    //if there is an email addr before '?', we need to merge it with the params
                    $to = 'to=' . $regs[1][$i];
                    if (strpos($mailto_params, 'to=') > -1) {
                        //already a 'to='
                        $mailto_params = str_replace('to=', $to . '%2C%20', $mailto_params);
                    } else {
                        if ($mailto_params) {
                            //already some params, append to them
                            $mailto_params .= '&amp;' . $to;
                        } else {
                            $mailto_params .= '?' . $to;
                        }
                    }
                }
                $url_str = preg_replace(array('/to=/i', '/(?<!b)cc=/i', '/bcc=/i'), array('send_to=', 'send_to_cc=', 'send_to_bcc='), $mailto_params);
                // we'll already have target=_blank, no need to allow comp_in_new
                // here (which would be a lot more work anyway)
                //
                global $compose_new_win;
                $temp_comp_in_new = $compose_new_win;
                $compose_new_win = 0;
                $comp_uri = makeComposeLink('src/compose.php' . $url_str, $mailto_before);
                $compose_new_win = $temp_comp_in_new;
                // remove <a href=" and anything after the next quote (we only
                // need the uri, not the link HTML) in compose uri
                //
                $comp_uri = substr($comp_uri, 9);
                $comp_uri = substr($comp_uri, 0, strpos($comp_uri, '"', 1));
                $trusted = str_replace($mailto_before, $comp_uri, $trusted);
            }
        }
    }
    return $trusted;
}
Beispiel #11
0
/**
 * internal function that builds mailing list links
 */
function plugin_listcommands_menu_do()
{
    global $passed_id, $passed_ent_id, $mailbox, $message, $startMessage, $oTemplate, $listcommands_allow_non_rfc_list_management;
    @(include_once SM_PATH . 'plugins/listcommands/config.php');
    /**
     * Array of commands we can deal with from the header. The Reply option
     * is added later because we generate it using the Post information.
     */
    $fieldsdescr = listcommands_fieldsdescr();
    $links = array();
    foreach ($message->rfc822_header->mlist as $cmd => $actions) {
        /* I don't know this action... skip it */
        if (!array_key_exists($cmd, $fieldsdescr)) {
            continue;
        }
        /* proto = {mailto,href} */
        $aActions = array_keys($actions);
        // note that we only use the first cmd/action, ignore the rest
        $proto = array_shift($aActions);
        $act = array_shift($actions);
        if ($proto == 'mailto') {
            $identity = '';
            if ($cmd == 'post' || $cmd == 'owner') {
                $url = 'src/compose.php?' . (isset($startMessage) ? 'startMessage=' . $startMessage . '&amp;' : '');
            } else {
                $url = "plugins/listcommands/mailout.php?action={$cmd}&amp;";
                // try to find which identity the mail should come from
                include_once SM_PATH . 'functions/identity.php';
                $idents = get_identities();
                // ripped from src/compose.php
                $identities = array();
                if (count($idents) > 1) {
                    foreach ($idents as $nr => $data) {
                        $enc_from_name = '"' . $data['full_name'] . '" <' . $data['email_address'] . '>';
                        $identities[] = $enc_from_name;
                    }
                    $identity_match = $message->rfc822_header->findAddress($identities);
                    if ($identity_match !== FALSE) {
                        $identity = $identity_match;
                    }
                }
            }
            // if things like subject are given, peel them off and give
            // them to src/compose.php as is (not encoded)
            if (strpos($act, '?') > 0) {
                list($act, $parameters) = explode('?', $act, 2);
                $parameters = '&amp;identity=' . $identity . '&amp;' . $parameters;
            } else {
                $parameters = '&amp;identity=' . $identity;
            }
            $url .= 'send_to=' . urlencode($act) . $parameters;
            $links[$cmd] = makeComposeLink($url, $fieldsdescr[$cmd]);
            if ($cmd == 'post') {
                if (!isset($mailbox)) {
                    $mailbox = 'INBOX';
                }
                $url .= '&amp;passed_id=' . $passed_id . '&amp;mailbox=' . urlencode($mailbox) . (isset($passed_ent_id) ? '&amp;passed_ent_id=' . $passed_ent_id : '');
                $url .= '&amp;smaction=reply';
                $links['reply'] = makeComposeLink($url, $fieldsdescr['reply']);
            }
        } else {
            if ($proto == 'href') {
                $links[$cmd] = create_hyperlink($act, $fieldsdescr[$cmd], '_blank');
            }
        }
    }
    // 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 . '&amp;' : '') . 'send_to=' . str_replace('?', '&amp;', $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 . '&amp;' : '') . 'send_to=' . str_replace('?', '&amp;', $non_rfc_list) . '&amp;passed_id=' . $passed_id . '&amp;mailbox=' . urlencode($mailbox) . (isset($passed_ent_id) ? '&amp;passed_ent_id=' . $passed_ent_id : '') . '&amp;smaction=reply';
                    $links['reply'] = makeComposeLink($url, $fieldsdescr['reply']);
                    break;
                }
            }
        }
    }
    if (count($links) > 0) {
        $oTemplate->assign('links', $links);
        $output = $oTemplate->fetch('plugins/listcommands/read_body_header.tpl');
        return array('read_body_header' => $output);
    }
}