# -----------------------
# Land Down Under - Website engine
# Copyright (C) 2003 Neocrome
# http://ldu.neocrome.net
# File : docs/ldu-createnew-525.sql
# Version : 525
# Updated : 2003-apr-15
# -----------------------

# -----------------------
# Land Down Under v525 - New install
# Run this script in phpMyAdmin to create tables
# in your MySQL database
# -----------------------
# phpMyAdmin MySQL-Dump
# http://phpwizard.net/phpMyAdmin/
# http://phpmyadmin.sourceforge.net/

CREATE TABLE ldu_banlist (
  banlist_id int(11) NOT NULL auto_increment,
  banlist_ip varchar(15) NOT NULL default '',
  banlist_email varchar(64) NOT NULL default '',
  banlist_reason varchar(64) NOT NULL default '',
  banlist_expire int(11) default '0',
  PRIMARY KEY  (banlist_id),
  KEY banlist_ip (banlist_ip)
) TYPE=MyISAM;

CREATE TABLE ldu_buddies (
  buddies_id int(11) NOT NULL auto_increment,
  buddies_ownerid int(11) NOT NULL default '0',
  buddies_buddyid int(11) NOT NULL default '0',
  buddies_buddyname varchar(24) NOT NULL default '',
  PRIMARY KEY  (buddies_id),
  KEY com_code (buddies_ownerid)
) TYPE=MyISAM;

CREATE TABLE ldu_com (
  com_id int(11) NOT NULL auto_increment,
  com_code varchar(16) NOT NULL default '',
  com_author varchar(24) NOT NULL default '',
  com_authorid int(11) default NULL,
  com_text text NOT NULL,
  com_date int(11) NOT NULL default '0',
  com_isspecial tinyint(1)  NOT NULL default '0',
  PRIMARY KEY  (com_id),
  KEY com_code (com_code)
) TYPE=MyISAM;

CREATE TABLE ldu_config (
  config_cat char(2) NOT NULL default '99',
  config_name varchar(32) NOT NULL default '',
  config_type tinyint(2) NOT NULL default '0',

  config_value text NOT NULL,
  PRIMARY KEY  (config_name)
) TYPE=MyISAM;

CREATE TABLE ldu_eventp (
  eventp_id int(11) NOT NULL auto_increment,
  eventp_eventid int(11) NOT NULL default '0',
  eventp_userid int(11) NOT NULL default '0',
  eventp_state tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (eventp_id)
) TYPE=MyISAM;

CREATE TABLE ldu_events (
  event_id mediumint(8) unsigned NOT NULL auto_increment,
  event_state tinyint(1) NOT NULL default '0',
  event_date int(11) NOT NULL default '0',
  event_title varchar(64) NOT NULL default '',
  event_text text,
  event_url varchar(128) NOT NULL default '',
  event_owner varchar(24) NOT NULL default '',
  PRIMARY KEY  (event_id),
  KEY event_date (event_date)
) TYPE=MyISAM;

CREATE TABLE ldu_forum_posts (
  fp_id mediumint(8) unsigned NOT NULL auto_increment,
  fp_topicid mediumint(8) NOT NULL default '0',
  fp_sectionid smallint(5) NOT NULL default '0',
  fp_posterid int(11) NOT NULL default '-1',
  fp_postername varchar(24) NOT NULL default '',
  fp_updated int(11) NOT NULL default '0',
  fp_text text NOT NULL,
  fp_posterip varchar(15) NOT NULL default '',
  PRIMARY KEY  (fp_id),
  KEY fp_updated (fp_updated),
  KEY fp_topicid (fp_topicid),
  KEY fp_sectionid (fp_sectionid),
  KEY fp_posterid (fp_posterid)
) TYPE=MyISAM;

