Made of Everything You're Not

Personal blog of PHP programmer Eric Lamb.
  • Blog
  • Portfolio

Archive for August, 2010

Mailpress 5.0 Email Validation Bug

Posted in Code, Programming, Rant on August 10th, 2010 by Eric Lamb – 4 Comments

A couple weeks ago I received an email from a client of mine about a bug one of their clients was having using the Mailpress Wordpress plugin and wanting to know if I could help. They're an agency and I always want to make them happy so, even though I didn't write Mailpress, I decided to dive in a see what was up. Plus, it's always fun to contribute to open source projects and to get paid to do it is always a win-win.

Mailpress Email Validation Bug

Before getting into the bug I just want to say that I didn't want to post it in this way; ideally there would be channels available to submit issues but Mailpress doesn't exactly make that easy. Their site, while having links to the expected destinations like Community and Submitting a patch, doesn't appear to be finished and those sections are essentially empty at the moment.  The information to put this information out there very well might be in the site but, frankly, the thought of writing this post was less painful than digging through the site looking for info. Plus, this isn't a security issue at all so there's that. Ass == Covered.

The issue was that the email validation was returning false even when an email was valid, specifically if the email wasn't entirely lowercase. The problem with that, in case it's not clear, is that an email address doesn't have to be lower case (at least in the name portion). For example the below two emails are valid and, in fact, different:

eric@example.com
Eric@example.com

They look similar and it's not really advisable to do email addresses in that format but people do it that way and, technically, it is allowed so not sure why Mailpress doesn't.

Mailpress would throw an error on the second email which was pissing of my client's client and my client (sigh...). The fix is pretty stratightford and easy; just replace the regular expression in Mailpress with the working one I cribbed from Zaheer.

File: "/wp-content/plugins/mailpress/mp-admin/js/write.js"

219
is_email : function(m) { var pattern = /^+(\.+)*@+(\.+)*(\.{2,4})$/; return pattern.test(m); },

With:

219
is_email : function(m) { var pattern = /^+@+\.{2,4}$/; return pattern.test(m); },

Hopefully, the issue doesn't go deeper than the javascript validation but the above does allow for a working email validation script. Now we just need Mailpress to update their wonderful plugin with the fix...

WP-Click-Track 0.7.2 Released

Posted in Code, Programming on August 03rd, 2010 by Eric Lamb – 1 Comments

Today I finally found the time to release an update to wp-click-track with a few bugs that some users have been encountering. This release is purely a bug fix release so there won't be any new bells or whistles but if you run IIS 6 or want to clear out some links or reset your system you're in luck. The only "interesting" bug that was fixed was the IIS6 HTTPS issue.

WP-Click-Track 0.7.2 Released

Because of how IIS6 and PHP populate the $_SERVER value some users were experiencing issues with their stats page. Turns out that IIS6 will return a value of "off" if the request wasn't made through HTTPS instead of the default behavior of returning a boolean. So, while the below code will work with Apache and newer versions of IIS, IIS6 creates a bit of a false positive:

<?php
if(isset($_SERVER))
{
     //server has HTTPS but IIS6 will always think it's on
}
?>

Instead, it's better to check the value along with the existance check like:

<?php
if(isset($_SERVER) && $_SERVER != 'off')
{
    //server has HTTPS and IIS6 is being account for
}
?>

Go Microsoft smile

  • Subscribe: Entries | Comments
  • About Me

    Email Email
    Twitter Twitter
    310.739.3322
  • Categories

    • Brain Dump
    • Business
    • Code
    • IT
    • Programming
    • Rant
    • Servers
  • Archives

    • February 2012
    • October 2011
    • August 2011
    • July 2011
    • June 2011
    • May 2011
    • April 2011
    • March 2011
    • February 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
  • Advertisement

Copyright © 2008 - 2013 Eric Lamb - All rights reserved