Ejemplo n.º 1
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}UserSettings` (\n  `uid` varchar(23) character set latin1 NOT NULL,\n  `memorable_name` varchar(100) character set latin1 NOT NULL,\n  `memorable_password` varchar(100) character set latin1 NOT NULL,\n  `email` varchar(100) character set latin1 NOT NULL,\n  `spoiler_mode` tinyint(1) NOT NULL default '0',\n  `snippet_length` smallint(3) NOT NULL default '80',\n  `topics_mode` tinyint(1) NOT NULL,\n  `ostrich_mode` tinyint(1) NOT NULL default '0',\n  PRIMARY KEY  (`uid`),\n  KEY `memorable_name` (`memorable_name`),\n  KEY `email` (`email`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
DB::SetTableRevision("UserSettings", 1);
Ejemplo n.º 2
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}LastActions` (\n  `feature` varchar(30) NOT NULL,\n  `time` int(11) NOT NULL,\n  PRIMARY KEY  (`feature`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
DB::SetTableRevision("LastActions", 1);
Ejemplo n.º 3
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Activity` (\n  `uid` varchar(23) NOT NULL,\n  `time` int(10) NOT NULL,\n  `action_name` varchar(60) NOT NULL,\n  `action_id` int(10) NOT NULL,\n  PRIMARY KEY  (`uid`),\n  KEY `time` (`time`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
DB::SetTableRevision('Activity', 1);
Ejemplo n.º 4
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Users` (\n  `uid` varchar(23) character set latin1 NOT NULL,\n  `password` varchar(32) character set latin1 NOT NULL,\n  `first_seen` int(10) NOT NULL,\n  `ip_address` varchar(100) character set latin1 NOT NULL,\n  PRIMARY KEY  (`uid`),\n  KEY `first_seen` (`first_seen`),\n  KEY `ip_address` (`ip_address`)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
DB::SetTableRevision("Users", 1);
Ejemplo n.º 5
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Pages` (\n  `id` int(6) unsigned NOT NULL auto_increment,\n  `url` varchar(100) NOT NULL,\n  `page_title` varchar(200) NOT NULL,\n  `content` text NOT NULL,\n  PRIMARY KEY  (`id`),\n  UNIQUE KEY `url` (`url`)\n) ENGINE=MyISAM  DEFAULT CHARSET=latin1;");
DB::SetTableRevision("Pages", 1);
Ejemplo n.º 6
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Bulletins` (\n  `id` INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,\n  `time` INT(11) NOT NULL, \n  `author` varchar(23) NOT NULL,\n  `body` TEXT NOT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
DB::SetTableRevision('Bulletins', 1);
Ejemplo n.º 7
0
<?php

/**
 * Migrations table revision 1 (Initial structure)
 *
 * Copyright (c) 2009 ATBBS Contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
DB::Execute("CREATE TABLE IF NOT EXISTS {P}Migrations (\nname VARCHAR( 30 ) NOT NULL ,\nrevision INT( 11 ) UNSIGNED NOT NULL DEFAULT '1',\nPRIMARY KEY ( name )\n) ENGINE = MYISAM ");
DB::SetTableRevision('Migrations', 1);
Ejemplo n.º 8
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Watchlists` (\n  `uid` varchar(23) NOT NULL,\n  `topic_id` int(10) NOT NULL,\n  KEY `uid` (`uid`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
DB::SetTableRevision("Watchlists", 1);
Ejemplo n.º 9
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Filters` (\n\t`filID` INT(11) PRIMARY KEY AUTO_INCREMENT NOT NULL,\n\t`filText` TEXT NOT NULL,\n\t`filReason` TEXT NOT NULL,\n\t`filPunishType` INT(2) NOT NULL,\n\t`filPunishDuration` INT(11) NOT NULL,\n\t`filReplacement` TEXT NOT NULL\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");
DB::SetTableRevision("Filters", 1);
Ejemplo n.º 10
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Trash` (\n  `uid` varchar(23) NOT NULL,\n  `time` int(10) NOT NULL,\n  `headline` varchar(100) NOT NULL,\n  `body` text NOT NULL,\n  KEY `uid` (`uid`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
DB::SetTableRevision("Trash", 1);
Ejemplo n.º 11
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Topics` (\n  `id` int(11) unsigned NOT NULL auto_increment,\n  `time` int(10) unsigned NOT NULL,\n  `author` varchar(23) character set latin1 collate latin1_spanish_ci NOT NULL,\n  `author_ip` varchar(100) character set latin1 NOT NULL,\n  `replies` int(10) NOT NULL,\n  `last_post` int(10) NOT NULL,\n  `visits` int(10) NOT NULL default '0',\n  `headline` varchar(100) character set latin1 NOT NULL,\n  `body` text character set latin1 NOT NULL,\n  `edit_time` int(10) default NULL,\n  `edit_mod` tinyint(1) default NULL,\n  PRIMARY KEY  (`id`),\n  KEY `author` (`author`),\n  KEY `author_ip` (`author_ip`),\n  KEY `last_post` (`last_post`)\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");
DB::SetTableRevision("Topics", 1);
Ejemplo n.º 12
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}IgnoreLists` (\n  `uid` varchar(23) NOT NULL,\n  `ignored_phrases` text NOT NULL,\n  PRIMARY KEY  (`uid`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
DB::SetTableRevision("IgnoreLists", 1);
Ejemplo n.º 13
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS {P}PMs (\n\tpmID INT(11) PRIMARY KEY AUTO_INCREMENT,\n\tpmThread INT(11),\n\tpmTitle VARCHAR(100),\n\tpmFrom VARCHAR(23),\n\tpmTo VARCHAR(23),\n\tpmBody TEXT,\n\tpmDateSent INT(11),\n\tpmFlags INT(11) DEFAULT 0\n) ENGINE=MyISAM CHARSET=utf8");
DB::SetTableRevision('PMs', 1);
Ejemplo n.º 14
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Images` (\n  `file_name` varchar(80) NOT NULL,\n  `md5` varchar(32) NOT NULL,\n  `topic_id` int(10) unsigned DEFAULT NULL,\n  `reply_id` int(10) unsigned DEFAULT NULL,\n  UNIQUE KEY `reply_id` (`reply_id`),\n  UNIQUE KEY `topic_id` (`topic_id`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
DB::SetTableRevision("Images", 1);
Ejemplo n.º 15
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}Bans` (\n  `uid` varchar(23) NOT NULL,\n  `ip` varchar(39) NOT NULL,\n  `expiry` int(11) NOT NULL,\n  `flags` int(11) NOT NULL,\n  `appeal` text NOT NULL,\n  `reason` text NOT NULL\n) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");
DB::SetTableRevision("Bans", 1);
Ejemplo n.º 16
0
<?php

/**
* Skin support
*/
define('FLAG_SPOILER', 4);
// 3rd bit
define('FLAG_TOPICS', 8);
// 4th bit
define('FLAG_OSTRICH', 16);
// 5th bit
$theme = THEME;
// Backup
DB::Execute("DROP TABLE IF EXISTS BACKUP_{P}UserSettings");
DB::Execute("DROP TABLE IF EXISTS NEW_{P}UserSettings");
DB::Execute("CREATE TABLE NEW_{P}UserSettings\n(\n\tusrID \tVARCHAR(23) NOT NULL PRIMARY KEY,\n\tusrName\tVARCHAR(100) NOT NULL,\n\tusrPasshash VARCHAR(40) NOT NULL,\n\tusrFlags INT(11) NOT NULL DEFAULT 0,\n\tusrEmail VARCHAR(100) NOT NULL,\n\tusrSnipLen INT(3) NOT NULL\n) ENGINE=MyISAM DEFAULT CHARSET=utf8\n");
// I'm really proud of this.  I don't know why, as it's very ugly.
// tl;dr Copies old shit into new shitbucket BUT:
// * Password is SHA-1 hashed with a UID salt
// * spoiler_mode and co are turned into flags
// * Fields are renamed
DB::Execute("\nINSERT INTO NEW_{P}UserSettings\nSELECT \n\tuid as usrID, \n\tmemorable_name as usrName, \n\tSHA1(CONCAT(uid,memorable_password)) as usrPasshash,\n\t( 0 | ( `spoiler_mode` *" . FLAG_SPOILER . " ) | ( `topics_mode` *" . FLAG_TOPICS . " ) | ( `ostrich_mode` *" . FLAG_OSTRICH . " ) ) AS usrFlags,\n\temail as usrEmail,\n\tsnippet_length as usrSnipLen\nFROM {P}UserSettings");
DB::Execute("RENAME TABLE {P}UserSettings TO BACKUP_{P}UserSettings");
DB::Execute("RENAME TABLE NEW_{P}UserSettings TO {P}UserSettings");
DB::SetTableRevision('UserSettings', 2);
Ejemplo n.º 17
0
<?php

// Add "flags" field and "name" field.
DB::Execute("ALTER TABLE `{P}Replies` ADD `flags` INT( 11 ) NOT NULL DEFAULT '0'");
DB::Execute("ALTER TABLE `{P}Replies` ADD `name` varchar( 25 ) NOT NULL DEFAULT ''");
// Set flags field
DB::Execute("UPDATE `{P}Replies` SET flags = (0|(edit_mod*1))");
// Remove edit_mod
DB::Execute("ALTER TABLE `{P}Replies` DROP `edit_mod`");
DB::SetTableRevision("Replies", 2);
Ejemplo n.º 18
0
<?php

DB::Execute("CREATE TABLE IF NOT EXISTS `{P}FailedPostings` (\n  `uid` varchar(23) NOT NULL,\n  `time` int(10) NOT NULL,\n  `reason` text NOT NULL,\n  `headline` varchar(100) NOT NULL,\n  `body` text NOT NULL,\n  KEY `time` (`time`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
DB::SetTableRevision('FailedPostings', 1);