WordPress Smileys URL Bug; Take 2
12 Jun 2006Well, as many of you have noticed, my blog started causing those who were viewing the Utah Open Source Planet to get an SSL Certificate Authorization dialog, again.
For the time being, I have turned off the convert smileies to graphics option.
It turned out, that I had to also pull up the offending post(s) and resave them to get that setting to take effect in the db, which is strange, since it was dynamic for the site last time I fixed the bug. Oh, well.
As many of you who use WordPress know, it wasn’t until the 2.0 release that WordPress supported having your admin interface portion of the site encrypted. The way that they implemented this feature in WordPress 2.0 was to have two different URLs that you can configure, the blog URL (where visitors see your blog) and the site URL (where your admin interface lives).
The two URL idea was the right way to do it. I benefit from it, as the admin interface is on a different hostname from the blog. Unfortunately, the WordPress developers made a couple of small mistakes in implementing the use of the two URLs and that’s where the bug that has affected UOSP readers comes from.
But, I know how to fix these bugs.
I will be going through the code and cleaning up those bits that drop URLs into the output, making sure that the blog URL gets used instead of the site URL. However, that will not be quite enough. There are a couple of other things that should be fixed while I’m at it.
The code in WordPress 2.0 has two ways (different function calls) that URLs can be dropped into HTML output. The first is a poorly implemented if-else tree that maps to the parameters as set by the admin and stored in the DB (actually, there are several functions of this type). The second function is a wrapper around the first one and others like the first one. This is a very inefficient design, not to mention confusing.
Another problem is that the two functions in question (i.e. those that deal with the blog URL and the site URL) use the same parameters for different meanings, reversing the result from what one expects.
The right way to fix all of that is to use a set of simple indexed arrays to access those parameters (or a single two-dimensional indexed array). This will eliminate the overhead of the multiple, nested function calls and provide one consistent location for accessing any configured parameter.





