fsf changes, meant to be rebased on upstream
[squirrelmail.git] / plugins / message_details / setup.php
CommitLineData
bbdea028 1<?php
4b4abf93 2
86c62251 3/**
91e0dccc 4 * Message Details plugin - main setup script
86c62251 5 *
6 * Plugin to view the RFC822 raw message output and the bodystructure of a message
7 *
8 * @author Marc Groot Koerkamp
30460a05 9 * @copyright 2002 Marc Groot Koerkamp, The Netherlands
c997cbe6 10 * @copyright 2002-2021 The SquirrelMail Project Team
86c62251 11 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
12 * @version $Id$
13 * @package plugins
14 * @subpackage message_details
15 **/
bbdea028 16
ea5f4b8e 17/**
18 * Initialize the plugin
e9ec1bd8 19 * @access private
ea5f4b8e 20 */
bbdea028 21function squirrelmail_plugin_init_message_details()
22{
23 global $squirrelmail_plugin_hooks;
24
04f6008a 25 $squirrelmail_plugin_hooks['read_body_header_right']['message_details'] = 'show_message_details';
bbdea028 26}
27
86c62251 28/**
29 * Add message details link in message view
30 * @access private
31 */
8b393e79 32function show_message_details(&$links) {
fab8e10c 33 global $passed_id, $mailbox, $passed_ent_id;
cba125b4 34
bbdea028 35 if (strlen(trim($mailbox)) < 1) {
36 $mailbox = 'INBOX';
37 }
38
fab8e10c 39 $params = '?passed_ent_id=' . $passed_ent_id .
bbdea028 40 '&mailbox=' . urlencode($mailbox) .
41 '&passed_id=' . $passed_id;
42
cba125b4 43 $url = checkForJavascript() ? 'javascript:MessageSource();' :
4d7e2270 44 '../plugins/message_details/message_details_main.php' .
45 $params;
bbdea028 46
bbdea028 47 /* Output the link. */
4d7e2270 48 $links[] = array('URL' => $url,
e70f0d1b 49 'Text' => _("View Message Details") );
4d7e2270 50
4ae656b7 51 if (checkForJavascript()) {
aa84dace 52 echo '<script type="text/javascript">' . "\n"
53 . '<!--' . "\n"
54 . " function MessageSource() {\n"
cba125b4 55 . ' window.open("'
56 . sqm_baseuri()
aa84dace 57 . 'plugins/message_details/message_details_main.php' .
58 $params . '","MessageDetails","width=800,height=600");' . "\n"
59 . " }\n"
60 . "// -->\n"
61 . "</script>\n\n";
91e0dccc 62 }
bbdea028 63}
4d7e2270 64