[ Index ]

PHP Cross Reference of Textpattern 4.0.8

title

Body

[close]

/textpattern/setup/ -> txpsql.php (source)

   1  <?php
   2  
   3  /*
   4  $HeadURL: https://textpattern.googlecode.com/svn/releases/4.0.8/source/textpattern/setup/txpsql.php $
   5  $LastChangedRevision: 3057 $
   6  */
   7  
   8  
   9  if (!defined('TXP_INSTALL'))
  10      exit;
  11  
  12  @ignore_user_abort(1);
  13  @set_time_limit(0);
  14  
  15  mysql_connect($dhost,$duser,$dpass,false,$dclient_flags);
  16  mysql_select_db($ddb);
  17  
  18  $result = mysql_query("describe `".PFX."textpattern`");
  19  if ($result) die("Textpattern database table already exist. Can't run setup.");
  20  
  21  
  22  $version = mysql_get_server_info();
  23  //Use "ENGINE" if version of MySQL > (4.0.18 or 4.1.2)
  24  $tabletype = ( intval($version[0]) >= 5 || preg_match('#^4\.(0\.[2-9]|(1[89]))|(1\.[2-9])#',$version))
  25      ? " ENGINE=MyISAM "
  26      : " TYPE=MyISAM ";
  27  
  28  // On 4.1 or greater use utf8-tables
  29  if ( isset($dbcharset) && (intval($version[0]) >= 5 || preg_match('#^4\.[1-9]#',$version)))
  30  {
  31      $tabletype .= " CHARACTER SET = $dbcharset ";
  32      if ($dbcharset == 'utf8')
  33          $tabletype .= " COLLATE utf8_general_ci ";
  34      mysql_query("SET NAMES ".$dbcharset);
  35  }
  36  
  37  // Default to messy URLs if we know clean ones won't work
  38  $permlink_mode = 'section_id_title';
  39  if (is_callable('apache_get_modules'))
  40  {
  41      $modules = apache_get_modules();
  42      if (!in_array('mod_rewrite', $modules))
  43          $permlink_mode = 'messy';
  44  }
  45  else
  46  {
  47      $server_software = (@$_SERVER['SERVER_SOFTWARE'] || @$_SERVER['HTTP_HOST'])
  48          ? ( (@$_SERVER['SERVER_SOFTWARE']) ?  @$_SERVER['SERVER_SOFTWARE'] :  $_SERVER['HTTP_HOST'] )
  49          : '';
  50      if (!stristr($server_software, 'Apache'))
  51          $permlink_mode = 'messy';
  52  }
  53  
  54  $name = ps('name') ? ps('name') : 'anon';
  55  
  56  $create_sql = array();
  57  
  58  $create_sql[] = "CREATE TABLE `".PFX."textpattern` (
  59    `ID` int(11) NOT NULL auto_increment,
  60    `Posted` datetime NOT NULL default '0000-00-00 00:00:00',
  61    `AuthorID` varchar(64) NOT NULL default '',
  62    `LastMod` datetime NOT NULL default '0000-00-00 00:00:00',
  63    `LastModID` varchar(64) NOT NULL default '',
  64    `Title` varchar(255) NOT NULL default '',
  65    `Title_html` varchar(255) NOT NULL default '',
  66    `Body` mediumtext NOT NULL,
  67    `Body_html` mediumtext NOT NULL,
  68    `Excerpt` text NOT NULL,
  69    `Excerpt_html` mediumtext NOT NULL,
  70    `Image` varchar(255) NOT NULL default '',
  71    `Category1` varchar(128) NOT NULL default '',
  72    `Category2` varchar(128) NOT NULL default '',
  73    `Annotate` int(2) NOT NULL default '0',
  74    `AnnotateInvite` varchar(255) NOT NULL default '',
  75    `comments_count` int(8) NOT NULL default '0',
  76    `Status` int(2) NOT NULL default '4',
  77    `textile_body` int(2) NOT NULL default '1',
  78    `textile_excerpt` int(2) NOT NULL default '1',
  79    `Section` varchar(64) NOT NULL default '',
  80    `override_form` varchar(255) NOT NULL default '',
  81    `Keywords` varchar(255) NOT NULL default '',
  82    `url_title` varchar(255) NOT NULL default '',
  83    `custom_1` varchar(255) NOT NULL default '',
  84    `custom_2` varchar(255) NOT NULL default '',
  85    `custom_3` varchar(255) NOT NULL default '',
  86    `custom_4` varchar(255) NOT NULL default '',
  87    `custom_5` varchar(255) NOT NULL default '',
  88    `custom_6` varchar(255) NOT NULL default '',
  89    `custom_7` varchar(255) NOT NULL default '',
  90    `custom_8` varchar(255) NOT NULL default '',
  91    `custom_9` varchar(255) NOT NULL default '',
  92    `custom_10` varchar(255) NOT NULL default '',
  93    `uid` varchar(32) NOT NULL default '',
  94    `feed_time` date NOT NULL default '0000-00-00',
  95    PRIMARY KEY  (`ID`),
  96    KEY `categories_idx` (`Category1`(10),`Category2`(10)),
  97    KEY `Posted` (`Posted`),
  98    FULLTEXT KEY `searching` (`Title`,`Body`)
  99  ) $tabletype PACK_KEYS=1 AUTO_INCREMENT=2 ";
 100  
 101  $setup_comment_invite = doSlash( ( gTxt('setup_comment_invite')=='setup_comment_invite') ? 'Comment' : gTxt('setup_comment_invite') );
 102  $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.\n** Some Textpattern tags use \"forms\":siteurl/textpattern/index.php?event=form, which are building blocks for reusable snippets of code and markup you may build and use at your discretion.\n\nThere are a host of \"Frequently Asked Questions\":http://textpattern.com/faq/ to help you get started.\n\n\"Textpattern tags\":http://textpattern.com/textpattern-tag-reference, their attributes and values are as well explained as sampled at the \"Textbook Wiki\":http://textbook.textpattern.net/, where you will also find valuable tips and tutorials.\n\nIf all else fails, there\'s a whole crowd of friendly, helpful people over at the \"Textpattern support forum\":http://forum.textpattern.com/. Come and pay a visit!\n', '\t<h3>What do you want to do next?</h3>\n\n\t<ul>\n\t\t<li>Modify or even delete this article? The <a href=\"siteurl/textpattern/index.php?event=list\">article list</a> is the place to start.</li>\n\t\t<li>Change this site&#8217;s name, or modify the style of the <span class=\"caps\">URL</span>s? It&#8217;s all up to your <a href=\"siteurl/textpattern/index.php?event=prefs\">preferences</a>.</li>\n\t\t<li>Get yourself acquainted with Textile, the humane web text generator which comes with Textpattern? The basics are <a href=\"http://textpattern.com/textile-sandbox\">simple</a>. If you want to learn more about Textile, you can dig into an <a href=\"http://textpattern.com/textile-reference-manual\">extensive manual</a> later.</li>\n\t\t<li>Be guided through your <a href=\"http://textpattern.com/textpattern-first-steps\">Textpattern first steps</a> by completing some basic tasks?</li>\n\t\t<li>Study the <a href=\"http://textpattern.com/textpattern-semantic-model\">Textpattern Semantic Model?</a></li>\n\t\t<li>Add <a href=\"siteurl/textpattern/index.php?event=admin\">another user</a>, or extend the capabilities with <a href=\"siteurl/textpattern/index.php?event=plugin\">third party plugins</a> you discovered from the central plugin directory at <a href=\"http://textpattern.org/\">Textpattern Resources</a>?</li>\n\t\t<li>Dive in and learn by trial and error? Then please note:\n\t<ul>\n\t\t<li>When you <a href=\"siteurl/textpattern/index.php?event=article\">write</a> an article you assign it to a section of your site.</li>\n\t\t<li>Sections use a <a href=\"siteurl/textpattern/index.php?event=page\">page template</a> and a <a href=\"siteurl/textpattern/index.php?event=css\">style</a> as an output scaffold.</li>\n\t\t<li>Page templates use <span class=\"caps\">XHTML</span> and Textpattern tags (like this: <code>&lt;txp:article /&gt;</code>) to build the markup.</li>\n\t\t<li>Some Textpattern tags use <a href=\"siteurl/textpattern/index.php?event=form\">forms</a>, which are building blocks for reusable snippets of code and markup you may build and use at your discretion.</li>\n\t</ul></li>\n\t</ul>\n\n\t<p>There are a host of <a href=\"http://textpattern.com/faq/\">Frequently Asked Questions</a> to help you get started.</p>\n\n\t<p><a href=\"http://textpattern.com/textpattern-tag-reference\">Textpattern tags</a>, their attributes and values are as well explained as sampled at the <a href=\"http://textbook.textpattern.net/\">Textbook Wiki</a>, where you will also find valuable tips and tutorials.</p>\n\n\t<p>If all else fails, there&#8217;s a whole crowd of friendly, helpful people over at the <a href=\"http://forum.textpattern.com/\">Textpattern support forum</a>. Come and pay a visit!</p>', '', '', '', 'hope-for-the-future', 'meaningful-labor', 1, '".$setup_comment_invite."', 1, 4, 1, 1, 'articles', '', '', 'welcome-to-your-site', '', '', '', '', '', '', '', '', '', '', '".md5(uniqid(rand(), true))."', now())";
 103  
 104  
 105  $create_sql[] = "CREATE TABLE `".PFX."txp_category` (
 106    `id` int(6) NOT NULL auto_increment,
 107    `name` varchar(64) NOT NULL default '',
 108    `type` varchar(64) NOT NULL default '',
 109    `parent` varchar(64) NOT NULL default '',
 110    `lft` int(6) NOT NULL default '0',
 111    `rgt` int(6) NOT NULL default '0',
 112    `title` varchar(255) NOT NULL default '',
 113    PRIMARY KEY  (`id`)
 114  ) $tabletype PACK_KEYS=1 AUTO_INCREMENT=10 ";
 115  
 116  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (1, 'root', 'article', '', 1, 8, 'root')";
 117  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (2, 'root', 'link', '', 1, 4, 'root')";
 118  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (3, 'root', 'image', '', 1, 4, 'root')";
 119  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (4, 'root', 'file', '', 1, 2, 'root')";
 120  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (5, 'hope-for-the-future', 'article', 'root', 2, 3, 'Hope for the Future')";
 121  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (6, 'meaningful-labor', 'article', 'root', 4, 5, 'Meaningful Labor')";
 122  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (7, 'reciprocal-affection', 'article', 'root', 6, 7, 'Reciprocal Affection')";
 123  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (8, 'textpattern', 'link', 'root', 2, 3, 'Textpattern')";
 124  $create_sql[] = "INSERT INTO `".PFX."txp_category` VALUES (9, 'site-design', 'image', 'root', 2, 3, 'Site Design')";
 125  
 126  
 127  $create_sql[] = "CREATE TABLE `".PFX."txp_css` (
 128    `name` varchar(255) NOT NULL,
 129    `css` text NOT NULL,
 130    UNIQUE KEY `name` (`name`)
 131  ) $tabletype ";
 132  
 133  $create_sql[] = "INSERT INTO `".PFX."txp_css` VALUES ('default', 'LyogYmFzZQ0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi8NCg0KYm9keSB7DQoJbWFyZ2luOiAwOw0KCXBhZGRpbmc6IDA7DQoJZm9udC1mYW1pbHk6IFZlcmRhbmEsICJMdWNpZGEgR3JhbmRlIiwgVGFob21hLCBIZWx2ZXRpY2EsIHNhbnMtc2VyaWY7DQoJY29sb3I6ICMwMDA7DQoJYmFja2dyb3VuZC1jb2xvcjogI2ZmZjsNCn0NCg0KYmxvY2txdW90ZSwgaDMsIHAsIGxpIHsNCglwYWRkaW5nLXJpZ2h0OiAxMHB4Ow0KCXBhZGRpbmctbGVmdDogMTBweDsNCglmb250LXNpemU6IDAuOWVtOw0KCWxpbmUtaGVpZ2h0OiAxLjZlbTsNCn0NCg0KYmxvY2txdW90ZSB7DQoJbWFyZ2luLXJpZ2h0OiAwOw0KCW1hcmdpbi1sZWZ0OiAyMHB4Ow0KfQ0KDQpoMSwgaDIsIGgzIHsNCgltYXJnaW46IDAgMCAxNXB4IDA7DQoJcGFkZGluZzogMCAxMHB4Ow0KCWZvbnQtd2VpZ2h0OiBub3JtYWw7DQp9DQoNCmgxLCBoMiB7DQoJZm9udC1mYW1pbHk6IEdlb3JnaWEsIFRpbWVzLCBzZXJpZjsNCn0NCg0KaDEgew0KCWZvbnQtc2l6ZTogMS40ZW07DQp9DQ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TogY2lyY2xlOw0KCWxpc3Qtc3R5bGUtcG9zaXRpb246IGluc2lkZTsNCglib3JkZXI6IDJweCBzb2xpZCAjZmRkOw0KfQ0KDQpkaXYjY3ByZXZpZXcgew0KCWNvbG9yOiAjMDAwOw0KCWJhY2tncm91bmQtY29sb3I6ICNmMWYxZjE7DQoJYm9yZGVyOiAycHggc29saWQgI2RkZDsNCn0NCg0KZm9ybSN0eHBDb21tZW50SW5wdXRGb3JtIHRkIHsNCgl2ZXJ0aWNhbC1hbGlnbjogdG9wOw0KfQ0KDQojY29tbWVudHMtaGVscCB7DQoJbWFyZ2luOiAycHggMCAxNXB4IDA7DQoJZm9udC1zaXplOiAwLjdlbTsNCn0NCg0KLyogZXJyb3IgcGFnZQ0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gKi8NCg0KLmVycm9yLXN0YXR1cyB7DQoJZm9udDogMS4zZW0gR2VvcmdpYSwgVGltZXMsIHNlcmlmOw0KfQ==')";
 134  
 135  $create_sql[] = "CREATE TABLE `".PFX."txp_discuss` (
 136    `discussid` int(6) unsigned zerofill NOT NULL auto_increment,
 137    `parentid` int(8) NOT NULL default '0',
 138    `name` varchar(255) NOT NULL default '',
 139    `email` varchar(50) NOT NULL default '',
 140    `web` varchar(255) NOT NULL default '',
 141    `ip` varchar(100) NOT NULL default '',
 142    `posted` datetime NOT NULL default '0000-00-00 00:00:00',
 143    `message` text NOT NULL,
 144    `visible` tinyint(4) NOT NULL default '1',
 145    PRIMARY KEY  (`discussid`),
 146    KEY `parentid` (`parentid`)
 147  ) $tabletype PACK_KEYS=1 AUTO_INCREMENT=2 ";
 148  
 149  $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', '<p>I enjoy your site very much.</p>', 1)";
 150  
 151  $create_sql[] = "CREATE TABLE `".PFX."txp_discuss_ipban` (
 152    `ip` varchar(255) NOT NULL default '',
 153    `name_used` varchar(255) NOT NULL default '',
 154    `date_banned` datetime NOT NULL default '0000-00-00 00:00:00',
 155    `banned_on_message` int(8) NOT NULL default '0',
 156    PRIMARY KEY (`ip`)
 157  ) $tabletype ";
 158  
 159  $create_sql[] = "CREATE TABLE `".PFX."txp_discuss_nonce` (
 160    `issue_time` datetime NOT NULL default '0000-00-00 00:00:00',
 161    `nonce` varchar(255) NOT NULL default '',
 162    `used` tinyint(4) NOT NULL default '0',
 163    `secret` varchar(255) NOT NULL default '',
 164    PRIMARY KEY (`nonce`)
 165  ) $tabletype ";
 166  
 167  $create_sql[] = "CREATE TABLE `".PFX."txp_file` (
 168    `id` int(11) NOT NULL auto_increment,
 169    `filename` varchar(255) NOT NULL default '',
 170    `category` varchar(255) NOT NULL default '',
 171    `permissions` varchar(32) NOT NULL default '0',
 172    `description` text NOT NULL,
 173    `downloads` int(4) unsigned NOT NULL default '0',
 174    PRIMARY KEY  (`id`),
 175    UNIQUE KEY `filename` (`filename`)
 176  ) $tabletype PACK_KEYS=0 AUTO_INCREMENT=1 ";
 177  
 178  $create_sql[] = "CREATE TABLE `".PFX."txp_form` (
 179    `name` varchar(64) NOT NULL,
 180    `type` varchar(28) NOT NULL default '',
 181    `Form` text NOT NULL,
 182    PRIMARY KEY (`name`)
 183  ) $tabletype PACK_KEYS=1";
 184  
 185  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('Links', 'link', '<p><txp:link /><br />\n<txp:link_description /></p>')";
 186  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('lofi', 'article', '<h3 class=\"entry-title\"><txp:title /> <txp:permlink>#</txp:permlink></h3>\n\n<p class=\"published\"><txp:posted /></p>\n\n<div class=\"entry-content\">\n<txp:body />\n</div>\n\n<hr />\n\n')";
 187  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('single', 'article', '<h3 class=\"entry-title\"><txp:permlink><txp:title /></txp:permlink></h3>\n\t<p class=\"published\"><txp:posted /></p>\n\n<div class=\"entry-content\">\n<txp:body />\n</div>\n\n')";
 188  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('plainlinks', 'link', '<txp:linkdesctitle /><br />')";
 189  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('comments', 'comment', '<txp:comment_message />\n\n<p class=\"small\">&#8212; <txp:comment_name /> &#183; <txp:comment_time /> &#183; <txp:comment_permlink>#</txp:comment_permlink></p>')";
 190  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('default', 'article', '<txp:if_individual_article>\n<h1 class=\"entry-title\"><txp:permlink><txp:title /></txp:permlink></h1>\n<txp:else />\n<h3 class=\"entry-title\"><txp:permlink><txp:title /></txp:permlink></h3>\n</txp:if_individual_article>\n\n<p class=\"published\"><txp:posted /></p>\n\n<div class=\"entry-content\">\n<txp:body />\n</div>\n\n<address class=\"vcard author\">&#8212; <span class=\"fn\"><txp:author /></span></address>\n\n<p class=\"tags\"><txp:category1 title=\"1\" link=\"1\" />, <txp:category2 title=\"1\" link=\"1\" /></p>\n\n<txp:comments_invite wraptag=\"p\" />\n\n<div class=\"divider\"><img src=\"<txp:site_url />images/1.gif\" width=\"400\" height=\"1\" alt=\"---\" title=\"\" /></div>\n\n')";
 191  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('comment_form', 'comment', '<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\n<tr>\n\t<td align=\"right\">\n\t\t<label for=\"name\"><txp:text item=\"comment_name\" /></label>\n\t</td>\n\n\t<td>\n\t\t<txp:comment_name_input />\n\t\t<txp:comment_remember />\n\t</td>\n</tr>\n\n<tr>\n\t<td align=\"right\">\n\t\t<label for=\"email\"><txp:text item=\"comment_email\" /></label>\n\t</td>\n\n\t<td>\n\t\t<txp:comment_email_input />\n\t</td>\n</tr>\n\n<tr>\n\t<td align=\"right\">\n\t\t<label for=\"web\"><txp:text item=\"comment_web\" /></label>\n\t</td>\n\n\t<td>\n\t\t<txp:comment_web_input />\n\t</td>\n</tr>\n\n<tr>\n\t<td align=\"right\">\n\t\t<label for=\"message\"><txp:text item=\"comment_message\" /></label>\n\t</td>\n\n\t<td>\n\t\t<txp:comment_message_input />\n\t\t<div id=\"comments-help\"><txp:comments_help /></div>\n\t</td>\n\n</tr>\n\n<tr>\n\t<td>&nbsp;</td>\n\n\t<td>\n\t\t<txp:comment_preview />\n\t\t<txp:comment_submit />\n\t</td>\n</tr>\n\n</table>')";
 192  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('noted', 'link', '<p><txp:link />. <txp:link_description /></p>')";
 193  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('popup_comments', 'comment', '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n\t<title><txp:page_title /></title>\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"<txp:css />\" />\n</head>\n<body>\n\n<div style=\"padding: 1em; width:300px;\">\n<txp:popup_comments />\n</div>\n\n</body>\n</html>')";
 194  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('files', 'file', '<txp:text item=\"file\" />: \n<txp:file_download_link>\n<txp:file_download_name /> [<txp:file_download_size format=\"auto\" decimals=\"2\" />]\n</txp:file_download_link>\n<br />\n<txp:text item=\"category\" />: <txp:file_download_category /><br />\n<txp:text item=\"download\" />: <txp:file_download_downloads />')";
 195  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('search_results', 'article', '<h3 class=\"entry-title\"><txp:permlink><txp:title /></txp:permlink></h3>\n\n<p class=\"published\"><txp:posted /></p>\n\n<p class=\"entry-summary\"><txp:search_result_excerpt /></p>\n\n<p class=\"small\"><txp:permlink><txp:permlink /></txp:permlink></p>\n\n<div class=\"divider\"><img src=\"<txp:site_url />images/1.gif\" width=\"400\" height=\"1\" alt=\"---\" title=\"\" /></div>')";
 196  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('comments_display', 'article', '<h2 id=\"<txp:text item=\"comment\" />\"><txp:comments_invite textonly=\"1\" showalways=\"1\" showcount=\"0\" /></h2>\n\n<txp:comments />\n\n<txp:if_comments_preview>\n<div id=\"cpreview\">\n<txp:comments_preview />\n</div>\n</txp:if_comments_preview>\n\n<txp:if_comments_allowed>\n<txp:comments_form isize=\"25\" msgcols=\"45\" msgrows=\"15\" />\n<txp:else />\n<p><txp:text item=\"comments_closed\" /></p>\n</txp:if_comments_allowed>')";
 197  $create_sql[] = "INSERT INTO `".PFX."txp_form` VALUES ('article_listing', 'article', '<txp:if_first_article><ul class=\"directory\"></txp:if_first_article>\n\n<li><span class=\"entry-title\"><txp:permlink><txp:title /></txp:permlink></span> &#183; <span class=\"published\"><txp:posted format=\"%Y-%m-%d\" /></span></li>\n\n<txp:if_last_article></ul></txp:if_last_article>')";
 198  
 199  $create_sql[] = "CREATE TABLE `".PFX."txp_image` (
 200    `id` int(11) NOT NULL auto_increment,
 201    `name` varchar(255) NOT NULL default '',
 202    `category` varchar(255) NOT NULL default '',
 203    `ext` varchar(20) NOT NULL default '',
 204    `w` int(8) NOT NULL default '0',
 205    `h` int(8) NOT NULL default '0',
 206    `alt` varchar(255) NOT NULL default '',
 207    `caption` text NOT NULL,
 208    `date` datetime NOT NULL default '0000-00-00 00:00:00',
 209    `author` varchar(255) NOT NULL default '',
 210    `thumbnail` int(2) NOT NULL default '0',
 211    PRIMARY KEY  (`id`)
 212  ) $tabletype PACK_KEYS=0 AUTO_INCREMENT=2 ";
 213  
 214  $create_sql[] = "INSERT INTO `".PFX."txp_image` VALUES (1, 'divider.gif', 'site-design', '.gif', 400, 1, '', '', '2005-07-22 16:37:11', '".doSlash($name)."', 0)";
 215  
 216  $create_sql[] = "CREATE TABLE `".PFX."txp_lang` (
 217    `id` int(9) NOT NULL auto_increment,
 218    `lang` varchar(16) NOT NULL,
 219    `name` varchar(64) NOT NULL,
 220    `event` varchar(64) NOT NULL,
 221    `data` tinytext,
 222    `lastmod` timestamp,
 223    PRIMARY KEY  (`id`),
 224    UNIQUE KEY `lang` (`lang`,`name`),
 225    KEY `lang_2` (`lang`,`event`)
 226  ) $tabletype AUTO_INCREMENT=1 ";
 227  
 228  $create_sql[] = "CREATE TABLE `".PFX."txp_link` (
 229    `id` int(6) NOT NULL auto_increment,
 230    `date` datetime NOT NULL default '0000-00-00 00:00:00',
 231    `category` varchar(64) NOT NULL default '',
 232    `url` text NOT NULL,
 233    `linkname` varchar(255) NOT NULL default '',
 234    `linksort` varchar(128) NOT NULL default '',
 235    `description` text NOT NULL,
 236    PRIMARY KEY  (`id`)
 237  ) $tabletype PACK_KEYS=1 AUTO_INCREMENT=4 ";
 238  
 239  $create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES (1, '2005-07-20 12:54:26', 'textpattern', 'http://textpattern.com/', 'Textpattern', 'Textpattern', '')";
 240  $create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES (2, '2005-07-20 12:54:41', 'textpattern', 'http://textpattern.net/', 'TextBook', 'TextBook', '')";
 241  $create_sql[] = "INSERT INTO `".PFX."txp_link` VALUES (3, '2005-07-20 12:55:04', 'textpattern', 'http://textpattern.org/', 'Txp Resources', 'Txp Resources', '')";
 242  
 243  $create_sql[] = "CREATE TABLE `".PFX."txp_log` (
 244    `id` int(12) NOT NULL auto_increment,
 245    `time` datetime NOT NULL default '0000-00-00 00:00:00',
 246    `host` varchar(255) NOT NULL default '',
 247    `page` varchar(255) NOT NULL default '',
 248    `refer` mediumtext NOT NULL,
 249    `status` int(11) NOT NULL default '200',
 250    `method` varchar(16) NOT NULL default 'GET',
 251    `ip` varchar(16) NOT NULL default '',
 252    PRIMARY KEY  (`id`),
 253    KEY `time` (`time`)
 254  ) $tabletype AUTO_INCREMENT=77 ";
 255  
 256  $create_sql[] = "CREATE TABLE `".PFX."txp_page` (
 257    `name` varchar(128) NOT NULL,
 258    `user_html` text NOT NULL,
 259    PRIMARY KEY (`name`)
 260  ) $tabletype PACK_KEYS=1";
 261  
 262  $create_sql[] = "INSERT INTO `".PFX."txp_page` VALUES ('default', '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n\n\t<title><txp:page_title /></title>\n\n\t<link rel=\"home\" href=\"<txp:site_url />\" />\n\n\t<txp:feed_link flavor=\"atom\" format=\"link\" label=\"Atom\" />\n\t<txp:feed_link flavor=\"rss\" format=\"link\" label=\"RSS\" />\n\n\t<txp:css format=\"link\" />\n\n\t<txp:rsd />\n</head>\n<body id=\"<txp:if_section name=\"\">front<txp:else /><txp:section /></txp:if_section>\">\n\n<!-- accessibility -->\n<div id=\"accessibility\">\n\t<ul>\n\t\t<li><a href=\"#content\"><txp:text item=\"go_content\" /></a></li>\n\t\t<li><a href=\"#sidebar-1\"><txp:text item=\"go_nav\" /></a></li>\n\t\t<li><a href=\"#sidebar-2\"><txp:text item=\"go_search\" /></a></li>\n\t</ul>\n</div>\n\n<div id=\"container\">\n\n<!-- head -->\n\t<div id=\"head\">\n\t\t<h1 id=\"site-name\"><txp:link_to_home><txp:site_name /></txp:link_to_home></h1>\n\t\t<p id=\"site-slogan\"><txp:site_slogan /></p>\n\t</div>\n\n<!-- left -->\n\t<div id=\"sidebar-1\">\n\t\t<txp:section_list default_title=\'<txp:text item=\"home\" />\' include_default=\"1\" wraptag=\"ul\" break=\"li\">\n\t\t\t<txp:if_section name=\'<txp:section />\'>&raquo;</txp:if_section>\n\t\t\t<txp:section link=\"1\" title=\"1\" />\n\t\t\t<txp:if_section name=\'<txp:section />\'>\n\t\t\t\t<txp:article_custom  section=\'<txp:section />\' wraptag=\"ul\" break=\"li\">\n\t\t\t\t\t<txp:if_article_id>&rsaquo;</txp:if_article_id>\n\t\t\t\t\t<txp:permlink><txp:title /></txp:permlink>\n\t\t\t\t</txp:article_custom>\n\t\t\t</txp:if_section>\n\t\t</txp:section_list>\n\t\t<txp:search_input wraptag=\"p\" />\n\n\t\t<p><txp:feed_link label=\"RSS\" /> / <txp:feed_link flavor=\"atom\" label=\"Atom\" /></p>\n\t</div>\n\n<!-- right -->\n\t<div id=\"sidebar-2\">\n\t\t<txp:linklist wraptag=\"p\" />\n\n\t\t<p><a href=\"http://textpattern.com/\"><img src=\"<txp:site_url />textpattern/txp_img/txp_slug105x45.gif\" width=\"105\" height=\"45\" alt=\"Textpattern\" title=\"\" /></a></p>\n\t</div>\n\n<!-- center -->\n\t<div id=\"content\">\n<txp:if_category>\n\t\t<h2><txp:category title=\"1\" /></h2>\n\n\t\t<div class=\"hfeed\">\n\t\t<txp:article form=\"article_listing\" limit=\"5\" />\n\t\t</div>\n<txp:else />\n\t<txp:if_search>\n\t\t<h2><txp:text item=\"search_results\" />: <txp:page_url type=\"q\" /></h2>\n\n\t\t<div class=\"divider\"><img src=\"<txp:site_url />images/1.gif\" width=\"400\" height=\"1\" alt=\"---\" title=\"\" /></div>\n\t</txp:if_search>\n\n\t\t<div class=\"hfeed\">\n\t\t<txp:article limit=\"5\" />\n\t\t</div>\n</txp:if_category>\n\n\t\n<txp:if_individual_article>\n\t\t<div class=\"divider\"><img src=\"<txp:site_url />images/1.gif\" width=\"400\" height=\"1\" alt=\"---\" title=\"\" /></div>\n\n\t\t<p><txp:link_to_prev>&#171; <txp:prev_title /></txp:link_to_prev> \n\t\t\t<txp:link_to_next><txp:next_title /> &#187;</txp:link_to_next></p>\n<txp:else />\n\t\t<p><txp:older>&#171; <txp:text item=\"older\" /></txp:older> \n\t\t\t<txp:newer><txp:text item=\"newer\" /> &#187;</txp:newer></p>\n</txp:if_individual_article>\n\t</div>\n\n<!-- footer -->\n\t<div id=\"foot\">&nbsp;</div>\n\n</div>\n\n</body>\n</html>')";
 263  $create_sql[] = "INSERT INTO `".PFX."txp_page` VALUES ('archive', '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n\n\t<title><txp:page_title /></title>\n\n\t<link rel=\"home\" href=\"<txp:site_url />\" />\n\n\t<txp:feed_link flavor=\"atom\" format=\"link\" label=\"Atom\" />\n\t<txp:feed_link flavor=\"rss\" format=\"link\" label=\"RSS\" />\n\n\t<txp:css format=\"link\" />\n\n\t<txp:rsd />\n</head>\n<body id=\"<txp:section />\">\n\n<!-- accessibility -->\n<div id=\"accessibility\">\n\t<ul>\n\t\t<li><a href=\"#content\"><txp:text item=\"go_content\" /></a></li>\n\t\t<li><a href=\"#sidebar-1\"><txp:text item=\"go_nav\" /></a></li>\n\t\t<li><a href=\"#sidebar-2\"><txp:text item=\"go_search\" /></a></li>\n\t</ul>\n</div>\n\n<div id=\"container\">\n\n<!-- head -->\n\t<div id=\"head\">\n\t\t<p id=\"site-name\"><txp:link_to_home><txp:site_name /></txp:link_to_home></p>\n\t\t<p id=\"site-slogan\"><txp:site_slogan /></p>\n\t</div>\n\n<!-- left -->\n\t<div id=\"sidebar-1\">\n\t\t<txp:section_list default_title=\'<txp:text item=\"home\" />\' include_default=\"1\" wraptag=\"ul\" break=\"li\">\n\t\t\t<txp:if_section name=\'<txp:section />\'>&raquo;</txp:if_section>\n\t\t\t<txp:section link=\"1\" title=\"1\" />\n\t\t\t<txp:if_section name=\'<txp:section />\'>\n\t\t\t\t<txp:article_custom  section=\'<txp:section />\' wraptag=\"ul\" break=\"li\">\n\t\t\t\t\t<txp:if_article_id>&rsaquo;</txp:if_article_id>\n\t\t\t\t\t<txp:permlink><txp:title /></txp:permlink>\n\t\t\t\t</txp:article_custom>\n\t\t\t</txp:if_section>\n\t\t</txp:section_list>\n\n\t\t<txp:search_input wraptag=\"p\" />\n\n\t\t<p><txp:feed_link label=\"RSS\" /> / <txp:feed_link flavor=\"atom\" label=\"Atom\" /></p>\n\t</div>\n\n<!-- right -->\n\t<div id=\"sidebar-2\">\n\t\t<txp:linklist wraptag=\"p\" />\n\n\t\t<p><a href=\"http://textpattern.com/\"><img src=\"<txp:site_url />textpattern/txp_img/txp_slug105x45.gif\" width=\"105\" height=\"45\" alt=\"Textpattern\" title=\"\" /></a></p>\n\t</div>\n\n<!-- center -->\n\t<div id=\"content\">\n\t\t<txp:if_article_list><h1><txp:section title=\"1\" /></h1></txp:if_article_list>\n\n\t\t<div class=\"hfeed\">\n\t\t<txp:article listform=\"article_listing\" limit=\"5\" />\n\t\t</div>\n\t\n<txp:if_individual_article>\n\t\t<div class=\"divider\"><img src=\"<txp:site_url />images/1.gif\" width=\"400\" height=\"1\" alt=\"---\" title=\"\" /></div>\n\n\t\t<p><txp:link_to_prev>&#171; <txp:prev_title /></txp:link_to_prev> \n\t\t\t<txp:link_to_next><txp:next_title /> &#187;</txp:link_to_next></p>\n<txp:else />\n\t\t<p><txp:older>&#171; <txp:text item=\"older\" /></txp:older> \n\t\t\t<txp:newer><txp:text item=\"newer\" /> &#187;</txp:newer></p>\n</txp:if_individual_article>\n\t</div>\n\n<!-- footer -->\n\t<div id=\"foot\">&nbsp;</div>\n\n</div>\n\n</body>\n</html>')";
 264  
 265  $create_sql[] = "CREATE TABLE `".PFX."txp_plugin` (
 266    `name` varchar(64) NOT NULL default '',
 267    `status` int(2) NOT NULL default '1',
 268    `author` varchar(128) NOT NULL default '',
 269    `author_uri` varchar(128) NOT NULL default '',
 270    `version` varchar(10) NOT NULL default '1.0',
 271    `description` text NOT NULL,
 272    `help` text NOT NULL,
 273    `code` text NOT NULL,
 274    `code_restore` text NOT NULL,
 275    `code_md5` varchar(32) NOT NULL default '',
 276    `type` int(2) NOT NULL default '0',
 277    UNIQUE KEY `name` (`name`)
 278  ) $tabletype ";
 279  
 280  $create_sql[] = "CREATE TABLE `".PFX."txp_prefs` (
 281    `prefs_id` int(11) NOT NULL,
 282    `name` varchar(255) NOT NULL,
 283    `val` varchar(255) NOT NULL default '',
 284    `type` smallint(5) unsigned NOT NULL default '2',
 285    `event` varchar(12) NOT NULL default 'publish',
 286    `html` varchar(64) NOT NULL default 'text_input',
 287    `position` smallint(5) unsigned NOT NULL default '0',
 288    UNIQUE KEY `prefs_idx` (`prefs_id`,`name`),
 289    KEY `name` (`name`)
 290  ) $tabletype ";
 291  
 292  $prefs['blog_uid'] = md5(uniqid(rand(),true));
 293  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'prefs_id', '1', 2, 'publish', 'text_input', 0)";
 294  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'sitename', '".doSlash(gTxt('my_site'))."', 0, 'publish', 'text_input', 10)";
 295  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'siteurl', 'comment.local', 0, 'publish', 'text_input', 20)";
 296  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'site_slogan', '".doSlash(gTxt('my_slogan'))."', 0, 'publish', 'text_input', 30)";
 297  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'language', 'en-gb', 2, 'publish', 'languages', 40)";
 298  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'url_mode', '1', 2, 'publish', 'text_input', 0)";
 299  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'timeoffset', '0', 2, 'publish', 'text_input', 0)";
 300  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_on_default', '0', 0, 'comments', 'yesnoradio', 140)";
 301  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_default_invite', '".$setup_comment_invite."', 0, 'comments', 'text_input', 180)";
 302  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_mode', '0', 0, 'comments', 'commentmode', 200)";
 303  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_disabled_after', '42', 0, 'comments', 'weeks', 210)";
 304  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'use_textile', '2', 0, 'publish', 'pref_text', 110)";
 305  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'ping_weblogsdotcom', '0', 1, 'publish', 'yesnoradio', 0)";
 306  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'rss_how_many', '5', 1, 'admin', 'text_input', 0)";
 307  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'logging', 'all', 0, 'publish', 'logging', 100)";
 308  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'use_comments', '1', 0, 'publish', 'yesnoradio', 120)";
 309  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'use_categories', '1', 2, 'publish', 'text_input', 0)";
 310  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'use_sections', '1', 2, 'publish', 'text_input', 0)";
 311  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'send_lastmod', '0', 1, 'admin', 'yesnoradio', 0)";
 312  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'path_from_root', '/', 2, 'publish', 'text_input', 0)";
 313  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'lastmod', '2005-07-23 16:24:10', 2, 'publish', 'text_input', 0)";
 314  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_dateformat', '%b %d, %I:%M %p', 0, 'comments', 'dateformats', 190)";
 315  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'dateformat', 'since', 0, 'publish', 'dateformats', 70)";
 316  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'archive_dateformat', '%b %d, %I:%M %p', 0, 'publish', 'dateformats', 80)";
 317  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_moderate', '1', 0, 'comments', 'yesnoradio', 130)";
 318  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'img_dir', 'images', 1, 'admin', 'text_input', 0)";
 319  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_disallow_images', '0', 0, 'comments', 'yesnoradio', 170)";
 320  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_sendmail', '0', 0, 'comments', 'yesnoradio', 160)";
 321  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'file_max_upload_size', '2000000', 1, 'admin', 'text_input', 0)";
 322  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'file_list_pageby', '25', 2, 'publish', 'text_input', 0)";
 323  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'path_to_site', '', 2, 'publish', 'text_input', 0)";
 324  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'article_list_pageby', '25', 2, 'publish', 'text_input', 0)";
 325  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'link_list_pageby', '25', 2, 'publish', 'text_input', 0)";
 326  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'image_list_pageby', '25', 2, 'publish', 'text_input', 0)";
 327  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'log_list_pageby', '25', 2, 'publish', 'text_input', 0)";
 328  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comment_list_pageby', '25', 2, 'publish', 'text_input', 0)";
 329  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'permlink_mode', '".doSlash($permlink_mode)."', 0, 'publish', 'permlinkmodes', 90)";
 330  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_are_ol', '1', 0, 'comments', 'yesnoradio', 150)";
 331  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'is_dst', '0', 0, 'publish', 'yesnoradio', 60)";
 332  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'locale', 'en_GB.UTF-8', 2, 'publish', 'text_input', 0)";
 333  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'tempdir', '".doSlash(find_temp_dir())."', 1, 'admin', 'text_input', 0)";
 334  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'file_base_path', '".doSlash(dirname(txpath).DS.'files')."', 1, 'admin', 'text_input', 0)";
 335  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'blog_uid', '". $prefs['blog_uid'] ."', 2, 'publish', 'text_input', 0)";
 336  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'blog_mail_uid', '".doSlash(ps('email'))."', 2, 'publish', 'text_input', 0)";
 337  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'blog_time_uid', '2005', 2, 'publish', 'text_input', 0)";
 338  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'edit_raw_css_by_default', '1', 1, 'css', 'yesnoradio', 0)";
 339  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'allow_page_php_scripting', '1', 1, 'publish', 'yesnoradio', 0)";
 340  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'allow_article_php_scripting', '1', 1, 'publish', 'yesnoradio', 0)";
 341  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'allow_raw_php_scripting', '0', 1, 'publish', 'yesnoradio', 0)";
 342  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'textile_links', '0', 1, 'link', 'yesnoradio', 0)";
 343  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'show_article_category_count', '1', 2, 'category', 'yesnoradio', 0)";
 344  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'show_comment_count_in_feed', '1', 1, 'publish', 'yesnoradio', 0)";
 345  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'syndicate_body_or_excerpt', '1', 1, 'publish', 'yesnoradio', 0)";
 346  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'include_email_atom', '1', 1, 'publish', 'yesnoradio', 0)";
 347  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comment_means_site_updated', '1', 1, 'publish', 'yesnoradio', 0)";
 348  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'never_display_email', '0', 1, 'publish', 'yesnoradio', 0)";
 349  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_require_name', '1', 1, 'comments', 'yesnoradio', 0)";
 350  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_require_email', '1', 1, 'comments', 'yesnoradio', 0)";
 351  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'articles_use_excerpts', '1', 1, 'publish', 'yesnoradio', 0)";
 352  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'allow_form_override', '1', 1, 'publish', 'yesnoradio', 0)";
 353  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'attach_titles_to_permalinks', '1', 1, 'publish', 'yesnoradio', 0)";
 354  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'permalink_title_format', '1', 1, 'publish', 'yesnoradio', 0)";
 355  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'expire_logs_after', '7', 1, 'publish', 'text_input', 0)";
 356  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'use_plugins', '1', 1, 'publish', 'yesnoradio', 0)";
 357  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_1_set', 'custom1', 1, 'custom', 'text_input', 1)";
 358  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_2_set', 'custom2', 1, 'custom', 'text_input', 2)";
 359  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_3_set', '', 1, 'custom', 'text_input', 3)";
 360  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_4_set', '', 1, 'custom', 'text_input', 4)";
 361  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_5_set', '', 1, 'custom', 'text_input', 5)";
 362  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_6_set', '', 1, 'custom', 'text_input', 6)";
 363  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_7_set', '', 1, 'custom', 'text_input', 7)";
 364  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_8_set', '', 1, 'custom', 'text_input', 8)";
 365  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_9_set', '', 1, 'custom', 'text_input', 9)";
 366  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'custom_10_set', '', 1, 'custom', 'text_input', 10)";
 367  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'ping_textpattern_com', '1', 1, 'publish', 'yesnoradio', 0)";
 368  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'use_dns', '1', 1, 'publish', 'yesnoradio', 0)";
 369  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'admin_side_plugins', '1', 1, 'publish', 'yesnoradio', 0)";
 370  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comment_nofollow', '1', 1, 'publish', 'yesnoradio', 0)";
 371  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'use_mail_on_feeds_id', '0', 1, 'publish', 'yesnoradio', 0)";
 372  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'max_url_len', '200', 1, 'publish', 'text_input', 0)";
 373  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'spam_blacklists', 'sbl.spamhaus.org', 1, 'publish', 'text_input', 0)";
 374  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'override_emailcharset', '0', 1, 'admin', 'yesnoradio', 21)";
 375  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'production_status', 'testing', 0, 'publish', 'prod_levels', 210)";
 376  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'comments_auto_append', '1', 0, 'comments', 'yesnoradio', 211)";
 377  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'dbupdatetime', '1122194504', 2, 'publish', 'text_input', 0)";
 378  $create_sql[] = "INSERT INTO `".PFX."txp_prefs` VALUES (1, 'version', '1.0rc4', 2, 'publish', 'text_input', 0)";
 379  
 380  $create_sql[] = "CREATE TABLE `".PFX."txp_section` (
 381    `name` varchar(128) NOT NULL,
 382    `page` varchar(128) NOT NULL default '',
 383    `css` varchar(128) NOT NULL default '',
 384    `is_default` int(2) NOT NULL default '0',
 385    `in_rss` int(2) NOT NULL default '1',
 386    `on_frontpage` int(2) NOT NULL default '1',
 387    `searchable` int(2) NOT NULL default '1',
 388    `title` varchar(255) NOT NULL default '',
 389    PRIMARY KEY (`name`)
 390  ) $tabletype PACK_KEYS=1";
 391  
 392  $create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('articles', 'archive', 'default', 1, 1, 1, 1, 'Articles')";
 393  $create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('default', 'default', 'default', 0, 1, 1, 1, 'default')";
 394  $create_sql[] = "INSERT INTO `".PFX."txp_section` VALUES ('about', 'default', 'default', 0, 0, 0, 1, 'About')";
 395  
 396  $create_sql[] = "CREATE TABLE `".PFX."txp_users` (
 397    `user_id` int(4) NOT NULL auto_increment,
 398    `name` varchar(64) NOT NULL default '',
 399    `pass` varchar(128) NOT NULL default '',
 400    `RealName` varchar(64) NOT NULL default '',
 401    `email` varchar(100) NOT NULL default '',
 402    `privs` tinyint(2) NOT NULL default '1',
 403    `last_access` datetime NOT NULL default '0000-00-00 00:00:00',
 404    `nonce` varchar(64) NOT NULL default '',
 405    PRIMARY KEY  (`user_id`),
 406    UNIQUE KEY `name` (`name`)
 407  ) $tabletype PACK_KEYS=1 AUTO_INCREMENT=2 ";
 408  
 409  
 410  $GLOBALS['txp_install_successful'] = true;
 411  $GLOBALS['txp_err_count'] = 0;
 412  foreach ($create_sql as $query)
 413  {
 414      $result = mysql_query($query);
 415      if (!$result)
 416      {
 417          $GLOBALS['txp_err_count']++;
 418          echo "<b>".$GLOBALS['txp_err_count'].".</b> ".mysql_error()."<br />\n";
 419          echo "<!--\n $query \n-->\n";
 420          $GLOBALS['txp_install_successful'] = false;
 421      }
 422  }
 423  
 424  # Skip the RPC language fetch when testing
 425  if (defined('TXP_TEST'))
 426      return;
 427  
 428  require_once txpath.'/lib/IXRClass.php';
 429  $client = new IXR_Client('http://rpc.textpattern.com');
 430  
 431  if (!$client->query('tups.getLanguage',$prefs['blog_uid'],LANG))
 432  {
 433      # If cannot install from lang file, setup the english lang
 434      if (!install_language_from_file(LANG))
 435      {
 436          $lang = 'en-gb';
 437          include_once txpath.'/setup/en-gb.php';
 438          if (!@$lastmod) $lastmod = '0000-00-00 00:00:00';
 439          foreach ($en_gb_lang as $evt_name => $evt_strings)
 440          {
 441              foreach ($evt_strings as $lang_key => $lang_val)
 442              {
 443                  $lang_val = doSlash($lang_val);
 444                  if (@$lang_val)
 445                      mysql_query("INSERT DELAYED INTO `".PFX."txp_lang` SET lang='en-gb', name='".$lang_key."', event='".$evt_name."', data='".$lang_val."', lastmod='".$lastmod."'");
 446              }
 447          }
 448      }
 449  }
 450  else
 451  {
 452      $response = $client->getResponse();
 453      $lang_struct = unserialize($response);
 454      foreach ($lang_struct as $item)
 455      {
 456          foreach ($item as $name => $value)
 457              $item[$name] = doSlash($value);
 458          mysql_query("INSERT DELAYED INTO `".PFX."txp_lang` SET lang='".LANG."', name='".$item['name']."', event='".$item['event']."', data='".$item['data']."', lastmod='".strftime('%Y%m%d%H%M%S',$item['uLastmod'])."'");
 459      }
 460  }
 461  
 462  mysql_query("FLUSH TABLE `".PFX."txp_lang`");
 463  
 464  ?>


Generated: Thu May 21 23:03:01 2009 Cross-referenced by PHPXref 0.7