Fixing WordPress fGallery plugin
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 infim_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.