29 Jun 2011, 19:00
ah, I figured it would be quicker just to write my own for a single-board website.
There are two files and both are written in python- one for viewing the board and threads, and one for posting. Combined it's a total of 314 lines (comments included).
And look ma, no <table>s
One abnormalty to normal imageboards is how files are handled. If you noticed, filenames are an incremental ID similarly to post IDs. This makes it so when you post an image that's already been posted, instead of denying you the privilage it simply uses the original file and fileid. Also, it makes it so when you delete an offensive image it deletes it from every thread its ever been posted in. And finally it leaves the possiblitiy for imageID "get"s
Here's the schema if you're interested. I just do a left join on the posts and files.
CREATE TABLE `bans` (
`ip` varchar(15) DEFAULT NULL,
`expr` datetime DEFAULT NULL,
`reason` text
)
CREATE TABLE `files` (
`fid` int(11) NOT NULL AUTO_INCREMENT,
`dimension` varchar(25) DEFAULT NULL,
`md5` char(32) DEFAULT NULL,
`size` int(11) DEFAULT NULL,
`filename` varchar(255) DEFAULT NULL,
`ext` varchar(10) DEFAULT NULL,
PRIMARY KEY (`fid`)
)
CREATE TABLE `posts` (
`pid` int(11) NOT NULL AUTO_INCREMENT,
`tid` int(11) DEFAULT NULL,
`fid` int(11) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`subject` varchar(255) DEFAULT NULL,
`posttext` text,
`pdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ip` varchar(15) DEFAULT NULL,
PRIMARY KEY (`pid`)
)