CREATE TABLE ldu_forum_sections (
  fs_id smallint(5) unsigned NOT NULL auto_increment,
  fs_state tinyint(1) unsigned NOT NULL default '0',
  fs_order smallint(5) unsigned NOT NULL default '0',
  fs_minlevel tinyint(2) unsigned NOT NULL default '0',
  fs_pollminlevel tinyint(2) unsigned NOT NULL default '60',
  fs_title varchar(128) NOT NULL default '',
  fs_category varchar(64) NOT NULL default '',
  fs_desc varchar(255) NOT NULL default '',
  fs_icon varchar(255) NOT NULL default '',
  fs_topiccount smallint(5) NOT NULL default '0',
  fs_topiccount_pruned int(11) default '0',
  fs_postcount smallint(5) NOT NULL default '0',
  fs_postcount_pruned int(11) default '0',
  fs_viewcount mediumint(8) NOT NULL default '0',
  PRIMARY KEY  (fs_id),
  KEY fs_order (fs_order)
) TYPE=MyISAM;

CREATE TABLE ldu_forum_topics (
  ft_id mediumint(8) unsigned NOT NULL auto_increment,
  ft_state tinyint(1) unsigned NOT NULL default '0',
  ft_sticky tinyint(1) unsigned NOT NULL default '0',
  ft_sectionid mediumint(8) NOT NULL default '0',
  ft_title varchar(64) NOT NULL default '',
  ft_creationdate int(11) NOT NULL default '0',
  ft_updated int(11) NOT NULL default '0',
  ft_postcount smallint(5) NOT NULL default '0',
  ft_viewcount mediumint(8) NOT NULL default '0',
  ft_lastposterid int(11) NOT NULL default '-1',
  ft_lastpostername varchar(24) NOT NULL default '',
  ft_firstposterid int(11) NOT NULL default '-1',
  ft_firstpostername varchar(24) NOT NULL default '',
  ft_poll int(11) unsigned NOT NULL default '0',
  ft_movedto int(11) default '0',
  PRIMARY KEY  (ft_id),
  KEY ft_updated (ft_updated)
) TYPE=MyISAM;

CREATE TABLE ldu_levels (
  level_id tinyint(2) NOT NULL auto_increment,
  level_level tinyint(2) unsigned NOT NULL default '0',
  level_name varchar(32) NOT NULL default '',
  level_pfs_maxfile int(11) NOT NULL default '10000',
  level_pfs_maxtotal int(11) NOT NULL default '10000',
  level_isdefault tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (level_id)
) TYPE=MyISAM;

CREATE TABLE ldu_links (
  link_id mediumint(8) unsigned NOT NULL auto_increment,
  link_cat varchar(32) NOT NULL default '',
  link_state tinyint(1) NOT NULL default '0',
  link_title varchar(64) NOT NULL default '',
  link_desc varchar(255) NOT NULL default '',
  link_url varchar(128) NOT NULL default '',
  link_owner varchar(24) NOT NULL default '',
  link_count mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY  (link_id),
  KEY link_cat (link_cat)
) TYPE=MyISAM;

CREATE TABLE ldu_logger (
  log_id mediumint(11) NOT NULL auto_increment,
  log_date int(11) NOT NULL default '0',
  log_ip varchar(15) NOT NULL default '',
  log_name varchar(24) NOT NULL default '',

  log_text varchar(255) NOT NULL default '',
  PRIMARY KEY  (log_id)
) TYPE=MyISAM;

CREATE TABLE ldu_news (
  news_id mediumint(8) unsigned NOT NULL auto_increment,
  news_minlevel int(11) NOT NULL default '0',
  news_title varchar(64) NOT NULL default '',
  news_owner varchar(24) NOT NULL default '',
  news_ownerid mediumint(8) NOT NULL default '0',
  news_date int(11) NOT NULL default '0',
  news_text text NOT NULL,
  PRIMARY KEY  (news_id),
  KEY news_date (news_date)
) TYPE=MyISAM;

CREATE TABLE ldu_online (
  online_ip varchar(15) NOT NULL default '',
  online_name varchar(24) NOT NULL default '',
  online_lastseen int(11) NOT NULL default '0',
  online_id int(11) NOT NULL default '0',
  online_shield int(11) NOT NULL default '0',
  online_action varchar(32) NOT NULL default '',
  online_hammer tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (online_ip),
  KEY online_lastseen (online_lastseen)
) TYPE=MyISAM;

