Friday, December 18, 2009

A poll mod for punBB 1.2.x


 First up, something I've been meaning to do for quite some time - create a poll mod for punBB.

The necessity for such a mod came from some website maintenance work I was doing for my University's pantomime society. We run a small punBB (version 1.2.16 - to be upgraded to 1.2.22 soon) based forum on the site, and it was apparent that a poll function might be useful. While several poll mods exist for punBB 1.2, none of them could be made to function harmoniously with our site, and all of them contained some rather horrible security flaws.

Hence, this mod. It is intended to be as simple and secure as possible. The goal is to keep as much of the code as possible in separate files so that minimal editing of the punBB code is required.

The attached code is functional, though it lacks several bells and whistles - the focus of this release is security and core functionality. Currently, the mod includes the following features
  • prevention of multiple voting
  • prevention of guest voting
  • two types of poll: mutually exclusive polls, and multi-select (n-1) polls
  • (Fairly) thorough input validation and security measures
The following features may be added at a later date
  • multilingual support
  • removing (or increasing) the restriction on the number of poll options
  • configuration panel, to make it easier for user to modify poll colours, etc.
  • fully annonymised voting
The attached code certainly can't be called elegant - all the error messages, plus the colour scheme, are hard coded into the program. I will probably change this at some point. But, at least it's functional.

Well, it's at least functional on punBB 1.2.16 with MySQL - I haven't tested it on any other punBB versions/database backends. If you have a crack at implementing this mod, please let me know of the (inevitable) bugs and problems!

An aside - , the reason that we still run the ancient punBB 1.2 is that the PantoSoc site is hosted on a rather archaic University server - running apache 1.3, php 4.3 and mysql 4.0 (yes, in 2009!). So really, any security implemented in this mod is likely negated by the poor security of our hosting environment.

robs_poll_mod_0.0.3.tar.gz