PageRenderTime 59ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/install/sql_querys.php

https://github.com/badboy/devbird
PHP | 149 lines | 127 code | 15 blank | 7 comment | 0 complexity | ecaac0360a12a87d2e605a0294318235 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?
  2. ############################################
  3. ########## DO NOT EDIT THIS FILE! ##########
  4. ########## unless you no what you ##########
  5. ########## are doing ##########
  6. ########## or you are the ##########
  7. ########## maintainer of Devbird ##########
  8. ############################################
  9. $drop_tables = array();
  10. $sql_querys = array();
  11. $db_prefix = $DB->real_escape_string($db_prefix);
  12. $drop_tables[] = "DROP TABLE IF EXISTS `{$db_prefix}news`";
  13. $sql_querys[] = <<<QUERY
  14. CREATE TABLE IF NOT EXISTS `{$db_prefix}news` (
  15. `id` bigint(20) NOT NULL auto_increment,
  16. `created` int(11) NOT NULL,
  17. `published` int(11) NOT NULL default '0',
  18. `short_name` varchar(150) collate utf8_unicode_ci default NULL,
  19. `title` varchar(150) collate utf8_unicode_ci NOT NULL,
  20. `message` text collate utf8_unicode_ci NOT NULL,
  21. `writer` varchar(50) collate utf8_unicode_ci NOT NULL,
  22. `tags` varchar(150) collate utf8_unicode_ci default NULL,
  23. `bb_code` text collate utf8_unicode_ci NOT NULL,
  24. `ajax_saved` tinyint(4) NOT NULL default '0',
  25. `comments` tinyint(4) NOT NULL default '1',
  26. PRIMARY KEY (`id`),
  27. FULLTEXT KEY `title` (`title`,`message`)
  28. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  29. QUERY;
  30. $drop_tables[] = "DROP TABLE IF EXISTS `{$db_prefix}news_comments`";
  31. $sql_querys[] = <<<QUERY
  32. CREATE TABLE IF NOT EXISTS `{$db_prefix}news_comments` (
  33. `id` bigint(20) NOT NULL auto_increment,
  34. `news_id` bigint(20) NOT NULL,
  35. `name` varchar(50) collate utf8_unicode_ci NOT NULL,
  36. `website` varchar(80) collate utf8_unicode_ci NOT NULL,
  37. `email` varchar(50) collate utf8_unicode_ci NOT NULL,
  38. `msg` text collate utf8_unicode_ci NOT NULL,
  39. `date` int(11) NOT NULL,
  40. `public` tinyint(4) NOT NULL default '1',
  41. `read` tinyint(4) NOT NULL default '0',
  42. PRIMARY KEY (`id`)
  43. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  44. QUERY;
  45. $drop_tables[] = "DROP TABLE IF EXISTS `{$db_prefix}links`";
  46. $sql_querys[] = <<<QUERY
  47. CREATE TABLE IF NOT EXISTS `{$db_prefix}links` (
  48. `id` bigint(20) NOT NULL auto_increment,
  49. `category` int(11) NOT NULL default '1' COMMENT '1=blogroll, 0=menu',
  50. `sort` int(11) NOT NULL default '1' COMMENT 'only for menu',
  51. `link` varchar(100) collate utf8_unicode_ci NOT NULL,
  52. `name` varchar(50) collate utf8_unicode_ci NOT NULL,
  53. `desc` varchar(100) collate utf8_unicode_ci NOT NULL,
  54. PRIMARY KEY (`id`)
  55. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  56. QUERY;
  57. $drop_tables[] = "DROP TABLE IF EXISTS `{$db_prefix}settings`";
  58. $sql_querys[] = <<<QUERY
  59. CREATE TABLE IF NOT EXISTS `{$db_prefix}settings` (
  60. `name` varchar(50) collate utf8_unicode_ci NOT NULL,
  61. `type` int(11) NOT NULL default '0',
  62. `value` varchar(150) collate utf8_unicode_ci default NULL,
  63. `possibilities` varchar(255) collate utf8_unicode_ci default NULL,
  64. `description` varchar(255) collate utf8_unicode_ci default NULL,
  65. `level` int(11) NOT NULL,
  66. `sort` int(11) NOT NULL,
  67. PRIMARY KEY (`name`)
  68. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  69. QUERY;
  70. $drop_tables[] = "DROP TABLE IF EXISTS `{$db_prefix}user`";
  71. $sql_querys[] = <<<QUERY
  72. CREATE TABLE IF NOT EXISTS `{$db_prefix}user` (
  73. `id` bigint(20) NOT NULL auto_increment,
  74. `name` varchar(50) collate utf8_unicode_ci NOT NULL,
  75. `rights` tinyint(11) NOT NULL default '0',
  76. `password` varchar(50) collate utf8_unicode_ci NOT NULL,
  77. `mail` varchar(150) collate utf8_unicode_ci NOT NULL,
  78. `last_login` int(11) NOT NULL default '0',
  79. `use_cookies` tinyint(4) NOT NULL default '0',
  80. `cookie_value` varchar(50) collate utf8_unicode_ci default NULL,
  81. `reseted_pw` varchar(20) collate utf8_unicode_ci default NULL,
  82. `salt` varchar(16) collate utf8_unicode_ci NOT NULL,
  83. PRIMARY KEY (`id`)
  84. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  85. QUERY;
  86. $drop_tables[] = "DROP TABLE IF EXISTS `{$db_prefix}pages`";
  87. $sql_querys[] = <<<QUERY
  88. CREATE TABLE IF NOT EXISTS `{$db_prefix}pages` (
  89. `short_name` varchar(50) collate utf8_unicode_ci NOT NULL,
  90. `title` varchar(100) collate utf8_unicode_ci NOT NULL,
  91. `created` int(11) NOT NULL,
  92. `published` int(11) NOT NULL,
  93. `body` text collate utf8_unicode_ci NOT NULL,
  94. `bb_code` text collate utf8_unicode_ci NOT NULL,
  95. PRIMARY KEY (`short_name`)
  96. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  97. QUERY;
  98. $sql_order = array('news', 'news_comments', 'links', 'settings', 'user', 'pages');
  99. $settings_insert = <<<SETTINGS
  100. INSERT INTO `{$db_prefix}settings` (`name`, `type`, `value`, `possibilities`, `description`, `level`, `sort`) VALUES
  101. ('Blogname', 1, '{$all_blogname}', NULL, 'Der Name für diesen Blog', 1, 0),
  102. ('Blogbeschreibung', 1, '{$all_blogdesc}', NULL, 'Beschreibung des Blogs', 1, 1),
  103. ('Bloglink', 1, '{$path_url}', NULL, 'Link zum Blog', 1, 2),
  104. ('Blogroot', 1, '{$path_root}', NULL, 'der Pfad zum Blog', 1, 3),
  105. ('News pro Seite', 2, '5', '1-30', 'Anzahl der angezeigten News pro Seite', 1, 4),
  106. ('Design', 3, 'default', '\$dir:/design/', 'Das gewählte Design', 1, 5),
  107. ('Kommentare', 2, 'an', 'an|aus', 'Kommentare generell erlauben?', 1, 6),
  108. ('Zeichensatz', 2, 'UTF-8', 'UTF-8|ISO-8859-15', 'Der auf der Seite verwendete Zeichensatz', 1, 7),
  109. ('AJAX-Autosave', 2, 'an', 'an|aus', 'Soll der Editor mittels AJAX Artikel automatisch zwischenspeichern?', 1, 8),
  110. ('Standardcodesprache', 3, 'c', '\$dir:/admin/geshi/geshi/ -.php', 'Standardmäßig verwendete Sprache für GeSHi (Syntaxhighlighter)', 1, 9);
  111. SETTINGS;
  112. $salt_pw = mt_rand();
  113. $hashed = sha1('--' . $salt_pw . '--' . $user_password);
  114. $user_insert = <<<USERS
  115. INSERT INTO `{$db_prefix}user` (`id`, `name`, `rights`, `password`, `mail`, `last_login`, `use_cookies`, `cookie_value`, `reseted_pw`, `salt`) VALUES
  116. (1, '{$user_name}', 15, '{$hashed}', '{$user_mail}', 0, 0, NULL, NULL, '{$salt_pw}');
  117. USERS;
  118. $date = time(0);
  119. $first_article = <<<F_ARTICLE
  120. INSERT INTO `{$db_prefix}news` (`created`, `published`, `short_name`, `title`, `message`, `writer`, `tags`, `bb_code`) VALUES
  121. ({$date}, {$date}, 'erster-artikel', 'Erster Artikel', 'Hey! Scheint, als ob Devbird fertig installiert ist.<br />\r\nDas hier jedenfalls ist der erste Artikel.<br />\r\nIm Admin-Menü kannst du ihn bearbeiten oder löschen.', 'Devbird', 'article main first blog devbird', 'Hey! Scheint, als ob Devbird fertig installiert ist.\r\nDas hier jedenfalls ist der erste Artikel. \r\nIm Admin-Menü kannst du ihn bearbeiten oder löschen.');
  122. F_ARTICLE;
  123. $first_links = <<<F_LINKS
  124. INSERT INTO `{$db_prefix}links` (`category`, `sort`, `link`, `name`, `desc`) VALUES
  125. (0, 1, 'index', 'Home', 'Zur Startseite'),
  126. (0, 2, 'search.php', 'Suche', 'Suche und finde Artikel'),
  127. (1, 0, 'http://badboy.pytalhost.de/', 'BadBoy_', 'Blog des Programmierers hinter Devbird ');
  128. F_LINKS;
  129. $date += 120;
  130. $first_comment = <<<F_COMMENT
  131. INSERT INTO `{$db_prefix}news_comments` (`news_id`, `name`, `website`, `email`, `msg`, `date`, `public`, `read`) VALUES
  132. (1, 'Devbird', '{$path_url}', '', 'Hey! Und hier siehst du auch gleich den ersten Kommentar. Wunderbar, nicht?', {$date}, 1, 0);
  133. F_COMMENT;
  134. ?>