Fix comp_in_new: make outputing the compose link a function so that
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 8 Jun 2003 14:37:35 +0000 (14:37 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 8 Jun 2003 14:37:35 +0000 (14:37 +0000)
the comp_in_new works the same everywhere.
In this new function, make sure that comp_in_new still works when
JavaScript off.
When JavaScript off, do not output all kinds of JavaScript functions
which are never going to be called.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4977 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
functions/page_header.php
functions/strings.php
functions/url_parser.php
plugins/listcommands/setup.php
src/addressbook.php
src/read_body.php
src/vcard.php

index 8be36dc..51ca2fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,11 @@ Version 1.5.0 -- CVS
   - Fixed language bug in posting on modifying/deleting servers on mail_fetch plugin
     (#742705).
   - Fixed infinite loop in parseAddress on invalid mailadress (#742584).
+  - Rewrote ugly "Not a very useful errormessage" to something more friendly.
+  - Make central function for compose links to make sure compose_in_new always
+    works the same way.
+  - Fix that when JavaScript off, compose in new was broken (#749654).
+  - Do not output JavaScript functions in page_header when JavaScript off.
 
 **************************************
 *** SquirrelMail Stable Series 1.4 ***
index bf731b5..b44a746 100644 (file)
@@ -66,20 +66,24 @@ ECHO;
     echo "\n</head>\n\n";
 }
 
-
-function displayInternalLink($path, $text, $target='') {
+function makeInternalLink($path, $text, $target='') {
     sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
     if ($target != '') {
         $target = " target=\"$target\"";
     }
-    echo '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
+    return '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
+}
+
+function displayInternalLink($path, $text, $target='') {
+    echo makeInternalLink($path, $text, $target='');
 }
 
 function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
 
     global $hide_sm_attributions, $PHP_SELF, $frame_top,
            $compose_new_win, $compose_width, $compose_height,
-           $attachemessages, $provider_name, $provider_uri;
+           $attachemessages, $provider_name, $provider_uri,
+           $javascript_on;
 
     sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION );
     sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION );
@@ -97,121 +101,127 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
         $compose_uri = $base_uri.'src/compose.php?newmessage=1';
        $session = 0;
     }
-   
-    switch ( $module ) {
-    case 'src/read_body.php':
-            $js ='';
-            if ($compose_new_win == '1') {
-                if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
-                    $compose_width = '640';
-                }
-                if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
-                    $compose_height = '550';
-                }
-                $js .= "\n".'<script language="JavaScript" type="text/javascript">' .
-                    "\n<!--\n";
-                $js .= "function comp_in_new(comp_uri) {\n".
-                    "       if (!comp_uri) {\n".
-                    '           comp_uri = "'.$compose_uri."\";\n".
-                    '       }'. "\n".
-                     '    var newwin = window.open(comp_uri' .
-                     ', "_blank",'.
-                     '"width='.$compose_width. ',height='.$compose_height.
-                     ',scrollbars=yes,resizable=yes");'."\n".
-                     "}\n\n";
-
-
-                $js .= 'function sendMDN() {'."\n".
-                       "mdnuri=window.location+'&sendreceipt=1';".
-                       "var newwin = window.open(mdnuri,'right');".
-                      "\n}\n\n";
-
-                $js .= "// -->\n".
-                      "</script>\n";
+  
+    if($javascript_on) { 
+
+      switch ( $module ) {
+        case 'src/read_body.php':
+                $js ='';
+                if ($compose_new_win == '1') {
+                    if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
+                        $compose_width = '640';
+                    }
+                    if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
+                        $compose_height = '550';
+                    }
+                    $js .= "\n".'<script language="JavaScript" type="text/javascript">' .
+                        "\n<!--\n";
+                    $js .= "function comp_in_new(comp_uri) {\n".
+                    "       if (!comp_uri) {\n".
+                    '           comp_uri = "'.$compose_uri."\";\n".
+                    '       }'. "\n".
+                         '    var newwin = window.open(comp_uri' .
+                         ', "_blank",'.
+                         '"width='.$compose_width. ',height='.$compose_height.
+                         ',scrollbars=yes,resizable=yes");'."\n".
+                         "}\n\n";
+
+
+                    $js .= 'function sendMDN() {'."\n".
+                           "mdnuri=window.location+'&sendreceipt=1';".
+                           "var newwin = window.open(mdnuri,'right');".
+                      "\n}\n\n";
+
+                    $js .= "// -->\n".
+                      "</script>\n";
             
-             }
-             displayHtmlHeader ('SquirrelMail', $js);
-             $onload = $xtra;
-        break;
-    case 'src/compose.php':
-        $js = '<script language="JavaScript" type="text/javascript">' .
-             "\n<!--\n" .
-             "function checkForm() {\n".
-                "var f = document.forms.length;\n".
-                "var i = 0;\n".
-                "var pos = -1;\n".
-                "while( pos == -1 && i < f ) {\n".
-                    "var e = document.forms[i].elements.length;\n".
-                    "var j = 0;\n".
-                    "while( pos == -1 && j < e ) {\n".
-                        "if ( document.forms[i].elements[j].type == 'text' ) {\n".
-                            "pos = j;\n".
+                 }
+                 displayHtmlHeader ('SquirrelMail', $js);
+                 $onload = $xtra;
+            break;
+        case 'src/compose.php':
+            $js = '<script language="JavaScript" type="text/javascript">' .
+                 "\n<!--\n" .
+                 "function checkForm() {\n".
+                    "var f = document.forms.length;\n".
+                    "var i = 0;\n".
+                    "var pos = -1;\n".
+                    "while( pos == -1 && i < f ) {\n".
+                        "var e = document.forms[i].elements.length;\n".
+                        "var j = 0;\n".
+                        "while( pos == -1 && j < e ) {\n".
+                            "if ( document.forms[i].elements[j].type == 'text' ) {\n".
+                                "pos = j;\n".
+                            "}\n".
+                            "j++;\n".
                         "}\n".
