Yet more site problems - FancyURLs not working
Once again, my site's been playing up. All the links within the site were giving HTTP 404 errors. This has happened before, because I use the FancyURLs option within Nucleus, which makes the URLs of each article more search engine friendly, but less web server friendly. Last time this broke was when the .htaccess file had been replaced by persons unknown who had compromised the site. However, looking into it, the .htaccess file was there and contained the right content. This files contains instructions for the webserver to URLs like "/item/223", and pass them to the the Nucleus PHP scripts to handle. Unfortunately, it looks like my hosting provider made some changes to their implementation of PHP and Apache, and the standard instructions for making FancyURLs work are no longer compatible. The old .htaccess file had directives along the lines of:
<FilesMatch "^item$">
ForceType application/x-httpd-php
</FilesMatch>
After much digging around and experimenting, I have a solution. Instead of using the Apache ForceType directive, the Apache SetHandler directive works instead. So now the above should be changed to:
<FilesMatch "^item$">
SetHandler php-script
</FilesMatch>
I'm not going to pretend I understand all the intricacies of this, but the notice I got from my hosting provider about the PHP changes gave some clues. They've switched from the PHP Apache module to a CGI-based installation of PHP. There was a hint that to make PHP work, you need to use the AddHandler directive, so a bit more digging around suggested that switching from ForceType to SetHandler would probably have the same effect under the new installation, and hey presto, it worked! Fingers crossed, everything is back to normal - sorry for any disruption in service.
So, if you're having problems with FancyURLs not working in Nucleus CMS, then try the above - obviously you'll need to make the change for each entry in the .htaccess file (and for each .htaccess file if you're running blogs in multiple directories). Good luck!
Nucleus Security Plugin - NP_Paranoia
I wanted to know when new accounts were being created on my blog software (Nucleus), and when people were logging in to it. As this wasn't available in the core Nucleus functionality, I've written a plugin, called NP_Paranoia, to do this. Very roughly, it sends an email when a new account is created, when an account is deleted, when a successful login occurs, and when a failed login occurs. Each of these can be turned on and off as required, and they can also be recorded along with the requesting IP address in the Action Log.
Let me know if you use it and it's any use, and if there's any other features you would like, I might be able to accomodate them as well.
NP_Ping Tweaks - Code
Test - Tweaks to NP_Ping
I've just tweaked NP_Ping (an update to NP_PingPong) because it doesn't seem to be pinging Technorati. I've added some tweaks I'd originally made to NP_PingPong to log stuff to the Nucleus Action Log (success, or failure with the error message), because although it appears there's code in there to do this, it doesn't seem to log anything. I've also got a feeling that the ping to Technorati is using the wrong URL (rpc.technorati.com:80/rpc/ping/ instead of rpc.technorati.com:80/rpc/ping - ie with a trailing slash instead of without).
Lets see if this works... (Perhaps I need a development environment, instead of testing on a live server?)
PS The result was inconclusive. When I started writing the post, Technorati hadn't picked up my last one. After I first posted this one, Technorati has picked up my previous post. I'm guessing they're running slow, so perhaps that was the problem? Still, I like my tweaks to NP_Ping. Plus - good new - Technorati's stopped displaying the raw HTML, so at least the Atom update worked! Hurray!
New Atom 1.0 feed
In my ongoing quest to get my entries on Technorati to display correctly, I found an upgraded Atom 1.0 skin for Nucleus courtesy of Rakaz. It upgrades the Atom 0.3 feed to Atom 1.0, and more importantly, my Atom feed now validates at FEED Validator. It needs tweaking slightly to insert the code from the Technorati Tags plugin - the feeds/atom/entries template changes the contents of the <content> element from:
<![CDATA[<%body%><%more%>]]>
</content>
to:
<![CDATA[<%body%><%more%><%TechnoratiTags(ltag)%>]]>
</content>
Actually, at this point I think I realised what the problem was. There's far too many square brackets in the old Atom 0.3 template (which I dilligently backed up), so I suspect I made a cut-and-paste error at some point and corrupted it. Nevermind - hopefully when I post this, Technorati will get properly pinged (I'm not convinced that's working properly either now...) and it can then read the feed properly and render the content correctly, rather than as raw HTML.
You may ask why I bother? Well, mostly because I hate it when something isn't working! Fingers crossed...
PS I've just discovered NP_GeSHI2 and NP_TinyMCE2 don't get along. In fact I'm thinking about taking TinyMCE off, as it doesn't do half the stuff I'd hoped, and doesn't look anywhere near as slick as the example on the Tiny MCE website. Fingers crossed this post will now display on my own site, let alone Technorati!
NucleusCMS Upgrade
Well, I'm working through some of my New Year's resolutions. So far I've renewed my hosting and domain name, and I've just upgraded to NucleusCMS v3.31. All told it was a very painless process (to be fair, all previous upgrades have been too). All I had to remember was that index.php needed tweaking to support fancyurls. As far as I can tell, everything seems to be working fine. 
Now I know Imran suggested that I should switch to Worldpress, but it wouldn't be as much fun. I'm trying to kid myself that I have some hands-on technical ability left (OK, that assumes I had some to start with...) by tweaking the off bit of PHP from time to time. Which reminds me, NP_Ping, which seems to replace NP_PingPong for Nucles v3.31, doesn't seem to log to the ActionLog anymore (or maybe NP_PingPong didn't either - that might have been one of my own tweaks), so there's something to do straight away! I've also added NP_TinyMCE2, a WYSIWYG editor for writing blog entries. Mostly this was because my own plugin to make external links open in new windows didn't really work how I wanted, but a quick look at the Tiny MCE website showed a few useful features like a spell checker (to save me cutting and pasting posts into Word), although some of these don't appear to have been implmented in the Nucleus plugin. Still, it looks good so far, and it may be possible to add those features with a bit more tweaking.
Well, that's it for now. Tomorrow I'm off to Ponds Forge to play Octopush in the Nautilus competition, so I'll post the results when I get back.
My First Nucleus Plugin - NP_PopUpLink
Well, I say I wrote it, in fairness it was more a case of creating it. The main body is heavily based on NP_AdminPreview, with a healthy dose of NP_TechnoratiTags, and some of the core Nucleus HTML & javascript. And I say it's my first, but I'm not sure I'll be writing a second.
So why did I do it, and what does it do? Well, as you may have noticed, I like all external links on the site (eg to my Flickr account) to open in a new window, and all internal links (eg to my photo albums and older posts) to stay in the same window. Maybe that's bad practise, but that's how I like it. Unfortunately, the javascript toolbar in the admin area for adding/editing posts doesn't provide this functionality - I have to manually add a target="..." attribute after the fact. After two years of doing this manually, I finally decided to do something about it. I've been interested in how plugins work (having customised one or two to meet my needs), and this seemed a good excuse to write one.
A look round the Nucleus plugins turned up NP_AdminPreview which adds functionality to the Add and Edit pages in the Admin area, so this seemed like a good place to start. This gave me a way to add functionality into the "Extra Plugins Options" subsection of those pages. The actual button code (and graphic) were based on the same used for the "Make Link" button in the standard javascript tool bar, but tweaked to add target="_blank" to the <a href="..."> element. NP_TechnoratiTags gave me a way to add this code into a javascript include file, linked from the page header, rather than writing the script out with the button. (For now that probably doesn't matter, but if I wanted to add new buttons in the future, it's a more flexible approach.)
The good news is (after one aborted attempt caused by leaving some redundant code in the re-purposed NP_TechnoratiTags function) it works. The bad news is it's not exactly usable, as I can't have both the standard javascript toolbar and my new button on screen at the same time. Further research (which I should have done earlier...) shows a FAQ entry "How do I add custom buttons to my Add/Edit Item page?". This says, in summary, you can't do it with a plugin! It can be done, but you need to edit the core Nucleus code, so it gets wiped out whenever you upgrade your version of Nucleus.
It wasn't a completely wasted exercise. I've learnt a bit about Nucleus plugins, and I do have my new button (just in the wrong place). I shan't be publishing it on the Nucleus plugin site, but if anyone desperately wants a copy, it's here: NP_PopUpLink. extract the zip file into your Nucleus plugins directory, ensuring you've got both the PHP file and the popuplink directory containing the button graphic and javascript file. If you want to see the code, read the full version of this article (which should be nicely highlighted by NP_GeSHi2).

