setup.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 &copy; 2002 Marc Groot Koerkamp, The Netherlands
  9. * @copyright &copy; 2002-2006 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. * Initialize the plugin
  17. * @access private
  18. */
  19. function squirrelmail_plugin_init_message_details()
  20. {
  21. global $squirrelmail_plugin_hooks;
  22. $squirrelmail_plugin_hooks['read_body_header_right']['message_details'] = 'show_message_details';
  23. }
  24. /**
  25. * Add message details link in message view
  26. * @access private
  27. */
  28. function show_message_details() {
  29. global $passed_id, $mailbox, $ent_num,
  30. $javascript_on;
  31. if (strlen(trim($mailbox)) < 1) {
  32. $mailbox = 'INBOX';
  33. }
  34. $params = '?passed_ent_id=' . $ent_num .
  35. '&mailbox=' . urlencode($mailbox) .
  36. '&passed_id=' . $passed_id;
  37. $print_text = _("View Message details");
  38. $result = '';
  39. /* Output the link. */
  40. if ($javascript_on) {
  41. $result = '<script type="text/javascript">' . "\n" .
  42. '<!--' . "\n" .
  43. " function MessageSource() {\n" .
  44. ' window.open("../plugins/message_details/message_details_main.php' .
  45. $params . '","MessageDetails","width=800,height=600");' . "\n".
  46. " }\n" .
  47. "// -->\n" .
  48. "</script>\n" .
  49. "&nbsp;|&nbsp;<a href=\"javascript:MessageSource();\">$print_text</a>\n";
  50. }
  51. echo $result;
  52. }