Skip to content

Commit

Permalink
* core/print_api.php
Browse files Browse the repository at this point in the history
  (get_email_link): don't apply string_url() to the whole mailto link since
    it causes @ to be escaped which doesn't work well when you copy the
    email address from the browser's context menu and paste it somewhere
    else
  (get_email_link_with_subject): ditto


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@2114 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Julian Fitzell committed Mar 20, 2003
1 parent 468f190 commit 8a617cb
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions core/print_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: print_api.php,v 1.62 2003-03-12 18:27:13 int2str Exp $
# $Id: print_api.php,v 1.63 2003-03-20 07:27:09 jfitzell Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -980,10 +980,13 @@ function get_email_link( $p_email, $p_text ) {
return $p_text;
}

$p_email = string_url( $p_email );
# If we apply string_url() to the whole mailto: link then the @
# gets turned into a %40 and you can't right click in browsers to
# do Copy Email Address.
$t_mailto = string_attribute( "mailto:$p_email" );
$p_text = string_display( $p_text );

return "<a href=\"mailto:$p_email\">$p_text</a>";
return "<a href=\"$t_mailto\">$p_text</a>";
}
# --------------------
# print a mailto: href link with subject
Expand All @@ -999,11 +1002,15 @@ function get_email_link_with_subject( $p_email, $p_text, $p_summary ) {
return $p_text;
}

$p_email = string_url( $p_email );
$p_text = string_display( $p_text );
# If we apply string_url() to the whole mailto: link then the @
# gets turned into a %40 and you can't right click in browsers to
# do Copy Email Address. If we don't apply string_url() to the
# summary text then an ampersand (for example) will truncate the text
$p_summary = string_url( $p_summary );
$t_mailto = string_attribute( "mailto:$p_email?subject=$p_summary" );
$p_text = string_display( $p_text );

return "<a href=\"mailto:$p_email?subject=$p_summary\">$p_text</a>";
return "<a href=\"$t_mailto\">$p_text</a>";
}
# --------------------
# Print a hidden input for each name=>value pair in the array
Expand Down

0 comments on commit 8a617cb

Please sign in to comment.