* this plugin displays a menu which gives the user a choice of mailinglist
* commands such as (un)subscribe, help and list archives.
*
- * @copyright © 1999-2007 The SquirrelMail Project Team
+ * @copyright 1999-2021 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package plugins
*/
function plugin_listcommands_optpage_register_block_do()
{
-
global $optpage_blocks, $listcommands_allow_non_rfc_list_management;
// only allow management of non-RFC lists if admin deems necessary
* internal function that builds mailing list links
*/
function plugin_listcommands_menu_do() {
- global $passed_id, $passed_ent_id, $color, $mailbox, $message,
+ global $passed_id, $passed_ent_id, $mailbox, $message,
$startMessage, $oTemplate, $listcommands_allow_non_rfc_list_management;
@include_once(SM_PATH . 'plugins/listcommands/config.php');
/* 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.'&':'');
} else {
$url = "plugins/listcommands/mailout.php?action=$cmd&";
+
+ // 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;
+ }
+ }
}
- $url .= 'send_to=' . str_replace('?','&', $act);
+
+ // 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 = '&identity=' . $identity . '&' . $parameters;
+ } else {
+ $parameters = '&identity=' . $identity;
+ }
+
+ $url .= 'send_to=' . urlencode($act) . $parameters;
$links[$cmd] = makeComposeLink($url, $fieldsdescr[$cmd]);
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)) {
+ 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);