Forum core source dump (as of July 31)

SQL Tables

Note: These were heavily modified since the last time

-- Create all tables

-- Topics and replies are stored here
CREATE TABLE `messages` (
	`id` bigint(20) NOT NULL auto_increment,
	`parent_id` bigint(20) default 0,
	`forum_id` int(25) default 0,
	`title` varchar(255) NOT NULL default '',
	`content` text default '',
	`content_plain` text default '',
	`created` datetime NOT NULL default '0000-00-00 00:00:00',
	`user_id` bigint(20) default 0,
	`author` varchar(50) default '',
	`author_email` varchar(100) default '',
	`author_web` varchar(255) default '',
	`author_ip` varchar(100) default '',
	`reply_count` int(25) default 0,
	`view_count` int(25) default 0,
	`locked` tinyint(4) default 0,
	`sticky` tinyint(4) default 0,
	`global_sticky` tinyint(4) default 0,
	`last_id` bigint(20) NOT NULL default 0,
	`last_author` varchar(50) NOT NULL default '',
	`last_date` datetime NOT NULL default '0000-00-00 00:00:00',
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- All forum data
CREATE TABLE `forums` (
	`id` int(25) NOT NULL auto_increment,
	`parent_id` int(25) default 0,
	`display_order` int(16) default 0,
	`title` varchar(255) NOT NULL default '',
	`content` text default '',
	`content_plain` text default '',
	`topic_count` int(25) default 0,
	`reply_count` int(25) default 0,
	`last_id` bigint(20) default '0',
	`last_author` varchar(50) default '',
	`last_date` datetime default '0000-00-00 00:00:00',
	`read_only` tinyint(4) default 0,
	`private` tinyint(4) default 0,
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- Membership info
CREATE TABLE `users` (
	`id` bigint(20) NOT NULL auto_increment,
	`username` varchar(50) NOT NULL default '',
	`password` text NOT NULL default '',
	`password_salt` text NOT NULL default '',
	`display_name` varchar(100) default '',
	`created` datetime NOT NULL default '0000-00-00 00:00:00',
	`enabled` tinyint(4) default 1,
	`sig` text default '',
	`avatar` text default '',
	`email` varchar(100) default '',
	`web` varchar(255) default '',
	`bio` text default '',
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- Sorted groups
CREATE TABLE `groups` (
	`id` int(25) NOT NULL auto_increment,
	`title` varchar(255) NOT NULL default '',
	`content` text default '',
	`signup` tinyint(4) default 0,
	`privileges` text default '000000000000000000000',
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- User / Group relationships
CREATE TABLE `usersgroups` (
	`user_id` bigint(20) NOT NULL,
	`group_id` int(25) NOT NULL
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- Private Messaging
CREATE TABLE `pm` (
	`id` bigint(20) NOT NULL auto_increment,
	`user_id` bigint(20) default 0,
	`sender_id` bigint(20) default 0,
	`title` varchar(255) NOT NULL default '',
	`content` text default '',
	`created` datetime NOT NULL default '0000-00-00 00:00:00',
	`opened` tinyint(4) default 0,
	`hide_sender` tinyint(4) default 0,
	`hide_reader` tinyint(4) default 0,
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- Topic polls
CREATE TABLE `polls` (
	`id` bigint(20) NOT NULL auto_increment,
	`message_id` bigint(20) default 0,
	`question` text NOT NULL default '',
	`multiple` tinyint(4) default 0,
	`option1` varchar(255) default '',
	`option2` varchar(255) default '',
	`option3` varchar(255) default '',
	`option4` varchar(255) default '',
	`option5` varchar(255) default '',
	`option6` varchar(255) default '',
	`option7` varchar(255) default '',
	`option8` varchar(255) default '',
	`option9` varchar(255) default '',
	`option10` varchar(255) default '',
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- Poll votes
CREATE TABLE `pollvotes` (
	`id` bigint(20) NOT NULL auto_increment,
	`poll_id` bigint(20) NOT NULL,
	`user_id` bigint(20) NOT NULL,
	`options` varchar(15) default '0000000000',
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- Banned emails, IPs or usernames
CREATE TABLE `banned` (
	`id` bigint(20) NOT NULL auto_increment,
	`ip` varchar(100) default '',
	`username` varchar(50) default '',
	`email` varchar(100) default '',
	`reason` varchar(255) default '',
	`ban_date` datetime NOT NULL default '0000-00-00 00:00:00',
	`expires` datetime default '0000-00-00 00:00:00',
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- Registration or email change confirmations
CREATE TABLE `confirmations` (
	`id` bigint(20) NOT NULL auto_increment,
	`user_id` bigint(20) NOT NULL,
	`title` varchar(255) default '',
	`type` varchar(100) NOT NULL default '',
	`created` datetime default '0000-00-00 00:00:00',
	`expires` datetime default '0000-00-00 00:00:00',
		PRIMARY KEY (`id`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;


-- Flood prevention
CREATE TABLE `floodcheck` (
	`ip` char(130) NOT NULL,
	`last_access` datetime default '0000-00-00 00:00:00',
		PRIMARY KEY (`ip`)
) TYPE = MyISAM DEFAULT CHARSET = utf8;
Advertisements

6 thoughts on “Forum core source dump (as of July 31)

  1. Pingback: I have developer ADHD « This page intentionally left ugly

  2. This was a very interesting read for me!
    Although I have a question,
    I am a beginning php programmer, currently developing drupal modules on my internship, but looking to develop some sort of forum script/cms/framework/… . I’m not planning on actually making it public, it’s just a personal project to teach myself some things. So, my question…, I saw in your main.php you do:
    Core::getInstance and Modules::getInstance, is it the same as doing:
    $core = new Core();
    $core->getInstance(…); ? and did you have to define ‘Core’ somewhere or does php automatically recognise it as a class and searches for it (with the autoload function you wrote)?
    thanks in advance!

    You can contact me on my email if you want

    • Hi Jelle

      Yes, the basic idea is to let the autoload function load the class dynamically so you wouldn’t need to declare it elsewhere.

      Technically $core = new Core(); wouldn’t work in this case becuse the __construct function in that class is set to private.

      So you would always have to use the getInstance method when you want to create a new instance unless you’re calling new Core() inside the Core class itself.

  3. Pingback: (Snippet) Blocking IPs from a list file with PHP « This page intentionally left ugly

  4. Pingback: PHP Plugin/Module system | This page intentionally left ugly

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s