From 1df9b70c2ecff4b9c7bac73985ada5042596ffce Mon Sep 17 00:00:00 2001 From: Norv Date: Mon, 15 Jul 2013 21:31:01 +0300 Subject: [PATCH 1/2] Remove Sqlite 2.8 scripts from the core repository. Signed-off-by: Norv --- install/install_1-0_sqlite.sql | 2382 -------------------------- install/upgrade_2-0_sqlite.sql | 986 ----------- install/upgrade_2-1_sqlite.sql | 336 ---- install/upgrade_elk_1-0_sqlite.sql | 682 -------- sources/database/Db-sqlite.class.php | 1302 -------------- sources/database/Db-sqlite.subs.php | 180 -- sources/database/DbSearch-sqlite.php | 107 -- sources/database/DbTable-sqlite.php | 840 --------- 8 files changed, 6815 deletions(-) delete mode 100644 install/install_1-0_sqlite.sql delete mode 100644 install/upgrade_2-0_sqlite.sql delete mode 100644 install/upgrade_2-1_sqlite.sql delete mode 100644 install/upgrade_elk_1-0_sqlite.sql delete mode 100644 sources/database/Db-sqlite.class.php delete mode 100644 sources/database/Db-sqlite.subs.php delete mode 100644 sources/database/DbSearch-sqlite.php delete mode 100644 sources/database/DbTable-sqlite.php diff --git a/install/install_1-0_sqlite.sql b/install/install_1-0_sqlite.sql deleted file mode 100644 index 04c2285830..0000000000 --- a/install/install_1-0_sqlite.sql +++ /dev/null @@ -1,2382 +0,0 @@ -#### ATTENTION: You do not need to run or use this file! The install.php script does everything for you! -#### Install script for SQLite - -# -# Table structure for table `admin_info_files` -# - -CREATE TABLE {$db_prefix}admin_info_files ( - id_file integer primary key, - filename varchar(255) NOT NULL, - path varchar(255) NOT NULL, - parameters varchar(255) NOT NULL, - data text NOT NULL, - filetype varchar(255) NOT NULL -); - -# -# Indexes for table `admin_info_files` -# - -CREATE INDEX {$db_prefix}admin_info_files_filename ON {$db_prefix}admin_info_files (filename); - -# -# Dumping data for table `admin_info_files` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (1, 'current-version.js', '/site/', 'version=%3$s', '', 'text/javascript'); -INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (2, 'detailed-version.js', '/site/', 'language=%1$s&version=%3$s', '', 'text/javascript'); -INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (3, 'latest-news.js', '/site/', 'language=%1$s&format=%2$s', '', 'text/javascript'); -INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (4, 'latest-packages.js', '/site/', 'language=%1$s&version=%3$s', '', 'text/javascript'); -INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (5, 'latest-smileys.js', '/site/', 'language=%1$s&version=%3$s', '', 'text/javascript'); -INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (6, 'latest-support.js', '/site/', 'language=%1$s&version=%3$s', '', 'text/javascript'); -INSERT INTO {$db_prefix}admin_info_files (id_file, filename, path, parameters, data, filetype) VALUES (7, 'latest-themes.js', '/site/', 'language=%1$s&version=%3$s', '', 'text/javascript'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `antispam_questions` -# - -CREATE TABLE {$db_prefix}antispam_questions ( - id_question integer primary key, - question text NOT NULL, - answer text NOT NULL, - language varchar(50) NOT NULL -); - -# -# Indexes for table `admin_info_files` -# - -CREATE INDEX {$db_prefix}antispam_questions_language ON {$db_prefix}antispam_questions (language); - -# -------------------------------------------------------- - -# -# Table structure for table `approval_queue` -# - -CREATE TABLE {$db_prefix}approval_queue ( - id_msg int NOT NULL default '0', - id_attach int NOT NULL default '0', - id_event smallint NOT NULL default '0' -); - -# -# Table structure for table `attachments` -# - -CREATE TABLE {$db_prefix}attachments ( - id_attach integer primary key, - id_thumb int NOT NULL default '0', - id_msg int NOT NULL default '0', - id_member int NOT NULL default '0', - id_folder smallint NOT NULL default '1', - attachment_type smallint NOT NULL default '0', - filename varchar(255) NOT NULL, - file_hash varchar(40) NOT NULL default '', - fileext varchar(8) NOT NULL default '', - size int NOT NULL default '0', - downloads int NOT NULL default '0', - width int NOT NULL default '0', - height int NOT NULL default '0', - mime_type varchar(20) NOT NULL default '', - approved smallint NOT NULL default '1' -); - -# -# Indexes for table `attachments` -# - -CREATE UNIQUE INDEX {$db_prefix}attachments_id_member ON {$db_prefix}attachments (id_member, id_attach); -CREATE INDEX {$db_prefix}attachments_id_msg ON {$db_prefix}attachments (id_msg); -CREATE INDEX {$db_prefix}attachments_attachment_type ON {$db_prefix}attachments (attachment_type); - -# -# Table structure for table `ban_groups` -# - -CREATE TABLE {$db_prefix}ban_groups ( - id_ban_group integer primary key, - name varchar(20) NOT NULL default '', - ban_time int NOT NULL default '0', - expire_time int, - cannot_access smallint NOT NULL default '0', - cannot_register smallint NOT NULL default '0', - cannot_post smallint NOT NULL default '0', - cannot_login smallint NOT NULL default '0', - reason varchar(255) NOT NULL, - notes text NOT NULL -); - -# -# Table structure for table `ban_items` -# - -CREATE TABLE {$db_prefix}ban_items ( - id_ban integer primary key, - id_ban_group smallint NOT NULL default '0', - ip_low1 smallint NOT NULL default '0', - ip_high1 smallint NOT NULL default '0', - ip_low2 smallint NOT NULL default '0', - ip_high2 smallint NOT NULL default '0', - ip_low3 smallint NOT NULL default '0', - ip_high3 smallint NOT NULL default '0', - ip_low4 smallint NOT NULL default '0', - ip_high4 smallint NOT NULL default '0', - ip_low5 smallint NOT NULL default '0', - ip_high5 smallint NOT NULL default '0', - ip_low6 smallint NOT NULL default '0', - ip_high6 smallint NOT NULL default '0', - ip_low7 smallint NOT NULL default '0', - ip_high7 smallint NOT NULL default '0', - ip_low8 smallint NOT NULL default '0', - ip_high8 smallint NOT NULL default '0', - hostname varchar(255) NOT NULL, - email_address varchar(255) NOT NULL, - id_member int NOT NULL default '0', - hits int NOT NULL default '0' -); - -# -# Indexes for table `ban_items` -# - -CREATE INDEX {$db_prefix}ban_items_id_ban_group ON {$db_prefix}ban_items (id_ban_group); - -# -# Table structure for table `board_permissions` -# - -CREATE TABLE {$db_prefix}board_permissions ( - id_group smallint NOT NULL default '0', - id_profile smallint NOT NULL default '0', - permission varchar(30) NOT NULL default '', - add_deny smallint NOT NULL default '1', - PRIMARY KEY (id_group, id_profile, permission) -); - -# -# Dumping data for table `board_permissions` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (-1, 1, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'remove_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'poll_add_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'poll_edit_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'poll_lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'postby_email'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'moderate_board'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'poll_add_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'poll_remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'poll_lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'poll_edit_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'make_sticky'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'move_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'merge_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'split_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'delete_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'modify_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'approve_posts'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 1, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'moderate_board'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'poll_add_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'poll_remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'poll_lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'poll_edit_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'make_sticky'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'move_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'merge_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'split_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'delete_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'modify_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'approve_posts'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 1, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (-1, 2, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'remove_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'postby_email'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'moderate_board'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'poll_add_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'poll_remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'poll_lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'poll_edit_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'make_sticky'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'move_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'merge_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'split_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'delete_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'modify_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'approve_posts'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 2, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'moderate_board'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'poll_add_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'poll_remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'poll_lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'poll_edit_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'make_sticky'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'move_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'merge_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'split_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'delete_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'modify_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'approve_posts'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 2, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (-1, 3, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'remove_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 3, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'moderate_board'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'poll_add_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'poll_remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'poll_lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'poll_edit_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'make_sticky'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'move_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'merge_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'split_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'delete_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'modify_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'approve_posts'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 3, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'moderate_board'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'poll_add_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'poll_remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'poll_lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'poll_edit_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'make_sticky'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'move_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'merge_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'split_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'delete_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'modify_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'approve_posts'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 3, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (-1, 4, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 4, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 4, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 4, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 4, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 4, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 4, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 4, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'moderate_board'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'poll_add_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'poll_remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'poll_lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'poll_edit_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'make_sticky'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'move_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'merge_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'split_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'delete_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'modify_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'approve_posts'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (2, 4, 'view_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'moderate_board'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_new'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_autosave_draft'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_reply_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_reply_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_unapproved_topics'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_unapproved_replies_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_unapproved_replies_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_unapproved_attachments'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'poll_post'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'poll_add_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'poll_remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'poll_view'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'poll_vote'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'poll_lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'poll_edit_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'report_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'lock_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'send_topic'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'mark_any_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'mark_notify'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'delete_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'modify_own'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'make_sticky'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'lock_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'remove_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'move_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'merge_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'split_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'delete_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'modify_any'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'approve_posts'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'post_attachment'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (3, 4, 'view_attachments'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `boards` -# - -CREATE TABLE {$db_prefix}boards ( - id_board integer primary key, - id_cat smallint NOT NULL default '0', - child_level smallint NOT NULL default '0', - id_parent smallint NOT NULL default '0', - board_order smallint NOT NULL default '0', - id_last_msg int NOT NULL default '0', - id_msg_updated int NOT NULL default '0', - member_groups varchar(255) NOT NULL default '-1,0', - id_profile smallint NOT NULL default '1', - name varchar(255) NOT NULL, - description text NOT NULL, - num_topics int NOT NULL default '0', - num_posts int NOT NULL default '0', - count_posts smallint NOT NULL default '0', - id_theme smallint NOT NULL default '0', - override_theme smallint NOT NULL default '0', - unapproved_posts smallint NOT NULL default '0', - unapproved_topics smallint NOT NULL default '0', - redirect varchar(255) NOT NULL default '', - deny_member_groups varchar(255) NOT NULL default '' -); - -# -# Indexes for table `boards` -# - -CREATE UNIQUE INDEX {$db_prefix}boards_categories ON {$db_prefix}boards (id_cat, id_board); -CREATE INDEX {$db_prefix}boards_id_parent ON {$db_prefix}boards (id_parent); -CREATE INDEX {$db_prefix}boards_id_msg_updated ON {$db_prefix}boards (id_msg_updated); -CREATE INDEX {$db_prefix}boards_member_groups ON {$db_prefix}boards (member_groups); - -# -# Dumping data for table `boards` -# - -INSERT INTO {$db_prefix}boards - (id_board, id_cat, board_order, id_last_msg, id_msg_updated, name, description, num_topics, num_posts, member_groups) -VALUES (1, 1, 1, 1, 1, '{$default_board_name}', '{$default_board_description}', 1, 1, '-1,0,2'); -# -------------------------------------------------------- - -# -# Table structure for table `calendar` -# - -CREATE TABLE {$db_prefix}calendar ( - id_event integer primary key, - start_date date NOT NULL default '0001-01-01', - end_date date NOT NULL default '0001-01-01', - id_board smallint NOT NULL default '0', - id_topic int NOT NULL default '0', - title varchar(255) NOT NULL default '', - id_member int NOT NULL default '0' -); - -# -# Indexes for table `calendar` -# - -CREATE INDEX {$db_prefix}calendar_start_date ON {$db_prefix}calendar (start_date); -CREATE INDEX {$db_prefix}calendar_end_date ON {$db_prefix}calendar (end_date); -CREATE INDEX {$db_prefix}calendar_topic ON {$db_prefix}calendar (id_topic, id_member); - -# -# Table structure for table `calendar_holidays` -# - -CREATE TABLE {$db_prefix}calendar_holidays ( - id_holiday integer primary key, - event_date date NOT NULL default '0001-01-01', - title varchar(255) NOT NULL default '' -); - -# -# Indexes for table `calendar_holidays` -# - -CREATE INDEX {$db_prefix}calendar_holidays_event_date ON {$db_prefix}calendar_holidays (event_date); - -# -# Dumping data for table `calendar_holidays` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('New Year''s', '0004-01-01'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Christmas', '0004-12-25'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Valentine''s Day', '0004-02-14'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('St. Patrick''s Day', '0004-03-17'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('April Fools', '0004-04-01'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Earth Day', '0004-04-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('United Nations Day', '0004-10-24'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Halloween', '0004-10-31'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2010-05-09'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2011-05-08'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2012-05-13'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2013-05-12'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2014-05-11'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2015-05-10'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2016-05-08'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2017-05-14'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2018-05-13'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2019-05-12'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Mother''s Day', '2020-05-10'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2010-06-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2011-06-19'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2012-06-17'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2013-06-16'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2014-06-15'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2015-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2016-06-19'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2017-06-18'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2018-06-17'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2019-06-16'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Father''s Day', '2020-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2010-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2011-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2012-06-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2013-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2014-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2015-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2016-06-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2017-06-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2018-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2019-06-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Summer Solstice', '2020-06-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2010-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2011-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2012-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2013-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2014-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2015-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2016-03-19'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2017-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2018-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2019-03-20'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Vernal Equinox', '2020-03-19'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2010-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2011-12-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2012-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2013-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2014-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2015-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2016-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2017-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2018-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2019-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Winter Solstice', '2020-12-21'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2010-09-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2011-09-23'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2012-09-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2013-09-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2014-09-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2015-09-23'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2016-09-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2017-09-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2018-09-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2019-09-23'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Autumnal Equinox', '2020-09-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Independence Day', '0004-07-04'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Cinco de Mayo', '0004-05-05'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Flag Day', '0004-06-14'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Veterans Day', '0004-11-11'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Groundhog Day', '0004-02-02'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2010-11-25'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2011-11-24'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2012-11-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2013-11-28'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2014-11-27'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2015-11-26'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2016-11-24'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2017-11-23'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2018-11-22'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2019-11-28'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Thanksgiving', '2020-11-26'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2010-05-31'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2011-05-30'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2012-05-28'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2013-05-27'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2014-05-26'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2015-05-25'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2016-05-30'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2017-05-29'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2018-05-28'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2019-05-27'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Memorial Day', '2020-05-25'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2010-09-06'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2011-09-05'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2012-09-03'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2013-09-02'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2014-09-01'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2015-09-07'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2016-09-05'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2017-09-04'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2018-09-03'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2019-09-02'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('Labor Day', '2020-09-07'); -INSERT INTO {$db_prefix}calendar_holidays (title, event_date) VALUES ('D-Day', '0004-06-06'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `categories` -# - -CREATE TABLE {$db_prefix}categories ( - id_cat integer primary key, - cat_order smallint NOT NULL default '0', - name varchar(255) NOT NULL, - can_collapse smallint NOT NULL default '1' -); - -# -# Dumping data for table `categories` -# - -INSERT INTO {$db_prefix}categories -VALUES (1, 0, '{$default_category_name}', 1); -# -------------------------------------------------------- - -# -# Table structure for table `collapsed_categories` -# - -CREATE TABLE {$db_prefix}collapsed_categories ( - id_cat smallint NOT NULL default '0', - id_member int NOT NULL default '0', - PRIMARY KEY (id_cat, id_member) -); - -# -# Table structure for table `custom_fields` -# - -CREATE TABLE {$db_prefix}custom_fields ( - id_field integer primary key, - col_name varchar(12) NOT NULL default '', - field_name varchar(40) NOT NULL default '', - field_desc varchar(255) NOT NULL, - field_type varchar(8) NOT NULL default 'text', - field_length smallint NOT NULL default '255', - field_options text NOT NULL, - mask varchar(255) NOT NULL, - show_reg smallint NOT NULL default '0', - show_display smallint NOT NULL default '0', - show_memberlist smallint NOT NULL default '0', - show_profile varchar(20) NOT NULL default 'forumprofile', - private smallint NOT NULL default '0', - active smallint NOT NULL default '1', - bbc smallint NOT NULL default '0', - can_search smallint NOT NULL default '0', - default_value varchar(255) NOT NULL, - enclose text NOT NULL, - placement smallint NOT NULL default '0' -); - -# -# Indexes for table `custom_fields` -# - -CREATE UNIQUE INDEX {$db_prefix}custom_fields_col_name ON {$db_prefix}custom_fields (col_name); - -# -# Table structure for table `group_moderators` -# - -CREATE TABLE {$db_prefix}group_moderators ( - id_group smallint NOT NULL default '0', - id_member int NOT NULL default '0', - PRIMARY KEY (id_group, id_member) -); - -# -# Table structure for table `follow_ups` -# - -CREATE TABLE {$db_prefix}follow_ups ( - follow_up int NOT NULL default '0', - derived_from int NOT NULL default '0', - PRIMARY KEY (follow_up, derived_from) -); - -# -# Table structure for table `log_actions` -# - -CREATE TABLE {$db_prefix}log_actions ( - id_action integer primary key, - id_log smallint NOT NULL default '1', - log_time int NOT NULL default '0', - id_member int NOT NULL default '0', - ip char(16) NOT NULL default ' ', - action varchar(30) NOT NULL default '', - id_board smallint NOT NULL default '0', - id_topic int NOT NULL default '0', - id_msg int NOT NULL default '0', - extra text NOT NULL -); - -# -# Indexes for table `log_actions` -# - -CREATE INDEX {$db_prefix}log_actions_log_time ON {$db_prefix}log_actions (log_time); -CREATE INDEX {$db_prefix}log_actions_id_member ON {$db_prefix}log_actions (id_member); -CREATE INDEX {$db_prefix}log_actions_id_board ON {$db_prefix}log_actions (id_board); -CREATE INDEX {$db_prefix}log_actions_id_msg ON {$db_prefix}log_actions (id_msg); -CREATE INDEX {$db_prefix}log_actions_id_log ON {$db_prefix}log_actions (id_log); - -# -# Table structure for table `log_activity` -# - -CREATE TABLE {$db_prefix}log_activity ( - date date NOT NULL default '0001-01-01', - hits int NOT NULL default '0', - topics smallint NOT NULL default '0', - posts smallint NOT NULL default '0', - registers smallint NOT NULL default '0', - most_on smallint NOT NULL default '0', - pm smallint NOT NULL default '0', - email smallint NOT NULL default '0', - PRIMARY KEY (date) -); - -# -# Indexes for table `log_activity` -# -CREATE INDEX {$db_prefix}log_activity_most_on ON {$db_prefix}log_activity (most_on); - -# -# Table structure for table `log_banned` -# - -CREATE TABLE {$db_prefix}log_banned ( - id_ban_log integer primary key, - id_member int NOT NULL default '0', - ip char(16) NOT NULL default ' ', - email varchar(255) NOT NULL, - log_time int NOT NULL default '0' -); - -# -# Indexes for table `log_banned` -# - -CREATE INDEX {$db_prefix}log_banned_log_time ON {$db_prefix}log_banned (log_time); - -# -# Table structure for table `log_boards` -# - -CREATE TABLE {$db_prefix}log_boards ( - id_member int NOT NULL default '0', - id_board smallint NOT NULL default '0', - id_msg int NOT NULL default '0', - PRIMARY KEY (id_member, id_board) -); - -# -# Table structure for table `log_comments` -# - -CREATE TABLE {$db_prefix}log_comments ( - id_comment integer primary key, - id_member int NOT NULL default '0', - member_name varchar(80) NOT NULL default '', - comment_type varchar(8) NOT NULL default 'warning', - id_recipient int NOT NULL default '0', - recipient_name varchar(255) NOT NULL, - log_time int NOT NULL default '0', - id_notice int NOT NULL default '0', - counter smallint NOT NULL default '0', - body text NOT NULL -); - -# -# Indexes for table `log_comments` -# - -CREATE INDEX {$db_prefix}log_comments_id_recipient ON {$db_prefix}log_comments (id_recipient); -CREATE INDEX {$db_prefix}log_comments_log_time ON {$db_prefix}log_comments (log_time); -CREATE INDEX {$db_prefix}log_comments_comment_type ON {$db_prefix}log_comments (comment_type); - -# -# Table structure for table `log_digest` -# - -CREATE TABLE {$db_prefix}log_digest ( - id_topic int NOT NULL, - id_msg int NOT NULL, - note_type varchar(10) NOT NULL default 'post', - daily smallint NOT NULL default '0', - exclude int NOT NULL default '0' -); - -# -# Table structure for table `log_errors` -# - -CREATE TABLE {$db_prefix}log_errors ( - id_error integer primary key, - log_time int NOT NULL default '0', - id_member int NOT NULL default '0', - ip char(16) NOT NULL default ' ', - url text NOT NULL, - message text NOT NULL, - session char(64) NOT NULL default ' ', - error_type char(15) NOT NULL default 'general', - file varchar(255) NOT NULL, - line int NOT NULL default '0' -); - -# -# Indexes for table `log_errors` -# - -CREATE INDEX {$db_prefix}log_errors_log_time ON {$db_prefix}log_errors (log_time); -CREATE INDEX {$db_prefix}log_errors_id_member ON {$db_prefix}log_errors (id_member); -CREATE INDEX {$db_prefix}log_errors_ip ON {$db_prefix}log_errors (ip); - -# -# Table structure for table `log_floodcontrol` -# - -CREATE TABLE {$db_prefix}log_floodcontrol ( - ip char(16) NOT NULL default ' ', - log_time int NOT NULL default '0', - log_type varchar(8) NOT NULL default 'post', - PRIMARY KEY (ip, log_type) -); - -# -# Table structure for table `log_group_requests` -# - -CREATE TABLE {$db_prefix}log_group_requests ( - id_request integer primary key, - id_member int NOT NULL default '0', - id_group smallint NOT NULL default '0', - time_applied int NOT NULL default '0', - reason text NOT NULL -); - -# -# Indexes for table `log_group_requests` -# - -CREATE UNIQUE INDEX {$db_prefix}log_group_requests_id_member ON {$db_prefix}log_group_requests (id_member, id_group); - -# -# Table structure for table `log_karma` -# - -CREATE TABLE {$db_prefix}log_karma ( - id_target int NOT NULL default '0', - id_executor int NOT NULL default '0', - log_time int NOT NULL default '0', - action smallint NOT NULL default '0', - PRIMARY KEY (id_target, id_executor) -); - -# -# Indexes for table `log_karma` -# - -CREATE INDEX {$db_prefix}log_karma_log_time ON {$db_prefix}log_karma (log_time); - -# -# Table structure for table `log_mark_read` -# - -CREATE TABLE {$db_prefix}log_mark_read ( - id_member int NOT NULL default '0', - id_board smallint NOT NULL default '0', - id_msg int NOT NULL default '0', - PRIMARY KEY (id_member, id_board) -); - -# -# Table structure for table `log_member_notices` -# - -CREATE TABLE {$db_prefix}log_member_notices ( - id_notice integer primary key, - subject varchar(255) NOT NULL, - body text NOT NULL -); - -# -# Table structure for table `log_notify` -# - -CREATE TABLE {$db_prefix}log_notify ( - id_member int NOT NULL default '0', - id_topic int NOT NULL default '0', - id_board smallint NOT NULL default '0', - sent smallint NOT NULL default '0', - PRIMARY KEY (id_member, id_topic, id_board) -); - -# -# Indexes for table `log_notify` -# - -CREATE INDEX {$db_prefix}log_notify_id_topic ON {$db_prefix}log_notify (id_topic, id_member); - -# -# Table structure for table `log_online` -# - -CREATE TABLE {$db_prefix}log_online ( - session varchar(64) NOT NULL default '', - log_time int(10) NOT NULL default '0', - id_member int NOT NULL default '0', - id_spider smallint NOT NULL default '0', - ip int NOT NULL default '0', - url text NOT NULL, - PRIMARY KEY (session) -); - -# -# Indexes for table `log_online` -# - -CREATE INDEX {$db_prefix}log_online_log_time ON {$db_prefix}log_online (log_time); -CREATE INDEX {$db_prefix}log_online_id_member ON {$db_prefix}log_online (id_member); - -# -# Table structure for table `log_packages` -# - -CREATE TABLE {$db_prefix}log_packages ( - id_install integer primary key, - filename varchar(255) NOT NULL, - package_id varchar(255) NOT NULL, - name varchar(255) NOT NULL, - version varchar(255) NOT NULL, - id_member_installed int NOT NULL default '0', - member_installed varchar(255) NOT NULL, - time_installed int NOT NULL default '0', - id_member_removed int NOT NULL default '0', - member_removed varchar(255) NOT NULL, - time_removed int NOT NULL default '0', - install_state smallint NOT NULL default '1', - failed_steps text NOT NULL, - db_changes text NOT NULL, - credits varchar(255) NOT NULL, - themes_installed varchar(255) NOT NULL -); - -# -# Indexes for table `log_packages` -# - -CREATE INDEX {$db_prefix}log_packages_filename ON {$db_prefix}log_packages (filename); - -# -# Table structure for table `log_polls` -# - -CREATE TABLE {$db_prefix}log_polls ( - id_poll int NOT NULL default '0', - id_member int NOT NULL default '0', - id_choice smallint NOT NULL default '0' -); - -# -# Indexes for table `log_polls` -# - -CREATE INDEX {$db_prefix}log_polls_id_poll ON {$db_prefix}log_polls (id_poll, id_member, id_choice); - -# -# Table structure for table `log_reported` -# - -CREATE TABLE {$db_prefix}log_reported ( - id_report integer primary key, - id_msg int NOT NULL default '0', - id_topic int NOT NULL default '0', - id_board smallint NOT NULL default '0', - id_member int NOT NULL default '0', - membername varchar(255) NOT NULL, - subject varchar(255) NOT NULL, - body text NOT NULL, - time_started int NOT NULL default '0', - time_updated int NOT NULL default '0', - num_reports int NOT NULL default '0', - closed smallint NOT NULL default '0', - ignore_all smallint NOT NULL default '0' -); - -# -# Indexes for table `log_reported` -# - -CREATE INDEX {$db_prefix}log_reported_id_member ON {$db_prefix}log_reported (id_member); -CREATE INDEX {$db_prefix}log_reported_id_topic ON {$db_prefix}log_reported (id_topic); -CREATE INDEX {$db_prefix}log_reported_closed ON {$db_prefix}log_reported (closed); -CREATE INDEX {$db_prefix}log_reported_time_started ON {$db_prefix}log_reported (time_started); -CREATE INDEX {$db_prefix}log_reported_id_msg ON {$db_prefix}log_reported (id_msg); - -# -# Table structure for table `log_reported_comments` -# - -CREATE TABLE {$db_prefix}log_reported_comments ( - id_comment integer primary key, - id_report int NOT NULL default '0', - id_member int NOT NULL, - membername varchar(255) NOT NULL, - email_address varchar(255) NOT NULL, - member_ip varchar(255) NOT NULL, - comment varchar(255) NOT NULL, - time_sent int NOT NULL -); - -# -# Indexes for table `log_reported_comments` -# - -CREATE INDEX {$db_prefix}log_reported_comments_id_report ON {$db_prefix}log_reported_comments (id_report); -CREATE INDEX {$db_prefix}log_reported_comments_id_member ON {$db_prefix}log_reported_comments (id_member); -CREATE INDEX {$db_prefix}log_reported_comments_time_sent ON {$db_prefix}log_reported_comments (time_sent); - -# -# Table structure for table `log_scheduled_tasks` -# - -CREATE TABLE {$db_prefix}log_scheduled_tasks ( - id_log integer primary key, - id_task smallint NOT NULL default '0', - time_run int NOT NULL default '0', - time_taken float NOT NULL default '0' -); - -# -# Table structure for table `log_search_messages` -# - -CREATE TABLE {$db_prefix}log_search_messages ( - id_search smallint NOT NULL default '0', - id_msg int NOT NULL default '0', - PRIMARY KEY (id_search, id_msg) -); - -# -# Table structure for table `log_search_results` -# - -CREATE TABLE {$db_prefix}log_search_results ( - id_search smallint NOT NULL default '0', - id_topic int NOT NULL default '0', - id_msg int NOT NULL default '0', - relevance smallint NOT NULL default '0', - num_matches smallint NOT NULL default '0', - PRIMARY KEY (id_search, id_topic) -); - -# -# Table structure for table `log_search_subjects` -# - -CREATE TABLE {$db_prefix}log_search_subjects ( - word varchar(20) NOT NULL default '', - id_topic int NOT NULL default '0', - PRIMARY KEY (word, id_topic) -); - -# -# Indexes for table `log_search_subjects` -# - -CREATE INDEX {$db_prefix}log_search_subjects_id_topic ON {$db_prefix}log_search_subjects (id_topic); - -# -# Table structure for table `log_search_topics` -# - -CREATE TABLE {$db_prefix}log_search_topics ( - id_search smallint NOT NULL default '0', - id_topic int NOT NULL default '0', - PRIMARY KEY (id_search, id_topic) -); - -# -# Table structure for table `log_spider_hits` -# - -CREATE TABLE {$db_prefix}log_spider_hits ( - id_hit integer primary key, - id_spider smallint NOT NULL default '0', - log_time int NOT NULL default '0', - url varchar(255) NOT NULL, - processed smallint NOT NULL default '0' -); - -# -# Indexes for table `log_spider_hits` -# - -CREATE INDEX {$db_prefix}log_spider_hits_id_spider ON {$db_prefix}log_spider_hits (id_spider); -CREATE INDEX {$db_prefix}log_spider_hits_log_time ON {$db_prefix}log_spider_hits (log_time); -CREATE INDEX {$db_prefix}log_spider_hits_processed ON {$db_prefix}log_spider_hits (processed); - -# -# Table structure for table `log_spider_stats` -# - -CREATE TABLE {$db_prefix}log_spider_stats ( - id_spider smallint NOT NULL default '0', - page_hits smallint NOT NULL default '0', - last_seen int NOT NULL default '0', - stat_date date NOT NULL default '0001-01-01', - PRIMARY KEY (stat_date, id_spider) -); - -# -# Table structure for table `log_subscribed` -# - -CREATE TABLE {$db_prefix}log_subscribed ( - id_sublog integer primary key, - id_subscribe smallint unsigned NOT NULL default '0', - id_member int NOT NULL default '0', - old_id_group int NOT NULL default '0', - start_time int NOT NULL default '0', - end_time int NOT NULL default '0', - status smallint NOT NULL default '0', - payments_pending smallint NOT NULL default '0', - pending_details text NOT NULL, - reminder_sent smallint NOT NULL default '0', - vendor_ref varchar(255) NOT NULL -); - -# -# Indexes for table `log_subscribed` -# - -CREATE INDEX {$db_prefix}log_subscribed_id_subscribe ON {$db_prefix}log_subscribed (id_subscribe, id_member); -CREATE INDEX {$db_prefix}log_subscribed_end_time ON {$db_prefix}log_subscribed (end_time); -CREATE INDEX {$db_prefix}log_subscribed_reminder_sent ON {$db_prefix}log_subscribed (reminder_sent); -CREATE INDEX {$db_prefix}log_subscribed_payments_pending ON {$db_prefix}log_subscribed (payments_pending); -CREATE INDEX {$db_prefix}log_subscribed_status ON {$db_prefix}log_subscribed (status); -CREATE INDEX {$db_prefix}log_subscribed_id_member ON {$db_prefix}log_subscribed (id_member); - -# -# Table structure for table `log_topics` -# - -CREATE TABLE {$db_prefix}log_topics ( - id_member int NOT NULL default '0', - id_topic int NOT NULL default '0', - id_msg int NOT NULL default '0', - disregarded int NOT NULL default '0', - PRIMARY KEY (id_member, id_topic) -); - -# -# Indexes for table `log_topics` -# - -CREATE INDEX {$db_prefix}log_topics_id_topic ON {$db_prefix}log_topics (id_topic); - -# -# Table structure for table `mail_queue` -# - -CREATE TABLE {$db_prefix}mail_queue ( - id_mail integer primary key, - time_sent int NOT NULL default '0', - recipient varchar(255) NOT NULL, - body text NOT NULL, - subject varchar(255) NOT NULL, - headers text NOT NULL, - send_html smallint NOT NULL default '0', - priority smallint NOT NULL default '1', - private smallint NOT NULL default '0', - message_id int NOT NULL default '0' -); - -# -# Indexes for table `mail_queue` -# - -CREATE INDEX {$db_prefix}mail_queue_time_sent ON {$db_prefix}mail_queue (time_sent); -CREATE INDEX {$db_prefix}mail_queue_mail_priority ON {$db_prefix}mail_queue (priority, id_mail); - -# -# Table structure for table `membergroups` -# - -CREATE TABLE {$db_prefix}membergroups ( - id_group integer primary key, - group_name varchar(80) NOT NULL default '', - description text NOT NULL, - online_color varchar(20) NOT NULL default '', - min_posts int NOT NULL default '-1', - max_messages smallint NOT NULL default '0', - icons varchar(255) NOT NULL, - group_type smallint NOT NULL default '0', - hidden smallint NOT NULL default '0', - id_parent smallint NOT NULL default '-2' -); - -# -# Indexes for table `membergroups` -# - -CREATE INDEX {$db_prefix}membergroups_min_posts ON {$db_prefix}membergroups (min_posts); - -# -# Dumping data for table `membergroups` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}membergroups (id_group, group_name, description, online_color, min_posts, icons, group_type) VALUES (1, '{$default_administrator_group}', '', '#FF0000', -1, '5#iconadmin.png', 1); -INSERT INTO {$db_prefix}membergroups (id_group, group_name, description, online_color, min_posts, icons) VALUES (2, '{$default_global_moderator_group}', '', '#0000FF', -1, '5#icongmod.png'); -INSERT INTO {$db_prefix}membergroups (id_group, group_name, description, online_color, min_posts, icons) VALUES (3, '{$default_moderator_group}', '', '', -1, '5#iconmod.png'); -INSERT INTO {$db_prefix}membergroups (id_group, group_name, description, online_color, min_posts, icons) VALUES (4, '{$default_newbie_group}', '', '', 0, '1#icon.png'); -INSERT INTO {$db_prefix}membergroups (id_group, group_name, description, online_color, min_posts, icons) VALUES (5, '{$default_junior_group}', '', '', 50, '2#icon.png'); -INSERT INTO {$db_prefix}membergroups (id_group, group_name, description, online_color, min_posts, icons) VALUES (6, '{$default_full_group}', '', '', 100, '3#icon.png'); -INSERT INTO {$db_prefix}membergroups (id_group, group_name, description, online_color, min_posts, icons) VALUES (7, '{$default_senior_group}', '', '', 250, '4#icon.png'); -INSERT INTO {$db_prefix}membergroups (id_group, group_name, description, online_color, min_posts, icons) VALUES (8, '{$default_hero_group}', '', '', 500, '5#icon.png'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `members` -# - -CREATE TABLE {$db_prefix}members ( - id_member integer primary key, - member_name varchar(80) NOT NULL default '', - date_registered int NOT NULL default '0', - posts int NOT NULL default '0', - id_group smallint NOT NULL default '0', - lngfile varchar(255) NOT NULL, - last_login int NOT NULL default '0', - real_name varchar(255) NOT NULL, - instant_messages smallint NOT NULL default 0, - unread_messages smallint NOT NULL default 0, - new_pm smallint NOT NULL default '0', - buddy_list text NOT NULL, - pm_ignore_list varchar(255) NOT NULL, - pm_prefs int NOT NULL default '0', - mod_prefs varchar(20) NOT NULL default '', - message_labels text NOT NULL, - passwd varchar(64) NOT NULL default '', - openid_uri text NOT NULL, - email_address varchar(255) NOT NULL, - personal_text varchar(255) NOT NULL, - gender smallint NOT NULL default '0', - birthdate date NOT NULL default '0001-01-01', - website_title varchar(255) NOT NULL, - website_url varchar(255) NOT NULL, - location varchar(255) NOT NULL, - hide_email smallint NOT NULL default '0', - show_online smallint NOT NULL default '1', - time_format varchar(80) NOT NULL default '', - signature text NOT NULL, - time_offset float NOT NULL default '0', - avatar varchar(255) NOT NULL, - pm_email_notify smallint NOT NULL default '0', - karma_bad smallint NOT NULL default '0', - karma_good smallint NOT NULL default '0', - likes_given int NOT NULL default '0', - likes_received int NOT NULL default '0', - usertitle varchar(255) NOT NULL, - notify_announcements smallint NOT NULL default '1', - notify_regularity smallint NOT NULL default '1', - notify_send_body smallint NOT NULL default '0', - notify_types smallint NOT NULL default '2', - member_ip varchar(255) NOT NULL, - member_ip2 varchar(255) NOT NULL, - secret_question varchar(255) NOT NULL, - secret_answer varchar(64) NOT NULL default '', - id_theme smallint NOT NULL default '0', - is_activated smallint NOT NULL default '1', - validation_code varchar(10) NOT NULL default '', - id_msg_last_visit int NOT NULL default '0', - additional_groups varchar(255) NOT NULL, - smiley_set varchar(48) NOT NULL default '', - id_post_group smallint NOT NULL default '0', - total_time_logged_in int NOT NULL default '0', - password_salt varchar(255) NOT NULL default '', - ignore_boards text NOT NULL, - warning smallint NOT NULL default '0', - passwd_flood varchar(12) NOT NULL default '', - pm_receive_from smallint NOT NULL default '1' -); - -# -# Indexes for table `members` -# - -CREATE INDEX {$db_prefix}members_member_name ON {$db_prefix}members (member_name); -CREATE INDEX {$db_prefix}members_real_name ON {$db_prefix}members (real_name); -CREATE INDEX {$db_prefix}members_date_registered ON {$db_prefix}members (date_registered); -CREATE INDEX {$db_prefix}members_id_group ON {$db_prefix}members (id_group); -CREATE INDEX {$db_prefix}members_birthdate ON {$db_prefix}members (birthdate); -CREATE INDEX {$db_prefix}members_posts ON {$db_prefix}members (posts); -CREATE INDEX {$db_prefix}members_last_login ON {$db_prefix}members (last_login); -CREATE INDEX {$db_prefix}members_lngfile ON {$db_prefix}members (lngfile); -CREATE INDEX {$db_prefix}members_id_post_group ON {$db_prefix}members (id_post_group); -CREATE INDEX {$db_prefix}members_warning ON {$db_prefix}members (warning); -CREATE INDEX {$db_prefix}members_total_time_logged_in ON {$db_prefix}members (total_time_logged_in); -CREATE INDEX {$db_prefix}members_id_theme ON {$db_prefix}members (id_theme); - - -# -# Table structure for table `member_logins` -# - -CREATE TABLE {$db_prefix}member_logins ( - id_login integer primary key, - id_member int NOT NULL default '0', - time int(10) NOT NULL default '0', - ip varchar(255) NOT NULL default '0', - ip2 varchar(255) NOT NULL default '0' -); - -# -# Indexes for table `member_logins` -# -CREATE INDEX {$db_prefix}member_logins_id_member ON {$db_prefix}member_logins (id_member); -CREATE INDEX {$db_prefix}member_logins_time ON {$db_prefix}member_logins (time); - -# -# Table structure for table `message_icons` -# - -CREATE TABLE {$db_prefix}message_icons ( - id_icon integer primary key, - title varchar(80) NOT NULL default '', - filename varchar(80) NOT NULL default '', - id_board smallint NOT NULL default '0', - icon_order smallint NOT NULL default '0' -); - -# -# Indexes for table `message_icons` -# - -CREATE INDEX {$db_prefix}message_icons_id_board ON {$db_prefix}message_icons (id_board); - -# -# Dumping data for table `message_icons` -# - -# // !!! i18n -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('xx', 'Standard', '0'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('thumbup', 'Thumb Up', '1'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('thumbdown', 'Thumb Down', '2'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('exclamation', 'Exclamation point', '3'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('question', 'Question mark', '4'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('lamp', 'Lamp', '5'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('smiley', 'Smiley', '6'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('angry', 'Angry', '7'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('cheesy', 'Cheesy', '8'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('grin', 'Grin', '9'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('sad', 'Sad', '10'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('wink', 'Wink', '11'); -INSERT INTO {$db_prefix}message_icons (filename, title, icon_order) VALUES ('poll', 'Poll', '12'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `messages` -# - -CREATE TABLE {$db_prefix}messages ( - id_msg integer primary key, - id_topic int NOT NULL default '0', - id_board smallint NOT NULL default '0', - poster_time int NOT NULL default '0', - id_member int NOT NULL default '0', - id_msg_modified int NOT NULL default '0', - subject varchar(255) NOT NULL, - poster_name varchar(255) NOT NULL, - poster_email varchar(255) NOT NULL, - poster_ip varchar(255) NOT NULL, - smileys_enabled smallint NOT NULL default '1', - modified_time int NOT NULL default '0', - modified_name varchar(255) NOT NULL, - body text NOT NULL, - icon varchar(16) NOT NULL default 'xx', - approved smallint NOT NULL default '1' -); - -# -# Indexes for table `messages` -# - -CREATE UNIQUE INDEX {$db_prefix}messages_topic ON {$db_prefix}messages (id_topic, id_msg); -CREATE UNIQUE INDEX {$db_prefix}messages_id_board ON {$db_prefix}messages (id_board, id_msg); -CREATE UNIQUE INDEX {$db_prefix}messages_id_member ON {$db_prefix}messages (id_member, id_msg); -CREATE INDEX {$db_prefix}messages_approved ON {$db_prefix}messages (approved); -CREATE INDEX {$db_prefix}messages_ip_index ON {$db_prefix}messages (poster_ip, id_topic); -CREATE INDEX {$db_prefix}messages_participation ON {$db_prefix}messages (id_member, id_topic); -CREATE INDEX {$db_prefix}messages_show_posts ON {$db_prefix}messages (id_member, id_board); -CREATE INDEX {$db_prefix}messages_id_topic ON {$db_prefix}messages (id_topic); -CREATE INDEX {$db_prefix}messages_id_member_msg ON {$db_prefix}messages (id_member, approved, id_msg); -CREATE INDEX {$db_prefix}messages_current_topic ON {$db_prefix}messages (id_topic, id_msg, id_member, approved); -CREATE INDEX {$db_prefix}messages_related_ip ON {$db_prefix}messages (id_member, poster_ip, id_msg); -# -# Dumping data for table `messages` -# - -INSERT INTO {$db_prefix}messages - (id_msg, id_msg_modified, id_topic, id_board, poster_time, subject, poster_name, poster_email, poster_ip, modified_name, body, icon) -VALUES (1, 1, 1, 1, {$current_time}, '{$default_topic_subject}', 'Elkarte', 'info@elkarte.net', '127.0.0.1', '', '{$default_topic_message}', 'xx'); -# -------------------------------------------------------- - -# -# Table structure for table `moderators` -# - -CREATE TABLE {$db_prefix}moderators ( - id_board smallint NOT NULL default '0', - id_member int NOT NULL default '0', - PRIMARY KEY (id_board, id_member) -); - -# -# Table structure for table `openid_assoc` -# - -CREATE TABLE {$db_prefix}openid_assoc ( - server_url text NOT NULL, - handle varchar(255) NOT NULL, - secret text NOT NULL, - issued int NOT NULL default '0', - expires int NOT NULL default '0', - assoc_type varchar(64) NOT NULL, - PRIMARY KEY (server_url, handle) -); - -# -# Indexes for table `openid_assoc` -# - -CREATE INDEX {$db_prefix}openid_assoc_expires ON {$db_prefix}openid_assoc (expires); - -# -# Table structure for table `package_servers` -# - -CREATE TABLE {$db_prefix}package_servers ( - id_server integer primary key, - name varchar(255) NOT NULL, - url varchar(255) NOT NULL -); - -# -# Dumping data for table `package_servers` -# - -INSERT INTO {$db_prefix}package_servers - (name, url) -VALUES ('ElkArte Third-party Add-ons Site', 'https://github.com/elkarte/addons/tree/master/packages'); -# -------------------------------------------------------- - -# -# Table structure for table `permission_profiles` -# - -CREATE TABLE {$db_prefix}permission_profiles ( - id_profile integer primary key, - profile_name varchar(255) NOT NULL -); - -# -# Dumping data for table `permission_profiles` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}permission_profiles (id_profile, profile_name) VALUES (1, 'default'); -INSERT INTO {$db_prefix}permission_profiles (id_profile, profile_name) VALUES (2, 'no_polls'); -INSERT INTO {$db_prefix}permission_profiles (id_profile, profile_name) VALUES (3, 'reply_only'); -INSERT INTO {$db_prefix}permission_profiles (id_profile, profile_name) VALUES (4, 'read_only'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `permissions` -# - -CREATE TABLE {$db_prefix}permissions ( - id_group smallint NOT NULL default '0', - permission varchar(30) NOT NULL default '', - add_deny smallint NOT NULL default '1', - PRIMARY KEY (id_group, permission) -); - -# -# Dumping data for table `permissions` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'search_posts'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'calendar_view'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'view_stats'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (-1, 'profile_view_any'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'view_mlist'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'search_posts'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_view_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_view_any'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'pm_read'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'pm_send'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'pm_draft'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'pm_autosave_draft'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'calendar_view'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'view_stats'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'who_view'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_identity_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_extra_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_remove_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_server_avatar'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_upload_avatar'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_remote_avatar'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'profile_gravatar'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'send_email_to_members'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (0, 'karma_edit'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'view_mlist'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'search_posts'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_view_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_view_any'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'pm_read'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'pm_send'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'pm_draft'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'pm_autosave_draft'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'calendar_view'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'view_stats'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'who_view'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_identity_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_extra_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_remove_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_server_avatar'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_upload_avatar'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_remote_avatar'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_gravatar'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'send_email_to_members'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'profile_title_own'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'calendar_post'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'calendar_edit_any'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'karma_edit'); -INSERT INTO {$db_prefix}permissions (id_group, permission) VALUES (2, 'access_mod_center'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `personal_messages` -# - -CREATE TABLE {$db_prefix}personal_messages ( - id_pm integer primary key, - id_pm_head int NOT NULL default '0', - id_member_from int NOT NULL default '0', - deleted_by_sender smallint NOT NULL default '0', - from_name varchar(255) NOT NULL, - msgtime int NOT NULL default '0', - subject varchar(255) NOT NULL, - body text NOT NULL -); - -# -# Indexes for table `personal_messages` -# - -CREATE INDEX {$db_prefix}personal_messages_id_member ON {$db_prefix}personal_messages (id_member_from, deleted_by_sender); -CREATE INDEX {$db_prefix}personal_messages_msgtime ON {$db_prefix}personal_messages (msgtime); -CREATE INDEX {$db_prefix}personal_messages_id_pm_head ON {$db_prefix}personal_messages (id_pm_head); - -# -# Table structure for table `pm_recipients` -# - -CREATE TABLE {$db_prefix}pm_recipients ( - id_pm int NOT NULL default '0', - id_member int NOT NULL default '0', - labels varchar(60) NOT NULL default '-1', - bcc smallint NOT NULL default '0', - is_read smallint NOT NULL default '0', - is_new smallint NOT NULL default '0', - deleted smallint NOT NULL default '0', - PRIMARY KEY (id_pm, id_member) -); - -# -# Indexes for table `pm_recipients` -# - -CREATE UNIQUE INDEX {$db_prefix}pm_recipients_id_member ON {$db_prefix}pm_recipients (id_member, deleted, id_pm); - -# -# Table structure for table `pm_rules` -# - -CREATE TABLE {$db_prefix}pm_rules ( - id_rule integer primary key, - id_member integer NOT NULL default '0', - rule_name varchar(60) NOT NULL, - criteria text NOT NULL, - actions text NOT NULL, - delete_pm smallint NOT NULL default '0', - is_or smallint NOT NULL default '0' -); - -# -# Indexes for table `pm_rules` -# - -CREATE INDEX {$db_prefix}pm_rules_id_member ON {$db_prefix}pm_rules (id_member); -CREATE INDEX {$db_prefix}pm_rules_delete_pm ON {$db_prefix}pm_rules (delete_pm); - -# -# Table structure for table `polls` -# - -CREATE TABLE {$db_prefix}polls ( - id_poll integer primary key, - question varchar(255) NOT NULL, - voting_locked smallint NOT NULL default '0', - max_votes smallint NOT NULL default '1', - expire_time int NOT NULL default '0', - hide_results smallint NOT NULL default '0', - change_vote smallint NOT NULL default '0', - guest_vote smallint NOT NULL default '0', - num_guest_voters int NOT NULL default '0', - reset_poll int NOT NULL default '0', - id_member int NOT NULL default '0', - poster_name varchar(255) NOT NULL -); - -# -# Table structure for table `poll_choices` -# - -CREATE TABLE {$db_prefix}poll_choices ( - id_poll int NOT NULL default '0', - id_choice smallint NOT NULL default '0', - label varchar(255) NOT NULL, - votes smallint NOT NULL default '0', - PRIMARY KEY (id_poll, id_choice) -); - -# -# Table structure for table `scheduled_tasks` -# - -CREATE TABLE {$db_prefix}scheduled_tasks ( - id_task integer primary key, - next_time int NOT NULL default '0', - time_offset int NOT NULL default '0', - time_regularity smallint NOT NULL default '0', - time_unit varchar(1) NOT NULL default 'h', - disabled smallint NOT NULL default '0', - task varchar(24) NOT NULL default '' -); - -# -# Indexes for table `scheduled_tasks` -# - -CREATE INDEX {$db_prefix}scheduled_tasks_next_time ON {$db_prefix}scheduled_tasks (next_time); -CREATE INDEX {$db_prefix}scheduled_tasks_disabled ON {$db_prefix}scheduled_tasks (disabled); -CREATE UNIQUE INDEX {$db_prefix}scheduled_tasks_task ON {$db_prefix}scheduled_tasks (task); - -# -# Dumping data for table `scheduled_tasks` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (1, 0, 0, 2, 'h', 0, 'approval_notification'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (2, 0, 0, 7, 'd', 0, 'auto_optimize'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (3, 0, 60, 1, 'd', 0, 'daily_maintenance'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (5, 0, 0, 1, 'd', 0, 'daily_digest'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (6, 0, 0, 1, 'w', 0, 'weekly_digest'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (7, 0, {$sched_task_offset}, 1, 'd', 0, 'fetchFiles'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (8, 0, 0, 1, 'd', 1, 'birthdayemails'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (9, 0, 0, 1, 'w', 0, 'weekly_maintenance'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (10, 0, 120, 1, 'd', 1, 'paid_subscriptions'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (11, 0, 120, 1, 'd', 0, 'remove_temp_attachments'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (12, 0, 180, 1, 'd', 0, 'remove_topic_redirect'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (13, 0, 240, 1, 'd', 0, 'remove_old_drafts'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (14, 0, 0, 6, 'h', 0, 'remove_old_followups'); -INSERT INTO {$db_prefix}scheduled_tasks (id_task, next_time, time_offset, time_regularity, time_unit, disabled, task) VALUES (15, 0, 360, 10, 'm', 0, 'maillist_fetch_IMAP'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `settings` -# - -CREATE TABLE {$db_prefix}settings ( - variable varchar(255) NOT NULL, - value text NOT NULL, - PRIMARY KEY (variable) -); - -# -# Dumping data for table `settings` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('elkVersion', '{$current_version}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('news', '{$default_news}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('compactTopicPagesContiguous', '5'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('compactTopicPagesEnable', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableStickyTopics', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('todayMod', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('karmaMode', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('karmaTimeRestrictAdmins', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enablePreviousNext', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('pollMode', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableVBStyleLogin', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableCompressedOutput', '{$enableCompressedOutput}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('karmaWaitTime', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('karmaMinPosts', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('karmaLabel', '{$default_karmaLabel}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('karmaSmiteLabel', '{$default_karmaSmiteLabel}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('karmaApplaudLabel', '{$default_karmaApplaudLabel}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentSizeLimit', '128'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentPostLimit', '192'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentNumPerPostLimit', '4'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentDirSizeLimit', '10240'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentDirFileLimit', '1000'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentUploadDir', '{BOARDDIR}/attachments'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentExtensions', 'doc,gif,jpg,mpg,pdf,png,txt,zip'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentCheckExtensions', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentShowImages', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentEnable', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentEncryptFilenames', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentThumbnails', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentThumbWidth', '150'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachmentThumbHeight', '150'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('use_subdirectories_for_attachments', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('censorIgnoreCase', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('mostOnline', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('mostOnlineToday', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('mostDate', {$current_time}); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('allow_disableAnnounce', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('trackStats', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('userLanguage', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('titlesEnable', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('topicSummaryPosts', '15'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableErrorLogging', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('max_image_width', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('max_image_height', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('onlineEnable', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_enabled', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_maxyear', '2020'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_minyear', '2008'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_daysaslink', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_defaultboard', ''); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_showholidays', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_showbdays', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_showevents', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_showweeknum', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_maxspan', '7'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smtp_host', ''); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smtp_port', '25'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smtp_username', ''); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smtp_password', ''); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('mail_type', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('timeLoadPageEnable', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('totalMembers', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('totalTopics', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('totalMessages', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('simpleSearch', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('censor_vulgar', ''); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('censor_proper', ''); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enablePostHTML', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('theme_allow', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('theme_default', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('theme_guests', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableEmbeddedFlash', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('xmlnews_enable', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('xmlnews_limit', '5'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('xmlnews_maxlen', '255'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('hotTopicPosts', '15'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('hotTopicVeryPosts', '25'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('registration_method', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('send_validation_onChange', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('send_welcomeEmail', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('allow_editDisplayName', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('admin_session_lifetime', '10'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('allow_hideOnline', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('guest_hideContacts', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('spamWaitTime', '5'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('pm_spam_settings', '10,5,20'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reserveWord', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reserveCase', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reserveUser', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reserveName', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reserveNames', '{$default_reserved_names}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('autoLinkUrls', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('banLastUpdated', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smileys_dir', '{BOARDDIR}/smileys'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smileys_url', '{$boardurl}/smileys'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_default', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_directory', '{BOARDDIR}/avatars'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_url', '{$boardurl}/avatars'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_max_height_external', '65'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_max_width_external', '65'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_action_too_large', 'option_html_resize'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_max_height_upload', '65'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_max_width_upload', '65'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_resize_upload', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_download_png', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('gravatar_rating', 'g'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('failed_login_threshold', '3'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('oldTopicDays', '120'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('edit_wait_time', '90'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('edit_disable_time', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('autoFixDatabase', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('allow_guestAccess', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('time_format', '{$default_time_format}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('number_format', '1234.00'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableBBC', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('max_messageLength', '20000'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('signature_settings', '1,300,0,0,0,0,0,0:'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('autoOptMaxOnline', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('defaultMaxMessages', '15'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('defaultMaxTopics', '20'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('defaultMaxMembers', '30'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableParticipation', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('recycle_enable', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('recycle_board', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('maxMsgID', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enableAllMessages', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('fixLongWords', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('knownThemes', '1,2,3'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('who_enabled', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('time_offset', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cookieTime', '60'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('jquery_source', 'local'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('lastActive', '15'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smiley_sets_known', 'default,aaron,akyhne,fugue'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smiley_sets_names', '{$default_smileyset_name} -{$default_aaron_smileyset_name} -{$default_akyhne_smileyset_name} -{$default_fugue_smileyset_name}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('smiley_sets_default', 'default'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cal_days_for_index', '7'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('requireAgreement', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('unapprovedMembers', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('default_personal_text', ''); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('package_make_backups', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('databaseSession_enable', '{$databaseSession_enable}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('databaseSession_loose', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('databaseSession_lifetime', '2880'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_cache_size', '50'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_results_per_page', '30'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_weight_frequency', '30'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_weight_age', '25'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_weight_length', '20'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_weight_subject', '15'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_weight_first_message', '10'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_max_results', '1200'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('search_floodcontrol_time', '5'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('permission_enable_deny', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('permission_enable_postgroups', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('mail_next_send', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('mail_recent', '0000000000|0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('settings_updated', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('next_task_time', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('warning_settings', '1,20,0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('warning_watch', '10'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('warning_moderate', '35'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('warning_mute', '60'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('admin_features', ''); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('last_mod_report_action', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('pruningOptions', '30,180,180,180,30,7,0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('cache_enable', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('reg_verification', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('visual_verification_type', '3'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('visual_verification_num_chars', '6'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enable_buddylist', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('birthday_email', 'happy_birthday'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('dont_repeat_theme_core', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('dont_repeat_smileys_20', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('dont_repeat_buddylists', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachment_image_reencode', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachment_image_paranoid', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('attachment_thumb_png', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_reencode', '1'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('avatar_paranoid', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('enable_disregard', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('badbehavior_enabled', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('badbehavior_logging', '0'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('badbehavior_ip_wl', 'a:3:{i:2;s:10:"10.0.0.0/8";i:5;s:13:"172.16.0.0/12";i:6;s:14:"192.168.0.0/16";}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('badbehavior_ip_wl_desc', 'a:3:{i:2;s:18:"RFC 1918 addresses";i:5;s:18:"RFC 1918 addresses";i:6;s:18:"RFC 1918 addresses";}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('badbehavior_url_wl', 'a:1:{i:0;s:19:"/subscriptions.php";}'); -INSERT INTO {$db_prefix}settings (variable, value) VALUES ('badbehavior_url_wl_desc', 'a:1:{i:0;s:21:"Payment Gateway";}'); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `sessions` -# - -CREATE TABLE {$db_prefix}sessions ( - session_id char(64) NOT NULL, - last_update int NOT NULL, - data text NOT NULL, - PRIMARY KEY (session_id) -); - -# -# Table structure for table `smileys` -# - -CREATE TABLE {$db_prefix}smileys ( - id_smiley integer primary key, - code varchar(30) NOT NULL default '', - filename varchar(48) NOT NULL default '', - description varchar(80) NOT NULL default '', - smiley_row smallint NOT NULL default '0', - smiley_order smallint NOT NULL default '0', - hidden smallint NOT NULL default '0' -); - -# -# Dumping data for table `smileys` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':)', 'smiley.gif', '{$default_smiley_smiley}', 0, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (';)', 'wink.gif', '{$default_wink_smiley}', 1, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':D', 'cheesy.gif', '{$default_cheesy_smiley}', 2, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (';D', 'grin.gif', '{$default_grin_smiley}', 3, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('>:(', 'angry.gif', '{$default_angry_smiley}', 4, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':(', 'sad.gif', '{$default_sad_smiley}', 5, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':o', 'shocked.gif', '{$default_shocked_smiley}', 6, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('8)', 'cool.gif', '{$default_cool_smiley}', 7, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('???', 'huh.gif', '{$default_huh_smiley}', 8, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('::)', 'rolleyes.gif', '{$default_roll_eyes_smiley}', 9, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':P', 'tongue.gif', '{$default_tongue_smiley}', 10, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':-[', 'embarrassed.gif', '{$default_embarrassed_smiley}', 11, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':-X', 'lipsrsealed.gif', '{$default_lips_sealed_smiley}', 12, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':-\', 'undecided.gif', '{$default_undecided_smiley}', 13, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':-*', 'kiss.gif', '{$default_kiss_smiley}', 14, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':''(', 'cry.gif', '{$default_cry_smiley}', 15, 0); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('>:D', 'evil.gif', '{$default_evil_smiley}', 16, 1); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('^-^', 'azn.gif', '{$default_azn_smiley}', 17, 1); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('O0', 'afro.gif', '{$default_afro_smiley}', 18, 1); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES (':))', 'laugh.gif', '{$default_laugh_smiley}', 19, 1); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('C:-)', 'police.gif', '{$default_police_smiley}', 20, 1); -INSERT INTO {$db_prefix}smileys (code, filename, description, smiley_order, hidden) VALUES ('O:-)', 'angel.gif', '{$default_angel_smiley}', 21, 1); -COMMIT; - -# -------------------------------------------------------- - -# -# Table structure for table `spiders` -# - -CREATE TABLE {$db_prefix}spiders ( - id_spider integer primary key, - spider_name varchar(255) NOT NULL, - user_agent varchar(255) NOT NULL, - ip_info varchar(255) NOT NULL -); - -# -# Dumping data for table `spiders` -# -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (1, 'Google', 'googlebot', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (2, 'Yahoo!', 'Yahoo! Slurp', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (3, 'MSN', 'msnbot', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (4, 'Bing', 'bingbot', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (5, 'Google (Mobile)', 'Googlebot-Mobile', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (6, 'Google (Image)', 'Googlebot-Image', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (7, 'Google (AdSense)', 'Mediapartners-Google', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (8, 'Google (Adwords)', 'AdsBot-Google', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (9, 'Yahoo! (Mobile)', 'YahooSeeker/M1A1-R2D2', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (10, 'Yahoo! (Image)', 'Yahoo-MMCrawler', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (11, 'Yahoo! (Blogs)', 'Yahoo-Blogs', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (12, 'Yahoo! (Feeds)', 'YahooFeedSeeker', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (13, 'MSN (Mobile)', 'MSNBOT_Mobile', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (14, 'MSN (Media)', 'msnbot-media', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (15, 'Cuil', 'twiceler', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (16, 'Ask', 'Teoma', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (17, 'Baidu', 'Baiduspider', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (18, 'Gigablast', 'Gigabot', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (19, 'InternetArchive', 'ia_archiver-web.archive.org', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (20, 'Alexa', 'ia_archiver', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (21, 'Omgili', 'omgilibot', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (22, 'EntireWeb', 'Speedy Spider', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (23, 'Yandex', 'YandexBot', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (24, 'Yandex (Images)', 'YandexImages', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (25, 'Yandex (Video)', 'YandexVideo', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (26, 'Yandex (Blogs)', 'YandexBlogs', ''); -INSERT INTO {$db_prefix}spiders (id_spider, spider_name, user_agent, ip_info) VALUES (27, 'Yandex (Media)', 'YandexMedia', ''); - -# -# Table structure for table `subscriptions` -# - -CREATE TABLE {$db_prefix}subscriptions( - id_subscribe integer primary key, - name varchar(60) NOT NULL, - description varchar(255) NOT NULL, - cost text NOT NULL, - length varchar(6) NOT NULL, - id_group int NOT NULL default '0', - add_groups varchar(40) NOT NULL, - active smallint NOT NULL default '1', - repeatable smallint NOT NULL default '0', - allow_partial smallint NOT NULL default '0', - reminder smallint NOT NULL default '0', - email_complete text NOT NULL -); - -# -# Indexes for table `subscriptions` -# - -CREATE INDEX {$db_prefix}subscriptions_active ON {$db_prefix}subscriptions (active); - -# -# Table structure for table `themes` -# - -CREATE TABLE {$db_prefix}themes ( - id_member int NOT NULL default '0', - id_theme smallint NOT NULL default '1', - variable varchar(255) NOT NULL, - value text NOT NULL, - PRIMARY KEY (id_theme, id_member, variable) -); - -# -# Indexes for table `themes` -# - -CREATE INDEX {$db_prefix}themes_id_member ON {$db_prefix}themes (id_member); - -# -# Dumping data for table `themes` -# - -BEGIN TRANSACTION; -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'name', '{$default_theme_name}'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'theme_url', '{$boardurl}/themes/default'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'images_url', '{$boardurl}/themes/default/images'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'theme_dir', '{BOARDDIR}/themes/default'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_bbc', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_latest_member', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_modify', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_user_images', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_blurb', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_gender', '0'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_newsfader', '0'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'number_recent_posts', '0'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_member_bar', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'linktree_link', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_profile_buttons', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_mark_read', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_stats_index', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'show_board_desc', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'newsfader_time', '5000'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'allow_no_censored', '0'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'additional_options_collapsable', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'use_image_buttons', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'enable_news', '1'); -INSERT INTO {$db_prefix}themes (id_theme, variable, value) VALUES (1, 'forum_width', '90%'); -INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'display_quick_reply', '2'); -INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'posts_apply_ignore_list', '1'); -INSERT INTO {$db_prefix}themes (id_member, id_theme, variable, value) VALUES (-1, 1, 'drafts_autosave_enabled', '1'); -COMMIT; -# -------------------------------------------------------- - -# -# Table structure for table `topics` -# - -CREATE TABLE {$db_prefix}topics ( - id_topic integer primary key, - is_sticky smallint NOT NULL default '0', - id_board smallint NOT NULL default '0', - id_first_msg int NOT NULL default '0', - id_last_msg int NOT NULL default '0', - id_member_started int NOT NULL default '0', - id_member_updated int NOT NULL default '0', - id_poll int NOT NULL default '0', - id_previous_board smallint NOT NULL default '0', - id_previous_topic int NOT NULL default '0', - num_replies int NOT NULL default '0', - num_views int NOT NULL default '0', - num_likes int NOT NULL default '0', - locked smallint NOT NULL default '0', - redirect_expires int NOT NULL default '0', - id_redirect_topic int NOT NULL default '0', - unapproved_posts smallint NOT NULL default '0', - approved smallint NOT NULL default '1' -); - -# -# Indexes for table `topics` -# - -CREATE UNIQUE INDEX {$db_prefix}topics_last_message ON {$db_prefix}topics (id_last_msg, id_board); -CREATE UNIQUE INDEX {$db_prefix}topics_first_message ON {$db_prefix}topics (id_first_msg, id_board); -CREATE UNIQUE INDEX {$db_prefix}topics_poll ON {$db_prefix}topics (id_poll, id_topic); -CREATE INDEX {$db_prefix}topics_is_sticky ON {$db_prefix}topics (is_sticky); -CREATE INDEX {$db_prefix}topics_approved ON {$db_prefix}topics (approved); -CREATE INDEX {$db_prefix}topics_id_board ON {$db_prefix}topics (id_board); -CREATE INDEX {$db_prefix}topics_member_started ON {$db_prefix}topics (id_member_started, id_board); -CREATE INDEX {$db_prefix}topics_last_message_sticky ON {$db_prefix}topics (id_board, is_sticky, id_last_msg); -CREATE INDEX {$db_prefix}topics_board_news ON {$db_prefix}topics (id_board, id_first_msg); - -# -# Dumping data for table `topics` -# - -INSERT INTO {$db_prefix}topics - (id_topic, id_board, id_first_msg, id_last_msg, id_member_started, id_member_updated) -VALUES (1, 1, 1, 1, 0, 0); -# -------------------------------------------------------- - -# -# Table structure for table `user_drafts` -# - -CREATE TABLE {$db_prefix}user_drafts ( - id_draft integer primary key, - id_topic int unsigned NOT NULL default '0', - id_board smallint unsigned NOT NULL default '0', - id_reply int unsigned NOT NULL default '0', - type smallint NOT NULL default '0', - poster_time int unsigned NOT NULL default '0', - id_member int unsigned NOT NULL default '0', - subject varchar(255) NOT NULL default '', - smileys_enabled smallint NOT NULL default '1', - body text NOT NULL, - icon varchar(16) NOT NULL default 'xx', - locked smallint NOT NULL default '0', - is_sticky smallint NOT NULL default '0', - to_list varchar(255) NOT NULL default '', - outbox smallint NOT NULL default '0' -); - -# -# Indexes for table `user_drafts` -# - -CREATE UNIQUE INDEX {$db_prefix}id_member ON {$db_prefix}user_drafts (id_member, id_draft, type); -# -------------------------------------------------------- - -# -# Table structure for table `log_badbehavior` -# - -CREATE TABLE {$db_prefix}log_badbehavior ( - id integer primary key, - ip char NOT NULL, - date int NOT NULL default '0', - request_method varchar(255) NOT NULL, - request_uri varchar(255) NOT NULL, - server_protocol varchar(255) NOT NULL, - http_headers text NOT NULL, - user_agent varchar(255) NOT NULL, - request_entity varchar(255) NOT NULL, - valid varchar(255) NOT NULL, - id_member int unsigned NOT NULL, - session char(64) NOT NULL default '', -) - -# -# Indexes for table `log_badbehavior` -# - -CREATE INDEX {$db_prefix}ip ON {$db_prefix}log_badbehavior (ip); -CREATE INDEX {$db_prefix}user_agent ON {$db_prefix}log_badbehavior (user_agent); - -# -# Table structure for table `postby_emails` -# - -CREATE TABLE {$db_prefix}postby_emails ( - id_email varchar(50) primary key, - time_sent int NOT NULL, - email_to varchar(50) NOT NULL, -); - -# -# Table structure for table `postby_emails_error` -# - -CREATE TABLE {$db_prefix}postby_emails_error - id_email integer primary key, - error varchar(255) NOT NULL default '', - data_id varchar(255) NOT NULL default '0', - subject varchar(255) NOT NULL default '', - id_message int NOT NULL default '0', - id_board smallint(5) NOT NULL default '0', - email_from varchar(50) NOT NULL default '', - message_type char(10) NOT NULL default '', - message text NOT NULL default '', -); - -# -# Table structure for table `postby_emails_filter` -# - -CREATE TABLE {$db_prefix}postby_emails_filter - id_filter integer primary key, - filter_style char(5) NOT NULL default '', - filter_type varchar(255) NOT NULL default '', - filter_to varchar(255) NOT NULL default '', - filter_from varchar(255) NOT NULL default '', - filter_name varchar(255) NOT NULL default '', -); - -# -# Table structure for table `log_likes` -# - -CREATE TABLE {$db_prefix}log_likes ( - action char(1) NOT NULL default '0', - id_target int NOT NULL default '0', - id_member int NOT NULL default '0', - log_time int NOT NULL default '0', - PRIMARY KEY (id_target, id_member) -); - -# -# Indexes for table `log_likes` -# - -CREATE INDEX {$db_prefix}log_likes_log_time ON {$db_prefix}log_likes (log_time); - -# -# Table structure for table `message_likes` -# - -CREATE TABLE {$db_prefix}message_likes ( - id_member int NOT NULL default '0', - id_msg int NOT NULL default '0', - PRIMARY KEY (id_msg, id_member) -); diff --git a/install/upgrade_2-0_sqlite.sql b/install/upgrade_2-0_sqlite.sql deleted file mode 100644 index ec4c63a999..0000000000 --- a/install/upgrade_2-0_sqlite.sql +++ /dev/null @@ -1,986 +0,0 @@ -/* ATTENTION: You don't need to run or use this file! The upgrade.php script does everything for you! */ - -/******************************************************************************/ ---- Updating custom fields. -/******************************************************************************/ - ----# Adding search ability to custom fields. ----{ -$smcFunc['db_alter_table']('{db_prefix}custom_fields', array( - 'add' => array( - 'can_search' => array( - 'name' => 'can_search', - 'null' => false, - 'default' => 0, - 'type' => 'smallint', - 'size' => 255, - 'auto' => false, - ), - ), -)); - -if (isset($modSettings['smfVersion']) && $modSettings['smfVersion'] < '2.0 Beta 4') -{ -upgrade_query(" - UPDATE {$db_prefix}custom_fields - SET private = 3 - WHERE private = 2"); -} ----} ----# - ----# Adding new custom fields columns. ----{ -$smcFunc['db_alter_table']('{db_prefix}custom_fields', array( - 'add' => array( - 'enclose' => array( - 'name' => 'enclose', - 'null' => false, - 'default' => '', - 'type' => 'text', - 'auto' => false, - ), - ) -)); - -$smcFunc['db_alter_table']('{db_prefix}custom_fields', array( - 'add' => array( - 'placement' => array( - 'name' => 'placement', - 'null' => false, - 'default' => '', - 'type' => 'smallint', - 'auto' => false, - ), - ) -)); ----} ----# - ----# Fixing default value for the "show_profile" column ----{ -$smcFunc['db_alter_table']('{db_prefix}custom_fields', array( - 'change' => array( - 'show_profile' => array( - 'name' => 'show_profile', - 'null' => false, - 'default' => 'forumprofile', - 'type' => 'varchar(20)', - 'auto' => false, - ), - ) -)); ----} ----# - -ALTER TABLE {$db_prefix}custom_fields -ALTER COLUMN show_profile DEFAULT 'forumprofile'; ----# - -/******************************************************************************/ ---- Adding search engine tracking. -/******************************************************************************/ - ----# Creating spider table. -CREATE TABLE {$db_prefix}spiders ( - id_spider integer primary key, - spider_name varchar(255) NOT NULL, - user_agent varchar(255) NOT NULL, - ip_info varchar(255) NOT NULL -); ----# - ----# Inserting the search engines. ----{ -$smcFunc['db_insert']('ignore', - '{db_prefix}spiders', - array('id_spider' => 'int', 'spider_name' => 'string-255', 'user_agent' => 'string-255', 'ip_info' => 'string-255'), - array( - array(1, 'Google', 'googlebot', ''), - array(2, 'Yahoo!', 'slurp', ''), - array(3, 'MSN', 'msnbot', ''), - array(4, 'Google (Mobile)', 'Googlebot-Mobile', ''), - array(5, 'Google (Image)', 'Googlebot-Image', ''), - array(6, 'Google (AdSense)', 'Mediapartners-Google', ''), - array(7, 'Google (Adwords)', 'AdsBot-Google', ''), - array(8, 'Yahoo! (Mobile)', 'YahooSeeker/M1A1-R2D2', ''), - array(9, 'Yahoo! (Image)', 'Yahoo-MMCrawler', ''), - array(10, 'MSN (Mobile)', 'MSNBOT_Mobile', ''), - array(11, 'MSN (Media)', 'msnbot-media', ''), - array(12, 'Cuil', 'twiceler', ''), - array(13, 'Ask', 'Teoma', ''), - array(14, 'Baidu', 'Baiduspider', ''), - array(15, 'Gigablast', 'Gigabot', ''), - array(16, 'InternetArchive', 'ia_archiver-web.archive.org', ''), - array(17, 'Alexa', 'ia_archiver', ''), - array(18, 'Omgili', 'omgilibot', ''), - array(19, 'EntireWeb', 'Speedy Spider', '') - ), - array('user_agent') -); ----} ----# - ----# Removing a spider. ----{ - upgrade_query(" - DELETE FROM {$db_prefix}spiders - WHERE user_agent = 'yahoo' - AND spider_name = 'Yahoo! (Publisher)' - "); ----} ----# - ----# Creating spider hit tracking table. -CREATE TABLE {$db_prefix}log_spider_hits ( - id_spider integer NOT NULL default '0', - session varchar(32) NOT NULL default '', - log_time int NOT NULL, - url varchar(255) NOT NULL, - processed smallint NOT NULL default '0' -); - -CREATE INDEX {$db_prefix}log_spider_hits_id_spider ON {$db_prefix}log_spider_hits (id_spider); -CREATE INDEX {$db_prefix}log_spider_hits_log_time ON {$db_prefix}log_spider_hits (log_time); -CREATE INDEX {$db_prefix}log_spider_hits_processed ON {$db_prefix}log_spider_hits (processed); ----# - ----# Creating spider statistic table. -CREATE TABLE {$db_prefix}log_spider_stats ( - id_spider integer NOT NULL default '0', - unique_visits smallint NOT NULL default '0', - page_hits smallint NOT NULL default '0', - last_seen int NOT NULL default '0', - stat_date date NOT NULL default '0001-01-01', - PRIMARY KEY (stat_date, id_spider) -); ----# - -/******************************************************************************/ ---- Adding new forum settings. -/******************************************************************************/ - ----# Enable cache if upgrading from 2.0 beta 1 and lower. ----{ -if (isset($modSettings['smfVersion']) && $modSettings['smfVersion'] <= '2.0 Beta 1') -{ - $request = upgrade_query(" - SELECT value - FROM {$db_prefix}settings - WHERE variable = 'cache_enable'"); - list ($cache_enable) = $smcFunc['db_fetch_row']($request); - - // No cache before - if ($smcFunc['db_num_rows']($request) == 0) - upgrade_query(" - INSERT INTO {$db_prefix}settings - (variable, value) - VALUES ('cache_enable', '1')"); - elseif (empty($cache_enable)) - upgrade_query(" - UPDATE {$db_prefix}settings - SET value = '1' - WHERE variable = 'cache_enable'"); -} ----} ----# - ----# Adding advanced password brute force protection to "members" table... ----{ -$smcFunc['db_alter_table']('{db_prefix}members', array( - 'add' => array( - 'passwd_flood' => array( - 'name' => 'passwd_flood', - 'null' => false, - 'default' => '', - 'type' => 'varchar', - 'size' => 12, - 'auto' => false, - ), - ) -)); ----} ----# - ----# Ensuring forum width setting present... ----{ -// Don't do this twice! -$smcFunc['db_insert']('ignore', - '{db_prefix}themes', - array('id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-255'), - array(1, 'forum_width', '90%'), - array('id_theme', 'variable', 'value') -); ----} ----# - -/******************************************************************************/ ---- Adding weekly maintenance task. -/******************************************************************************/ - ----# Adding weekly maintenance task... ----{ -$smcFunc['db_insert']('ignore', - '{db_prefix}scheduled_tasks', - array( - 'next_time' => 'int', 'time_offset' => 'int', 'time_regularity' => 'int', - 'time_unit' => 'string', 'disabled' => 'int', 'task' => 'string', - ), - array( - 0, 0, 1, 'w', 0, 'weekly_maintenance', - ), - array('task') -); ----} ----# - ----# Setting the birthday email template if not set... ----{ -if (!isset($modSettings['birthday_email'])) -{ - upgrade_query(" - INSERT INTO {$db_prefix}settings - (variable, value) - VALUES - ('birthday_email', 'happy_birthday')"); -} ----} ----# - -/******************************************************************************/ ---- Adding log pruning. -/******************************************************************************/ - ----# Adding pruning option... ----{ -$smcFunc['db_insert']('ignore', - '{db_prefix}settings', - array('variable' => 'string-255', 'value' => 'string-65534'), - array('pruningOptions', '30,180,180,180,30'), - array('variable') -); ----} ----# - -/******************************************************************************/ ---- Updating mail queue functionality. -/******************************************************************************/ - ----# Adding type to mail queue... ----{ -$smcFunc['db_alter_table']('{db_prefix}mail_queue', array( - 'add' => array( - 'private' => array( - 'name' => 'private', - 'null' => false, - 'default' => 0, - 'type' => 'smallint', - 'size' => 1, - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Updating attachments. -/******************************************************************************/ - ----# Adding multiple attachment path functionality. ----{ -$smcFunc['db_alter_table']('{db_prefix}attachments', array( - 'add' => array( - 'id_folder' => array( - 'name' => 'id_folder', - 'null' => false, - 'default' => 1, - 'type' => 'smallint', - 'size' => 255, - 'auto' => false, - ), - ) -)); ----} ----# - ----# Adding file hash. ----{ -$smcFunc['db_alter_table']('{db_prefix}attachments', array( - 'add' => array( - 'file_hash' => array( - 'name' => 'file_hash', - 'null' => false, - 'default' => '', - 'type' => 'varchar', - 'size' => 40, - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Providing more room for apf options. -/******************************************************************************/ - ----# Changing field_options column to a larger field type... ----{ -$smcFunc['db_alter_table']('{db_prefix}custom_fields', array( - 'change' => array( - 'aim' => array( - 'name' => 'field_options', - 'null' => false, - 'type' => 'text', - 'default' => '' - ) - ) -)); ----} ----# - -/******************************************************************************/ ---- Adding extra columns to polls. -/******************************************************************************/ - ----# Adding reset poll timestamp and guest voters counter... ----{ -$smcFunc['db_alter_table']('{db_prefix}polls', array( - 'add' => array( - 'reset_poll' => array( - 'name' => 'reset_poll', - 'null' => false, - 'default' => 0, - 'type' => 'int', - 'size' => 10, - 'auto' => false, - ), - 'num_guest_voters' => array( - 'name' => 'num_guest_voters', - 'null' => false, - 'default' => 0, - 'type' => 'int', - 'size' => 10, - 'auto' => false, - ), - ) -)); ----} ----# - ----# Fixing guest voter tallys on existing polls... ----{ -$request = upgrade_query(" - SELECT p.id_poll, count(lp.id_member) as guest_voters - FROM {$db_prefix}polls AS p - LEFT JOIN {$db_prefix}log_polls AS lp ON (lp.id_poll = p.id_poll AND lp.id_member = 0) - WHERE lp.id_member = 0 - AND p.num_guest_voters = 0 - GROUP BY p.id_poll"); - -while ($request && $row = $smcFunc['db_fetch_assoc']($request)) - upgrade_query(" - UPDATE {$db_prefix}polls - SET num_guest_voters = ". $row['guest_voters']. " - WHERE id_poll = " . $row['id_poll'] . " - AND num_guest_voters = 0"); ----} ----# - -/******************************************************************************/ ---- Adding restore topic from recycle. -/******************************************************************************/ - ----# Adding restore from recycle feature... ----{ -$smcFunc['db_alter_table']('{db_prefix}topics', array( - 'add' => array( - 'id_previous_board' => array( - 'name' => 'id_previous_board', - 'null' => false, - 'default' => 0, - 'type' => 'smallint', - 'auto' => false, - ), - 'id_previous_topic' => array( - 'name' => 'id_previous_topic', - 'null' => false, - 'default' => 0, - 'type' => 'int', - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Fixing aim on members for longer nicks. -/******************************************************************************/ - ----# Changing 'aim' to varchar to allow using email... ----{ -$smcFunc['db_alter_table']('{db_prefix}members', array( - 'change' => array( - 'aim' => array( - 'name' => 'aim', - 'null' => false, - 'type' => 'varchar', - 'size' => 255, - 'default' => '' - ) - ) -)); ----} ----# - -/******************************************************************************/ ---- Allow for longer calendar event/holiday titles. -/******************************************************************************/ - ----# Changing event title column to a larger field type... ----{ -$smcFunc['db_alter_table']('{db_prefix}calendar', array( - 'change' => array( - 'title' => array( - 'name' => 'title', - 'null' => false, - 'type' => 'varchar', - 'size' => 255, - 'default' => '' - ) - ) -)); ----} ----# - ----# Changing holiday title column to a larger field type... ----{ -$smcFunc['db_alter_table']('{db_prefix}calendar_holidays', array( - 'change' => array( - 'title' => array( - 'name' => 'title', - 'null' => false, - 'type' => 'varchar', - 'size' => 255, - 'default' => '' - ) - ) -)); ----} ----# - -/******************************************************************************/ ---- Adding new indexes to the topics table. -/******************************************************************************/ - ----# Adding index member_started... -CREATE INDEX {$db_prefix}topics_member_started ON {$db_prefix}topics (id_member_started, id_board); ----# - ----# Adding index last_message_sticky... -CREATE INDEX {$db_prefix}topics_last_message_sticky ON {$db_prefix}topics (id_board, is_sticky, id_last_msg); ----# - ----# Adding index board_news... -CREATE INDEX {$db_prefix}topics_board_news ON {$db_prefix}topics (id_board, id_first_msg); ----# - -/******************************************************************************/ ---- Adding new indexes to members table. -/******************************************************************************/ - ----# Adding index on total_time_logged_in... -CREATE INDEX {$db_prefix}members_total_time_logged_in ON {$db_prefix}members (total_time_logged_in); ----# - ----# Adding index on id_theme... -CREATE INDEX {$db_prefix}members_id_theme ON {$db_prefix}members (id_theme); ----# - ----# Adding index on real_name... -CREATE INDEX {$db_prefix}members_real_name ON {$db_prefix}members (real_name); ----# - -/******************************************************************************/ ---- Adding new indexes to messages table. -/******************************************************************************/ - ----# Adding index id_member_msg... -CREATE INDEX {$db_prefix}messages_id_member_msg ON {$db_prefix}messages (id_member, approved, id_msg); ----# - ----# Adding index current_topic... -CREATE INDEX {$db_prefix}messages_current_topic ON {$db_prefix}messages (id_topic, id_msg, id_member, approved); ----# - ----# Adding index related_ip... -CREATE INDEX {$db_prefix}messages_related_ip ON {$db_prefix}messages (id_member, poster_ip, id_msg); ----# - -/******************************************************************************/ ---- Adding new indexes to attachments table. -/******************************************************************************/ - ----# Adding index on attachment_type... -CREATE INDEX {$db_prefix}attachments_attachment_type ON {$db_prefix}attachments (attachment_type); ----# - -/******************************************************************************/ ---- Dropping unnecessary indexes... -/******************************************************************************/ - ----# Removing index on hits... ----{ -$smcFunc['db_remove_index']($db_prefix . 'log_activity', $db_prefix . 'log_activity_hits'); ----} ----# - -/******************************************************************************/ ---- Adding new personal message setting. -/******************************************************************************/ - ----# Adding column that stores the PM receiving setting... ----{ -$smcFunc['db_alter_table']('{db_prefix}members', array( - 'add' => array( - 'pm_receive_from' => array( - 'name' => 'pm_receive_from', - 'null' => false, - 'type' => 'tinyint', - 'size' => 4, - 'default' => '1' - ) - ) -)); ----} ----# - ----# Enable the buddy and ignore lists if we have not done so thus far... ----{ - -// Don't do this if we've done this already. -if (empty($modSettings['dont_repeat_buddylists'])) -{ - // Make sure the pm_receive_from column has the right default value - early adoptors might have a '0' set here. - $smcFunc['db_alter_table']('{db_prefix}members', array( - 'change' => array( - 'pm_receive_from' => array( - 'name' => 'pm_receive_from', - 'null' => false, - 'type' => 'tinyint', - 'size' => 4, - 'default' => '1' - ) - ) - )); - - // Update previous ignore lists if they're set to ignore all. - upgrade_query(" - UPDATE {$db_prefix}members - SET pm_receive_from = 3, pm_ignore_list = '' - WHERE pm_ignore_list = '*'"); - - // Enable buddy and ignore lists. - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('enable_buddylist', '1')"); - - // Ignore posts made by ignored users by default, too. - upgrade_query(" - REPLACE INTO {$db_prefix}themes - (id_member, id_theme, variable, value) - VALUES - (-1, 1, 'posts_apply_ignore_list', '1')"); - - // Make sure not to skip this step next time we run this. - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('dont_repeat_buddylists', '1')"); -} - -// And yet, and yet... We might have a small hiccup here... -if (!empty($modSettings['dont_repeat_buddylists']) && !isset($modSettings['enable_buddylist'])) -{ - // Correct RC3 adopters setting here... - if (isset($modSettings['enable_buddylists'])) - { - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('enable_buddylist', '". $modSettings['enable_buddylists']. "')"); - } - else - { - // This should never happen :) - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('enable_buddylist', '1')"); - } -} ----} ----# - -/******************************************************************************/ ---- Adding settings for attachments and avatars. -/******************************************************************************/ - ----# Add new security settings for attachments and avatars... ----{ - -// Don't do this if we've done this already. -if (!isset($modSettings['attachment_image_reencode'])) -{ - // Enable image re-encoding by default. - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('attachment_image_reencode', '1')"); -} -if (!isset($modSettings['attachment_image_paranoid'])) -{ - // Disable draconic checks by default. - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('attachment_image_paranoid', '0')"); -} -if (!isset($modSettings['avatar_reencode'])) -{ - // Enable image re-encoding by default. - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('avatar_reencode', '1')"); -} -if (!isset($modSettings['avatar_paranoid'])) -{ - // Disable draconic checks by default. - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('avatar_paranoid', '0')"); -} - ----} ----# - ----# Add other attachment settings... ----{ -if (!isset($modSettings['attachment_thumb_png'])) -{ - // Make image attachment thumbnail as PNG by default. - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('attachment_thumb_png', '1')"); -} - ----} ----# - -/******************************************************************************/ ---- Installing new default theme... -/******************************************************************************/ - ----# Installing theme settings... ----{ -// This is Grudge's secret "I'm not a developer" theme install code - keep this quiet ;) - -// Firstly, I'm going out of my way to not do this twice! -if ((!isset($modSettings['smfVersion']) || $modSettings['smfVersion'] <= '2.0 RC2') && empty($modSettings['dont_repeat_theme_core'])) -{ - // Check it's not already here, just in case. - $theme_request = upgrade_query(" - SELECT id_theme - FROM {$db_prefix}themes - WHERE variable = 'theme_dir' - AND value LIKE '%core'"); - // Only do the upgrade if it doesn't find the theme already. - if ($smcFunc['db_num_rows']($theme_request) == 0) - { - // Try to get some settings from the current default theme. - $request = upgrade_query(" - SELECT t1.value AS theme_dir, t2.value AS theme_url, t3.value AS images_url - FROM {$db_prefix}themes AS t1, {$db_prefix}themes AS t2, {$db_prefix}themes AS t3 - WHERE t1.id_theme = 1 - AND t1.id_member = 0 - AND t1.variable = 'theme_dir' - AND t2.id_theme = 1 - AND t2.id_member = 0 - AND t2.variable = 'theme_url' - AND t3.id_theme = 1 - AND t3.id_member = 0 - AND t3.variable = 'images_url' - LIMIT 1"); - if ($smcFunc['db_num_rows']($request) != 0) - { - $curve = $smcFunc['db_fetch_assoc']($request); - - if (substr_count($curve['theme_dir'], 'default') === 1) - $core['theme_dir'] = strtr($curve['theme_dir'], array('default' => 'core')); - if (substr_count($curve['theme_url'], 'default') === 1) - $core['theme_url'] = strtr($curve['theme_url'], array('default' => 'core')); - if (substr_count($curve['images_url'], 'default') === 1) - $core['images_url'] = strtr($curve['images_url'], array('default' => 'core')); - } - $smcFunc['db_free_result']($request); - - if (!isset($core['theme_dir'])) - $core['theme_dir'] = addslashes($GLOBALS['boarddir']) . '/themes/core'; - if (!isset($core['theme_url'])) - $core['theme_url'] = $GLOBALS['boardurl'] . '/themes/core'; - if (!isset($core['images_url'])) - $core['images_url'] = $GLOBALS['boardurl'] . '/themes/core/images'; - - // Get an available id_theme first... - $request = upgrade_query(" - SELECT MAX(id_theme) + 1 - FROM {$db_prefix}themes"); - list ($id_core_theme) = $smcFunc['db_fetch_row']($request); - $smcFunc['db_free_result']($request); - - // Insert the core theme into the tables. - $smcFunc['db_insert']('ignore', - '{db_prefix}themes', - array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-255'), - array( - array(0, $id_core_theme, 'name', 'Core Theme'), - array(0, $id_core_theme, 'theme_url', $core['theme_url']), - array(0, $id_core_theme, 'images_url', $core['images_url']), - array(0, $id_core_theme, 'theme_dir', $core['theme_dir']) - ), - array() - ); - - // Update the name of the default theme in the database. - upgrade_query(" - UPDATE {$db_prefix}themes - SET value = 'SMF Default Theme - Curve' - WHERE id_theme = 1 - AND variable = 'name'"); - - $newSettings = array(); - // Now that we have the old theme details - switch anyone who used the default to it (Make sense?!) - if (!empty($modSettings['theme_default']) && $modSettings['theme_default'] == 1) - $newSettings[] = "('theme_default', $id_core_theme)"; - // Did guests use to use the default? - if (!empty($modSettings['theme_guests']) && $modSettings['theme_guests'] == 1) - $newSettings[] = "('theme_guests', $id_core_theme)"; - - // If known themes aren't set, let's just pick all themes available. - if (empty($modSettings['knownThemes'])) - { - $request = upgrade_query(" - SELECT DISTINCT id_theme - FROM {$db_prefix}themes"); - $themes = array(); - while ($row = $smcFunc['db_fetch_assoc']($request)) - $themes[] = $row['id_theme']; - $modSettings['knownThemes'] = implode(',', $themes); - upgrade_query(" - UPDATE {$db_prefix}settings - SET value = '$modSettings[knownThemes]' - WHERE variable = 'knownThemes'"); - } - - // Known themes. - $allThemes = explode(',', $modSettings['knownThemes']); - $allThemes[] = $id_core_theme; - $newSettings[] = "('knownThemes', '" . implode(',', $allThemes) . "')"; - - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - " . implode(', ', $newSettings)); - - // What about members? - upgrade_query(" - UPDATE {$db_prefix}members - SET id_theme = $id_core_theme - WHERE id_theme = 1"); - - // Boards? - upgrade_query(" - UPDATE {$db_prefix}boards - SET id_theme = $id_core_theme - WHERE id_theme = 1"); - - // The other themes used to use core as their base theme. - if (isset($core['theme_dir']) && isset($core['theme_url'])) - { - $coreBasedThemes = array_diff($allThemes, array(1)); - - // Exclude the themes that already have a base_theme_dir. - $request = upgrade_query(" - SELECT DISTINCT id_theme - FROM {$db_prefix}themes - WHERE variable = 'base_theme_dir'"); - while ($row = $smcFunc['db_fetch_assoc']($request)) - $coreBasedThemes = array_diff($coreBasedThemes, array($row['id_theme'])); - $smcFunc['db_free_result']($request); - - // Only base themes if there are templates that need a fall-back. - $insertRows = array(); - $request = upgrade_query(" - SELECT id_theme, value AS theme_dir - FROM {$db_prefix}themes - WHERE id_theme IN (" . implode(', ', $coreBasedThemes) . ") - AND id_member = 0 - AND variable = 'theme_dir'"); - while ($row = $smcFunc['db_fetch_assoc']($request)) - { - if (!file_exists($row['theme_dir'] . '/BoardIndex.template.php') || !file_exists($row['theme_dir'] . '/Display.template.php') || !file_exists($row['theme_dir'] . '/index.template.php') || !file_exists($row['theme_dir'] . '/MessageIndex.template.php') || !file_exists($row['theme_dir'] . '/Settings.template.php')) - { - $insertRows[] = "(0, $row[id_theme], 'base_theme_dir', '" . addslashes($core['theme_dir']) . "')"; - $insertRows[] = "(0, $row[id_theme], 'base_theme_url', '" . addslashes($core['theme_url']) . "')"; - } - } - $smcFunc['db_free_result']($request); - - if (!empty($insertRows)) - foreach ($insertRows as $insertRow) - upgrade_query(" - INSERT IGNORE INTO {$db_prefix}themes - (id_member, id_theme, variable, value) - VALUES - " . implode(', - ', $insertRow)); - } - } - $smcFunc['db_free_result']($theme_request); - - // This ain't running twice either - not with the risk of log_tables timing us all out! - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('dont_repeat_theme_core', '1')"); -} - ----} ----# - -/******************************************************************************/ ---- Installing new smileys sets... -/******************************************************************************/ - ----# Installing new smiley sets... ----{ -// Don't do this twice! -if (empty($modSettings['installed_new_smiley_sets_20'])) -{ - // First, the entries. - upgrade_query(" - UPDATE {$db_prefix}settings - SET value = CONCAT(value, ',aaron,akyhne') - WHERE variable = 'smiley_sets_known'"); - - // Second, the names. - upgrade_query(" - UPDATE {$db_prefix}settings - SET value = CONCAT(value, '\nAaron\nAkyhne') - WHERE variable = 'smiley_sets_names'"); - - // This ain't running twice either. - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('installed_new_smiley_sets_20', '1')"); -} ----} ----# - -/******************************************************************************/ ---- Adding extra columns to reported post comments -/******************************************************************************/ - ----# Adding email address and member ip columns... ----{ -$smcFunc['db_alter_table']('{db_prefix}log_reported_comments', array( - 'add' => array( - 'email_address' => array( - 'name' => 'email_address', - 'null' => false, - 'default' => '', - 'type' => 'varchar', - 'size' => 255, - 'auto' => false, - ), - 'member_ip' => array( - 'name' => 'member_ip', - 'null' => false, - 'default' => '', - 'type' => 'varchar', - 'size' => 255, - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Adjusting group types. -/******************************************************************************/ - ----# Fixing the group types. ----{ -// Get the admin group type. -$request = upgrade_query(" - SELECT group_type - FROM {$db_prefix}membergroups - WHERE id_group = 1 - LIMIT 1"); -list ($admin_group_type) = $smcFunc['db_fetch_row']($request); -$smcFunc['db_free_result']($request); - -// Not protected means we haven't updated yet! -if ($admin_group_type != 1) -{ - // Increase by one. - upgrade_query(" - UPDATE {$db_prefix}membergroups - SET group_type = group_type + 1 - WHERE group_type > 0"); -} ----} ----# - ----# Changing the group type for Administrator group. -UPDATE {$db_prefix}membergroups -SET group_type = 1 -WHERE id_group = 1; ----# - -/******************************************************************************/ ---- Adjusting calendar maximum year. -/******************************************************************************/ - ----# Adjusting calendar maximum year. ----{ -if (!isset($modSettings['cal_maxyear']) || $modSettings['cal_maxyear'] == '2010') -{ - upgrade_query(" - REPLACE INTO {$db_prefix}settings - (variable, value) - VALUES - ('cal_maxyear', '2020')"); -} ----} ----# \ No newline at end of file diff --git a/install/upgrade_2-1_sqlite.sql b/install/upgrade_2-1_sqlite.sql deleted file mode 100644 index f6cd4f56be..0000000000 --- a/install/upgrade_2-1_sqlite.sql +++ /dev/null @@ -1,336 +0,0 @@ -/* ATTENTION: You don't need to run or use this file! The upgrade.php script does everything for you! */ - -/******************************************************************************/ ---- Adding new settings... -/******************************************************************************/ - ----# Adding login history... -CREATE TABLE IF NOT EXISTS {$db_prefix}member_logins ( - id_login integer NOT NULL auto_increment, - id_member integer NOT NULL, - time integer NOT NULL, - ip varchar(255) NOT NULL default '', - ip2 varchar(255) NOT NULL default '', - PRIMARY KEY id_login(id_login) - KEY id_member (id_member) - KEY time (time) -); ----# - ----# Copying the current package backup setting... ----{ -if (!isset($modSettings['package_make_full_backups']) && isset($modSettings['package_make_backups'])) - upgrade_query(" - INSERT INTO {$db_prefix}settings - (variable, value) - VALUES - ('package_make_full_backups', '" . $modSettings['package_make_backups'] . "')"); ----} ----# - -/******************************************************************************/ ---- Updating legacy attachments... -/******************************************************************************/ - ----# Converting legacy attachments. ----{ -$request = upgrade_query(" - SELECT MAX(id_attach) - FROM {$db_prefix}attachments"); -list ($step_progress['total']) = $smcFunc['db_fetch_row']($request); -$smcFunc['db_free_result']($request); - -$_GET['a'] = isset($_GET['a']) ? (int) $_GET['a'] : 0; -$step_progress['name'] = 'Converting legacy attachments'; -$step_progress['current'] = $_GET['a']; - -// We may be using multiple attachment directories. -if (!empty($modSettings['currentAttachmentUploadDir']) && !is_array($modSettings['attachmentUploadDir'])) - $modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']); - -$is_done = false; -while (!$is_done) -{ - nextSubStep($substep); - - $request = upgrade_query(" - SELECT id_attach, id_folder, filename, file_hash - FROM {$db_prefix}attachments - WHERE file_hash = '' - LIMIT $_GET[a], 100"); - - // Finished? - if ($smcFunc['db_num_rows']($request) == 0) - $is_done = true; - - while ($row = $smcFunc['db_fetch_assoc']($request)) - { - // The current folder. - $current_folder = !empty($modSettings['currentAttachmentUploadDir']) ? $modSettings['attachmentUploadDir'][$row['id_folder']] : $modSettings['attachmentUploadDir']; - - // The old location of the file. - $old_location = getLegacyAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder']); - - // The new file name. - $file_hash = getAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder'], true); - - // And we try to move it. - rename($old_location, $current_folder . '/' . $row['id_attach'] . '_' . $file_hash); - - // Only update thif if it was successful. - if (file_exists($current_folder . '/' . $row['id_attach'] . '_' . $file_hash) && !file_exists($old_location)) - upgrade_query(" - UPDATE {$db_prefix}attachments - SET file_hash = '$file_hash' - WHERE id_attach = $row[id_attach]"); - } - $smcFunc['db_free_result']($request); - - $_GET['a'] += 100; - $step_progress['current'] = $_GET['a']; -} - -unset($_GET['a']); ----} ----# - -/******************************************************************************/ ---- Adding support for IPv6... -/******************************************************************************/ - ----# Adding new columns to ban items... -ALTER TABLE {$db_prefix}ban_items -ADD COLUMN ip_low5 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_high5 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_low6 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_high6 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_low7 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_high7 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_low8 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_high8 smallint(255) unsigned NOT NULL DEFAULT '0'; ----# - ----# Changing existing columns to ban items... -ALTER TABLE {$db_prefix}ban_items -CHANGE ip_low1 ip_low1 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_high1 ip_high1 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_low2 ip_low2 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_high2 ip_high2 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_low3 ip_low3 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_high3 ip_high3 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_low4 ip_low4 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_high4 ip_high4 smallint(255) unsigned NOT NULL DEFAULT '0'; ----# - -/******************************************************************************/ ---- Adding support for tag in package manager -/******************************************************************************/ ----# Adding new columns to log_packages .. -ALTER TABLE {$db_prefix}log_packages -ADD COLUMN credits varchar(255) NOT NULL DEFAULT ''; ----# - -/******************************************************************************/ ---- Adding more space for session ids -/******************************************************************************/ ----# Altering the session_id columns... -ALTER TABLE {$db_prefix}log_online -CHANGE `session` `session` varchar(64) NOT NULL DEFAULT ''; - -ALTER TABLE {$db_prefix}log_errors -CHANGE `session` `session` char(64) NOT NULL default ' '; - -ALTER TABLE {$db_prefix}sessions -CHANGE `session_id` `session_id` char(64) NOT NULL; ----# - -/******************************************************************************/ ---- Adding new columns for MOVED topic updates -/******************************************************************************/ ----# Adding new custom fields columns. ----{ -$smcFunc['db_alter_table']('{db_prefix}topics', array( - 'add' => array( - 'redirect_expires' => array( - 'name' => 'redirect_expires', - 'null' => false, - 'default' => '0', - 'type' => 'int', - 'auto' => false, - ), - ) -)); -$smcFunc['db_alter_table']('{db_prefix}topics', array( - 'add' => array( - 'id_redirect_topic' => array( - 'name' => 'id_redirect_topic', - 'null' => false, - 'default' => '0', - 'type' => 'int', - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Adding new scheduled tasks -/******************************************************************************/ ----# Adding new scheduled tasks -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 120, 1, 'd', 0, 'remove_temp_attachments'); -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 180, 1, 'd', 0, 'remove_topic_redirect'); -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 240, 1, 'd', 0, 'remove_old_drafts'); -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 0, 6, 'h', 0, 'remove_old_followups'); ----# - -/******************************************************************************/ ---- Adding support for deny boards access -/******************************************************************************/ ----# Adding new columns to boards... ----{ -$smcFunc['db_alter_table']('{db_prefix}boards', array( - 'add' => array( - 'deny_member_groups' => array( - 'name' => 'deny_member_groups', - 'null' => false, - 'default' => '', - 'type' => varchar, - 'size' => 255, - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Adding support for topic disregard -/******************************************************************************/ ----# Adding new columns to log_topics... ----{ -$smcFunc['db_alter_table']('{db_prefix}log_topics', array( - 'add' => array( - 'disregarded' => array( - 'name' => 'disregarded', - 'null' => false, - 'default' => 0, - 'type' => 'int', - 'auto' => false, - ), - ) -)); - -UPDATE {$db_prefix}log_topics -SET disregarded = 0; - -INSERT INTO {$db_prefix}settings - (variable, value) -VALUES - ('enable_disregard', 0); ----} ----# - -/******************************************************************************/ ---- Name changes -/******************************************************************************/ ----# Altering the membergroup stars to icons ----{ -upgrade_query(" - ALTER TABLE {$db_prefix}membergroups - CHANGE `stars` `icons` varchar(255) NOT NULL DEFAULT ''"); ----} ----# - -/******************************************************************************/ ---- Adding support for drafts -/******************************************************************************/ ----# Creating drafts table. -CREATE TABLE {$db_prefix}user_drafts ( - id_draft int unsigned NOT NULL auto_increment, - id_topic int unsigned NOT NULL default '0', - id_board smallint unsigned NOT NULL default '0', - id_reply int unsigned NOT NULL default '0', - type smallint NOT NULL default '0', - poster_time int unsigned NOT NULL default '0', - id_member int unsigned NOT NULL default '0', - subject varchar(255) NOT NULL default '', - smileys_enabled smallint NOT NULL default '1', - body text NOT NULL, - icon varchar(16) NOT NULL default 'xx', - locked smallint NOT NULL default '0', - is_sticky smallint NOT NULL default '0', - to_list varchar(255) NOT NULL default '', - outbox smallint NOT NULL default '0', - PRIMARY KEY (id_draft) -); ----# - ----# Adding draft permissions... ----{ -// We cannot do this twice -// @todo this won't work when you upgrade from smf -if (@$modSettings['ourVersion'] < '1.0') -{ - // Anyone who can currently post unapproved topics we assume can create drafts as well ... - $request = upgrade_query(" - SELECT id_group, id_board, add_deny, permission - FROM {$db_prefix}board_permissions - WHERE permission = 'post_unapproved_topics'"); - $inserts = array(); - while ($row = $smcFunc['db_fetch_assoc']($request)) - { - $inserts[] = "($row[id_group], $row[id_board], 'post_draft', $row[add_deny])"; - $inserts[] = "($row[id_group], $row[id_board], 'post_autosave_draft', $row[add_deny])"; - } - $smcFunc['db_free_result']($request); - - if (!empty($inserts)) - upgrade_query(" - INSERT IGNORE INTO {$db_prefix}board_permissions - (id_group, id_board, permission, add_deny) - VALUES - " . implode(',', $inserts)); - - // Next we find people who can send PMs, and assume they can save pm_drafts as well - $request = upgrade_query(" - SELECT id_group, add_deny, permission - FROM {$db_prefix}permissions - WHERE permission = 'pm_send'"); - $inserts = array(); - while ($row = $smcFunc['db_fetch_assoc']($request)) - { - $inserts[] = "($row[id_group], 'pm_draft', $row[add_deny])"; - $inserts[] = "($row[id_group], 'pm_autosave_draft', $row[add_deny])"; - } - $smcFunc['db_free_result']($request); - - if (!empty($inserts)) - upgrade_query(" - INSERT IGNORE INTO {$db_prefix}permissions - (id_group, permission, add_deny) - VALUES - " . implode(',', $inserts)); -} ----} ----# - -/******************************************************************************/ ---- Cleaning up integration hooks -/******************************************************************************/ ----# -DELETE FROM {$db_prefix}settings -WHERE variable LIKE 'integrate_%'; ----# \ No newline at end of file diff --git a/install/upgrade_elk_1-0_sqlite.sql b/install/upgrade_elk_1-0_sqlite.sql deleted file mode 100644 index 371e91de5c..0000000000 --- a/install/upgrade_elk_1-0_sqlite.sql +++ /dev/null @@ -1,682 +0,0 @@ -/* ATTENTION: You don't need to run or use this file! The upgrade.php script does everything for you! */ - -/******************************************************************************/ ---- Adding new settings... -/******************************************************************************/ - ----# Adding login history... -CREATE TABLE IF NOT EXISTS {$db_prefix}member_logins ( - id_login integer NOT NULL auto_increment, - id_member integer NOT NULL, - time integer NOT NULL, - ip varchar(255) NOT NULL default '', - ip2 varchar(255) NOT NULL default '', - PRIMARY KEY id_login(id_login) - KEY id_member (id_member) - KEY time (time) -); ----# - ----# Copying the current package backup setting... ----{ -if (!isset($modSettings['package_make_full_backups']) && isset($modSettings['package_make_backups'])) - upgrade_query(" - INSERT INTO {$db_prefix}settings - (variable, value) - VALUES - ('package_make_full_backups', '" . $modSettings['package_make_backups'] . "')"); ----} ----# - ----# Adding new settings ... -INSERT IGNORE INTO {$db_prefix}settings - (variable, value) -VALUES - ('avatar_default', '0'); -INSERT IGNORE INTO {$db_prefix}settings - (variable, value) -VALUES - ('gravatar_rating', 'g'); -INSERT IGNORE INTO {$db_prefix}settings - (variable, value) -VALUES - ('admin_session_lifetime', 10); -INSERT IGNORE INTO {$db_prefix}settings - (variable, value) -VALUES - ('xmlnews_limit', 5); -INSERT IGNORE INTO {$db_prefix}settings - (variable, value) -VALUES - ('visual_verification_num_chars', '6'); -INSERT IGNORE INTO {$db_prefix}settings - (variable, value) -VALUES - ('enable_disregard', 0); -INSERT IGNORE INTO {$db_prefix}settings - (variable, value) -VALUES - ('jquery_source', 'local'); ----# - -/******************************************************************************/ ---- Updating legacy attachments... -/******************************************************************************/ - ----# Converting legacy attachments. ----{ -$request = upgrade_query(" - SELECT MAX(id_attach) - FROM {$db_prefix}attachments"); -list ($step_progress['total']) = $smcFunc['db_fetch_row']($request); -$smcFunc['db_free_result']($request); - -$_GET['a'] = isset($_GET['a']) ? (int) $_GET['a'] : 0; -$step_progress['name'] = 'Converting legacy attachments'; -$step_progress['current'] = $_GET['a']; - -// We may be using multiple attachment directories. -if (!empty($modSettings['currentAttachmentUploadDir']) && !is_array($modSettings['attachmentUploadDir'])) - $modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']); - -$is_done = false; -while (!$is_done) -{ - nextSubStep($substep); - - $request = upgrade_query(" - SELECT id_attach, id_folder, filename, file_hash - FROM {$db_prefix}attachments - WHERE file_hash = '' - LIMIT $_GET[a], 100"); - - // Finished? - if ($smcFunc['db_num_rows']($request) == 0) - $is_done = true; - - while ($row = $smcFunc['db_fetch_assoc']($request)) - { - // The current folder. - $current_folder = !empty($modSettings['currentAttachmentUploadDir']) ? $modSettings['attachmentUploadDir'][$row['id_folder']] : $modSettings['attachmentUploadDir']; - - // The old location of the file. - $old_location = getLegacyAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder']); - - // The new file name. - $file_hash = getAttachmentFilename($row['filename'], $row['id_attach'], $row['id_folder'], true); - - // And we try to move it. - rename($old_location, $current_folder . '/' . $row['id_attach'] . '_' . $file_hash); - - // Only update thif if it was successful. - if (file_exists($current_folder . '/' . $row['id_attach'] . '_' . $file_hash) && !file_exists($old_location)) - upgrade_query(" - UPDATE {$db_prefix}attachments - SET file_hash = '$file_hash' - WHERE id_attach = $row[id_attach]"); - } - $smcFunc['db_free_result']($request); - - $_GET['a'] += 100; - $step_progress['current'] = $_GET['a']; -} - -unset($_GET['a']); ----} ----# - -/******************************************************************************/ ---- Adding support for IPv6... -/******************************************************************************/ - ----# Adding new columns to ban items... -ALTER TABLE {$db_prefix}ban_items -ADD COLUMN ip_low5 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_high5 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_low6 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_high6 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_low7 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_high7 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_low8 smallint(255) unsigned NOT NULL DEFAULT '0', -ADD COLUMN ip_high8 smallint(255) unsigned NOT NULL DEFAULT '0'; ----# - ----# Changing existing columns to ban items... -ALTER TABLE {$db_prefix}ban_items -CHANGE ip_low1 ip_low1 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_high1 ip_high1 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_low2 ip_low2 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_high2 ip_high2 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_low3 ip_low3 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_high3 ip_high3 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_low4 ip_low4 smallint(255) unsigned NOT NULL DEFAULT '0', -CHANGE ip_high4 ip_high4 smallint(255) unsigned NOT NULL DEFAULT '0'; ----# - -/******************************************************************************/ ---- Adding support for tag in package manager -/******************************************************************************/ ----# Adding new columns to log_packages .. -ALTER TABLE {$db_prefix}log_packages -ADD COLUMN credits varchar(255) NOT NULL DEFAULT ''; ----# - -/******************************************************************************/ ---- Adding more space for session ids -/******************************************************************************/ ----# Altering the session_id columns... -ALTER TABLE {$db_prefix}log_online -CHANGE `session` `session` varchar(64) NOT NULL DEFAULT ''; - -ALTER TABLE {$db_prefix}log_errors -CHANGE `session` `session` char(64) NOT NULL default ' '; - -ALTER TABLE {$db_prefix}sessions -CHANGE `session_id` `session_id` char(64) NOT NULL; ----# - -/******************************************************************************/ ---- Adding new columns for MOVED topic updates -/******************************************************************************/ ----# Adding new custom fields columns. ----{ -$smcFunc['db_alter_table']('{db_prefix}topics', array( - 'add' => array( - 'redirect_expires' => array( - 'name' => 'redirect_expires', - 'null' => false, - 'default' => '0', - 'type' => 'int', - 'auto' => false, - ), - ) -)); -$smcFunc['db_alter_table']('{db_prefix}topics', array( - 'add' => array( - 'id_redirect_topic' => array( - 'name' => 'id_redirect_topic', - 'null' => false, - 'default' => '0', - 'type' => 'int', - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Adding new scheduled tasks -/******************************************************************************/ ----# Adding new scheduled tasks -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 120, 1, 'd', 0, 'remove_temp_attachments'); -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 180, 1, 'd', 0, 'remove_topic_redirect'); -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 240, 1, 'd', 0, 'remove_old_drafts'); -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 0, 6, 'h', 0, 'remove_old_followups'); -INSERT INTO {$db_prefix}scheduled_tasks - (next_time, time_offset, time_regularity, time_unit, disabled, task) -VALUES - (0, 360, 10, 'm', 0, 'maillist_fetch_IMAP'); ----# - -/******************************************************************************/ ---- Adding support for deny boards access -/******************************************************************************/ ----# Adding new columns to boards... ----{ -$smcFunc['db_alter_table']('{db_prefix}boards', array( - 'add' => array( - 'deny_member_groups' => array( - 'name' => 'deny_member_groups', - 'null' => false, - 'default' => '', - 'type' => varchar, - 'size' => 255, - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Adding support for topic disregard -/******************************************************************************/ ----# Adding new columns to log_topics... ----{ -$smcFunc['db_alter_table']('{db_prefix}log_topics', array( - 'add' => array( - 'disregarded' => array( - 'name' => 'disregarded', - 'null' => false, - 'default' => 0, - 'type' => 'int', - 'auto' => false, - ), - ) -)); - -UPDATE {$db_prefix}log_topics -SET disregarded = 0; ----} ----# - -/******************************************************************************/ ---- Adding support for custom profile fields on memberlist -/******************************************************************************/ ----# Adding new columns to boards... ----{ -$smcFunc['db_alter_table']('{db_prefix}custom_fields', array( - 'add' => array( - 'show_memberlist' => array( - 'name' => 'show_memberlist', - 'null' => false, - 'default' => 0, - 'type' => 'smallint', - 'auto' => false, - ), - ) -)); ----} ----# - -/******************************************************************************/ ---- Name changes -/******************************************************************************/ ----# Altering the membergroup stars to icons ----{ -upgrade_query(" - ALTER TABLE {$db_prefix}membergroups - CHANGE `stars` `icons` varchar(255) NOT NULL DEFAULT ''"); ----} ----# - -/******************************************************************************/ ---- Adding support for drafts -/******************************************************************************/ ----# Creating drafts table. -CREATE TABLE IF NOT EXISTS {$db_prefix}user_drafts ( - id_draft int unsigned NOT NULL auto_increment, - id_topic int unsigned NOT NULL default '0', - id_board smallint unsigned NOT NULL default '0', - id_reply int unsigned NOT NULL default '0', - type smallint NOT NULL default '0', - poster_time int unsigned NOT NULL default '0', - id_member int unsigned NOT NULL default '0', - subject varchar(255) NOT NULL default '', - smileys_enabled smallint NOT NULL default '1', - body text NOT NULL, - icon varchar(16) NOT NULL default 'xx', - locked smallint NOT NULL default '0', - is_sticky smallint NOT NULL default '0', - to_list varchar(255) NOT NULL default '', - outbox smallint NOT NULL default '0', - PRIMARY KEY (id_draft) -); ----# - ----# Adding draft permissions... ----{ -// We cannot do this twice -if (@$modSettings['smfVersion'] < '2.1') -{ - // Anyone who can currently post unapproved topics we assume can create drafts as well ... - $request = upgrade_query(" - SELECT id_group, id_board, add_deny, permission - FROM {$db_prefix}board_permissions - WHERE permission = 'post_unapproved_topics'"); - $inserts = array(); - while ($row = $smcFunc['db_fetch_assoc']($request)) - { - $inserts[] = "($row[id_group], $row[id_board], 'post_draft', $row[add_deny])"; - $inserts[] = "($row[id_group], $row[id_board], 'post_autosave_draft', $row[add_deny])"; - } - $smcFunc['db_free_result']($request); - - if (!empty($inserts)) - upgrade_query(" - INSERT IGNORE INTO {$db_prefix}board_permissions - (id_group, id_board, permission, add_deny) - VALUES - " . implode(',', $inserts)); - - // Next we find people who can send PMs, and assume they can save pm_drafts as well - $request = upgrade_query(" - SELECT id_group, add_deny, permission - FROM {$db_prefix}permissions - WHERE permission = 'pm_send'"); - $inserts = array(); - while ($row = $smcFunc['db_fetch_assoc']($request)) - { - $inserts[] = "($row[id_group], 'pm_draft', $row[add_deny])"; - $inserts[] = "($row[id_group], 'pm_autosave_draft', $row[add_deny])"; - } - $smcFunc['db_free_result']($request); - - if (!empty($inserts)) - upgrade_query(" - INSERT IGNORE INTO {$db_prefix}permissions - (id_group, permission, add_deny) - VALUES - " . implode(',', $inserts)); -} ----} ----# - -/******************************************************************************/ ---- Messenger fields -/******************************************************************************/ ----# Insert new fields -INSERT INTO `{$db_prefix}custom_fields` - (`col_name`, `field_name`, `field_desc`, `field_type`, `field_length`, `field_options`, `mask`, `show_reg`, `show_display`, `show_profile`, `private`, `active`, `bbc`, `can_search`, `default_value`, `enclose`, `placement`) -VALUES - ('cust_aim', 'AOL Instant Messenger', 'This is your AOL Instant Messenger nickname.', 'text', 50, '', 'regex~[a-z][0-9a-z.-]{1,31}~i', 0, 1, 'forumprofile', 0, 1, 0, 0, '', 'AIM - {INPUT}', 1); -INSERT INTO `{$db_prefix}custom_fields` - (`col_name`, `field_name`, `field_desc`, `field_type`, `field_length`, `field_options`, `mask`, `show_reg`, `show_display`, `show_profile`, `private`, `active`, `bbc`, `can_search`, `default_value`, `enclose`, `placement`) -VALUES - ('cust_icq', 'ICQ', 'This is your ICQ number.', 'text', 12, '', 'regex~[1-9][0-9]{4,9}~i', 0, 1, 'forumprofile', 0, 1, 0, 0, '', 'ICQ - {INPUT}', 1); -INSERT INTO `{$db_prefix}custom_fields` - (`col_name`, `field_name`, `field_desc`, `field_type`, `field_length`, `field_options`, `mask`, `show_reg`, `show_display`, `show_profile`, `private`, `active`, `bbc`, `can_search`, `default_value`, `enclose`, `placement`) -VALUES - ('cust_msn', 'MSN/Live', 'Your Live Messenger email address', 'text', 50, '', 'email', 0, 1, 'forumprofile', 0, 1, 0, 0, '', 'Live - {INPUT}', 1); -INSERT INTO `{$db_prefix}custom_fields` - (`col_name`, `field_name`, `field_desc`, `field_type`, `field_length`, `field_options`, `mask`, `show_reg`, `show_display`, `show_profile`, `private`, `active`, `bbc`, `can_search`, `default_value`, `enclose`, `placement`) -VALUES - ('cust_yim', 'Yahoo! Messenger', 'This is your Yahoo! Instant Messenger nickname.', 'text', 50, '', 'email', 0, 1, 'forumprofile', 0, 1, 0, 0, '', 'Yahoo! Messenger - {INPUT}', 1); ----# - ----# Move existing values... ----{ -// We cannot do this twice -// @todo this won't work when you upgrade from smf -if (@$modSettings['elkVersion'] < '1.0') -{ - $request = upgrade_query(" - SELECT id_member, aim, icq, msn, yim - FROM {$db_prefix}members"); - $inserts = array(); - while ($row = mysql_fetch_assoc($request)) - { - if (!empty($row[aim])) - $inserts[] = "($row[id_member], -1, 'cust_aim', $row[aim])"; - - if (!empty($row[icq])) - $inserts[] = "($row[id_member], -1, 'cust_icq', $row[icq])"; - - if (!empty($row[msn])) - $inserts[] = "($row[id_member], -1, 'cust_msn', $row[msn])"; - - if (!empty($row[yim])) - $inserts[] = "($row[id_member], -1, 'cust_yim', $row[yim])"; - } - mysql_free_result($request); - - if (!empty($inserts)) - upgrade_query(" - INSERT INTO {$db_prefix}themes - (id_member, id_theme, variable, value) - VALUES - " . implode(',', $inserts)); -} ----} ----# - ----# Drop the old cols -ALTER TABLE `{$db_prefix}members` - DROP `icq`, - DROP `aim`, - DROP `yim`, - DROP `msn`; ----# - ----# Adding gravatar permissions... ----{ -// Don't do this twice! -if (@$modSettings['elkVersion'] < '1.0') -{ - // Try find people who probably can use remote avatars. - $request = upgrade_query(" - SELECT id_group, add_deny, permission - FROM {$db_prefix}permissions - WHERE permission = 'profile_remote_avatar'"); - $inserts = array(); - while ($row = mysql_fetch_assoc($request)) - { - $inserts[] = "($row[id_group], 'profile_gravatar', $row[add_deny])"; - } - mysql_free_result($request); - - if (!empty($inserts)) - upgrade_query(" - INSERT IGNORE INTO {$db_prefix}permissions - (id_group, permission, add_deny) - VALUES - " . implode(',', $inserts)); -} ----} ----# - -/******************************************************************************/ ---- Updating URLs information. -/******************************************************************************/ - ----# Changing URL to Elk package server... -UPDATE {$db_prefix}package_servers -SET url = 'https://github.com/elkarte/addons/tree/master/packages' -WHERE url = 'http://custom.simplemachines.org/packages/mods'; ----# - -/******************************************************************************/ ---- Adding follow-up support. -/******************************************************************************/ - ----# Creating follow-up table... -CREATE TABLE IF NOT EXISTS {$db_prefix}follow_ups ( - follow_up int NOT NULL default '0', - derived_from int NOT NULL default '0', - PRIMARY KEY (follow_up, derived_from) -); ----# - -/******************************************************************************/ ---- Updating antispam questions. -/******************************************************************************/ - ----# Creating antispam questions table... -CREATE TABLE IF NOT EXISTS {$db_prefix}antispam_questions ( - id_question tinyint(4) unsigned NOT NULL auto_increment, - question text NOT NULL default '', - answer text NOT NULL default '', - language varchar(50) NOT NULL default '', - PRIMARY KEY (id_question), - KEY language (language(30)) -) ENGINE=MyISAM; ----# - ----# Move existing values... ----{ -global $language; - -$request = upgrade_query(" - SELECT id_comment, recipient_name as answer, body as question - FROM {$db_prefix}log_comments - WHERE comment_type = 'ver_test'"); -if (mysql_num_rows($request) != 0) -{ - $values = array(); - $id_comments = array(); - while ($row = mysql_fetch_assoc($request)) - { - upgrade_query(" - INSERT INTO {$db_prefix}antispam_questions - (answer, question, language) - VALUES - ('" . serialize(array($row['answer'])) . "', '" . $row['question'] . "', '" . $language . "')"); - upgrade_query(" - DELETE FROM {$db_prefix}log_comments - WHERE id_comment = " . $row['id_comment'] . " - LIMIT 1"); - } -} ----} ----# - -/******************************************************************************/ ---- Messenger fields -/******************************************************************************/ ----# Insert new fields -INSERT INTO `{$db_prefix}custom_fields` - (`col_name`, `field_name`, `field_desc`, `field_type`, `field_length`, `field_options`, `mask`, `show_reg`, `show_display`, `show_profile`, `private`, `active`, `bbc`, `can_search`, `default_value`, `enclose`, `placement`) -VALUES - ('cust_aim', 'AOL Instant Messenger', 'This is your AOL Instant Messenger nickname.', 'text', 50, '', 'regex~[a-z][0-9a-z.-]{1,31}~i', 0, 1, 'forumprofile', 0, 1, 0, 0, '', 'AIM - {INPUT}', 1), - ('cust_icq', 'ICQ', 'This is your ICQ number.', 'text', 12, '', 'regex~[1-9][0-9]{4,9}~i', 0, 1, 'forumprofile', 0, 1, 0, 0, '', 'ICQ - {INPUT}', 1), - ('cust_msn', 'MSN/Live', 'Your Live Messenger email address', 'text', 50, '', 'email', 0, 1, 'forumprofile', 0, 1, 0, 0, '', 'Live - {INPUT}', 1), - ('cust_yim', 'Yahoo! Messenger', 'This is your Yahoo! Instant Messenger nickname.', 'text', 50, '', 'email', 0, 1, 'forumprofile', 0, 1, 0, 0, '', 'Yahoo! Messenger - {INPUT}', 1); ----# - ----# Move existing values... ----{ -// We cannot do this twice -// @todo this won't work when you upgrade from smf -if (@$modSettings['ourVersion'] < '1.0') -{ - $request = upgrade_query(" - SELECT id_member, aim, icq, msn, yim - FROM {$db_prefix}members"); - $inserts = array(); - while ($row = mysql_fetch_assoc($request)) - { - if (!empty($row[aim])) - $inserts[] = "($row[id_member], -1, 'cust_aim', $row[aim])"; - - if (!empty($row[icq])) - $inserts[] = "($row[id_member], -1, 'cust_icq', $row[icq])"; - - if (!empty($row[msn])) - $inserts[] = "($row[id_member], -1, 'cust_msn', $row[msn])"; - - if (!empty($row[yim])) - $inserts[] = "($row[id_member], -1, 'cust_yim', $row[yim])"; - } - mysql_free_result($request); - - if (!empty($inserts)) - upgrade_query(" - INSERT INTO {$db_prefix}themes - (id_member, id_theme, variable, value) - VALUES - " . implode(',', $inserts)); -} ----} ----# - ----# Drop the old cols -ALTER TABLE `{$db_prefix}members` - DROP `icq`, - DROP `aim`, - DROP `yim`, - DROP `msn`; ----# - -/******************************************************************************/ ---- Adding support for Maillist -/******************************************************************************/ ----# Creating postby_emails table -CREATE TABLE IF NOT EXISTS {$db_prefix}postby_emails ( - id_email varchar(50) NOT NULL, - time_sent int NOT NULL default '0', - email_to varchar(50) NOT NULL, - PRIMARY KEY (id_email) -); ----# - ----# Creating postby_emails_error table -CREATE TABLE IF NOT EXISTS {$db_prefix}postby_emails_error ( - id_email int NOT NULL auto_increment, - error varchar(255) NOT NULL default '', - data_id varchar(255) NOT NULL default '0', - subject varchar(255) NOT NULL default '', - id_message int NOT NULL default '0', - id_board smallint NOT NULL default '0', - email_from varchar(50) NOT NULL default '', - message_type char(10) NOT NULL default '', - message text NOT NULL default '', - PRIMARY KEY (id_email), -); ----# - ----# Creating postby_emails_filters table -CREATE TABLE IF NOT EXISTS {$db_prefix}postby_emails_filters ( - id_filter int NOT NULL auto_increment, - filter_style char(5) NOT NULL default '', - filter_type varchar(255) NOT NULL default '', - filter_to varchar(255) NOT NULL default '', - filter_from varchar(255) NOT NULL default '', - filter_name varchar(255) NOT NULL default '', - PRIMARY KEY (id_filter), -); ----# - ----# Adding new columns to log_activity... -ALTER TABLE {$db_prefix}log_activity -ADD COLUMN pm smallint unsigned NOT NULL DEFAULT '0', -ADD COLUMN email smallint unsigned NOT NULL DEFAULT '0'; ----# - ----# Adding new columns to mail_queue... -ALTER TABLE {$db_prefix}mail_queue -ADD COLUMN message_id int NOT NULL DEFAULT '0'; ----# - ----# Updating board profiles... -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 1, 'postby_email'); -INSERT INTO {$db_prefix}board_permissions (id_group, id_profile, permission) VALUES (0, 2, 'postby_email'); ----# -/******************************************************************************/ ---- Adding likes support. -/******************************************************************************/ - ----# Creating likes log table... -CREATE TABLE IF NOT EXISTS {$db_prefix}log_likes ( - action char(1) NOT NULL default '0', - id_target int NOT NULL default '0', - id_member int NOT NULL default '0', - log_time int NOT NULL default '0', - PRIMARY KEY (id_target, id_member) -); ----# - ----# Creating likes log index ... -CREATE INDEX {$db_prefix}log_likes_log_time ON {$db_prefix}log_likes (log_time); ----# - ----# Creating likes message table... -CREATE TABLE IF NOT EXISTS {$db_prefix}message_likes ( - id_member int NOT NULL default '0', - id_msg int NOT NULL default '0', - PRIMARY KEY (id_msg, id_member) -); ----# - ----# Adding new columns to topics... -ALTER TABLE {$db_prefix}topics -ADD COLUMN num_likes int NOT NULL default '0'; ----# - ----# Adding new columns to members... -ALTER TABLE {$db_prefix}members -ADD COLUMN likes_given int NOT NULL default '0', -ADD COLUMN likes_received int NOT NULL default '0'; ----# diff --git a/sources/database/Db-sqlite.class.php b/sources/database/Db-sqlite.class.php deleted file mode 100644 index 54c19c45d1..0000000000 --- a/sources/database/Db-sqlite.class.php +++ /dev/null @@ -1,1302 +0,0 @@ -error_backtrace('Invalid value inserted or no type specified.', '', E_USER_ERROR, __FILE__, __LINE__); - - if (!isset($values[$matches[2]])) - $this->error_backtrace('The database value you\'re trying to insert does not exist: ' . htmlspecialchars($matches[2]), '', E_USER_ERROR, __FILE__, __LINE__); - - $replacement = $values[$matches[2]]; - - switch ($matches[1]) - { - case 'int': - if (!is_numeric($replacement) || (string) $replacement !== (string) (int) $replacement) - $this->error_backtrace('Wrong value type sent to the database. Integer expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); - return (string) (int) $replacement; - break; - - case 'string': - case 'text': - return sprintf('\'%1$s\'', sqlite_escape_string($replacement)); - break; - - case 'array_int': - if (is_array($replacement)) - { - if (empty($replacement)) - $this->error_backtrace('Database error, given array of integer values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); - - foreach ($replacement as $key => $value) - { - if (!is_numeric($value) || (string) $value !== (string) (int) $value) - $this->error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); - - $replacement[$key] = (string) (int) $value; - } - - return implode(', ', $replacement); - } - else - $this->error_backtrace('Wrong value type sent to the database. Array of integers expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); - - break; - - case 'array_string': - if (is_array($replacement)) - { - if (empty($replacement)) - $this->error_backtrace('Database error, given array of string values is empty. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); - - foreach ($replacement as $key => $value) - $replacement[$key] = sprintf('\'%1$s\'', sqlite_escape_string($value)); - - return implode(', ', $replacement); - } - else - $this->error_backtrace('Wrong value type sent to the database. Array of strings expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); - break; - - case 'date': - if (preg_match('~^(\d{4})-([0-1]?\d)-([0-3]?\d)$~', $replacement, $date_matches) === 1) - return sprintf('\'%04d-%02d-%02d\'', $date_matches[1], $date_matches[2], $date_matches[3]); - else - $this->error_backtrace('Wrong value type sent to the database. Date expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); - break; - - case 'float': - if (!is_numeric($replacement)) - $this->error_backtrace('Wrong value type sent to the database. Floating point number expected. (' . $matches[2] . ')', '', E_USER_ERROR, __FILE__, __LINE__); - return (string) (float) $replacement; - break; - - case 'identifier': - return '`' . strtr($replacement, array('`' => '', '.' => '')) . '`'; - break; - - case 'raw': - return $replacement; - break; - - default: - $this->error_backtrace('Undefined type used in the database query. (' . $matches[1] . ':' . $matches[2] . ')', '', false, __FILE__, __LINE__); - break; - } - } - - /** - * This function works like $this->query(), escapes and quotes a string, - * but it doesn't execute the query. - * - * @param string $db_string - * @param string $db_values - * @param resource $connection - */ - function quote($db_string, $db_values, $connection = null) - { - global $db_callback, $db_connection; - - // Only bother if there's something to replace. - if (strpos($db_string, '{') !== false) - { - // This is needed by the callback function. - $db_callback = array($db_values, $connection === null ? $db_connection : $connection); - - // Do the quoting and escaping - $db_string = preg_replace_callback('~{([a-z_]+)(?::([a-zA-Z0-9_-]+))?}~', 'elk_db_replacement__callback', $db_string); - - // Clear this global variable. - $db_callback = array(); - } - - return $db_string; - } - - /** - * Do a query. Takes care of errors too. - * - * @param string $identifier - * @param string $db_string - * @param string $db_values - * @param resource $connection - */ - function query($identifier, $db_string, $db_values = array(), $connection = null) - { - global $db_cache, $db_count, $db_connection, $db_show_debug, $time_start; - global $db_unbuffered, $db_callback, $modSettings; - - // Decide which connection to use. - $connection = $connection === null ? $db_connection : $connection; - - // Special queries that need processing. - $replacements = array( - 'birthday_array' => array( - '~DATE_FORMAT\(([^,]+),\s*([^\)]+)\s*\)~' => 'strftime($2, $1)' - ), - 'substring' => array( - '~SUBSTRING~' => 'SUBSTR', - ), - 'truncate_table' => array( - '~TRUNCATE~i' => 'DELETE FROM', - ), - 'user_activity_by_time' => array( - '~HOUR\(FROM_UNIXTIME\((poster_time\s+\+\s+\{int:.+\})\)\)~' => 'strftime(\'%H\', datetime($1, \'unixepoch\'))', - ), - 'unread_fetch_topic_count' => array( - '~\s*SELECT\sCOUNT\(DISTINCT\st\.id_topic\),\sMIN\(t\.id_last_msg\)(.+)$~is' => 'SELECT COUNT(id_topic), MIN(id_last_msg) FROM (SELECT DISTINCT t.id_topic, t.id_last_msg $1)', - ), - 'alter_table_boards' => array( - '~(.+)~' => '', - ), - 'get_random_number' => array( - '~RAND~' => 'RANDOM', - ), - 'set_character_set' => array( - '~(.+)~' => '', - ), - 'themes_count' => array( - '~\s*SELECT\sCOUNT\(DISTINCT\sid_member\)\sAS\svalue,\sid_theme.+FROM\s(.+themes)(.+)~is' => 'SELECT COUNT(id_member) AS value, id_theme FROM (SELECT DISTINCT id_member, id_theme, variable FROM $1) $2', - ), - 'attach_download_increase' => array( - '~LOW_PRIORITY~' => '', - ), - 'pm_conversation_list' => array( - '~ORDER BY id_pm~' => 'ORDER BY MAX(pm.id_pm)', - ), - 'boardindex_fetch_boards' => array( - '~(.)$~' => '$1 ORDER BY b.board_order', - ), - 'messageindex_fetch_boards' => array( - '~(.)$~' => '$1 ORDER BY b.board_order', - ), - 'order_by_board_order' => array( - '~(.)$~' => '$1 ORDER BY b.board_order', - ), - 'spider_check' => array( - '~(.)$~' => '$1 ORDER BY LENGTH(user_agent) DESC', - ), - ); - - if (isset($replacements[$identifier])) - $db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string); - - // SQLite doesn't support count(distinct). - $db_string = trim($db_string); - $db_string = preg_replace('~^\s*SELECT\s+?COUNT\(DISTINCT\s+?(.+?)\)(\s*AS\s*(.+?))*\s*(FROM.+)~is', 'SELECT COUNT(*) $2 FROM (SELECT DISTINCT $1 $4)', $db_string); - - // Or RLIKE. - $db_string = preg_replace('~AND\s*(.+?)\s*RLIKE\s*(\{string:.+?\})~', 'AND REGEXP(\1, \2)', $db_string); - - // INSTR? No support for that buddy :( - if (preg_match('~INSTR\((.+?),\s(.+?)\)~', $db_string, $matches) === 1) - { - $db_string = preg_replace('~INSTR\((.+?),\s(.+?)\)~', '$1 LIKE $2', $db_string); - list(, $search) = explode(':', substr($matches[2], 1, -1)); - $db_values[$search] = '%' . $db_values[$search] . '%'; - } - - // Lets remove ASC and DESC from GROUP BY clause. - if (preg_match('~GROUP BY .*? (?:ASC|DESC)~is', $db_string, $matches)) - { - $replace = str_replace(array('ASC', 'DESC'), '', $matches[0]); - $db_string = str_replace($matches[0], $replace, $db_string); - } - - // SQLite doesn't support TO_DAYS but has the julianday function which can be used in the same manner. But make sure it is being used to calculate a span. - $db_string = preg_replace('~\(TO_DAYS\(([^)]+)\) - TO_DAYS\(([^)]+)\)\) AS span~', '(julianday($1) - julianday($2)) AS span', $db_string); - - // One more query.... - $db_count = !isset($db_count) ? 1 : $db_count + 1; - - if (empty($modSettings['disableQueryCheck']) && strpos($db_string, '\'') !== false && empty($db_values['security_override'])) - $this->error_backtrace('Hacking attempt...', 'Illegal character (\') used in query...', true, __FILE__, __LINE__); - - if (empty($db_values['security_override']) && (!empty($db_values) || strpos($db_string, '{db_prefix}') !== false)) - { - // Pass some values to the global space for use in the callback function. - $db_callback = array($db_values, $connection); - - // Inject the values passed to this function. - $db_string = preg_replace_callback('~{([a-z_]+)(?::([a-zA-Z0-9_-]+))?}~', 'elk_db_replacement__callback', $db_string); - - // This shouldn't be residing in global space any longer. - $db_callback = array(); - } - - // Debugging. - if (isset($db_show_debug) && $db_show_debug === true) - { - // Get the file and line number this function was called. - list ($file, $line) = $this->error_backtrace('', '', 'return', __FILE__, __LINE__); - - // Initialize $db_cache if not already initialized. - if (!isset($db_cache)) - $db_cache = array(); - - if (!empty($_SESSION['debug_redirect'])) - { - $db_cache = array_merge($_SESSION['debug_redirect'], $db_cache); - $db_count = count($db_cache) + 1; - $_SESSION['debug_redirect'] = array(); - } - - $st = microtime(true); - // Don't overload it. - $db_cache[$db_count]['q'] = $db_count < 50 ? $db_string : '...'; - $db_cache[$db_count]['f'] = $file; - $db_cache[$db_count]['l'] = $line; - $db_cache[$db_count]['s'] = array_sum(explode(' ', $st)) - array_sum(explode(' ', $time_start)); - } - - $ret = @sqlite_query($db_string, $connection, SQLITE_BOTH, $err_msg); - if ($ret === false && empty($db_values['db_error_skip'])) - $ret = $this->error($db_string . '#!#' . $err_msg, $connection); - - // Debugging. - if (isset($db_show_debug) && $db_show_debug === true) - $db_cache[$db_count]['t'] = microtime(true) - $st; - - return $ret; - } - - /** - * Affected rows from previous operation. - * - * @param $database - */ - function affected_rows($database = null) - { - global $db_connection; - - return sqlite_changes($database === null ? $db_connection : $database); - } - - /** - * Last inserted id. - * - * @param string $table - * @param string $field = null - * @param resource $connection = null - */ - function insert_id($table, $field = null, $connection = null) - { - global $db_connection, $db_prefix; - - $table = str_replace('{db_prefix}', $db_prefix, $table); - - // SQLite doesn't need the table or field information. - return sqlite_last_insert_rowid($connection === null ? $db_connection : $connection); - } - - /** - * Do a transaction. - * - * @param string $type - the step to perform (i.e. 'begin', 'commit', 'rollback') - * @param resource $connection = null - */ - function db_transaction($type = 'commit', $connection = null) - { - global $db_connection, $db_in_transact; - - // Decide which connection to use - $connection = $connection === null ? $db_connection : $connection; - - if ($type == 'begin') - { - $db_in_transact = true; - return @sqlite_query('BEGIN', $connection); - } - elseif ($type == 'rollback') - { - $db_in_transact = false; - return @sqlite_query('ROLLBACK', $connection); - } - elseif ($type == 'commit') - { - $db_in_transact = false; - return @sqlite_query('COMMIT', $connection); - } - - return false; - } - - /** - * Return last error string from the database server - * - * @param resource $database = null - */ - function last_error($database = null) - { - global $db_connection, $sqlite_error; - - $query_errno = sqlite_last_error(empty($database) ? $db_connection : $database); - return $query_errno || empty($sqlite_error) ? sqlite_error_string($query_errno) : $sqlite_error; - } - - /** - * Database error! - * Backtrace, log, try to fix. - * - * @param string $db_string - * @param resource $connection = null - */ - function error($db_string, $connection = null) - { - global $txt, $context, $webmaster_email, $modSettings; - global $forum_version, $db_connection, $db_last_error, $db_persist; - global $db_server, $db_user, $db_passwd, $db_name, $db_show_debug, $ssi_db_user, $ssi_db_passwd; - - // We'll try recovering the file and line number the original db query was called from. - list ($file, $line) = $this->error_backtrace('', '', 'return', __FILE__, __LINE__); - - // Decide which connection to use - $connection = $connection === null ? $db_connection : $connection; - - // This is the error message... - $query_errno = sqlite_last_error($connection); - $query_error = sqlite_error_string($query_errno); - - // Get the extra error message. - $errStart = strrpos($db_string, '#!#'); - $query_error .= '
' . substr($db_string, $errStart + 3); - $db_string = substr($db_string, 0, $errStart); - - // Log the error. - if (function_exists('log_error')) - log_error($txt['database_error'] . ': ' . $query_error . (!empty($modSettings['enableErrorQueryLogging']) ? "\n\n" .$db_string : ''), 'database', $file, $line); - - // Sqlite optimizing - the actual error message isn't helpful or user friendly. - if (strpos($query_error, 'no_access') !== false || strpos($query_error, 'database schema has changed') !== false) - { - if (!empty($context) && !empty($txt) && !empty($txt['error_sqlite_optimizing'])) - fatal_error($txt['error_sqlite_optimizing'], false); - else - { - // Don't cache this page! - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); - header('Cache-Control: no-cache'); - - // Send the right error codes. - header('HTTP/1.1 503 Service Temporarily Unavailable'); - header('Status: 503 Service Temporarily Unavailable'); - header('Retry-After: 3600'); - - die('Sqlite is optimizing the database, the forum can not be accessed until it has finished. Please try refreshing this page momentarily.'); - } - } - - // Nothing's defined yet... just die with it. - if (empty($context) || empty($txt)) - die($query_error); - - // Show an error message, if possible. - $context['error_title'] = $txt['database_error']; - if (allowedTo('admin_forum')) - $context['error_message'] = nl2br($query_error) . '
' . $txt['file'] . ': ' . $file . '
' . $txt['line'] . ': ' . $line; - else - $context['error_message'] = $txt['try_again']; - - // Add database version that we know of, for the admin to know. (and ask for support) - if (allowedTo('admin_forum')) - $context['error_message'] .= '

' . sprintf($txt['database_error_versions'], $modSettings['elkVersion']); - - if (allowedTo('admin_forum') && isset($db_show_debug) && $db_show_debug === true) - { - $context['error_message'] .= '

' . nl2br($db_string); - } - - // It's already been logged... don't log it again. - fatal_error($context['error_message'], false); - } - - /** - * Insert data. - * - * @param string $method, options 'replace', 'ignore', 'insert' - * @param $table - * @param $columns - * @param $data - * @param $keys - * @param bool $disable_trans = false - * @param resource $connection = null - */ - function insert($method = 'replace', $table, $columns, $data, $keys, $disable_trans = false, $connection = null) - { - global $db_in_transact, $db_connection, $db_prefix; - - $connection = $connection === null ? $db_connection : $connection; - - if (empty($data)) - return; - - if (!is_array($data[array_rand($data)])) - $data = array($data); - - // Replace the prefix holder with the actual prefix. - $table = str_replace('{db_prefix}', $db_prefix, $table); - - $priv_trans = false; - if (count($data) > 1 && !$db_in_transact && !$disable_trans) - { - $this->db_transaction('begin', $connection); - $priv_trans = true; - } - - if (!empty($data)) - { - // Create the mold for a single row insert. - $insertData = '('; - foreach ($columns as $columnName => $type) - { - // Are we restricting the length? - if (strpos($type, 'string-') !== false) - $insertData .= sprintf('SUBSTR({string:%1$s}, 1, ' . substr($type, 7) . '), ', $columnName); - else - $insertData .= sprintf('{%1$s:%2$s}, ', $type, $columnName); - } - $insertData = substr($insertData, 0, -2) . ')'; - - // Create an array consisting of only the columns. - $indexed_columns = array_keys($columns); - - // Here's where the variables are injected to the query. - $insertRows = array(); - foreach ($data as $dataRow) - $insertRows[] = $this->quote($insertData, array_combine($indexed_columns, $dataRow), $connection); - - foreach ($insertRows as $entry) - // Do the insert. - $this->query('', - (($method === 'replace') ? 'REPLACE' : (' INSERT' . ($method === 'ignore' ? ' OR IGNORE' : ''))) . ' INTO ' . $table . '(' . implode(', ', $indexed_columns) . ') - VALUES - ' . $entry, - array( - 'security_override' => true, - 'db_error_skip' => $table === $db_prefix . 'log_errors', - ), - $connection - ); - } - - if ($priv_trans) - $this->db_transaction('commit', $connection); - } - - /** - * free_result. Doesn't do anything on sqlite! - * - * @param resource $handle = false - */ - function free_result($handle = false) - { - return true; - } - - /** - * Get the number of rows in the result. - * - * @param resource $result - */ - function num_rows($result) - { - // simply delegate to the native function - return sqlite_num_rows($result); - } - - /** - * Get the number of fields in the resultset. - */ - function num_fields($request) - { - return sqlite_num_fields($request); - } - - /** - * Reset the internal result pointer. - * SQLite implementation does not use the $request parameter, and will ignore it. - * - * @param $request - * @param $counter - */ - function data_seek($request, $counter) - { - // delegate to native sqlite function - return sqlite_seek($counter); - } - - /** - * Fetch a row of next data. - * SQLite method doesn't use the second parameter. - * - * @param $request - * @param bool $counter = false - */ - function fetch_row($handle, $counter = false) - { - // Make sure we return no string indexes - return sqlite_fetch_array($handle, SQLITE_NUM); - } - - /** - * Unescape an escaped string! - * - * @param $string - */ - function unescape_string($string) - { - return strtr($string, array('\'\'' => '\'')); - } - - /** - * This function tries to work out additional error information from a back trace. - * - * @param $error_message - * @param $log_message - * @param $error_type - * @param $file - * @param $line - */ - function error_backtrace($error_message, $log_message = '', $error_type = false, $file = null, $line = null) - { - if (empty($log_message)) - $log_message = $error_message; - - foreach (debug_backtrace() as $step) - { - // Found it? - if (!method_exists($this, $step['function']) && !in_array(substr($step['function'], 0, 7), array('elk_db_', 'preg_re', 'db_erro', 'call_us'))) - { - $log_message .= '
Function: ' . $step['function']; - break; - } - - if (isset($step['line'])) - { - $file = $step['file']; - $line = $step['line']; - } - } - - // A special case - we want the file and line numbers for debugging. - if ($error_type == 'return') - return array($file, $line); - - // Is always a critical error. - if (function_exists('log_error')) - log_error($log_message, 'critical', $file, $line); - - if (function_exists('fatal_error')) - { - fatal_error($error_message, $error_type); - - // Cannot continue... - exit; - } - elseif ($error_type) - trigger_error($error_message . ($line !== null ? '(' . basename($file) . '-' . $line . ')' : ''), $error_type); - else - trigger_error($error_message . ($line !== null ? '(' . basename($file) . '-' . $line . ')' : '')); - } - - /** - * Emulate UNIX_TIMESTAMP. - */ - function udf_unix_timestamp() - { - return strftime('%s', 'now'); - } - - /** - * Emulate INET_ATON. - * - * @param $ip - */ - function udf_inet_aton($ip) - { - $chunks = explode('.', $ip); - return @$chunks[0] * pow(256, 3) + @$chunks[1] * pow(256, 2) + @$chunks[2] * 256 + @$chunks[3]; - } - - /** - * Emulate INET_NTOA. - * - * @param $n - */ - function udf_inet_ntoa($n) - { - $t = array(0, 0, 0, 0); - $msk = 16777216.0; - $n += 0.0; - if ($n < 1) - return '0.0.0.0'; - - for ($i = 0; $i < 4; $i++) - { - $k = (int) ($n / $msk); - $n -= $msk * $k; - $t[$i] = $k; - $msk /= 256.0; - }; - - $a = join('.', $t); - return $a; - } - - /** - * Emulate FIND_IN_SET. - * - * @param $find - * @param $groups - */ - function udf_find_in_set($find, $groups) - { - foreach (explode(',', $groups) as $key => $group) - { - if ($group == $find) - return $key + 1; - } - - return 0; - } - - /** - * Emulate YEAR. - * - * @param $date - */ - function udf_year($date) - { - return substr($date, 0, 4); - } - - /** - * Emulate MONTH. - * - * @param $date - */ - function udf_month($date) - { - return substr($date, 5, 2); - } - - /** - * Emulate DAYOFMONTH. - * - * @param $date - */ - function udf_dayofmonth($date) - { - return substr($date, 8, 2); - } - - /** - * This function uses variable argument lists so that it can handle more then two parameters. - * Emulates the CONCAT function. - */ - function udf_concat() - { - // Since we didn't specify any arguments we must get them from PHP. - $args = func_get_args(); - - // It really doesn't matter if there were 0 to 100 arguments, just slap them all together. - return implode('', $args); - } - - /** - * We need to use PHP to locate the position in the string. - * - * @param string $find - * @param string $string - */ - function udf_locate($find, $string) - { - return strpos($string, $find); - } - - /** - * This is used to replace RLIKE. - * - * @param string $exp - * @param string $search - */ - function udf_regexp($exp, $search) - { - if (preg_match($exp, $match)) - return 1; - return 0; - } - - /** - * Escape the LIKE wildcards so that they match the character and not the wildcard. - * The optional second parameter turns human readable wildcards into SQL wildcards. - */ - function escape_wildcard_string($string, $translate_human_wildcards=false) - { - $replacements = array( - '%' => '\%', - '\\' => '\\\\', - ); - - if ($translate_human_wildcards) - $replacements += array( - '*' => '%', - ); - - return strtr($string, $replacements); - } - - /** - * Returns whether the database system supports ignore. - * - * @return bool - */ - function support_ignore() - { - return false; - } - - /** - * Gets all the necessary INSERTs for the table named table_name. - * It goes in 250 row segments. - * - * @param string $tableName - the table to create the inserts for. - * @param bool new_table - * @return string the query to insert the data back in, or an empty string if the table was empty. - */ - function insert_sql($tableName, $new_table = false) - { - global $db_prefix; - - static $start = 0, $num_rows, $fields, $limit; - - if ($new_table) - { - $limit = strstr($tableName, 'log_') !== false ? 500 : 250; - $start = 0; - } - - $data = ''; - $tableName = str_replace('{db_prefix}', $db_prefix, $tableName); - - // This will be handy... - $crlf = "\r\n"; - - $result = $this->query('', ' - SELECT * - FROM ' . $tableName . ' - LIMIT ' . $start . ', ' . $limit, - array( - 'security_override' => true, - ) - ); - - // The number of rows, just for record keeping and breaking INSERTs up. - $num_rows = $this->num_rows($result); - - if ($num_rows == 0) - return ''; - - if ($new_table) - { - $fields = array_keys($this->fetch_assoc($result)); - - // SQLite fetches an array so we need to filter out the numberic index for the columns. - foreach ($fields as $key => $name) - if (is_numeric($name)) - unset($fields[$key]); - - $this->data_seek($result, 0); - } - - // Start it off with the basic INSERT INTO. - $data = 'BEGIN TRANSACTION;' . $crlf; - $insert_msg = $crlf . 'INSERT INTO ' . $tableName . $crlf . "\t" . '(' . implode(', ', $fields) . ')' . $crlf . 'VALUES ' . $crlf . "\t"; - - // Loop through each row. - while ($row = $this->fetch_assoc($result)) - { - // Get the fields in this row... - $field_list = array(); - - foreach ($row as $key => $item) - { - // Try to figure out the type of each field. (NULL, number, or 'string'.) - if (!isset($item)) - $field_list[] = 'NULL'; - elseif (is_numeric($item) && (int) $item == $item) - $field_list[] = $item; - else - $field_list[] = '\'' . $this->escape_string($item) . '\''; - } - - // 'Insert' the data. - $data .= $insert_msg . '(' . implode(', ', $field_list) . ');' . $crlf; - } - $this->free_result($result); - - $data .= $crlf; - - $start += $limit; - - return $data; - } - - /** - * Dumps the schema (CREATE) for a table. - * - * @param string $tableName - the table - * @return string - the CREATE statement as string - */ - function db_table_sql($tableName) - { - global $db_prefix; - - $tableName = str_replace('{db_prefix}', $db_prefix, $tableName); - - // This will be needed... - $crlf = "\r\n"; - - // Start the create table... - $schema_create = ''; - $index_create = ''; - - // Let's get the create statement directly from SQLite. - $result = $this->query('', ' - SELECT sql - FROM sqlite_master - WHERE type = {string:type} - AND name = {string:table_name}', - array( - 'type' => 'table', - 'table_name' => $tableName, - ) - ); - list ($schema_create) = $this->fetch_row($result); - $this->free_result($result); - - // Now the indexes. - $result = $this->query('', ' - SELECT sql - FROM sqlite_master - WHERE type = {string:type} - AND tbl_name = {string:table_name}', - array( - 'type' => 'index', - 'table_name' => $tableName, - ) - ); - $indexes = array(); - while ($row = $this->fetch_assoc($result)) - if (trim($row['sql']) != '') - $indexes[] = $row['sql']; - $this->free_result($result); - - $index_create .= implode(';' . $crlf, $indexes); - $schema_create = empty($indexes) ? rtrim($schema_create) : $schema_create . ';' . $crlf . $crlf; - - return $schema_create . $index_create; - } - - /** - * This function lists all tables in the database. - * The listing could be filtered according to $filter. - * - * @param mixed $db_name_str string holding the database name, or false, default false - * @param mixed $filter string to filter by, or false, default false - * @return array an array of table names. (strings) - */ - function db_list_tables($db_name_str = false, $filter = false) - { - $filter = $filter == false ? '' : ' AND name LIKE \'' . str_replace("\_", "_", $filter) . '\''; - - $request = $this->query('', ' - SELECT name - FROM sqlite_master - WHERE type = {string:type} - {raw:filter} - ORDER BY name', - array( - 'type' => 'table', - 'filter' => $filter, - ) - ); - $tables = array(); - while ($row = $this->fetch_row($request)) - $tables[] = $row[0]; - $this->free_result($request); - - return $tables; - } - - /** - * This function optimizes a table. - * - * @param string $table - the table to be optimized - * @return how much it was gained - */ - function db_optimize_table($table) - { - global $db_prefix; - - $table = str_replace('{db_prefix}', $db_prefix, $table); - - $request = $this->query('', ' - VACUUM {raw:table}', - array( - 'table' => $table, - ) - ); - if (!$request) - return -1; - - $row = $this->fetch_assoc($request); - $this->free_result($request); - - // The function returns nothing. - return 0; - } - - /** - * Backup $table to $backup_table. - * - * @param string $table - * @param string $backup_table - * @return resource -the request handle to the table creation query - */ - function db_backup_table($table, $backup_table) - { - global $db_prefix; - - $table = str_replace('{db_prefix}', $db_prefix, $table); - - $result = $this->query('', ' - SELECT sql - FROM sqlite_master - WHERE type = {string:txttable} - AND name = {string:table}', - array( - 'table' => $table, - 'txttable' => 'table' - ) - ); - list ($create) = $this->fetch_row($result); - $this->free_result($result); - - $create = preg_split('/[\n\r]/', $create); - $auto_inc = ''; - - // Remove the first line and check to see if the second one contain useless info. - unset($create[0]); - if (trim($create[1]) == '(') - unset($create[1]); - if (trim($create[count($create)]) == ')') - unset($create[count($create)]); - - foreach ($create as $k => $l) - { - // Get the name of the auto_increment column. - if (strpos($l, 'primary') || strpos($l, 'PRIMARY')) - $auto_inc = trim($l); - - // Skip everything but keys... - if ((strpos($l, 'KEY') !== false && strpos($l, 'PRIMARY KEY') === false) || strpos($l, $table) !== false || strpos(trim($l), 'PRIMARY KEY') === 0) - unset($create[$k]); - } - - if (!empty($create)) - $create = '( - ' . implode(' - ', $create) . ')'; - else - $create = ''; - - // Is there an extra junk at the end? - if (substr($create, -2, 1) == ',') - $create = substr($create, 0, -2) . ')'; - if (substr($create, -2) == '))') - $create = substr($create, 0, -1); - - $this->query('', ' - DROP TABLE {raw:backup_table}', - array( - 'backup_table' => $backup_table, - 'db_error_skip' => true, - ) - ); - - $request = $this->quote(' - CREATE TABLE {raw:backup_table} {raw:create}', - array( - 'backup_table' => $backup_table, - 'create' => $create, - )); - - $this->query('', ' - CREATE TABLE {raw:backup_table} {raw:create}', - array( - 'backup_table' => $backup_table, - 'create' => $create, - )); - - $request = $this->query('', ' - INSERT INTO {raw:backup_table} - SELECT * - FROM {raw:table}', - array( - 'backup_table' => $backup_table, - 'table' => $table, - )); - - return $request; - } - - /** - * Simply return the database - and die. - * Only needed for SQLite. - * Used by DumpDatabase.php. - */ - function db_get_backup() - { - global $db_name; - - $db_file = substr($db_name, -3) === '.db' ? $db_name : $db_name . '.db'; - - // Add more info if zipped... - $ext = ''; - if (isset($_REQUEST['compress']) && function_exists('gzencode')) - $ext = '.gz'; - - // Do the remaining headers. - header('Content-Disposition: attachment; filename="' . $db_file . $ext . '"'); - header('Cache-Control: private'); - header('Connection: close'); - - // Literally dump the contents. Try reading the file first. - if (@readfile($db_file) == null) - echo file_get_contents($db_file); - - obExit(false); - } - - /** - * Get the server version number. - * For sqlite, that means the library version. - * - * @return string - the version - */ - function db_server_version() - { - return sqlite_libversion(); - } - - /** - * Escape string for the database input - * - * @param string $string - */ - function escape_string($string) - { - return sqlite_escape_string($string); - } - - /** - * Fetch next result as association. - * The sqlite implementation simply delegates to sqlite_fetch_array(). - * It requires $request parameter to be int. - * It ignores $counter parameter. - * - * @param int $request - * @param mixed counter = false - */ - function fetch_assoc($request, $counter = false) - { - return sqlite_fetch_array($request); - } - - /** - * Return server info. - * - * @return string - the version - */ - function db_server_info() - { - // give info on library version - return sqlite_libversion(); - } - - /** - * Get the client version number. - * - * @return string - the version - */ - function db_client_version() - { - return sqlite_libversion(); - } - - /** - * Get the name (title) of the database system. - */ - function db_title() - { - return 'SQLite'; - } - - /** - * Whether the database system is case sensitive. - * - * @return bool - */ - function db_case_sensitive() - { - return true; - } - -/** - * Select database. - * - * @param string $dbName = null - * @param resource $connection = null - */ - function select_db($dbName = null, $connection = null) - { - return true; - } - - /** - * Returns a reference to the existing instance - */ - static function db() - { - return self::$_db; - } -} diff --git a/sources/database/Db-sqlite.subs.php b/sources/database/Db-sqlite.subs.php deleted file mode 100644 index 5863592a64..0000000000 --- a/sources/database/Db-sqlite.subs.php +++ /dev/null @@ -1,180 +0,0 @@ -replacement__callback($matches); -} - -/** - * Database error! - * Backtrace, log, try to fix. - * - * @param string $db_string - * @param resource $connection = null - */ -function elk_db_error($db_string, $connection = null) -{ - $db = database(); - - return $db->error($db_string, $connection); -} - -/** - * This function tries to work out additional error information from a back trace. - * - * @param $error_message - * @param $log_message - * @param $error_type - * @param $file - * @param $line - */ -function elk_db_error_backtrace($error_message, $log_message = '', $error_type = false, $file = null, $line = null) -{ - $db = database(); - - return $db->error_backtrace($error_message, $log_message, $error_type, $file, $line); -} - -/** - * Emulate UNIX_TIMESTAMP. - */ -function elk_udf_unix_timestamp() -{ - $db = database(); - - return $db->udf_unix_timestamp(); -} - -/** - * Emulate INET_ATON. - * - * @param $ip - */ -function elk_udf_inet_aton($ip) -{ - $db = database(); - - return $db->udf_inet_aton($ip); -} - -/** - * Emulate INET_NTOA. - * - * @param $n - */ -function elk_udf_inet_ntoa($n) -{ - $db = database(); - - return $db->udf_inet_ntoa($n); -} - -/** - * Emulate FIND_IN_SET. - * - * @param $find - * @param $groups - */ -function elk_udf_find_in_set($find, $groups) -{ - $db = database(); - - return $db->udf_find_in_set($find, $groups); -} - -/** - * Emulate YEAR. - * - * @param $date - */ -function elk_udf_year($date) -{ - $db = database(); - - return $db->udf_year($date); -} - -/** - * Emulate MONTH. - * - * @param $date - */ -function elk_udf_month($date) -{ - $db = database(); - - return $db->udf_month($date); -} - -/** - * Emulate DAYOFMONTH. - * - * @param $date - */ -function elk_udf_dayofmonth($date) -{ - $db = database(); - - return $db->udf_dayofmonth($date); -} - -/** - * This function uses variable argument lists so that it can handle more then two parameters. - * Emulates the CONCAT function. - */ -function elk_udf_concat() -{ - $db = database(); - - return $db->udf_concat(); -} - -/** - * We need to use PHP to locate the position in the string. - * - * @param string $find - * @param string $string - */ -function elk_udf_locate($find, $string) -{ - $db = database(); - - return $db->udf_locate($find, $string); -} - -/** - * This is used to replace RLIKE. - * - * @param string $exp - * @param string $search - */ -function elk_udf_regexp($exp, $search) -{ - $db = database(); - - return $db->udf_regexp($exp, $search); -} \ No newline at end of file diff --git a/sources/database/DbSearch-sqlite.php b/sources/database/DbSearch-sqlite.php deleted file mode 100644 index 7a99b3fe33..0000000000 --- a/sources/database/DbSearch-sqlite.php +++ /dev/null @@ -1,107 +0,0 @@ - array( - '~mediumint\(\d\)~i' => 'int', - '~TYPE=HEAP~i' => '', - ), - 'create_tmp_log_search_messages' => array( - '~mediumint\(\d\)~i' => 'int', - '~TYPE=HEAP~i' => '', - ), - ); - - if (isset($replacements[$identifier])) - $db_string = preg_replace(array_keys($replacements[$identifier]), array_values($replacements[$identifier]), $db_string); - elseif (preg_match('~^\s*INSERT\sIGNORE~i', $db_string) != 0) - { - $db_string = preg_replace('~^\s*INSERT\sIGNORE~i', 'INSERT', $db_string); - // For eventual multi-insert, skip errors. - $db_values['db_error_skip'] = true; - } - - $return = $db->query('', $db_string, - $db_values, $connection - ); - - return $return; - } - - /** - * Make a custom word index. - * - * @param $size - */ - function create_word_search($size) - { - $db = database(); - - $size = 'int'; - - $db->query('', ' - CREATE TABLE {db_prefix}log_search_words ( - id_word {raw:size} NOT NULL default {string:string_zero}, - id_msg int(10) NOT NULL default {string:string_zero}, - PRIMARY KEY (id_word, id_msg) - )', - array( - 'size' => $size, - 'string_zero' => '0', - ) - ); - } - - /** - * Static method that allows to retrieve or create an instance of this class. - */ - public static function db_search() - { - if (is_null(self::$_search)) - { - self::$_search = new self(); - } - return self::$_search; - } -} \ No newline at end of file diff --git a/sources/database/DbTable-sqlite.php b/sources/database/DbTable-sqlite.php deleted file mode 100644 index c184628be8..0000000000 --- a/sources/database/DbTable-sqlite.php +++ /dev/null @@ -1,840 +0,0 @@ -_reservedTables = array('admin_info_files', 'approval_queue', 'attachments', 'ban_groups', 'ban_items', - 'board_permissions', 'boards', 'calendar', 'calendar_holidays', 'categories', 'collapsed_categories', - 'custom_fields', 'group_moderators', 'log_actions', 'log_activity', 'log_banned', 'log_boards', - 'log_digest', 'log_errors', 'log_floodcontrol', 'log_group_requests', 'log_karma', 'log_mark_read', - 'log_notify', 'log_online', 'log_packages', 'log_polls', 'log_reported', 'log_reported_comments', - 'log_scheduled_tasks', 'log_search_messages', 'log_search_results', 'log_search_subjects', - 'log_search_topics', 'log_topics', 'mail_queue', 'membergroups', 'members', 'message_icons', - 'messages', 'moderators', 'package_servers', 'permission_profiles', 'permissions', 'personal_messages', - 'pm_recipients', 'poll_choices', 'polls', 'scheduled_tasks', 'sessions', 'settings', 'smileys', - 'themes', 'topics'); - foreach ($this->_reservedTables as $k => $table_name) - $this->_reservedTables[$k] = strtolower($db_prefix . $table_name); - } - - /** - * This function can be used to create a table without worrying about schema - * compatabilities across supported database systems. - * - If the table exists will, by default, do nothing. - * - Builds table with columns as passed to it - at least one column must be sent. - * The columns array should have one sub-array for each column - these sub arrays contain: - * 'name' = Column name - * 'type' = Type of column - values from (smallint, mediumint, int, text, varchar, char, tinytext, mediumtext, largetext) - * 'size' => Size of column (If applicable) - for example 255 for a large varchar, 10 for an int etc. - * If not set it will pick a size. - * - 'default' = Default value - do not set if no default required. - * - 'null' => Can it be null (true or false) - if not set default will be false. - * - 'auto' => Set to true to make it an auto incrementing column. Set to a numerical value to set from what - * it should begin counting. - * - Adds indexes as specified within indexes parameter. Each index should be a member of $indexes. Values are: - * - 'name' => Index name (If left empty it will be generated). - * - 'type' => Type of index. Choose from 'primary', 'unique' or 'index'. If not set will default to 'index'. - * - 'columns' => Array containing columns that form part of key - in the order the index is to be created. - * - parameters: (None yet) - * - if_exists values: - * - 'ignore' will do nothing if the table exists. (And will return true) - * - 'overwrite' will drop any existing table of the same name. - * - 'error' will return false if the table already exists. - * - * @param string $table_name - * @param array $columns in the format specified. - * @param array $indexes default array(), in the format specified. - * @param array $parameters default array() - * @param string $if_exists default 'ignore' - * @param string $error default 'fatal' - */ - function db_create_table($table_name, $columns, $indexes = array(), $parameters = array(), $if_exists = 'ignore', $error = 'fatal') - { - global $db_prefix; - - // With or without the database name, the full name looks like this. - $real_prefix = preg_match('~^(`?)(.+?)\\1\\.(.*?)$~', $db_prefix, $match) === 1 ? $match[3] : $db_prefix; - $full_table_name = str_replace('{db_prefix}', $real_prefix, $table_name); - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - // First - no way do we touch our own tables. - // Commented out for now. We need to alter our tables in order to use this in the upgrade. - /* - if (in_array(strtolower($table_name), $this->_reservedTables)) - return false; - */ - - // Log that we'll want to remove this on uninstall. - $this->_package_log[] = array('remove_table', $table_name); - - // Grab ourselves one o'these. - $db = database(); - - // Does this table exist or not? - $tables = $db->db_list_tables(); - if (in_array($full_table_name, $tables)) - { - // This is a sad day... drop the table? If not, return false (error) by default. - if ($if_exists == 'overwrite') - $this->db_drop_table($table_name); - else - return $if_exists == 'ignore'; - } - - // Righty - let's do the damn thing! - $table_query = 'CREATE TABLE ' . $table_name . "\n" . '('; - $done_primary = false; - foreach ($columns as $column) - { - // Auto increment is special - if (!empty($column['auto'])) - { - $table_query .= "\n" . $column['name'] . ' integer PRIMARY KEY,'; - $done_primary = true; - continue; - } - elseif (isset($column['default']) && $column['default'] !== null) - $default = 'default \'' . $db->escape_string($column['default']) . '\''; - else - $default = ''; - - // Sort out the size... and stuff... - $column['size'] = isset($column['size']) && is_numeric($column['size']) ? $column['size'] : null; - list ($type, $size) = $this->db_calculate_type($column['type'], $column['size']); - if ($size !== null) - $type = $type . '(' . $size . ')'; - - // Now just put it together! - $table_query .= "\n\t" . $column['name'] . ' ' . $type . ' ' . (!empty($column['null']) ? '' : 'NOT NULL') . ' ' . $default . ','; - } - - // Loop through the indexes next... - $index_queries = array(); - foreach ($indexes as $index) - { - $columns = implode(',', $index['columns']); - - // Is it the primary? - if (isset($index['type']) && $index['type'] == 'primary') - { - // If we've done the primary via auto_inc, don't do it again! - if (!$done_primary) - $table_query .= "\n\t" . 'PRIMARY KEY (' . implode(',', $index['columns']) . '),'; - } - else - { - if (empty($index['name'])) - $index['name'] = implode('_', $index['columns']); - $index_queries[] = 'CREATE ' . (isset($index['type']) && $index['type'] == 'unique' ? 'UNIQUE' : '') . ' INDEX ' . $table_name . '_' . $index['name'] . ' ON ' . $table_name . ' (' . $columns . ')'; - } - } - - // No trailing commas! - if (substr($table_query, -1) == ',') - $table_query = substr($table_query, 0, -1); - - $table_query .= ')'; - - if (empty($parameters['skip_transaction'])) - $db->db_transaction('begin'); - - // Do the table and indexes... - $db->query('', $table_query, - array( - 'security_override' => true, - ) - ); - foreach ($index_queries as $query) - $db->query('', $query, - array( - 'security_override' => true, - ) - ); - - if (empty($parameters['skip_transaction'])) - $db->db_transaction('commit'); - } - - /** - * Drop a table. - * - * @param string $table_name - * @param array $parameters default array() - * @param bool $error - * @param string $error default 'fatal' - */ - function db_drop_table($table_name, $parameters = array(), $error = 'fatal') - { - global $db_prefix; - - // Strip out the table name, we might not need it in some cases - $real_prefix = preg_match('~^(`?)(.+?)\\1\\.(.*?)$~', $db_prefix, $match) === 1 ? $match[3] : $db_prefix; - $full_table_name = str_replace('{db_prefix}', $real_prefix, $table_name); - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - // God no - dropping one of these = bad. - if (in_array(strtolower($table_name), $this->_reservedTables)) - return false; - - // working hard with the db! - $db = database(); - - // Does it exist? - if (in_array($full_table_name, $db->db_list_tables())) - { - $query = 'DROP TABLE ' . $table_name; - $db->query('', $query, - array( - 'security_override' => true, - ) - ); - - return true; - } - - // Otherwise do 'nout. - return false; - } - - /** - * This function adds a column. - * - * @param string $table_name the name of the table - * @param array $column_info with column information - * @param array $parameters default array() - * @param string $if_exists default 'update' - * @param string $error default 'fatal' - */ - function db_add_column($table_name, $column_info, $parameters = array(), $if_exists = 'update', $error = 'fatal') - { - global $txt, $db_prefix; - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - // Log that we will want to uninstall this! - $this->_package_log[] = array('remove_column', $table_name, $column_info['name']); - - // Does it exist - if so don't add it again! - $columns = $this->db_list_columns($table_name, false); - foreach ($columns as $column) - if ($column == $column_info['name']) - { - // If we're going to overwrite then use change column. - if ($if_exists == 'update') - return $this->db_change_column($table_name, $column_info['name'], $column_info); - else - return false; - } - - // Alter the table to add the column. - if ($this->db_alter_table($table_name, array('add' => array($column_info))) === false) - return false; - - return true; - } - - /** - * Removes a column. - * - * We can't reliably do this on SQLite - damn! - * @param string $table_name - * @param string $column_name - * @param array $parameters default array() - * @param string $error default 'fatal' - */ - function db_remove_column($table_name, $column_name, $parameters = array(), $error = 'fatal') - { - global $db_prefix; - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - if ($this->db_alter_table($table_name, array('remove' => array(array('name' => $column_name))))) - return true; - else - return false; - } - - /** - * Change a column. - * - * @param string $table_name - * @param $old_column - * @param $column_info - * @param array $parameters default array() - * @param string $error default 'fatal' - */ - function db_change_column($table_name, $old_column, $column_info, $parameters = array(), $error = 'fatal') - { - global $db_prefix; - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - if ($this->db_alter_table($table_name, array('change' => array(array('name' => $old_column) + $column_info)))) - return true; - else - return false; - } - - /** - * Add an index. - * - * @param string $table_name - * @param array $index_info - * @param array $parameters default array() - * @param string $if_exists default 'update' - * @param string $error default 'fatal' - */ - function db_add_index($table_name, $index_info, $parameters = array(), $if_exists = 'update', $error = 'fatal') - { - global $db_prefix; - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - // No columns = no index. - if (empty($index_info['columns'])) - return false; - $columns = implode(',', $index_info['columns']); - - // No name - make it up! - if (empty($index_info['name'])) - { - // No need for primary. - if (isset($index_info['type']) && $index_info['type'] == 'primary') - $index_info['name'] = ''; - else - $index_info['name'] = implode('_', $index_info['columns']); - } - else - $index_info['name'] = $index_info['name']; - - // Log that we are going to want to remove this! - $this->_package_log[] = array('remove_index', $table_name, $index_info['name']); - - // Let's get all our indexes. - $indexes = $this->db_list_indexes($table_name, true); - // Do we already have it? - foreach ($indexes as $index) - { - if ($index['name'] == $index_info['name'] || ($index['type'] == 'primary' && isset($index_info['type']) && $index_info['type'] == 'primary')) - { - // If we want to overwrite simply remove the current one then continue. - if ($if_exists != 'update' || $index['type'] == 'primary') - return false; - else - $this->db_remove_index($table_name, $index_info['name']); - } - } - - // If we're here we know we don't have the index - so just add it. - if (!empty($index_info['type']) && $index_info['type'] == 'primary') - { - // @todo Doesn't work with PRIMARY KEY yet. - } - else - { - $db = database(); - $db->query('', ' - CREATE ' . (isset($index_info['type']) && $index_info['type'] == 'unique' ? 'UNIQUE' : '') . ' INDEX ' . $index_info['name'] . ' ON ' . $table_name . ' (' . $columns . ')', - array( - 'security_override' => true, - ) - ); - } - } - - /** - * Remove an index. - * - * @param string $table_name - * @param string $index_name - * @param array$parameters default array() - * @param string $error default 'fatal' - */ - function db_remove_index($table_name, $index_name, $parameters = array(), $error = 'fatal') - { - global $db_prefix; - - // database work, what did ya think we do - $db = database(); - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - // Better exist! - $indexes = $this->db_list_indexes($table_name, true); - - foreach ($indexes as $index) - { - // @todo Doesn't do primary key at the moment! - if ($index['type'] != 'primary' && $index['name'] == $index_name) - { - // Drop the bugger... - $db->query('', ' - DROP INDEX ' . $index_name, - array( - 'security_override' => true, - ) - ); - - return true; - } - } - - // Not to be found ;( - return false; - } - - /** - * Get the schema formatted name for a type. - * - * @param string $type_name - * @param $type_size - * @param $reverse - */ - function db_calculate_type($type_name, $type_size = null, $reverse = false) - { - // Let's be sure it's lowercase MySQL likes both, others no. - $type_name = strtolower($type_name); - // Generic => Specific. - if (!$reverse) - { - $types = array( - 'mediumint' => 'int', - 'tinyint' => 'smallint', - 'mediumtext' => 'text', - 'largetext' => 'text', - ); - } - else - { - $types = array( - 'integer' => 'int', - ); - } - - // Got it? Change it! - if (isset($types[$type_name])) - { - if ($type_name == 'tinytext') - $type_size = 255; - $type_name = $types[$type_name]; - } - // Numbers don't have a size. - if (strpos($type_name, 'int') !== false) - $type_size = null; - - return array($type_name, $type_size); - } - - /** - * Get table structure. - * - * @param string $table_name - * @param array $parameters default array() - */ - function db_table_structure($table_name, $parameters = array()) - { - global $db_prefix; - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - return array( - 'name' => $table_name, - 'columns' => $this->db_list_columns($table_name, true), - 'indexes' => $this->db_list_indexes($table_name, true), - ); - } - - /** - * Return column information for a table. - * Harder than it should be, on sqlite! - * - * @param string $table_name - * @param bool $detail - * @param array $parameters default array() - * @return mixed - */ - function db_list_columns($table_name, $detail = false, $parameters = array()) - { - global $db_prefix; - - // Need this - $db = database(); - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - $result = $db->query('', ' - PRAGMA table_info(' . $table_name . ')', - array( - 'security_override' => true, - ) - ); - $columns = array(); - - $primaries = array(); - while ($row = $db->fetch_assoc($result)) - { - if (!$detail) - { - $columns[] = $row['name']; - } - else - { - // Auto increment is hard to tell really... if there's only one primary it probably is. - if ($row['pk']) - $primaries[] = $row['name']; - - // Can we split out the size? - if (preg_match('~(.+?)\s*\((\d+)\)~i', $row['type'], $matches)) - { - $type = $matches[1]; - $size = $matches[2]; - } - else - { - $type = $row['type']; - $size = null; - } - - $columns[$row['name']] = array( - 'name' => $row['name'], - 'null' => $row['notnull'] ? false : true, - 'default' => $row['dflt_value'], - 'type' => $type, - 'size' => $size, - 'auto' => false, - ); - } - } - $db->free_result($result); - - // Put in our guess at auto_inc. - if (count($primaries) == 1) - $columns[$primaries[0]]['auto'] = true; - - return $columns; - } - - /** - * Get index information. - * - * @param string $table_name - * @param bool $detail - * @param array $parameters - * @return mixed - */ - function db_list_indexes($table_name, $detail = false, $parameters = array()) - { - global $db_prefix; - - // Need this - $db = database(); - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - $result = $db->query('', ' - PRAGMA index_list(' . $table_name . ')', - array( - 'security_override' => true, - ) - ); - $indexes = array(); - while ($row = $db->fetch_assoc($result)) - { - if (!$detail) - $indexes[] = $row['name']; - else - { - $result2 = $db->query('', ' - PRAGMA index_info(' . $row['name'] . ')', - array( - 'security_override' => true, - ) - ); - while ($row2 = $db->fetch_assoc($result2)) - { - // What is the type? - if ($row['unique']) - $type = 'unique'; - else - $type = 'index'; - - // This is the first column we've seen? - if (empty($indexes[$row['name']])) - { - $indexes[$row['name']] = array( - 'name' => $row['name'], - 'type' => $type, - 'columns' => array(), - ); - } - - // Add the column... - $indexes[$row['name']]['columns'][] = $row2['name']; - } - $db->free_result($result2); - } - } - $db->free_result($result); - - return $indexes; - } - - /** - * Alter table on SQLite. - * - * @param string $table_name - * @param array $columns - */ - function db_alter_table($table_name, $columns) - { - global $db_prefix, $db_name; - - $db_file = substr($db_name, -3) === '.db' ? $db_name : $db_name . '.db'; - - $table_name = str_replace('{db_prefix}', $db_prefix, $table_name); - - // Let's get the current columns for the table. - $current_columns = $this->db_list_columns($table_name, true); - - // Let's get a list of columns for the temp table. - $temp_table_columns = array(); - - // Let's see if we have columns to remove or columns that are being added that already exist. - foreach ($current_columns as $key => $column) - { - $exists = false; - if (isset($columns['remove'])) - foreach ($columns['remove'] as $drop) - if ($drop['name'] == $column['name']) - { - $exists = true; - break; - } - - if (isset($columns['add'])) - foreach ($columns['add'] as $key2 => $add) - if ($add['name'] == $column['name']) - { - unset($columns['add'][$key2]); - break; - } - - // Doesn't exist then we 'remove'. - if (!$exists) - $temp_table_columns[] = $column['name']; - } - - // If they are equal then that means that the column that we are adding exists or it doesn't exist and we are not looking to change any one of them. - if (count($temp_table_columns) == count($current_columns) && empty($columns['change']) && empty($columns['add'])) - return true; - - // Drop the temp table. - $db->query('', ' - DROP TABLE {raw:temp_table_name}', - array( - 'temp_table_name' => $table_name . '_tmp', - 'db_error_skip' => true, - ) - ); - - // Let's make a backup of the current database. - // We only want the first backup of a table modification. So if there is a backup file and older than an hour just delete and back up again - $db_backup_file = BOARDDIR . '/packages/backups/backup_' . $table_name . '_' . basename($db_file) . md5($table_name . $db_file); - if (file_exists($db_backup_file) && time() - filemtime($db_backup_file) > 3600) - { - @unlink($db_backup_file); - @copy($db_file, $db_backup_file); - } - elseif (!file_exists($db_backup_file)) - @copy($db_file, $db_backup_file); - - // If we don't have temp tables then everything crapped out. Just exit. - if (empty($temp_table_columns)) - return false; - - // Start - $db->db_transaction('begin'); - - // Let's create the temporary table. - $createTempTable = $db->query('', ' - CREATE TEMPORARY TABLE {raw:temp_table_name} - ( - {raw:columns} - );', - array( - 'temp_table_name' => $table_name . '_tmp', - 'columns' => implode(', ', $temp_table_columns), - 'db_error_skip' => true, - ) - ) !== false; - - if (!$createTempTable) - return false; - - // Insert into temp table. - $db->query('', ' - INSERT INTO {raw:temp_table_name} - ({raw:columns}) - SELECT {raw:columns} - FROM {raw:table_name}', - array( - 'table_name' => $table_name, - 'columns' => implode(', ', $temp_table_columns), - 'temp_table_name' => $table_name . '_tmp', - ) - ); - - // Drop the current table. - $dropTable = $db->query('', ' - DROP TABLE {raw:table_name}', - array( - 'table_name' => $table_name, - 'db_error_skip' => true, - ) - ) !== false; - - // If you can't drop the main table then there is no where to go from here. Just return. - if (!$dropTable) - return false; - - // We need to keep track of the structure for the current columns and the new columns. - $new_columns = array(); - $column_names = array(); - - // Let's get the ones that we already have first. - foreach ($current_columns as $name => $column) - { - if (in_array($name, $temp_table_columns)) - { - $new_columns[$name] = array( - 'name' => $name, - 'type' => $column['type'], - 'size' => isset($column['size']) ? (int) $column['size'] : null, - 'null' => !empty($column['null']), - 'auto' => isset($column['auto']) ? $column['auto'] : false, - 'default' => isset($column['default']) ? $column['default'] : '', - ); - - // Lets keep track of the name for the column. - $column_names[$name] = $name; - } - } - - // Now the new. - if (!empty($columns['add'])) - foreach ($columns['add'] as $add) - { - $new_columns[$add['name']] = array( - 'name' => $add['name'], - 'type' => $add['type'], - 'size' => isset($add['size']) ? (int) $add['size'] : null, - 'null' => !empty($add['null']), - 'auto' => isset($add['auto']) ? $add['auto'] : false, - 'default' => isset($add['default']) ? $add['default'] : '', - ); - - // Let's keep track of the name for the column. - $column_names[$add['name']] = strstr('int', $add['type']) ? ' 0 AS ' . $add['name'] : ' {string:empty_string} AS ' . $add['name']; - } - - // Now to change a column. Not drop but change it. - if (isset($columns['change'])) - foreach ($columns['change'] as $change) - if (isset($new_columns[$change['name']])) - $new_columns[$change['name']] = array( - 'name' => $change['name'], - 'type' => $change['type'], - 'size' => isset($change['size']) ? (int) $change['size'] : null, - 'null' => !empty($change['null']), - 'auto' => isset($change['auto']) ? $change['auto'] : false, - 'default' => isset($change['default']) ? $change['default'] : '', - ); - - // Now let's create the table. - $createTable = $this->db_create_table($table_name, $new_columns, array(), array('skip_transaction' => true)); - - // Did it create correctly? - if ($createTable === false) - return false; - - // Back to it's original table. - $insertData = $db->query('', ' - INSERT INTO {raw:table_name} - ({raw:columns}) - SELECT ' . implode(', ', $column_names) . ' - FROM {raw:temp_table_name}', - array( - 'table_name' => $table_name, - 'columns' => implode(', ', array_keys($new_columns)), - 'columns_select' => implode(', ', $column_names), - 'temp_table_name' => $table_name . '_tmp', - 'empty_string' => '', - ) - ); - - // Did everything insert correctly? - if (!$insertData) - return false; - - // Drop the temp table. - $db->query('', ' - DROP TABLE {raw:temp_table_name}', - array( - 'temp_table_name' => $table_name . '_tmp', - 'db_error_skip' => true, - ) - ); - - // Commit or else there is no point in doing the previous steps. - $db->db_transaction('commit'); - - // We got here so we're good. The temp table should be deleted, if not it will be gone later on >:D. - return true; - } - - public static function db_table() - { - if (is_null(self::$_tbl)) - self::$_tbl = new DbTable_MySQL(); - return self::$_tbl; - } -} From 29f8c61ec263b5bc068f166960d5f7cacf6a3abb Mon Sep 17 00:00:00 2001 From: Norv Date: Mon, 15 Jul 2013 21:31:37 +0300 Subject: [PATCH 2/2] Update documentation for database extensions to ElkArte. Signed-off-by: Norv --- docs/readme_install.html | 6 +++--- docs/readme_update.html | 4 ++-- docs/readme_upgrade.html | 4 ++-- install/install.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/readme_install.html b/docs/readme_install.html index af8dfb2913..47b844ca11 100644 --- a/docs/readme_install.html +++ b/docs/readme_install.html @@ -220,7 +220,7 @@

Create a database and a database

Creating a database using PHPMyAdmin

Most shared hosting services disable this option. If the option to create databases through PHPMyAdmin is available through the hosting service you use, the database can be created from the PHPMyAdmin home page.

Creating a database using a control panel

-

Shared hosting services usually disable the ability to create a database through PHPMyAdmin. If the hosting service provides a control panel interface, then this can be used to create a database. Selecting the "MySQL Databases" or "Database Wizard" options should take you to a page prompting you to creating a MySQL database. With different hosts, these options may have different names.

ElkArte has the ability to support other database types, including PostgreSQL and SQLite.

+

Shared hosting services usually disable the ability to create a database through PHPMyAdmin. If the hosting service provides a control panel interface, then this can be used to create a database. Selecting the "MySQL Databases" or "Database Wizard" options should take you to a page prompting you to creating a MySQL database. With different hosts, these options may have different names.

ElkArte has the ability to support other database types, including PostgreSQL and SQLite. To use other database systems, you must install ElkArte with the extension for your system.

Creating a database user

A database user can be created through the control panel provided by your hosting service. Selecting the "MySQL Databases" or "Database Wizard" options should take you to a page, prompting you to create a MySQL database user. With different hosts, these options may have different names.

The database user requires the following permissions: SELECT, INSERT, UPDATE, DELETE, ALTER, and INDEX. Additional permissions may be granted, if desired.

@@ -244,7 +244,7 @@

Basic forum settings

Database server settings

Database type
-
The database schema can be selected here from a list of database schemas supported by the server being used. Newer schemas such as PostgreSQL and SQLite may be listed here if available. MySQL is recommended.
+
The database type can be selected here from a list of database types supported by the server being used. Other types such as PostgreSQL and SQLite may be listed here, if available on your server and you have downloaded the installation package with the extension for the respective system. MySQL is recommended.
Server name
The location of the database is specified here. 99% of the time this will be localhost.
Username
@@ -286,4 +286,4 @@

Finishing everything up

- \ No newline at end of file + diff --git a/docs/readme_update.html b/docs/readme_update.html index 923746d5e4..a1ba9af0fa 100644 --- a/docs/readme_update.html +++ b/docs/readme_update.html @@ -164,7 +164,7 @@

Minimum installation requirements

  • Any of the following database systems @@ -277,4 +277,4 @@

    Finishing the update and cleaning up

    - \ No newline at end of file + diff --git a/docs/readme_upgrade.html b/docs/readme_upgrade.html index a147903a1d..0925418827 100644 --- a/docs/readme_upgrade.html +++ b/docs/readme_upgrade.html @@ -137,7 +137,7 @@

    Minimum installation requirements

  • Any of the following database systems @@ -252,4 +252,4 @@

    Finishing the upgrade and cleaning up

    - \ No newline at end of file + diff --git a/install/install.php b/install/install.php index d5c2b1316f..6254ff7623 100644 --- a/install/install.php +++ b/install/install.php @@ -2340,7 +2340,7 @@ function template_database_settings() '; - // Allow the toggling of input boxes for SQLite etc. + // Allow the toggling of input boxes for Postgresql echo '