-                        "j++;\n".
+                    "i++;\n".
                     "}\n".
-                "i++;\n".
-                "}\n".
-                "if( pos >= 0 ) {\n".
-                    "document.forms[i-1].elements[pos].focus();\n".
-                "}\n".
-            "}\n";
+                    "if( pos >= 0 ) {\n".
+                        "document.forms[i-1].elements[pos].focus();\n".
+                    "}\n".
+                "}\n";
            
-        $js .= "// -->\n".
-                "</script>\n";
-        $onload = 'onload="checkForm();"';
-        displayHtmlHeader ('SquirrelMail', $js);
-        break;   
-
-    default:
-        $js = '<script language="JavaScript" type="text/javascript">' .
-             "\n<!--\n" .
-             "function checkForm() {\n".
-                "var f = document.forms.length;\n".
-                "var i = 0;\n".
-                "var pos = -1;\n".
-                "while( pos == -1 && i < f ) {\n".
-                    "var e = document.forms[i].elements.length;\n".
-                    "var j = 0;\n".
-                    "while( pos == -1 && j < e ) {\n".
-                        "if ( document.forms[i].elements[j].type == 'text' " .
-                        "|| document.forms[i].elements[j].type == 'password' ) {\n".
-                            "pos = j;\n".
+            $js .= "// -->\n".
+                "</script>\n";
+            $onload = 'onload="checkForm();"';
+            displayHtmlHeader ('SquirrelMail', $js);
+            break;   
+
+        default:
+            $js = '<script language="JavaScript" type="text/javascript">' .
+                 "\n<!--\n" .
+                 "function checkForm() {\n".
+                    "var f = document.forms.length;\n".
+                    "var i = 0;\n".
+                    "var pos = -1;\n".
+                    "while( pos == -1 && i < f ) {\n".
+                        "var e = document.forms[i].elements.length;\n".
+                        "var j = 0;\n".
+                        "while( pos == -1 && j < e ) {\n".
+                            "if ( document.forms[i].elements[j].type == 'text' " .
+                            "|| document.forms[i].elements[j].type == 'password' ) {\n".
+                                "pos = j;\n".
+                            "}\n".
+                            "j++;\n".
                         "}\n".
