Notice the new search feature

Alert LnBlog uses who look at the sidebar may notice that the search section has changed. I've finally gotten around to writing a native search plugin. Yes, I finally got sick of waiting for Google to spider my site. It's pretty simple right now; it just searches for entries matching all search terms. It will also accept a regular expression if you enclose it in forward slashes. This will replace the Google search plugin as the standard search feature in the next release. The Google search plugin will still be included for anyone who wants it, but will be disabled in teh default configuration.

There is one interesting thing about the new plugin: it's the first plugin I've done that displays an entire page on its own. By that I mean that the sidebar panel and the search results page are both displayed by the plugin file, rather than using a separate page file for the search results. I still have a few bugs to work out of it, but if and when I get it sorted out, this plugin will provide a nice template for future self-contained plugins.

LnBlog 0.5.4 - "No Need for Testing"

This always happens to me - come out with a nice new release with lots of cool features and discover that it has a huge, glaring bug in it that makes it completely unusable for some people. Well, at least I found the bug and squashed it. At work, I occasionally have to fix bugs that have been lurking in software and messing up reports for years before anyone noticed them.

This is a critical bug fix release. This particular bug appears to have been introduced in version 0.5.1 and affects users who are running on web servers without the gettext extension enabled. Users who have gettext enabled (i.e. people who could actually use the software) are not affected by this issue and, hence, do not need to upgrade. Many thanks to Brandon for reporting this problem.

If you are affected by this bug and have PHP's error reporting turned on, you will see a message that says something like:
Fatal error: Call to undefined function: _() in /path/to/lnblog/blogconfig.php on line 133
This is due to an error in the blogconfig.php script. I mistakenly tried to mark a string for internationalization before loading the lib/i18n.php file, which contains the _() ad hoc internationalization function. Users with gettext enabled are not affected because LnBlog only uses the custom version of _() defined in lib/i18n.php if the gettext extension is not loaded. When it is present, the _() function is provided by gettext itself.

If you are affected by this bug, you can download the new release from the download page. Alternatively, you can get the same effect by downloading the fixed blogconfig.php file and apply it as described on this page.

Bug fix for 0.5.3

Oops! I messed up!

Apparently I introduced a bug into the last few releases for people who don't have the gettext extension enabled. I forgot to turn gettext support back off on one of my test systems, so I didn't catch this. My apologies to anyone affected.

Bascially, this bug causes an "undefined function _()" error in the blogconfig.php file. This is caused by an attempt to mark a string for translation before the ad hoc translation code is loaded. This only affects users running on servers without the gettext extension enabled. If gettext is enabled, then it will supply the _() function and there is no problem.

I will upload a new version and update the Freshmeat page later today or tomorrow. In the mean time, you can download the fix here. Just rename this file to "blogconfig.php" and copy it into the root of your LnBlog folder, overwriting the old one.

LnBlog 0.5.3 - "No Need for Spam"

It's release time again! LnBlog 0.5.3, also known as "No Need for Spam," is now available for download. You can get it from the download page as usual. You may also want to note that I've decided to join the 21st century and am now cryptographically signing the release archives with GnuPG. If you don't know what that means, don't worry about it. If you do know, then you can find my public key here.

This release adds a number of significant features. The biggest features are actually all implemented as standard plugins, meaning you can customize them and/or turn them off. The first of these is a plugin to blacklist IP addresses from submitting comments or trackbacks. This has several features. First, when you are logged in, it displays the IP address from which a comment or trackback was posted along with a link to ban it. If you are logged in as the administrator, there is also a "global ban" link. Basically, the idea is that you can ban apply a ban for just the current blog or globally for all blogs managed by LnBlog. The two files are merged when the plugin loads, so the blocking rules from both will be applied. If an IP address is found in one of those files, any comments or trackbacks it submits will just be discarded. And just as side note, if you want to make your regular account the administrator in order to make global banning more convenient, you can do that by creating a userconfig.cfg file in your LnBlog userdata directory and adding the following line to it:
ADMIN_USER = your_username_here
Note that this will make the administrator account into a regular user. Of course, that probably isn't a problem for most people.

As for the IP ban lists themselves, they are actually a list of regular expressions, one per line. When you click one of the ban links, the actual IP address is added to the appropriate ban file. However, you can edit the file from a sidebar link and actually change those lines to use PREG (Perl-compatible regular expression) syntax. So, for example, if you're getting spammed by the whole range of IP addresses between 123.45.67.89 and 123.45.67.98, you could block that entire subnet by simply adding 123.45.67.* to the ban file. If you're a real regular expression wizard, you could get really fancy, but this should be sufficient for most people.

The next spam-related feature in this release is another plugin, this time to just turn off comment and/or trackback posting for your whole blog. This plugin has settings that allow you to turn off trackbacks and to turn off comments either for everybody or just for people who are not logged in. This is for those who would rather just not deal with comment or trackback spam at all.

The third semi-spam-related feature is a plugin to notify you by e-mail when a trackback ping is received by an entry. Basically, this is exactly the same as the comment notification plugin, except for trackbacks. This way, you'll actually know when you get trackback spam.

