(4.0.18 or 4.1.2)
$tabletype = ( intval($version[0]) >= 5 || preg_match('#^4\.(0\.[2-9]|(1[89]))|(1\.[2-9])#',$version))
? " ENGINE=MyISAM "
: " TYPE=MyISAM ";
// On 4.1 or greater use utf8-tables
if ( isset($dbcharset) && (intval($version[0]) >= 5 || preg_match('#^4\.[1-9]#',$version)))
{
$tabletype .= " CHARACTER SET = $dbcharset ";
if ($dbcharset == 'utf8')
$tabletype .= " COLLATE utf8_general_ci ";
mysql_query("SET NAMES ".$dbcharset);
}
// Default to messy URLs if we know clean ones won't work
$permlink_mode = 'section_id_title';
if (is_callable('apache_get_modules'))
{
$modules = apache_get_modules();
if (!in_array('mod_rewrite', $modules))
$permlink_mode = 'messy';
}
else
{
$server_software = (@$_SERVER['SERVER_SOFTWARE'] || @$_SERVER['HTTP_HOST'])
? ( (@$_SERVER['SERVER_SOFTWARE']) ? @$_SERVER['SERVER_SOFTWARE'] : $_SERVER['HTTP_HOST'] )
: '';
if (!stristr($server_software, 'Apache'))
$permlink_mode = 'messy';
}
$name = ps('name') ? ps('name') : 'anon';
$create_sql = array();
$create_sql[] = "CREATE TABLE `".PFX."textpattern` (
`ID` int(11) NOT NULL auto_increment,
`Posted` datetime NOT NULL default '0000-00-00 00:00:00',
`AuthorID` varchar(64) NOT NULL default '',
`LastMod` datetime NOT NULL default '0000-00-00 00:00:00',
`LastModID` varchar(64) NOT NULL default '',
`Title` varchar(255) NOT NULL default '',
`Title_html` varchar(255) NOT NULL default '',
`Body` mediumtext NOT NULL,
`Body_html` mediumtext NOT NULL,
`Excerpt` text NOT NULL,
`Excerpt_html` mediumtext NOT NULL,
`Image` varchar(255) NOT NULL default '',
`Category1` varchar(128) NOT NULL default '',
`Category2` varchar(128) NOT NULL default '',
`Annotate` int(2) NOT NULL default '0',
`AnnotateInvite` varchar(255) NOT NULL default '',
`comments_count` int(8) NOT NULL default '0',
`Status` int(2) NOT NULL default '4',
`textile_body` int(2) NOT NULL default '1',
`textile_excerpt` int(2) NOT NULL default '1',
`Section` varchar(64) NOT NULL default '',
`override_form` varchar(255) NOT NULL default '',
`Keywords` varchar(255) NOT NULL default '',
`url_title` varchar(255) NOT NULL default '',
`custom_1` varchar(255) NOT NULL default '',
`custom_2` varchar(255) NOT NULL default '',
`custom_3` varchar(255) NOT NULL default '',
`custom_4` varchar(255) NOT NULL default '',
`custom_5` varchar(255) NOT NULL default '',
`custom_6` varchar(255) NOT NULL default '',
`custom_7` varchar(255) NOT NULL default '',
`custom_8` varchar(255) NOT NULL default '',
`custom_9` varchar(255) NOT NULL default '',
`custom_10` varchar(255) NOT NULL default '',
`uid` varchar(32) NOT NULL default '',
`feed_time` date NOT NULL default '0000-00-00',
PRIMARY KEY (`ID`),
KEY `categories_idx` (`Category1`(10),`Category2`(10)),
KEY `Posted` (`Posted`),
FULLTEXT KEY `searching` (`Title`,`Body`)
) $tabletype PACK_KEYS=1 AUTO_INCREMENT=2 ";
$setup_comment_invite = doSlash( ( gTxt('setup_comment_invite')=='setup_comment_invite') ? 'Comment' : gTxt('setup_comment_invite') );
$create_sql[] = "INSERT INTO `".PFX."textpattern` VALUES (1, now(), '".doSlash($name)."', now(), '', 'Welcome to Your Site!', '', 'h3. What do you want to do next?\n\n* Modify or even delete this article? The \"article list\":siteurl/textpattern/index.php?event=list is the place to start.\n* Change this site\'s name, or modify the style of the URLs? It\'s all up to your \"preferences\":siteurl/textpattern/index.php?event=prefs.\n* Get yourself acquainted with Textile, the humane web text generator which comes with Textpattern? The basics are \"simple\":http://textpattern.com/textile-sandbox. If you want to learn more about Textile, you can dig into an \"extensive manual\":http://textpattern.com/textile-reference-manual later.\n* Be guided through your \"Textpattern first steps\":http://textpattern.com/textpattern-first-steps by completing some basic tasks?\n* Study the \"Textpattern Semantic Model?\":http://textpattern.com/textpattern-semantic-model\n* Add \"another user\":siteurl/textpattern/index.php?event=admin, or extend the capabilities with \"third party plugins\":siteurl/textpattern/index.php?event=plugin you discovered from the central plugin directory at \"Textpattern Resources\":http://textpattern.org/?\n* Dive in and learn by trial and error? Then please note:\n** When you \"write\":siteurl/textpattern/index.php?event=article an article you assign it to a section of your site.\n** Sections use a \"page template\":siteurl/textpattern/index.php?event=page and a \"style\":siteurl/textpattern/index.php?event=css as an output scaffold.\n** Page templates use XHTML and Textpattern tags (like this: @
<txp:article />
) to build the markup.There are a host of Frequently Asked Questions to help you get started.
\n\n\tTextpattern tags, their attributes and values are as well explained as sampled at the Textbook Wiki, where you will also find valuable tips and tutorials.
\n\n\tIf all else fails, there’s a whole crowd of friendly, helpful people over at the Textpattern support forum. Come and pay a visit!
', '', '', '', 'hope-for-the-future', 'meaningful-labor', 1, '".$setup_comment_invite."', 1, 4, 1, 1, 'articles', '', '', 'welcome-to-your-site', '', '', '', '', '', '', '', '', '', '', '".md5(uniqid(rand(), true))."', now())"; $create_sql[] = "CREATE TABLE `".PFX."txp_category` ( `id` int(6) NOT NULL auto_increment, `name` varchar(64) NOT NULL default '', `type` varchar(64) NOT NULL default '', `parent` varchar(64) NOT NULL default '', `lft` int(6) NOT NULL default '0', `rgt` int(6) NOT NULL default '0', `title` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) $tabletype PACK_KEYS=1 AUTO_INCREMENT=10 "; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (1, 'root', 'article', '', 1, 8, 'root')"; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (2, 'root', 'link', '', 1, 4, 'root')"; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (3, 'root', 'image', '', 1, 4, 'root')"; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (4, 'root', 'file', '', 1, 2, 'root')"; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (5, 'hope-for-the-future', 'article', 'root', 2, 3, 'Hope for the Future')"; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (6, 'meaningful-labor', 'article', 'root', 4, 5, 'Meaningful Labor')"; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (7, 'reciprocal-affection', 'article', 'root', 6, 7, 'Reciprocal Affection')"; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (8, 'textpattern', 'link', 'root', 2, 3, 'Textpattern')"; $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (9, 'site-design', 'image', 'root', 2, 3, 'Site Design')"; $create_sql[] = "CREATE TABLE `".PFX."txp_css` ( `name` varchar(255) NOT NULL, `css` text NOT NULL, UNIQUE KEY `name` (`name`) ) $tabletype "; $create_sql[] = "INSERT INTO `".PFX."txp_css` VALUES ('default', 'LyogYmFzZQ0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi8NCg0KYm9keSB7DQoJbWFyZ2luOiAwOw0KCXBhZGRpbmc6IDA7DQoJZm9udC1mYW1pbHk6IFZlcmRhbmEsICJMdWNpZGEgR3JhbmRlIiwgVGFob21hLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWY7DQoJY29sb3I6ICMwMDA7DQoJYmFja2dyb3VuZC1jb2xvcjogI2ZmZjsNCn0NCg0KYmxvY2txdW90ZSwgaDMsIHAsIGxpIHsNCglwYWRkaW5nLXJpZ2h0OiAxMHB4Ow0KCXBhZGRpbmctbGVmdDogMTBweDsNCglmb250LXNpemU6IDAuOWVtOw0KCWxpbmUtaGVpZ2h0OiAxLjZlbTsNCn0NCg0KYmxvY2txdW90ZSB7DQoJbWFyZ2luLXJpZ2h0OiAwOw0KCW1hcmdpbi1sZWZ0OiAyMHB4Ow0KfQ0KDQpoMSwgaDIsIGgzIHsNCgltYXJnaW46IDAgMCAxNXB4IDA7DQoJcGFkZGluZzogMCAxMHB4Ow0KCWZvbnQtd2VpZ2h0OiBub3JtYWw7DQp9DQoNCmgxLCBoMiB7DQoJZm9udC1mYW1pbHk6IEdlb3JnaWEsIFRpbWVzLCBzZXJpZjsNCn0NCg0KaDEgew0KCWZvbnQtc2l6ZTogMS40ZW07DQp9DQoNCmgyIH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xlOw0KCWxpc3Qtc3R5bGUtcG9zaXRpb246IGluc2lkZTsNCglib3JkZXI6IDJweCBzb2xpZCAjZmRkOw0KfQ0KDQpkaXYjY3ByZXZpZXcgew0KCWNvbG9yOiAjMDAwOw0KCWJhY2tncm91bmQtY29sb3I6ICNmMWYxZjE7DQoJYm9yZGVyOiAycHggc29saWQgI2RkZDsNCn0NCg0KZm9ybSN0eHBDb21tZW50SW5wdXRGb3JtIHRkIHsNCgl2ZXJ0aWNhbC1hbGlnbjogdG9wOw0KfQ0KDQojY29tbWVudHMtaGVscCB7DQoJbWFyZ2luOiAycHggMCAxNXB4IDA7DQoJZm9udC1zaXplOiAwLjdlbTsNCn0NCg0KLyogZXJyb3IgcGFnZQ0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi8NCg0KLmVycm9yLXN0YXR1cyB7DQoJZm9udDogMS4zZW0gR2VvcmdpYSwgVGltZXMsIHNlcmlmOw0KfQ==')"; $create_sql[] = "CREATE TABLE `".PFX."txp_discuss` ( `discussid` int(6) unsigned zerofill NOT NULL auto_increment, `parentid` int(8) NOT NULL default '0', `name` varchar(255) NOT NULL default '', `email` varchar(50) NOT NULL default '', `web` varchar(255) NOT NULL default '', `ip` varchar(100) NOT NULL default '', `posted` datetime NOT NULL default '0000-00-00 00:00:00', `message` text NOT NULL, `visible` tinyint(4) NOT NULL default '1', PRIMARY KEY (`discussid`), KEY `parentid` (`parentid`) ) $tabletype PACK_KEYS=1 AUTO_INCREMENT=2 "; $create_sql[] = "INSERT INTO `".PFX."txp_discuss` VALUES (000001, 1, 'Donald Swain', 'me@here.com', 'example.com', '127.0.0.1', '2005-07-22 14:11:32', 'I enjoy your site very much.
', 1)"; $create_sql[] = "CREATE TABLE `".PFX."txp_discuss_ipban` ( `ip` varchar(255) NOT NULL default '', `name_used` varchar(255) NOT NULL default '', `date_banned` datetime NOT NULL default '0000-00-00 00:00:00', `banned_on_message` int(8) NOT NULL default '0', PRIMARY KEY (`ip`) ) $tabletype "; $create_sql[] = "CREATE TABLE `".PFX."txp_discuss_nonce` ( `issue_time` datetime NOT NULL default '0000-00-00 00:00:00', `nonce` varchar(255) NOT NULL default '', `used` tinyint(4) NOT NULL default '0', `secret` varchar(255) NOT NULL default '', PRIMARY KEY (`nonce`) ) $tabletype "; $create_sql[] = "CREATE TABLE `".PFX."txp_file` ( `id` int(11) NOT NULL auto_increment, `filename` varchar(255) NOT NULL default '', `category` varchar(255) NOT NULL default '', `permissions` varchar(32) NOT NULL default '0', `description` text NOT NULL, `downloads` int(4) unsigned NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `filename` (`filename`) ) $tabletype PACK_KEYS=0 AUTO_INCREMENT=1 "; $create_sql[] = "CREATE TABLE `".PFX."txp_form` ( `name` varchar(64) NOT NULL, `type` varchar(28) NOT NULL default '', `Form` text NOT NULL, PRIMARY KEY (`name`) ) $tabletype PACK_KEYS=1"; $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('Links', 'link', '
\n
—
\n\t\t\n\t | \n\n\t\n\t\t | \n
\n\t\t\n\t | \n\n\t\n\t\t | \n
\n\t\t\n\t | \n\n\t\n\t\t | \n
\n\t\t\n\t | \n\n\t\n\t\t | \n\n
\n\n\t | \n\t\t | \n