-                        "j++;\n".
+                    "i++;\n".
+                    "}\n".
+                    "if( pos >= 0 ) {\n".
+                        "document.forms[i-1].elements[pos].focus();\n".
                     "}\n".
-                "i++;\n".
-                "}\n".
-                "if( pos >= 0 ) {\n".
-                    "document.forms[i-1].elements[pos].focus();\n".
-                "}\n".
-               "$xtra\n".
-            "}\n";
+               "$xtra\n".
+                "}\n";
            
-            if ($compose_new_win == '1') {
-                if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
-                    $compose_width = '640';
-                }
-                if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
-                    $compose_height = '550';
+                if ($compose_new_win == '1') {
+                    if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
+                        $compose_width = '640';
+                    }
+                    if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
+                        $compose_height = '550';
+                    }
+                    $js .= "function comp_in_new(comp_uri) {\n".
+                    "       if (!comp_uri) {\n".
+                        '           comp_uri = "'.$compose_uri."\";\n".
+                    '       }'. "\n".
+                         '    var newwin = window.open(comp_uri' .
+                         ', "_blank",'.
+                         '"width='.$compose_width. ',height='.$compose_height.
+                         ',scrollbars=yes,resizable=yes");'."\n".
+                         "}\n\n";
+
                 }
-                $js .= "function comp_in_new(comp_uri) {\n".
-                    "       if (!comp_uri) {\n".
-                    '           comp_uri = "'.$compose_uri."\";\n".
-                    '       }'. "\n".
-                     '    var newwin = window.open(comp_uri' .
-                     ', "_blank",'.
-                     '"width='.$compose_width. ',height='.$compose_height.
-                     ',scrollbars=yes,resizable=yes");'."\n".
-                     "}\n\n";
-
-            }
-        $js .= "// -->\n". "</script>\n";
+            $js .= "// -->\n". "</script>\n";
        
+            $onload = 'onload="checkForm();"';
+            displayHtmlHeader ('SquirrelMail', $js);
+            break;   
 
-        $onload = 'onload="checkForm();"';
-        displayHtmlHeader ('SquirrelMail', $js);
-        break;   
-
+        }
+    } else {
+        /* do not use JavaScript */
+        displayHtmlHeader ('SquirrelMail');
+        $onload = '';
     }
 
     echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";
@@ -238,12 +248,7 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
         . html_tag( 'tr', '', '', $color[4] ) ."\n"
         . html_tag( 'td', '', 'left' ) ."\n";
     $urlMailbox = urlencode($mailbox);
-    if ($compose_new_win == '1') {
-        echo '<a href="javascript:void(0)" onclick="comp_in_new()">'. _("Compose").'</a>';
-    }
-    else {
-        displayInternalLink ("src/compose.php?mailbox=$urlMailbox", _("Compose"), 'right');
-    } 
+    echo makeComposeLink('src/compose.php?mailbox='.$urlMailbox);
     echo "&nbsp;&nbsp;\n";
     displayInternalLink ('src/addressbook.php', _("Addresses"), 'right');
     echo "&nbsp;&nbsp;\n";