The last spam-related feature is just the ability to handle trackback pings. You can now delete received trackbacks and turning off comments for an entry will also turn off trackbacks. Note that currently, the confirmation for trackback deletion is only in JavaScript, so if you have JavaScript disabled, clicking the delete link will delete the trackback ping immediately. Just an FYI.

One more option on the plugin front, it is now possible to add your own custom links to the articles section of the sidebar. When you log in, you will now see a link for that at the bottom of the articles section. The file format and interface is the same as for modifying the sitemap.

The last big feature is pretty permalinks for entries. Rather than the date and time, the last component of permalinks will now be a sanitized version of the subject line. Of course, the old-style permalinks will still work, even for new entries, so there is no need to convert anything. I've just added some code to create a wrapper PHP script with a nice name whenever an entry is added or modified. The other nice thing about this is that if you change the subject of an entry, the link with the old subject will still work.

That about covers the major changes for this release. I also made the plugin configuration page a little easier to use, added JavaScript confirmation for comment deletion, added a redirect to prevent duplicating comments, and fixed several bugs, such as tags being lost during post previews. Check the change log for details.

As always, leave a comment or e-mail me if you have any problems, questions, or comments. Enjoy!

One problem down

Well, it looks like the new IP blacklisting plugin has solved my trackback spam problem. All the spam was coming from two or three subnets, so I just banned the entire subnet and I haven't had anything since.

In other news, I implemented a couple of fixes and features today. First, I fixed a problem with links to uploaded files being broken by the new pretty link feature. Second, I fixed that annoying problem where tags weren't preserved in the edit box when previewing an entry.

On the feature front, I added the ability to turn off trackbacks. For now, there's no seperate setting for it - it just follows the setting for comments. I also added a plugin that allows you to turn off trackbacks or comments for an entire blog. That should be nice for people like me who never actually get any legitimate trackbacks.

Anyway, I want to do some testing, but I think I'm pretty much done with this version in terms of features. Look for a new release before the end of the week.

Gack! More trackback spam!

Well, it looks like testing out the IP banning plugin for a few days was a good idea, because it didn't work quite as well as I'd have hoped. In other words, I'm still getting trackback spam.

I took an hour or so to rework the plugin. This time I decided to keep it nice and simple. I made sure to remove all extraneous whitespace, separate the per-blog and global IP lists, and did the check with a simple preg_match() call. This has the added benefit that I can now use the same code to ban an entire subnet just by including a star in the IP.

I think I should also include a setting to turn off trackbacks and/or comments altogether. I'll bet there are a lot of people who just don't feel like trying to keep up with the spammers. And at this point, I really can't say I blame them. My site isn't even that popular, and I've gotten nearly 50 trackback spams just since I implemented e-mail notification the other day.

Yay! Spam handling!

Well, now my spam problem is (partially) taken care of. Today I added trackbacks to the IP blacklisting plugin, added a plugin to send e-mail notifications for new trackback pings, and added an interface to delete trackback pings. After I burn them in for a few days, I'll put up a new release.

I would have liked to just release the plugins, but it turns out that isn't possible. You see, I haven't actually touched the trackback code since I first added it. As a result, the trackback class wasn't raising any events for plugins to hook into. In fact, the class didn't even have a delete method. So I had to add all of that. The good news is that now it's taken care of, so hopefully in the future I can just release plugins.

And here I was worried about comment spam

Sigh.... And here I had just finished an IP banning plugin for comment spam and I discover that I'm now getting trackback spam. Pornographic trackback spam, no less. And I didn't even bother to implement an interface for deleting trackbacks, much less blocking them. I guess I'll be doing that tomorrow. My apologies for the oversight.

So it looks like I've got another couple of plugins to implement before the next release. For one, I'll want e-mail notifications of trackbacks, so that I'll actually know when I get trackback spam. Second, I'll have to extend the comment banning to trackbacks. Third, I guess I'll have to start working on that keyword banning idea I was thinking of for comment spam.

Pretty URLs

LnBlog grew a new feature this week: pretty URLs. And it's about time, too. I never really worried too much about the URLs being largely numeric, but after a year of looking at my logs and my own links, trying to figure out what an entry was about, I've now changed my tune.

I think the solution I came up with is fairly simple. When an entry is created or edited, a PHP wrapper script will be created in the same directory as the entry. All the script will do is change to the entry directory and call the index.php file there. It will be named using the entry subject with all non-word characters (everything but numbers and letters) converted into underscores and a PHP suffix tacked onto the end. If this file exists, it will be used as the permalink for the entry. So, for example, the permalink for this entry will be http://www.skepticats.com/lnblog/entries/2006/01/Pretty_URLs.php. I'll probably make this configurable so that people can still use the old-style URLs (in part because I'm not sure how I should handle non-Latin subject text), but the new ones will be the default.

There are a two main benefits to doing it this way:

  1. There is no need for conversion. All the old URLs will continue to work.
  2. Permalinks will not break if you edit an entry's subject. A new script will be created using the correct subject text, and will be used as the permalink in the future, but the old one will continue to point to the same location.

I suppose I'll probably release the next version soon. I want to add a few other changes, including some more hooks into the way entries are displayed to make plugins easier to write. One thing I'd like to include in the next few releases is a comment spam plugin, although I haven't really needed one so far. I just need to lay the groundwork first.