globalvar

Looking through the Blogsome/WPµ source, I came across a Smarty function {globalvar}. “Righto,” I thought, “I’ll google that, and see what comes up.” My template file was the first thing that did. Okay, what this function does is take a Smarty variable, and make it global in the PHP scope. Used in my template, and most Blogsome ones, it sets the variable $comment to be a global one. I haven’t come up with another good use for it, but it’s nice to know.

XMLRPC Escaped Quotes

For some time, since the XMLRPC file was updated, posting to Blogsome via the XMLRPC interface has been broken. It works, but extraneous slashes are inserted before quotes and apostrophes. I’ve been lucky enough to get my dirty little mitts on the source code, on a test server, and have come up with what may be a fix. The good folks at Blogsome (I think) replaced the dodgy, broken version of XMLRPC.php with one that prevented some problems with a security hole. However, this version of the file came from a more recent WordPress installation. The version of WP-µ that Blogsome uses may not have actually been vulnerable to the problem that the XMLRPC file could have caused, because of this code:

1        // Do some escapes for safety
2        $post_title = $wpdb->escape($post_title);
3        $post_name = sanitize_title($post_title);
4        $post_excerpt = $wpdb->escape($post_excerpt);
5        $post_content = $wpdb->escape($post_content);
6        $post_author = (int) $post_author;

However, the new XMLRPC file also escapes everything. So everything gets escaped twice, causing the quotes to be double-escaped. So, I replaced the above code with the code from the new version:

1        // Get the basics.
2        $post_content    = apply_filters('content_save_pre',   $post_content);
3        $post_excerpt    = apply_filters('excerpt_save_pre',   $post_excerpt);
4        $post_title      = apply_filters('title_save_pre',     $post_title);
5        $post_category   = apply_filters('category_save_pre',  $post_category);
6        $post_status     = apply_filters('status_save_pre',    $post_status);
7        $post_name       = apply_filters('name_save_pre',      $post_name);
8        $comment_status  = apply_filters('comment_status_pre', $comment_status);
9        $ping_status     = apply_filters('ping_status_pre',    $ping_status);

My test blog (which isn’t available to the public, as it’s on another server) seems to be coping well with this, I think I’ll publish a heap of entries to it and see how it holds up. I’m hoping that Ronan will be able to have a look over these changes, and hopefully we’ll see the Quote Escape bug gone, for good, very soon! Update: Apparently I didn’t do enough checking. The filters that are called don’t actually exist, so no escaping is done. That will teach me for going off half cocked. I will try to implement the new filters used by this version of the code, but we’ll see.

iPhoto vs. iMediaViewPro

This isn’t really a full review or comparison, just a few quick notes. I downloaded the demo version of iMediaView Pro, and ran it. I let it import all of my iPhoto library, and was fairly disappointed it didn’t automatically albumize them according to my iPhoto albums. I must say I don’t like the interface nearly as much as iPhoto’s. iPhoto is pretty much a great program, except it’s dog slow whenever you try to do anything. But it’s simple to use, and really has all of the cataloguing features I need right now. I just use a Smart Playlist to list every photo that doesn’t have an album, and create a new album each time I import photos, and add them all to that. Now that iPhoto has folders, I can have a level of hierarchical organisation. And iPhoto has built-in capabilities to view photos by date of creation. If only it wasn’t so. damn. slow.

iTMS.au

iTunes Music Store Australia is here. Since you need to sign up to even get access to the free music, I had to enter my Credit Card Number. It didn’t work. Three times. Apparently you need to actually have money in there for it to work.

Preloading Images

Apparently, it’s possible to use JavaScript to preload images. checked = new Image(); checked.src = "/images/true.gif"; unchecked = new Image(); unchecked.src = "/images/false.gif"; This is better than doing the CSS trick display:none;, as this doesn’t always preload in every browser.