@@ -272,55 +277,57 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
 /* blatently copied/truncated/modified from the above function */
 function compose_Header($color, $mailbox) {
 
-    global $delimiter, $hide_sm_attributions, $base_uri, $PHP_SELF, 
-           $data_dir, $username, $frame_top, $compose_new_win;
-
-
-    $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
-    if (!isset($frame_top)) {
-        $frame_top = '_top';
-    }
+    global $javascript_on;
 
     /*
-        Locate the first displayable form element
-    */
-    switch ( $module ) {
-    case 'src/search.php':
-        $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
-        $onload = "onload=\"document.forms[$pos].elements[2].focus();\"";
-        displayHtmlHeader (_("Compose"));
-        break;
-    default:
-        $js = '<script language="JavaScript" type="text/javascript">' .
-             "\n<!--\n" .
-             "function checkForm() {\n".
-                "var f = document.forms.length;\n".
-                "var i = 0;\n".
-                "var pos = -1;\n".
-                "while( pos == -1 && i < f ) {\n".
-                    "var e = document.forms[i].elements.length;\n".
-                    "var j = 0;\n".
-                    "while( pos == -1 && j < e ) {\n".
-                        "if ( document.forms[i].elements[j].type == 'text' ) {\n".
-                            "pos = j;\n".
+     * Locate the first displayable form element (only when JavaScript on)
+     */
+    if($javascript_on) {
+        global $delimiter, $base_uri, $PHP_SELF, $data_dir, $username;
+
+        $module = substr( $PHP_SELF, ( strlen( $PHP_SELF ) - strlen( $base_uri ) ) * -1 );
+
+        switch ( $module ) {
+        case 'src/search.php':
+            $pos = getPref($data_dir, $username, 'search_pos', 0 ) - 1;
+            $onload = "onload=\"document.forms[$pos].elements[2].focus();\"";
+            displayHtmlHeader (_("Compose"));
+            break;
+        default:
+            $js = '<script language="JavaScript" type="text/javascript">' .
+                 "\n<!--\n" .
+                 "function checkForm() {\n".
+                    "var f = document.forms.length;\n".
+                    "var i = 0;\n".
+                    "var pos = -1;\n".
+                    "while( pos == -1 && i < f ) {\n".
+                        "var e = document.forms[i].elements.length;\n".
+                        "var j = 0;\n".
+                        "while( pos == -1 && j < e ) {\n".
+                            "if ( document.forms[i].elements[j].type == 'text' ) {\n".
+                                "pos = j;\n".
+                            "}\n".
+                            "j++;\n".
                         "}\n".
-                        "j++;\n".
+                    "i++;\n".
                     "}\n".
-                "i++;\n".
-                "}\n".
-                "if( pos >= 0 ) {\n".
-                    "document.forms[i-1].elements[pos].focus();\n".
-                "}\n".
-            "}\n";
-        $js .= "// -->\n".
-                "</script>\n";
-        $onload = 'onload="checkForm();"';
-        displayHtmlHeader (_("Compose"), $js);
-        break;   
-
+                    "if( pos >= 0 ) {\n".
+                        "document.forms[i-1].elements[pos].focus();\n".
+                    "}\n".
+                "}\n";
+            $js .= "// -->\n".
+                "</script>\n";
+            $onload = 'onload="checkForm();"';
+            displayHtmlHeader (_("Compose"), $js);
+            break;   
+        }
+    } else {
+        /* javascript off */
+        displayHtmlHeader(_("Compose"));
+        $onload = '';
     }
 
     echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" $onload>\n\n";
 }
 
-?>
\ No newline at end of file
+?>
index db5ff7c..c9e583f 100644 (file)
@@ -415,6 +415,29 @@ function TrimArray(&$array) {
     }
 }   
 
+/* returns a link to the compose-page, taking in consideration
+ * the compose_in_new and javascript settings. */
+function makeComposeLink($url, $text = null)
+{
+    global $compose_new_win,$javascript_on;
+
+    if(!$text) {
+        $text = _("Compose");
+    }
+
+    if($compose_new_win != '1') {
+        return makeInternalLink($url, $text, 'right');
+    }
+
+    /* if we can use JS, use the fancy window, else just open a new one HTML-style */
+    if($javascript_on) {
+        sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
+        return '<a href="javascript:void(0)" onclick="comp_in_new(\''.$base_uri.$url.'\')">'. $text.'</a>';
+    }
+
+    return makeInternalLink($url, $text, '_blank');
+}
+
 $PHP_SELF = php_self();
 
 ?>
