New post editor

Here's a little sneak preview of the New post editorchanges I've made to the post editor for the next release. I've cleaned it up a little and added a fair amount of "unobtrusive JavaScript" for enhancements. Here's a screenshot of the basic view.

The default view is simpler than in previous releases. Notice the drop-down topic list so you no longer have to type in existing topics. The LBCode editor controls are also closer to the content area, so you can actually get to them. They also disappear when the markup type is something other than LBCode, so they're not in the way.

The rest of the post settings are available by expanding the lower panel. Here's the shapshot. Post settings panel Of course, the default configuration only has one upload box, but that can be changed in your system.ini. The new features to note here are, of course, the box to allow Pingbacks and the enclosure URL. If you're not familiar with RSS enclosures, they're basically the mechanism by which "Podcasting" is made possible. As with other URLs in LnBlog, you can specify a relative URL in this box.

So far, I think the new setup is pretty good. More functionality, fewer distractions, and just generally better. This interface will be available in the next 0.8.0 prerelease, which I'll be putting up some time this week.

TrackbackValidator: sneak preview

I read an interesting article on TrackBack spam today, called Taking TrackBack Back (from Spam). The ideas seemed sensible to me, so I banged out a TrackbackValidator plugin to implement it.

The idea behind the paper and the plugin is simple: the sites linked to by TrackBack spam never contain a link back to your blog entry, but nearly every legitimate blog entry that pings you does. Therefore, rather than fancy content filter, we can eliminate TrackBack spam by simply fetching the URL in the ping and only accepting it if the page actually contains a link to your site.

This plugin implements that idea. It also includes options to white-list all pings coming from your domain and to allow ping that link to files under your entry (e.g. an uploaded file or the comments page) rather than just the permalink. My spam rates have been way up lately, so I'll be uploading this tonight and we'll see how it goes.

Release preview

It's time for a preview release. We'll call this one LnBlog 0.8.0-pre1. I don't really want to call it a beta release, because that would imply that the feature set is at least close to finalized. I'm actually still not sure if I want to release after a little more testing or add a few more features and call it version 1.0.0.

Since this is a testing release, I of course recommend keeping a backup copy of the previous version around. No blog upgrades are required, so just upload the new version and rename it after your old installation. Note a few old plugins are now redundant and have been removed and a file has been added in the userdata folder, so I the recommended starting with the fresh installation directory and copying over your old userdata folder rather than trying to upload the new files into your existing directory.

This is going to be a major feature addition release. The big one in this release is support for sending and receiving Pingbacks. If you're not already aware, Pingbacks are very similar to TrackBacks, in that they are used to send a notification to another blog that you've linked to them. The main differences are that 1) Pingbacks are significantly more complicated to implement and 2) Pingbacks don't suffer from the same spam problems as TrackBacks, due to the fact that the server, rather than the client, determines what data goes into them.

The second bigish feature is support for enclosures. Basically, this means podcasting support. An enclosure is just a hint to an RSS reader that a post is related to a particular file so that it can be downloaded in the background. All you need to do is enter the URL of the file in the box and, provided it's on the same server, LnBlog will calculate the MIME type and file size to insert into the RSS feed. I also added a default profile.ini file that allows you to enter a "contact me" URL. Basically, you enter the HTML for the link you want and this will be displayed in your profile instead of your e-mail address. You can use that in ContactForm plugin.

There's a bunch of smaller stuff in this release too. Check the change log for the details. For starters, I did some cleanup to various plugins. For example, I added a "ban and delete" option to the IPBan plugin, added the "new standard" RSS icons to the sidebar, made the calendar look slightly less crappy, added a stylesheet to the RSS 2 feeds (so they look like something in a browser), and created RSS feeds for comments even when there are no comments yet.

There are also a number of small bug fixes. For example, TrackBacks finally work regardless of whether or not you have CURL. I also found a bug with receiving the response code when sending TrackBacks. I also fixed a few small display issues that were weird or didn't make sense.

Last, there's a bit of code cleanup and consolidation. For instance, the TrackbackNotifier and CommentNotifier plugins are now gone, replaced by a generic ReplyNotifier plugin that handles comments, TrackBacks, and Pingbacks. I also consolidated some functions in the utility library and a few things in the entry subclasses.

I'm debating whether to hold off on the next release, add some features, and go straight to version 1.0. Before that, I want to at least add a simple theme editor. My plan is to do something very simple and hacky: a stylesheet editor. Basically, just a GUI to automatically generate a stylesheet based on settings entered by the user. The idea is that this stylesheet will just be inserted into the page last, thus overriding the default settings for the theme.

Other possibile features include more granular security, support for draft entries, and Atom feeds, among other cleanup. If I'm going to go straight to version 1.0, then I'll probably try to do some of these first. Anyone have any thoughts on other features for 1.0 or opinions on the release schedule?

Even lower: userconfig.php and setting the timezone

In an earlier post, I talked about low-level customization with userconfig.cfg. Well, there's actually an even lower level. That would be userconfig.php.

The principle is simple: userconfig.php is a PHP file that, if it exists, is loaded and executed before anything else. So, in other words, this is the place to put any code you need to modify your PHP configuration or things of that manner.

One handy use of this is setting the time zone. You might want to do that if you're like me and use a web host that's in a different time zone than you are. Sadly, PHP 4 doesn't provide an easy way to format dates to a different time zone. However, if you're using a typical Linux/Apache server, you can simply set an environment variable to take care of this.

To do this, you can just create a userconfig.php file in your userdata and add the following text to it (substituting your own timesone, or course):
<?php
putenv("TZ=US/Eastern");
?>

If you need to add any other special PHP code, such as ini_set() calls, it would go between the PHP tags. Just keep in mind that you can't have any characters or blank space (including blank lines) outside the PHP tags.

Of course, since this file is raw PHP code, it's not a good idea to mess with it too much unless you really know what you're doing. In fact, it's probably a bad idea to use it if you don't have a working knowledge of PHP. It's really only there to make things easier for those rare occasions where you really, genuinely do need to add some code when a page loads.

New plugin: HideSidebar

I've uploaded a new plugin to the plugins page. It's called HideSidebar and it, well, hides the sidebar. The idea came from this comment and the plugin is a sort of proof of concept. I don't know how useful it will be, but it's a good demonstration of the power of the plugin system.

For the curious, it works by injecting an inline JavaScript into the page when it loads. It has PHP code to add a link to the menubar and insert the JavaScript into the page. The JavaScript then manipulates the DOM to hide the sidebar when the link is clicked. It's really quite simple. In fact, the JavaScript portion took me longer to write than the rest of the plugin.