CREATE TABLE ldu_pages (
  page_id int(11) unsigned NOT NULL auto_increment,
  page_state tinyint(1) unsigned NOT NULL default '0',
  page_execute tinyint(1) unsigned NOT NULL default '0',

  page_cat varchar(16) default NULL,
  page_type varchar(16) default NULL,
  page_key varchar(16) default NULL,
  page_title varchar(64) default NULL,
  page_desc varchar(255) default NULL,
  page_text text,
  page_author varchar(24) default NULL,
  page_owner varchar(24) default NULL,
  page_date int(11) NOT NULL default '0',
  page_file tinyint(1) default NULL,
  page_url varchar(255) default NULL,
  page_size varchar(16) default NULL,
  page_count mediumint(8) unsigned default '0',
  page_filecount mediumint(8) unsigned default '0',
  PRIMARY KEY  (page_id),
  KEY page_cat (page_cat),
  KEY page_type (page_type)
) TYPE=MyISAM;

CREATE TABLE ldu_pfs (
  pfs_id int(11) NOT NULL auto_increment,
  pfs_userid int(11) NOT NULL default '0',
  pfs_file varchar(255) NOT NULL default '',
  pfs_type varchar(32) NOT NULL default '',
  pfs_desc varchar(255) NOT NULL default '',
  pfs_size int(11) NOT NULL default '0',
  pfs_count int(11) NOT NULL default '0',
  PRIMARY KEY  (pfs_id),
  KEY pfs_userid (pfs_userid)
) TYPE=MyISAM;

CREATE TABLE ldu_pm (
  pm_id int(11) unsigned NOT NULL auto_increment,
  pm_state tinyint(2) NOT NULL default '0',
  pm_date int(11) NOT NULL default '0',
  pm_fromuserid int(11) NOT NULL default '0',
  pm_fromuser varchar(24) NOT NULL default '0',
  pm_touserid int(11) NOT NULL default '0',
  pm_title varchar(64) NOT NULL default '0',
  pm_text text NOT NULL,
  PRIMARY KEY  (pm_id),
  KEY pm_fromuserid (pm_fromuserid),
  KEY pm_touserid (pm_touserid)
) TYPE=MyISAM;

CREATE TABLE ldu_polls (
  poll_id mediumint(8) NOT NULL auto_increment,
  poll_type tinyint(1) unsigned NOT NULL default '0',
  poll_state tinyint(1) NOT NULL default '0',
  poll_minlevel tinyint(2) unsigned NOT NULL default '0',
  poll_creationdate int(11) NOT NULL default '0',
  poll_text varchar(255) NOT NULL default '',
  PRIMARY KEY  (poll_id),
  KEY poll_creationdate (poll_creationdate)
) TYPE=MyISAM;

CREATE TABLE ldu_polls_options (
  po_id mediumint(8) unsigned NOT NULL auto_increment,
  po_pollid mediumint(8) unsigned NOT NULL default '0',
  po_text varchar(128) NOT NULL default '',
  po_count mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY  (po_id),
  KEY po_pollid (po_pollid)
) TYPE=MyISAM;

CREATE TABLE ldu_polls_voters (
  pv_id mediumint(8) unsigned NOT NULL auto_increment,
  pv_pollid mediumint(8) NOT NULL default '0',
  pv_userid mediumint(8) NOT NULL default '0',
  pv_userip varchar(15) NOT NULL default '',
  PRIMARY KEY  (pv_id),
  KEY pv_pollid (pv_pollid)
) TYPE=MyISAM;

CREATE TABLE ldu_rated (
  rated_id int(11) unsigned NOT NULL auto_increment,
  rated_code varchar(16) default NULL,
  rated_userid int(11) default NULL,
  PRIMARY KEY  (rated_id),
  KEY rated_code (rated_code)
) TYPE=MyISAM;

