E_ALL is a moving target
[squirrelmail.git] / plugins / message_details / setup.php
index f4cfa4b462b54422b38af3d303674eefe9fed145..41b56e25a1395a258671e8ed36d23a46b0827f9c 100644 (file)
@@ -6,8 +6,8 @@
  * Plugin to view the RFC822 raw message output and the bodystructure of a message
  *
  * @author Marc Groot Koerkamp
- * @copyright © 2002 Marc Groot Koerkamp, The Netherlands
- * @copyright © 2002-2006 The SquirrelMail Project Team
+ * @copyright 2002 Marc Groot Koerkamp, The Netherlands
+ * @copyright 2002-2012 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
@@ -29,35 +29,36 @@ function squirrelmail_plugin_init_message_details()
  * Add message details link in message view
  * @access private
  */
-function show_message_details($links) {
-    global $passed_id, $mailbox, $ent_num,
-           $javascript_on;
-    
+function show_message_details(&$links) {
+    global $passed_id, $mailbox, $passed_ent_id;
+
     if (strlen(trim($mailbox)) < 1) {
         $mailbox = 'INBOX';
     }
 
-    $params = '?passed_ent_id=' . $ent_num .
+    $params = '?passed_ent_id=' . $passed_ent_id .
               '&mailbox=' . urlencode($mailbox) .
               '&passed_id=' . $passed_id;
 
-    $url = $javascript_on ? 'javascript:MessageSource();' : 
+    $url = checkForJavascript() ? 'javascript:MessageSource();' :
         '../plugins/message_details/message_details_main.php' .
         $params;
 
     /* Output the link. */
     $links[] = array('URL' => $url,
-        'Text' => _("View Message details") );
-
-    if ($javascript_on) {
-        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\n";
+        'Text' => _("View Message Details") );
+
+    if (checkForJavascript()) {
+        echo '<script type="text/javascript">' . "\n"
+           . '<!--' . "\n"
+           . "  function MessageSource() {\n"
+           . '    window.open("'
+           . sqm_baseuri()
+           . 'plugins/message_details/message_details_main.php' .
+                        $params . '","MessageDetails","width=800,height=600");' . "\n"
+           . "  }\n"
+           . "// -->\n"
+           . "</script>\n\n";
     }
 }