index 0d9fc15..20b1fda 100644 (file)
@@ -35,7 +35,7 @@ $Email_RegExp_Match = '[0-9a-z]([-_.+]?[0-9a-z])*(%' . $Host_RegExp_Match .
     ')?@' . $Host_RegExp_Match;
 
 function parseEmail (&$body) {
-    global $color, $Email_RegExp_Match, $compose_new_win;
+    global $color, $Email_RegExp_Match;
     $sbody     = $body;
     $addresses = array();
 
@@ -47,12 +47,7 @@ function parseEmail (&$body) {
     }
     /* Replace each email address with a compose URL */
     foreach ($addresses as $email) {
-        $comp_uri = '../src/compose.php?send_to='.urlencode($email);
-        if ($compose_new_win == '1') {
-            $comp_uri  = 'javascript:void(0)" onClick="comp_in_new('
-                       . "'$comp_uri'" . ')';
-        }
-        $comp_uri = '<a href="'.$comp_uri.'">'.$email.'</a>';
+        $comp_uri = makeComposeLink('src/compose.php?send_to='.urlencode($email), $email);
         $body = str_replace($email, $comp_uri, $body);
     }
     /* Return number of unique addresses found */
index 04fdb20..2337e97 100644 (file)
@@ -21,8 +21,7 @@ function squirrelmail_plugin_init_listcommands () {
 }
 
 function plugin_listcommands_menu() {
-    global $passed_id, $passed_ent_id, $color, $mailbox,
-           $message, $compose_new_win;
+    global $passed_id, $passed_ent_id, $color, $mailbox, $message;
 
     /**
      * Array of commands we can deal with from the header. The Reply option
@@ -55,28 +54,21 @@ function plugin_listcommands_menu() {
         if ($proto == 'mailto') {
 
             if (($cmd == 'post') || ($cmd == 'owner')) {
-                $url = 'compose.php?';
+                $url = 'src/compose.php?';
             } else {
-                $url = "../plugins/listcommands/mailout.php?action=$cmd&amp;";
+                $url = "plugins/listcommands/mailout.php?action=$cmd&amp;";
             }
             $url .= 'send_to=' . strtr($act,'?','&');
 
-            if ($compose_new_win == '1') {
-                $output[] = "<a href=\"javascript:void(0)\" onclick=\"comp_in_new('$url')\">" . $fieldsdescr[$cmd] . '</a>';
-            }
-            else {
-                $output[] = '<a href="' . $url . '">' . $fieldsdescr[$cmd] . '</a>';
-            }
+            $output[] = makeComposeLink($url, $fieldsdescr[$cmd]);
+
             if ($cmd == 'post') {
                $url .= '&amp;passed_id='.$passed_id.
                        '&amp;mailbox='.urlencode($mailbox).
                        (isset($passed_ent_id)?'&amp;passed_ent_id='.$passed_ent_id:'');
                 $url .= '&amp;action=reply';
-                if ($compose_new_win == '1') {
-                    $output[] = "<a href=\"javascript:void(0)\" onclick=\"comp_in_new('$url')\">" . $fieldsdescr['reply'] . '</a>';
-                } else {
-                    $output[] = '<a href="' . $url . '">' . $fieldsdescr['reply'] . '</a>';
-                }
+
+                $output[] = makeComposeLink($url, $fieldsdescr['reply']);
             }
         } else if ($proto == 'href') {
             $output[] = '<a href="' . $act . '" target="_blank">'
index 4ba7e96..d3d45fb 100644 (file)
@@ -386,13 +386,9 @@ if ($showaddrlist) {
             html_tag( 'td', '', 'left', '', 'valign="top" width="1%" nowrap' ) . '&nbsp;';
                 }
             $email = $abook->full_address($row);
-            if ($compose_new_win == '1') {
-                echo '<a href="javascript:void(0)" onclick=comp_in_new("compose.php?send_to='.rawurlencode($email).'")>';
-            }
-            else {
-                echo '<A HREF="compose.php?send_to=' . rawurlencode($email).'">';
-            }
-            echo htmlspecialchars($row['email']) . '</A>&nbsp;</td>'."\n".
+            echo makeComposeLink('src/compose.php?send_to='.rawurlencode($email),
+                 htmlspecialchars($row['email']) ) .
+            '&nbsp;</td>'."\n".
             html_tag( 'td', '&nbsp;' . htmlspecialchars($row['label']) . '&nbsp;', 'left', '', 'valign="top" width="1%"' ) .
             "</tr>\n";
             $line++;
index 3965c67..8d80761 100644 (file)
@@ -472,7 +472,7 @@ function formatEnvheader($mailbox, $passed_id, $passed_ent_id, $message,
 
 function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_response) {
     global $base_uri, $draft_folder, $where, $what, $color, $sort,
-           $startMessage, $compose_new_win, $PHP_SELF, $save_as_draft,
+           $startMessage, $PHP_SELF, $save_as_draft,
            $enable_forward_as_attachment;
 
     $topbar_delimiter = '&nbsp;|&nbsp;';
@@ -505,18 +505,11 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
         $s .= '<a href="' . $delete_url . '">' . _("Delete") . '</a>';
     }
 
-    $comp_uri = $base_uri . 'src/compose.php' .
+    $comp_uri = 'src/compose.php' .
                             '?passed_id=' . $passed_id .
                             '&amp;mailbox=' . $urlMailbox .
                             (isset($passed_ent_id)?'&amp;passed_ent_id='.$passed_ent_id:'');
 
-    if ($compose_new_win == '1') {
-        $link_open  = '<a href="javascript:void(0)" onclick="comp_in_new(\'';
-        $link_close = '\')">';
-    } else {
-        $link_open  = '<a href="';
-        $link_close = '">';
-    }
     if (($mailbox == $draft_folder) && ($save_as_draft)) {
         $comp_alt_uri = $comp_uri . '&amp;action=draft';
         $comp_alt_string = _("Resume Draft");
@@ -526,7 +519,7 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
     }
     if (isset($comp_alt_uri)) {
         $s .= $topbar_delimiter;
-        $s .= $link_open . $comp_alt_uri . $link_close . $comp_alt_string . '</a>';
+        $s .= makeComposeLink($comp_alt_uri, $comp_alt_string);
     }
 
     $s .= '</small></td><td align="center" width="33%"><small>';
@@ -594,25 +587,25 @@ function formatMenubar($mailbox, $passed_id, $passed_ent_id, $message, $mbx_resp
     $s .= '</small></td>' . "\n" . 
           html_tag( 'td', '', 'right', '', 'width="33%" nowrap' ) . '<small>';
     $comp_action_uri = $comp_uri . '&amp;action=forward';
-    $s .= $link_open . $comp_action_uri . $link_close . _("Forward") . '</a>';
+    $s .= makeComposeLink($comp_action_uri, _("Forward"));
 
     if ($enable_forward_as_attachment) {
         $comp_action_uri = $comp_uri . '&amp;action=forward_as_attachment';
         $s .= $topbar_delimiter;
-        $s .= $link_open . $comp_action_uri . $link_close . _("Forward as Attachment") . '</a>';
+        $s .= makeComposeLink($comp_action_uri, _("Forward as Attachment"));
     }
 
     $comp_action_uri = $comp_uri . '&amp;action=reply';
     $s .= $topbar_delimiter;
-    $s .= $link_open . $comp_action_uri . $link_close . _("Reply") . '</a>';
+    $s .= makeComposeLink($comp_action_uri, _("Reply"));
 
     $comp_action_uri = $comp_uri . '&amp;action=reply_all';
     $s .= $topbar_delimiter;
-    $s .= $link_open . $comp_action_uri . $link_close . _("Reply All") . '</a>';
+    $s .= makeComposeLink($comp_action_uri, _("Reply All"));
     $s .= '</small></td></tr></table>';
-    do_hook("read_body_menu_top");
+    do_hook('read_body_menu_top');
     echo $s;
-    do_hook("read_body_menu_bottom");
+    do_hook('read_body_menu_bottom');
 }
 
 function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
index ee109a6..401e120 100644 (file)
@@ -115,10 +115,11 @@ $ShowValues = array(
 echo '<tr><td><br>' .
         '<TABLE border=0 cellpadding=2 cellspacing=0 align=center>' . "\n";
 
-if (isset($vcard_safe['email;internet'])) {     $vcard_safe['email;internet'] = '<A HREF="../src/compose.php?send_to=' .
-        $vcard_safe['email;internet'] . '">' . $vcard_safe['email;internet'] .
-        '</A>';
+if (isset($vcard_safe['email;internet'])) {
+    $vcard_safe['email;internet'] = makeComposeLink('src/compose.php?send_to='.urlencode($vcard_safe['email;internet']),
+        $vcard_safe['email;internet']);
 }
+
 if (isset($vcard_safe['url'])) {
     $vcard_safe['url'] = '<A HREF="' . $vcard_safe['url'] . '">' .
         $vcard_safe['url'] . '</A>';