File downloads in Drupal 4.5

When I upgraded MacMegasite to Drupal 4.5 I got rid of the old filestore module I was using for downloads. Instead, I’m now taking advantage of the new capability to attach files directly to a story. I created a download page which lists the 20 most recent attached files. I found that the best way to add a new feature to the site is by putting the PHP code in a file and then creating a PHP page which simply includes it and add a URL alias to that page. That’s how I created the store & feedback pages. It’s a lot easier than writing a Drupal module.

Software Updates

I’ve upgraded both MacMegasite and WorldBeatPlanet to Drupal 4.5. The updates went very smoothly. To ensure that users won’t access the site during the updates, I changed my .htaccess to deny all except my own IP address and changed it back to allow all users after I finished the update.

MacMegasite update

Today I finally finished the Linux RAID how-to article I’ve been working on for a few days. I’ve been doing a lot of work with Drupal 4.5 and I’ve managed to fix all of the problems I found. I was able to get the article module working & came up with an improved theme. I will probably install it on the live site this weekend. After MacMegasite is upgraded, I’ll upgrade WorldBeatPlanet.

New Look

Drupal 4.5

I’ve been testing out the release candidate of Drupal 4.5 for MacMegasite. I’ve rewritten the theme, but a few features still aren’t working, most notably the articles module. I also plan to replace the old file module with the new upload feature.

Once I get it straightened out on the test site (running on my Linux box), I’ll update the live site. Next, I plan to upgrade WorldBeatPlanet and my condo’s site so all 3 will be running the same version of Drupal.

Drupal satisfaction

It’s been almost two weeks since I switched MacMegasite to Drupal and I’m very pleased with the results. I also used Drupal to create a community site for my condo last week.

Posting news items is a lot easier with Drupal than it was with PHP-Nuke. When people submitted news items to the Nuke site, they almost always entered the entire article in ‘story text’, which meant I had to copy and paste most of it to ‘extended text’ so the whole thing wouldn’t appear on the front page. Since Drupal automatically splits posts at an appropriate place, it’s no longer necessary to split them manually and people who submit news don’t have to know any special formatting. Unlike Nuke, Drupal automatically recognizes URLs in the text and converts them to clickable links.

Drupal’s user management is also a lot better than PHP-Nuke. I hated the way Nuke had separate user & administrator logins and you couldn’t really have different levels of user access. With Drupal, I can set up several different user levels from full administrative access to editors & authors who can manage certain content. For the condo site, I created a ‘staff’ role which allows posting articles but doesn’t let them do anything potentially dangerous, since the staff members are not techies, while regular authenticated users can only post to the forums or comment on articles.

I don’t even want to get into PHP-Nuke’s security holes. It’s the only piece of software that’s less secure than Windows. Drupal, on the other hand, is well written with security in mind.

Hack attempt

I see someone’s still trying to hack MacMegasite. I love checking Drupal’s error log – any attempt shows up there. I just saw someone attempt to access admin.php attempting to add a new administrator. Of course it failed since I’m no longer running PHP-Nuke. Even though his attempts are futile, I’ve blocked his IP address.

I also see someone else, most likely a spammer, is looking for formmail.cgi and a few other common CGI scripts for sending email. None of them are present.

Preserving links when converting from PHP-Nuke to Drupal

When I converted MacMegasite to Drupal it broke all of the old article links. It seems that a lot of people were still using old URLs, probably from pages cached at search engines. The first thing I did was redirect article links, which was easy since the story IDs remained the same. The rule I added converted a URL containing sid=nnn to a URL of the form ?q=node/view/nnn. I originally had it test specifically for name=News and the full article URL, but I found that a lot of queries broke it. I finally settled on the most liberal rule which looks for any query containing ‘&sid=’.

Checking my access logs I found that a lot of people were using direct links to reviews, downloads, or polls. Since the IDs have changed and reviews are now an article topic, I simply redirect any URL to the home page for that content type.

Here’s the final set of rules I’m using now:

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{QUERY_STRING} ^.*&sid=([^&]+)
  RewriteRule modules.php index.php?q=node/view/%1 [L]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{QUERY_STRING} ^name=Forums
  RewriteRule modules.php index.php?q=forum [L]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{QUERY_STRING} ^name=Downloads
  RewriteRule modules.php index.php?q=filestore2 [L]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{QUERY_STRING} ^name=Reviews
  RewriteRule modules.php index.php?q=article/reviews [L]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{QUERY_STRING} ^name=Surveys
  RewriteRule modules.php index.php?q=poll [L]

Converting from PHP-Nuke to Drupal

I found that I could preserve direct article links from the old Nuke site when I converted to Drupal by adding the following rewrite rule to my .htaccess:

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{QUERY_STRING} ^name=News&file=article&sid=([^&]+)$
  RewriteRule modules.php index.php?q=node/view/%1 [L]

Goodbye to PHP-Nuke

I’ve thought about converting MacMegasite to Drupal and I’ve been working on the theme for a while. When MacMegasite got hacked today, I decided it’s finally time to dump Nuke and make the switch. I have a test site running on my home server and I’ve converted all of the users & stories to the new site. In the next day or so I plan to go live with it.

PHP Nuke is the most poorly written pile of crap ever. It does absolutely no error checking and is less secure than Windows. I was running the patched version from NukeCops and they still managed to hack it. I did the same conversion with WorldBeatPlanet a few months ago and learned a lot from it.