CREATE TABLE ldu_ratings (
  rating_id int(11) NOT NULL auto_increment,
  rating_code varchar(16) NOT NULL default '',
  rating_state tinyint(2) NOT NULL default '0',
  rating_average decimal(5,2) NOT NULL default '0.00',
  rating_creationdate int(11) NOT NULL default '0',
  rating_text varchar(128) NOT NULL default '',
  PRIMARY KEY  (rating_id),
  KEY rating_code (rating_code)
) TYPE=MyISAM;

CREATE TABLE ldu_referers (
  ref_url varchar(255) NOT NULL default '',
  ref_count int(11) NOT NULL default '0',
  PRIMARY KEY  (ref_url)
) TYPE=MyISAM;

CREATE TABLE ldu_rules (
  rule_id int(11) NOT NULL auto_increment,
  rule_type varchar(24) NOT NULL default '',
  rule_operator char(4) NOT NULL default '',
  rule_level tinyint(2) unsigned NOT NULL default '0',
  rule_userid int(11) unsigned NOT NULL default '0',
  rule_username varchar(24) NOT NULL default '',
  rule_value varchar(16) NOT NULL default '',
  rule_setby varchar(24) NOT NULL default '',
  rule_allow tinyint(1) NOT NULL default '1',
  rule_isdefault tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (rule_id),
  KEY rule_type (rule_type),
  KEY rule_level (rule_level)
) TYPE=MyISAM;

CREATE TABLE ldu_smilies (
  smilie_id int(11) NOT NULL auto_increment,
  smilie_code varchar(16) NOT NULL default '',
  smilie_image varchar(128) NOT NULL default '',
  smilie_text varchar(32) NOT NULL default '',
  PRIMARY KEY  (smilie_id)
) TYPE=MyISAM;

CREATE TABLE ldu_stats (
  stat_name varchar(32) NOT NULL default '',
  stat_value int(11) NOT NULL default '0',
  PRIMARY KEY  (stat_name),
  KEY stat_name (stat_name)
) TYPE=MyISAM;

CREATE TABLE ldu_structure (
  structure_id mediumint(8) NOT NULL auto_increment,
  structure_key varchar(8) NOT NULL default '',
  structure_code varchar(16) NOT NULL default '',
  structure_title varchar(32) NOT NULL default '',
  structure_minlevel tinyint(2) NOT NULL default '-1',
  structure_icon varchar(128) NOT NULL default '',
  PRIMARY KEY  (structure_id)
) TYPE=MyISAM;

CREATE TABLE ldu_users (
  user_id int(11) unsigned NOT NULL auto_increment,
  user_active tinyint(1) unsigned NOT NULL default '0',
  user_banned tinyint(1) unsigned NOT NULL default '0',
  user_banexpire int(11) default '0',
  user_name varchar(24) NOT NULL default '',
  user_password varchar(32) NOT NULL default '',
  user_level tinyint(2) unsigned NOT NULL default '10',
  user_country char(2) NOT NULL default '',
  user_text text NOT NULL,
  user_extra1 varchar(255) NOT NULL default '',
  user_extra2 varchar(255) NOT NULL default '',
  user_extra3 varchar(255) NOT NULL default '',
  user_extra4 varchar(255) NOT NULL default '',
  user_extra5 varchar(255) NOT NULL default '',
  user_occupation varchar(64) NOT NULL default '',
  user_location varchar(64) NOT NULL default '',
  user_timezone decimal(2,0) NOT NULL default '0',
  user_birthdate int(11) NOT NULL default '0',
  user_sex char(1) NOT NULL default 'U',
  user_irc varchar(128) NOT NULL default '',
  user_msn varchar(64) NOT NULL default '',
  user_icq varchar(16) NOT NULL default '',
  user_website varchar(128) NOT NULL default '',
  user_email varchar(64) NOT NULL default '',
  user_skin varchar(16) NOT NULL default '',
  user_lang varchar(16) NOT NULL default '',
  user_regdate int(11) NOT NULL default '0',
  user_lastlog int(11) NOT NULL default '0',
  user_lastvisit int(11) NOT NULL default '0',
  user_lastip varchar(16) NOT NULL default '',
  user_logcount int(11) unsigned NOT NULL default '0',
  user_sessionid varchar(32) NOT NULL default '0',
  PRIMARY KEY  (user_id)
) TYPE=MyISAM;


