accept &$links by reference
[squirrelmail.git] / plugins / message_details / setup.php
index 4f68e9bd549e381f8a175c6db6bbfd6bb3f2f530..648fcb0b3f85ceb9ffa7e2caeee4cf58654a7b1e 100644 (file)
@@ -1,18 +1,22 @@
 <?php
-/** Message Source  
-*
-* Plugin to view the RFC822 raw message output and the bodystructure of a message
-*
-* Copyright (c) 2002 Marc Groot Koerkamp, The Netherlands
-* Licensed under the GNU GPL. For full terms see the file COPYING.
-* 
-* $Id$
-* @package plugins
-* @subpackage message_details
-**/
+
+/**
+ * Message Details plugin - main setup script
+ *
+ * Plugin to view the RFC822 raw message output and the bodystructure of a message
+ *
+ * @author Marc Groot Koerkamp
+ * @copyright &copy; 2002 Marc Groot Koerkamp, The Netherlands
+ * @copyright &copy; 2002-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package plugins
+ * @subpackage message_details
+ **/
 
 /**
  * Initialize the plugin
+ * @access private
  */
 function squirrelmail_plugin_init_message_details()
 {
@@ -21,10 +25,14 @@ function squirrelmail_plugin_init_message_details()
   $squirrelmail_plugin_hooks['read_body_header_right']['message_details'] = 'show_message_details';
 }
 
-function show_message_details() {
-    global $passed_id, $mailbox, $ent_num, $color,
+/**
+ * Add message details link in message view
+ * @access private
+ */
+function show_message_details(&$links) {
+    global $passed_id, $mailbox, $ent_num,
            $javascript_on;
-
+    
     if (strlen(trim($mailbox)) < 1) {
         $mailbox = 'INBOX';
     }
@@ -33,22 +41,23 @@ function show_message_details() {
               '&mailbox=' . urlencode($mailbox) .
               '&passed_id=' . $passed_id;
 
-    $print_text = _("View Message details");
+    $url = $javascript_on ? 'javascript:MessageSource();' : 
+        '../plugins/message_details/message_details_main.php' .
+        $params;
 
-    $result = '';
     /* Output the link. */
+    $links[] = array('URL' => $url,
+        'Text' => _("View Message details") );
+
     if ($javascript_on) {
-        $result = '<script type="text/javascript" language="javascript">' . "\n" .
+        echo '<script type="text/javascript">' . "\n" .
                 '<!--' . "\n" .
                 "  function MessageSource() {\n" .
                 '    window.open("../plugins/message_details/message_details_main.php' .
                         $params . '","MessageDetails","width=800,height=600");' . "\n".
                 "  }\n" .
                 "// -->\n" .
-                "</script>\n" .
-                "&nbsp;|&nbsp;<A HREF=\"javascript:MessageSource();\">$print_text</A>\n";
-    } 
-    echo $result;
+                "</script>\n\n";
+    }
 }
-?>
+