(finally)fix message_details plugin for new plugin infrastructure, and as
[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
4b4abf93 9 * @copyright &copy; 2002 Marc Groot Koerkamp, The Netherlands
47ccfad4 10 * @copyright &copy; 2002-2006 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 */
4d7e2270 32function show_message_details($links) {
ce68b76b 33 global $passed_id, $mailbox, $ent_num,
bbdea028 34 $javascript_on;
4d7e2270 35
bbdea028 36 if (strlen(trim($mailbox)) < 1) {
37 $mailbox = 'INBOX';
38 }
39
40 $params = '?passed_ent_id=' . $ent_num .
41 '&mailbox=' . urlencode($mailbox) .
42 '&passed_id=' . $passed_id;
43
4d7e2270 44 $url = $javascript_on ? 'javascript:MessageSource();' :
45 '../plugins/message_details/message_details_main.php' .
46 $params;
bbdea028 47
bbdea028 48 /* Output the link. */
4d7e2270 49 $links[] = array('URL' => $url,
50 'Text' => _("View Message details") );
51
bbdea028 52 if ($javascript_on) {
4d7e2270 53 echo '<script type="text/javascript">' . "\n" .
bbdea028 54 '<!--' . "\n" .
55 " function MessageSource() {\n" .
56 ' window.open("../plugins/message_details/message_details_main.php' .
04f6008a 57 $params . '","MessageDetails","width=800,height=600");' . "\n".
bbdea028 58 " }\n" .
59 "// -->\n" .
4d7e2270 60 "</script>\n\n";
91e0dccc 61 }
bbdea028 62}
4d7e2270 63