INSERT INTO ldu_stats (stat_name, stat_value) VALUES ('totalpages', '0');
INSERT INTO ldu_stats (stat_name, stat_value) VALUES ('totalmailsent', '0');
INSERT INTO ldu_stats (stat_name, stat_value) VALUES ('totalpms', '0');
INSERT INTO ldu_stats (stat_name, stat_value) VALUES ('totalantihammer', '0');
INSERT INTO ldu_stats (stat_name, stat_value) VALUES ('version', '525');

INSERT INTO ldu_pages VALUES (1, 0, 0, 'system', 'page', '', 'Contacts', '', 'System page sample, body of the page goes here', 'Administrator', 'Administrator', '2002-09-18', 0, '', '', 0, 0);
INSERT INTO ldu_pages VALUES (2, 0, 0, 'system', 'page', '', 'IRC chat', '', 'Our main chat room : Channel <b>#Mychannel</b> at server : <b>Irc.MyIrcServer.Net</b>\r\n\r\nTo connect you might need an IRC client :\r\n\r\nmIRC - <a href=\\"http://www.mirc.com/\\" target=\\"_blank\\">www.mirc.com</a>\r\nIRCle (Mac only) - <a href=\\"http://www.ircle.com\\" target=\\"_blank\\">www.ircle.com</a>\r\n', 'Administrator', 'Administrator', '2002-09-18', 0, '', '', 0, 0);

INSERT INTO ldu_structure VALUES (1, 'cat', 'main', 'MySite', '0', '');
INSERT INTO ldu_structure VALUES (2, 'cat', 'private', 'Private area', '20', '');
INSERT INTO ldu_structure VALUES (3, 'type', 'art', 'Articles', '0', '');

INSERT INTO ldu_structure VALUES (4, 'type', 'tut', 'Tutorials', '0', '');
INSERT INTO ldu_structure VALUES (5, 'type', 'file', 'Files', '0', '');
INSERT INTO ldu_structure VALUES (6, 'type', 'link', 'Links', '0', '');

INSERT INTO ldu_news VALUES (1,'0', 'Welcome !', 'Administrator', 1, 1038606300, 'Congratulations, your Land Down Under website is up and running !\r\n\r\nHere are some usefull links :\r\n\r\n<a href=\\"http://ldu.neocrome.net/view.php?v=manual1\\" target=\\"_blank\\">Online manual I</a>, general configuration and quick setup guide.\r\n<a href=\\"http://ldu.neocrome.net/view.php?v=manual2\\" target=\\"_blank\\">Online manual II</a>, listing all tags for skins, for advanced LDU users.\r\n<a href=\\"http://ldu.neocrome.net/forums.php\\" target=\\"_blank\\">LDU forums</a>, to meet other LDU webmasters, and technical support.\r\n<a href=\\"http://ldu.neocrome.net/view.php?v=services\\" target=\\"_blank\\">Licence and services</a>, to order specific LDU services and support Neocrome.Net');

INSERT INTO ldu_forum_sections VALUES ('1', '0', '1', '0', '40', 'General discussion', '1. Public', 'General chat.', 'system/img/forums.gif', '0', '0', '0','0','0');
INSERT INTO ldu_forum_sections VALUES ('2', '0', '2', '0', '40', 'Off-topic', '1. Public', 'Various and off-topic.', 'system/img/forums.gif', '0', '0', '0','0','0');
INSERT INTO ldu_forum_sections VALUES ('3', '0', '3', '0', '40', 'Twilight zone !', '1. Public', 'Testing area ...', 'system/img/forums.gif', '0', '0', '0','0','0');
INSERT INTO ldu_forum_sections VALUES ('4', '0', '1', '15', '40', 'Private area', '2. Private', 'Team members only.', 'system/img/forums.gif', '0', '0', '0','0','0');

