Release GM 1.6.1 Weekend of the 28-29nd

I have finished as much as I can with the changes to file access for this release. In addition to other small changes, I have moved all the file access (such as gm-counter, gm-entrylist, gm-banlist, etc.) to functions in a Gm_Storage library.

The only ‘but’ (and its a big one) is the actual Entry file itself. It is quite tricky and I have begun work on it, but must save it for next release. Once GreyMatter uses the functions to get Entries, then we can begin considering features such as having an Entry url be This_Is_A_Cool_Entry.html instead of 00000001.html.

So, with the weeks in October until the release, here is my checklist of stuff I have todo:


  • Update upgrade logic so that people can upgrade to 1.6.1
  • Update documentation where appropriate, combine with some other good documents provided by previous GreyMatter contributers.
  • Test, Test, and Test some more.
  • Integrate any other finished code provided by other developers (This is aimed at Pete Finnigan, but no pressure Pete, I know you have been busy).

I have a good feeling about this and check the boards on the weekend of the Oct. 28-29th.

Here is the beta for any testers who feel brave (be very, very sure to make a complete backup of your current greymatter installations).

I am still updating the documentation, but not much has changed. There are some new files that should go into the cgi-bin directory, but otherwise the upgrade process is very similar.
(use the GreyMatter 1.6.1 Beta link)


Release of the GM code

I was thinking about the previous regime of Greymatter support and how we could make it better. In the past a few individuals have collected mods/bugs and decided what would be included in a release. This led to very long gaps between releases and very few releases.

I favour a more open source approach. It would be better to release more times and more often. A major release with great new features could be released at longer intervals.

My thoughts were to add fixes for bugs small mods (any mod should be included in the core with the ability to not use it or we need a plug-in mechanism to allow all mods to follow the same format and to make it easier to include mods at runtime instead of the current mod process that means editing code to instructions on forum posts)

So why dont we have a stable release and a candidate release that includes the latest fixes. These should go up as 3rd point releases – i.e. 1.3.1 to 1.3.2 and we should have a major release on a longer schedule. The point releases would be available as soon as fixed code is added or small mods are included and would be available as a candidate release for all to download and test. As soon as its agreed its stable it would become the stable release and so on. The advantage is that everyone gets fixes straight away and more people test the bug fixes and new features.

Just some thoughts. What is everyone elses view???

A modular mod system (or plugin, if you will) is something I would like to see (as well as modular themes).

I like the idea of regular releases, but wouldn’t want to do too many, too often (I think people would get tired of upgrady all the time (like me )) However, maybe we can plan on quarterly releases with security fixes as needed?

Also, I am trying to find a project host for us (with cvs, bug tracking, etc.). I am still looking and seeing if we qualify for sourceforge, otherwise, I have a list of potential free hosts.

I also like the idea of plugins and themes. Great!

On the release cycle, I think its a case of upgrade when you want to. If the code tree has small fixes and we release often people do not need to upgrade. They can wait a few releases unless there is a serious security fix to take care of. I like the idea of a stable release and a release with new fixes / mods / features that is available to everyone for testing. A debug release if you will.

I would like to hear others opinions as well

I wanted to come back to the question of updating the code of GM, how often we should release and how many updates per release. I am still edging towards shorter release times and smaller updates.

I have spent quite a bit of time going through the code trying to understand its structure and one thing that strikes me immediatly is the problem for multiple people to update the code at the same time as its very monolithic and not modular.

This sort of backs up my suggestion to fix small amounts and release regularly at least until the code is tidied. I personally have a few fixes in my running versions of GM and for me it would make sense to update to 1.3.2 and release these.

I would like to see the code tidied in terms of style. The code is not easy to read as some is indented and some not and some indented differently. A clean consitent style would make sense to release quickly.

Then it would make sense to seperate various groups of functions to differeent files. For instance seperating search and comments, then a bigger task would be to split up gm-library into multiple files that support dedicated features.

Then as discussed before seperate out the access layers. In having a cleaner style and more modularity it would be easier for multiple people to work on the code at the same time.

For me, code style doesn’t really do much for functionality or even ability to modify. I have worked on projects with varying styles and the thing that I found to be the most usefull with multiple developers are good comments (usually what the method does, what arguments it takes, what it returns, and how to use it).

The thing I see with GM is that it doesn’t protect variables and its amazing there hasn’t been a name collision with variables. When I add new code, I always use ‘my’.

Functions always return values (unlike many gm functions, e.g. date, where the function is called and then the date variables are used through the code).

I agree that breaking the code out into other files is a good idea. The thing I also am trying to address where I can is that alot of code is copied, rather than a function written. There is alot of if … elseif … else that can be written as a function that is used.

