X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Flistcommands%2Fsetup.php;h=82969a7a92a28ebdd09e4d096eb38e94367cb428;hb=24024eb7a3db834ca68720cd30fec275af758237;hp=d333c479ebe4d17e9ea2b06a1d402f9b6c1f0cd3;hpb=050722c4a141bfda4a2eae435ec290c6b793aae6;p=squirrelmail.git diff --git a/plugins/listcommands/setup.php b/plugins/listcommands/setup.php index d333c479..82969a7a 100644 --- a/plugins/listcommands/setup.php +++ b/plugins/listcommands/setup.php @@ -1,93 +1,44 @@ - * + * @copyright © 1999-2007 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage listcommands */ -function squirrelmail_plugin_init_listcommands () -{ - global $squirrelmail_plugin_hooks; - - $squirrelmail_plugin_hooks['read_body_header']['listcommands'] = 'plugin_listcommands_menu'; -} - - -function plugin_listcommands_menu () { - - global $imapConnection, $passed_id, $color, $mailbox, - $subject, $ent_num, $priority_level; - - /* 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( 'Help' => _("Help"), - 'Unsubscribe' => _("Unsubscribe"), - 'Subscribe' => _("Subscribe"), - 'Post' => _("Post to the list"), - 'Archive' => _("List Archives"), - 'Owner' => _("Contact Listowner") ); - $fields = array_keys ($fieldsdescr); - $fieldsdescr['Reply'] = _("Reply to the list"); - - $cmds = array(); - $output = array(); - $lfields = 'List-' . implode (' List-', $fields); - - $sid = sqimap_session_id(); - fputs ($imapConnection, "$sid FETCH $passed_id BODY.PEEK[HEADER.FIELDS ($lfields)]\r\n"); - $read = sqimap_read_data ($imapConnection, $sid, true, $response, $emessage); - - for ($i = 1; $i < count($read); $i++) { - foreach ($fields as $field) { - if ( preg_match("/^List-$field: *<(.+?)>/i", $read[$i], $match) ) { - $cmds[$field] = $match[1]; - } - } - } - - foreach ($cmds as $cmd => $url) { - if ( eregi('mailto:(.+)', $url, $regs) ) { - $purl = parse_url($url); - - if ( $cmd == 'Post' || $cmd == 'Owner' ) { - $url = 'compose.php?'; - } else { - $url = '../plugins/listcommands/mailout.php?action=' . $cmd . '&'; - } +/** + * Initialize the listcommands plugin + */ +function squirrelmail_plugin_init_listcommands () { + global $squirrelmail_plugin_hooks; - $url .= 'mailbox=' . urlencode($mailbox) . '&send_to=' . $purl['path']; + $squirrelmail_plugin_hooks['template_construct_read_headers.tpl']['listcommands'] = 'plugin_listcommands_menu'; + $squirrelmail_plugin_hooks['optpage_register_block']['listcommands'] = 'plugin_listcommands_optpage_register_block'; - if ( isset($purl['query']) ) { - $url .= '&' . $purl['query']; - } +} - $output[] = '' . $fieldsdescr[$cmd] . ''; +/** + * Main function added to read_body_header + */ +function plugin_listcommands_menu() { + include_once(SM_PATH . 'plugins/listcommands/functions.php'); + return plugin_listcommands_menu_do(); +} - if ( $cmd == 'Post' ) { - $url .= '&reply_subj=' . urlencode($subject) . - '&reply_id=' . $passed_id . - '&ent_num=' . $ent_num . - '&mailprio=' . $priority_level; - $output[] = '' . $fieldsdescr['Reply'] . ''; - } - } elseif ( eregi('^(http|ftp)', $url) ) { - $output[] = '' . $fieldsdescr[$cmd] . ''; - } - } - if (count($output) > 0) { - echo "". - '' . _("Mailinglist options:") . ' ' . implode (' | ', $output) . - ''. - ''; - } +/** + * Show mailing list management option section on options page + */ +function plugin_listcommands_optpage_register_block() { + include_once(SM_PATH . 'plugins/listcommands/functions.php'); + plugin_listcommands_optpage_register_block_do(); } -?> \ No newline at end of file