[turba] mailto URL formatting problems

Dr. Michael J. Chudobiak mjc at avtechpulse.com
Wed Aug 20 10:43:21 PDT 2003


I've patched my Turba installation to properly show mailto URLs. It turns out that the imap_rfc822_write_address function encodes the brackets into HTML entities - which is OK for displaying, but not for use in HTML code.

I got around this by simplifying the mailto URLs to use just the email address, and not the full names.


Files: templates/search/row.inc, templates/browse/contactrow.inc
----------------------------------------------------------------

Original:

            // Format the address according to RFC822.
            $mailbox_host = explode('@', $show[$column]);
            if (!isset($mailbox_host[1])) {
                $mailbox_host[1] = '';
            }
            $name = $ob->getValue('name');
            $address = imap_rfc822_write_address($mailbox_host[0], $mailbox_host[1], $name);
            // Get rid of the trailing @ (when no host is included in the email address).
            $address = str_replace('@>', '>', $address);


Changed to:

	    $address = $show[$column];


File: templates/display/display.inc:
------------------------------------

Original:
        // Format the address according to RFC822.
        $mailbox_host = explode('@', $val);
        if (!isset($mailbox_host[1])) {
            $mailbox_host[1] = '';
        }
        $name = $this->object->getValue('name');
        $address = imap_rfc822_write_address($mailbox_host[0], $mailbox_host[1], $name);
        // Get rid of the trailing @ (when no host is included in the email address).
        $address = str_replace('@>', '>', $address);

Changed to:

      $address = $val;


I notice that the display.inc file says "// FIXME: should not rely on the imap extension.".


I hope this is helpful...

- Mike



> -----Original Message-----
> From: Dr. Michael J. Chudobiak 
> Sent: Thursday, August 14, 2003 2:05 PM
> To: turba at lists.horde.org
> Subject: RE: [turba] mailto URL formatting problems
> 
> 
> > > However, Turba seems to format the mailto URLs in a way 
> that neither
> > > Firebird or MS IE can understand. For example, it returns:
> > >
> > > <a href="mailto:Michael Chudobiak
> > > &amp;lt;mjc at avtechpulse.com&amp;gt;">mjc at avtechpulse.com</a>
> > >
> > > and the browser can't extract the email address.
> > 
> > Yes, that doesn't look right, this should be &lt; and &gt;
> > Looks like the url gets passed twice through 
> > htmlspecialchars(). Do you have
> > a patch to fix that?
> > 
> > Jan.
> 
> 
> No, I don't have a patch. I was hoping someone else would. 
> However, I will have to make one in the next few weeks, and I 
> will post it here, if I figure it out...
> 
> 
> - Mike
> 


More information about the turba mailing list