Currently on my local development Gm, I have broken the code out into modules in a ‘libs’ directory. Here are the current libraries that I have:


  • Gm_Storage (all the file access is being moved here)
  • Gm_Web (contains util functions specific to the web
  • Gm_Util (contains non-core util functions such as date, delouse, etc.)
  • Gm_Core (will contain the core functions such as template replaceing, etc.)

I am sure there could be more, but thats what I have for now. I would also like to move admin screen stuff to the gm.cgi script, since I would like to see the cgi specifc functionality in the cgi scripts.

A last note on the line identing thing, its alot easier to fix with programs like UltraEdit and TextWrangler that lets you ident blocks of text. It seems like everyone has pet peeves as far as coding style goes, and it seems like it can be a touchy subject (I had someone delete some of my code out of our cvs repository at one job because I didn’t follow his formatting style. Ironically enough, we were using JBuilder, which lets you modify the format of an entire file with one mouse click, so it was easily changed. Oh well.).

Thanks for your comments. I forgot to mention this one. you spotted it as well. the 11,000 line file could be smaller if it were modular and used functions. There is quite a lot of repetition as you point out.

I am not a luddite on styles, I dont really care which style is used as long as its consistent. I agree totally comments are needed. I also noticed this issue. I am also with you on namespace collisions and functions returning values.

I will be on site for the next couple of days but late this week I will report back on progress on the comment moderation mod.

Sorry I have been “off-line” for the last week or so working on site and also took some hols.

I have made progress writing comments to a queue and I am creating the admin page for the queue management. I am doing this by adding another option in the admin interface to allow access to work the queue.

I have also been looking into catchpa’s – these are the graphics that have the word / letters / numbers for the commenter to add.

If anyone has details of any other comment mods I would be interested to see them to decide whether to include them in this mod.

In the future I was going to look at some plugins that friends of mine use with word press called ‘akismet’.

And then I was given some links by another acquantance:

While I am not saying we should implement these for GreyMatter, its something to think about and possibly inspire. I think spam moderation is still an issue even for sites like Popular Science (a U.S. mag that recently started using the image verification gimick).

Lastly, a friend pointed out that encoding all links with the ‘nofollow’ directive makes them useless to spammers as search engines won’t follow/count them. That might be something simple to put into urls.

I think the queue method will be extremely useful, just my personal opinion though.


if a new version is going to be released

i think it needs to written from scratch. that’s the problem we ran into before. the original gm code is so convoluted and mashed together that it’s just not nearly as efficient or proper as it could/should be. this is a huge part of why we didn’t do new versions often. i personally feel that a new version should not be release unless it’s a complete rewrite.

Hi flippedcracker,

I am not so sure about that. If we did a complete re-write the mountain may be too big to climb in one go. I am more of a person who takes something and moulds it into something else. I think that there is scope to move GM to a more stable base and effectively a complete rewrite but not in one go.

For me, the two key things are to get comments working so that I can avoid spam. I have found most of the old mods via googles cache and was planning to summarise them here tomorrow. I am also working on the comment moderation mod I suggested some time ago. I also want to include having commentors enter a unique number before being allowed to post and also a mechanism where the first post is moderated and after being approved a poster can then post without further moderation. I will post details of how I plan to do all of this in the next day or so.

The second thing I would like in the short term is draft posts. This is easier to do. I start posts on my Oracle security blog and tend to leave windows open in IE on my different computers. I wnat to be able to start a post and then save it and come back to it.

In terms of a complete rewrite, I think Coldstones suggestion to isolate the file write code so that a data access API can be created is a good one. This will allow a move to a database easilly, a move to multiple blogs and also a move to categories. If the functional code is seperated from the data layer it will be easier to do this.

I think if we started on a complete rewrite it would be harder than to morph the code into what we want.

What is everyone elses views?? – can you add a poll coldstone?

Select/Deselect All in Edit Entry pages

Not so much a mod and not at all that I wrote it.

I found this check/uncheck all script at and have used it on other forms. We got hit with a ton of spam (before upgrading to newer version) and I wanted a quick way to select all comment entries to delete them all. Hope this helps someone else out too.


<script type=”text/javascript”>
/* This script and many more are available free online at
The JavaScript Source!!
Created by: Hillel Aftel :: equazcion (at) */

function checkAll(checkname, exby) {
for (i = 0; i < checkname.length; i++)
checkname[i].checked = exby.checked? true:false
// –>

println(‘<input type=”checkbox” name=”all” onClick=”checkAll(document.editentry.multideletecommentselection,this)”>Check/Uncheck All<br>’);

What all mods are out there?

And where can I get my hands on them at?

I did a google search for greymatter mods, but only a handful came up. And, since the original forums are down… I don’t have any clue as to what all there was out there at some point, and where they are now.

I realize this place is pretty much dead, but maybe someone will see this and be able to point me in a better direction?

I am hoping we can get some Mods from the old forums site up here, either from the forum owner, or by people reposting. Hopefully this place will pick up as people find it.

I got a mod for protecting your author’s names (you provide a password when posting, otherwise you get a warning message to choose a new name) in comments.

I will try to post that in a few days. If you find anything, it would be cool if you post a link back here. So far my google searches haven’t turned up much either.

xml-rpc script for Greymatter

I have created an xml-rpc script to allow pings to be sent to blog directories such as pingomatic. I based this script on a Perl script by Hans Kellner. The script is available on my [url]Greymatter mods page[/url] and there is some information on its background, setup and use on a blog entry titled “[url]XML-RPC to ping blog directories after an update[/url]”

Hope people find this useful.

Javascript to Save a Commenter’s Info

Problem: I would like a commenter’s name, email, and homepage to be remembered after they comment and to automatically appear in the comment form fields.

Solution: GreyMatter comes with the javascript to do this, however, it isn’t “hooked up” so to speak. A little template modifications and you are good to go.

First make sure that you have the cookie code variable ({{cookiescode}}) in your Entry Page Template templates (which the standard templates that ship with GM do).

Add these lines to your “{{entrycommentsform}} Posting Form” template:


<SCRIPT TYPE=”text/javascript” LANGUAGE=”JavaScript”>
document.newcomment.newcommentauthor.value = getCookie(“gmcmtauth”);
document.newcomment.newcommentemail.value = getCookie(“gmcmtmail”);
document.newcomment.newcommenthomepage.value = getCookie(“gmcmthome”);
<input name=”bakecookie” type=”checkbox” />Save Info?<br />

This goes nicely just in front of the ‘Reset’ button.

Lastly, modify your submit button to call the ‘setGMcookies’ javascript function. In your “{{entrycommentsform}} Posting Form” template change:


<input type=”submit” value=”Submit” class=”button” />



<input type=”submit” value=”Submit” class=”button” onClick=”javascript:setGMcookies()” />

Discussion: As features have been added, not all of them have been documented, particularly with the powerful template system that GreyMatter has. This recipe doesn’t require any code modification, yet it is able to significantly enhance the user experience. If every template configuration were absorbed into the code, GreyMatter would quickly become unusable.

Note: If you have trouble getting the javascript to work, most browsers have an ‘Error Console’ that may give some feedback. Also, Firebug is an amazing Firefox plugin that can be very helpful.

What to do if your archives are corrupt/ no worky

Question: I think my archive files are corrupted/broken, how can I fix them? I get an error rebuilding my site, how can I fix it?

Answer: There is probably some issue with your files that needs to be addressed. Here is a general process to recover your files/site.

    • [1] Do a fresh install of GreyMatter somewhere and get it running. Make an test post and get your configurations as close to what you had before.
    • [2] Copy over your original gm-authors.cgi and your original gm-templates.
    • [3] Do a rebuild of your new files and see that your templates are applied correctly and then do another test post as one of the original authors.
    • [4] Copy over your archive files (just the ones that end in .cgi, the html ones will be built by GM). Verify that the files names are sequention (i.e. that you have a 00000001.cgi upto the number of entries you have).
    • [5] Delete the contents of your gm-counter.cgi and your gm-entrylist.cgi, but leave the files.
    • [6] Do a Diagnostic and Repair and verify that your gm-counter file looks correct (the first number in the file should be your total entries count). Verify that gm-entrylist looks good (should have as many lines it as there are entries in the archives).
    • [7] Do a rebuild all files.

Also, here is some good general advice

  • Check ownership and permissions on the .cgi and .html files
  • Check file system space
  • Check the error_log on apache ( or your error log for whatever web server you are using).
  • Check the GreyMatter log.
  • Check if your archives directory, see if there is a certain number that the .html files stop at. This may give you a clue as to which entry is giving GreyMatter trouble.

    For example, if I had the files 00000001.cgi – 00000010.cgi and after rebuilding I only had files 00000001.html – 00000005.html, I would look at files 00000005.cgi and 00000006.cgi to see if there was a problem with the file. The file formats/layouts are detailed in the Gm Developer Documentation, available current release and on the download website.

  • See if your files contain windows line endings. This can happen if the files are uploaded without explicitly specifying to upload the files as ‘ascii’ files. Some editors can show if there are bad characters in the files.

Discussion: GreyMatter may have issues with bad characters, but it does have a good ability to regenerate files that it needs such as gm-counter.cgi and gm-entrylist.cgi. Diagnostics and Repair on the Configuration screen is informative and an excellent place to start debugging when issues occur.

1 2 3