Inspirated

 
 

February 17, 2009

Rough patches

Filed under: Blog — krkhan @ 3:20 pm

A little while ago I had to code a few fixes for the fGallery WordPress plugin. The patch was released as version 2.4.1-1 and it wasn’t until yesterday that I noticed the “Previous” and “Next” links behaving erratically for my images. Fixing it required a little hair-pulling dance with SQL sub-queries. Anyhow-way, the end product does work as expected. Here’s the incremental diff with the bugfix which should be applied to the 2.4.1-1 release. If you don’t understand what was just said in the last line, you can use the already patched zip archive to have things automatically sorted out.

Tags: , , , , , , , ,

September 21, 2008

Fixing WordPress fGallery plugin

Filed under: Blog — krkhan @ 9:22 pm

For the past two years, I have been using Fredrick Fahlstad’s fGallery plugin for managing images in my WordPress blog. Unfortunately, this excellent piece of software was left unmaintained with the last stable release taking place way back in 2006. For a while now, I’ve had my gripes with some of the things in fGallery. The two options I had were to either (A) fix what was broken or to (B) use another plugin from WordPress Extend.

(B) seemed like too much trouble so I decided to go for the former option and get my hands wet with PHP again. Here’s a list of stuff that I modified in the original 2.4.1 release:

  • Fixed output of special HTML characters in album and image titles to conform with XHTML standards.
  • Modified to send HTTP response “Status:200 OK” back to the client in fim_photos.php. Without this, all of my fGallery pages were returning 404 error code for nice URLs even though they were working in the browser.
  • Fixed an SQL injection vulnerability in fim_rss.php.
  • Fixed image order on album pages and RSS feeds. Without using the table name in the ORDER queries, images were being returned in random order.
  • Fixed date issues in album RSS feeds.
  • Images are now shown in their original sizes in case their width is smaller than 600 pixels. In case they overflow this limit, they are shown in a 600 pixels wide frame with an option to click them for viewing in original size. This was to prevent larger image from messing up blog themes.

Here’s a diff file with the mentioned changes, which should be applied to the 2.4.1 release. I’ve also uploaded a modified zip archive for convenience of those who don’t have access to the patch command.

Tags: , , , , , , , , ,