Allowing anchors when displaying HTML messages

Paul Lesniewski <[email protected]>
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <[email protected]>
All,

  https://sourceforge.net/tracker/index.php?func=detail&aid=2864736&group_id=311&atid=100311

  Anchors to another part of any HTML message are replaced with
blank.png, because SM thinks there is no valid URL in the href.

  The attached patch is a quick hack to allow anchors through,
although it has not been evaluated for abuse potential and the anchor
still opens up in a new window (which would be much more involved to
fix, as the whole Magic HTML code seems to assume that's the only
option you'd ever want).

  If anyone can comment or improve upon this, that would be nice.

-Paul

-- 
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
allow_anchors-1.4.diff (application/octet-stream, 868 B)
Index: functions/mime.php
===================================================================
--- functions/mime.php	(revision 13833)
+++ functions/mime.php	(working copy)
@@ -1829,7 +1830,12 @@
                         break;
                 }
             } else {
-                if (!(isset($aUrl['path']) && $aUrl['path'] == $secremoveimg)) {
+                // anchors are OK
+                // FIXME: can there be abuse of anchors here?
+                // FIXME: stop anchors from opening in another window
+                if (!isset($aUrl['path']) && !empty($aUrl['fragment'])) {
+                }
+                else if (!isset($aUrl['path']) || $aUrl['path'] != $secremoveimg) {
                     // parse_url did not lead to satisfying result
                     $attvalue = $sQuote . SM_PATH . 'images/blank.png' . $sQuote;
                 }
allow_anchors-1.5.diff (application/octet-stream, 868 B)
Index: functions/mime.php
===================================================================
--- functions/mime.php	(revision 13843)
+++ functions/mime.php	(working copy)
@@ -2006,7 +2006,12 @@
                         break;
                 }
             } else {
-                if (!(isset($aUrl['path']) && $aUrl['path'] == $secremoveimg)) {
+                // anchors are OK
+                // FIXME: can there be abuse of anchors here?
+                // FIXME: stop anchors from opening in another window
+                if (!isset($aUrl['path']) && !empty($aUrl['fragment'])) {
+                }
+                else if (!isset($aUrl['path']) || $aUrl['path'] != $secremoveimg) {
                     // parse_url did not lead to satisfying result
                     $attvalue = $sQuote . SM_PATH . 'images/blank.png' . $sQuote;
                 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.