INSERT INTO ldu_smilies VALUES (1, ':D', 'system/smilies/icon_biggrin.gif', 'Mister grin');
INSERT INTO ldu_smilies VALUES (2, ':blush', 'system/smilies/icon_blush.gif', 'Blush');
INSERT INTO ldu_smilies VALUES (3, ':con', 'system/smilies/icon_confused.gif', 'Confused');
INSERT INTO ldu_smilies VALUES (4, ':)', 'system/smilies/icon_smile.gif', 'Smile');
INSERT INTO ldu_smilies VALUES (5, ':cry', 'system/smilies/icon_cry.gif', 'Cry');
INSERT INTO ldu_smilies VALUES (6, ':dontgetit', 'system/smilies/icon_dontgetit.gif', 'Don\'t get it');
INSERT INTO ldu_smilies VALUES (7, ':dozingoff', 'system/smilies/icon_dozingoff.gif', 'Dozing off');
INSERT INTO ldu_smilies VALUES (8, ':love', 'system/smilies/icon_love.gif', 'Love');
INSERT INTO ldu_smilies VALUES (9, ':((', 'system/smilies/icon_mad.gif', 'Mad');
INSERT INTO ldu_smilies VALUES (10, ':|', 'system/smilies/icon_neutral.gif', 'Neutral');
INSERT INTO ldu_smilies VALUES (11, ':no', 'system/smilies/icon_no.gif', 'No');
INSERT INTO ldu_smilies VALUES (12, ':O_o', 'system/smilies/icon_o_o.gif', 'Suspicious');
INSERT INTO ldu_smilies VALUES (13, ':o_o', 'system/smilies/icon_o_o.gif', 'Suspicious');
INSERT INTO ldu_smilies VALUES (14, ':o_O', 'system/smilies/icon_o_o.gif', 'Suspicious');
INSERT INTO ldu_smilies VALUES (15, ':ow', 'system/smilies/icon_ow.gif', 'Ow...');
INSERT INTO ldu_smilies VALUES (16, ':plain', 'system/smilies/icon_plain.gif', 'Plain');
INSERT INTO ldu_smilies VALUES (17, ':p', 'system/smilies/icon_razz.gif', 'Razz');
INSERT INTO ldu_smilies VALUES (18, ':(', 'system/smilies/icon_sad.gif', 'Sad');
INSERT INTO ldu_smilies VALUES (19, ':satisfied', 'system/smilies/icon_satisfied.gif', 'Satisfied');
INSERT INTO ldu_smilies VALUES (20, ':sly', 'system/smilies/icon_sly.gif', 'Sly');
INSERT INTO ldu_smilies VALUES (21, '8)', 'system/smilies/icon_cool.gif', 'Cool');
INSERT INTO ldu_smilies VALUES (22, ':o', 'system/smilies/icon_surprised.gif', 'Surprised');
INSERT INTO ldu_smilies VALUES (23, ':wink', 'system/smilies/icon_wink.gif', 'Wink');
INSERT INTO ldu_smilies VALUES (24, ':yes', 'system/smilies/icon_yes.gif', 'Yes');

INSERT INTO ldu_levels VALUES ('1', '0', 'Visitors', '0', '0', '1');
INSERT INTO ldu_levels VALUES ('2', '10', 'Users', '8', '8', '1');
INSERT INTO ldu_levels VALUES ('3', '20', 'Trustees', '128', '256', '1');
INSERT INTO ldu_levels VALUES ('4', '30', 'Posters', '128', '512', '1');
INSERT INTO ldu_levels VALUES ('5', '40', 'Moderators', '256', '1024', '1');
INSERT INTO ldu_levels VALUES ('6', '50', 'Administrators', '512', '2048', '1');
INSERT INTO ldu_levels VALUES ('7', '59', 'ServerOp', '512', '4096', '1');
