code cleanup:
[squirrelmail.git] / plugins / message_details / setup.php
1 <?php
2 /**
3 * Message Details plugin - main setup script
4 *
5 * Plugin to view the RFC822 raw message output and the bodystructure of a message
6 *
7 * @author Marc Groot Koerkamp
8 * @copyright Copyright &copy; 2002 Marc Groot Koerkamp, The Netherlands
9 * @copyright Copyright &copy; 2004 The SquirrelMail Project Team
10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
11 * @version $Id$
12 * @package plugins
13 * @subpackage message_details
14 **/
15
16 /**
17 * Initialize the plugin
18 */
19 function squirrelmail_plugin_init_message_details()
20 {
21 global $squirrelmail_plugin_hooks;
22
23 $squirrelmail_plugin_hooks['read_body_header_right']['message_details'] = 'show_message_details';
24 }
25
26 /**
27 * Add message details link in message view
28 * @access private
29 */
30 function show_message_details() {
31 global $passed_id, $mailbox, $ent_num, $color,
32 $javascript_on;
33
34 if (strlen(trim($mailbox)) < 1) {
35 $mailbox = 'INBOX';
36 }
37
38 $params = '?passed_ent_id=' . $ent_num .
39 '&mailbox=' . urlencode($mailbox) .
40 '&passed_id=' . $passed_id;
41
42 $print_text = _("View Message details");
43
44 $result = '';
45 /* Output the link. */
46 if ($javascript_on) {
47 $result = '<script type="text/javascript" language="javascript">' . "\n" .
48 '<!--' . "\n" .
49 " function MessageSource() {\n" .
50 ' window.open("../plugins/message_details/message_details_main.php' .
51 $params . '","MessageDetails","width=800,height=600");' . "\n".
52 " }\n" .
53 "// -->\n" .
54 "</script>\n" .
55 "&nbsp;|&nbsp;<a href=\"javascript:MessageSource();\">$print_text</a>\n";
56 }
57 echo $result;
58 }
59
60 ?>