add_tables.php (6698B)
1 <?php 2 /** 3 * Add Tables 4 * 5 * This script configure the the database tables for the CMS 6 * 7 * @author Marcel Radzio <info@nordgedanken.de> 8 * @version 0.2 18/08/2014 18:49 9 */ 10 11 //Posts erstellen 12 require_once ('../core/config/connect.db.inc.php'); 13 $sql = " 14 CREATE TABLE IF NOT EXISTS `posts` ( 15 `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , 16 `text` TEXT NOT NULL , 17 `title` TEXT NOT NULL , 18 `author` TEXT NOT NULL , 19 `date` DATETIME NOT NULL , 20 `category` TEXT NOT NULL 21 ) ENGINE = MYISAM; 22 "; 23 $result = mysqli_query($connection, $sql) 24 or die("Anfrage fehlgeschlagen: " . mysql_error()); 25 echo 'Erstellen erfolgreich'; 26 27 //Permissions Table erstellen 28 require_once ('../core/config/connect.db.inc.php'); 29 $sql = " 30 CREATE TABLE IF NOT EXISTS `rpicms_permissions` ( 31 `id` int(11) NOT NULL AUTO_INCREMENT, 32 `name` varchar(150) NOT NULL, 33 PRIMARY KEY (`id`) 34 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3; 35 "; 36 $result = mysqli_query($connection, $sql) 37 or die("Anfrage fehlgeschlagen: " . mysql_error()); 38 echo 'Erstellen erfolgreich'; 39 40 //Permissions Table füllen 41 require_once ('../core/config/connect.db.inc.php'); 42 $sql = " 43 INSERT INTO `rpicms_permissions` (`id`, `name`) VALUES 44 (1, 'New Member'), 45 (2, 'Administrator'); 46 "; 47 $result = mysqli_query($connection, $sql) 48 or die("Anfrage fehlgeschlagen: " . mysql_error()); 49 echo 'Erstellen erfolgreich'; 50 51 //Users Table erstellen 52 require_once ('../core/config/connect.db.inc.php'); 53 $sql = " 54 CREATE TABLE IF NOT EXISTS `rpicms_users` ( 55 `id` int(11) NOT NULL AUTO_INCREMENT, 56 `user_name` varchar(50) NOT NULL, 57 `display_name` varchar(50) NOT NULL, 58 `password` varchar(225) NOT NULL, 59 `email` varchar(150) NOT NULL, 60 `activation_token` varchar(225) NOT NULL, 61 `last_activation_request` int(11) NOT NULL, 62 `lost_password_request` tinyint(1) NOT NULL, 63 `active` tinyint(1) NOT NULL, 64 `title` varchar(150) NOT NULL, 65 `sign_up_stamp` int(11) NOT NULL, 66 `last_sign_in_stamp` int(11) NOT NULL, 67 PRIMARY KEY (`id`) 68 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1; 69 "; 70 $result = mysqli_query($connection, $sql) 71 or die("Anfrage fehlgeschlagen: " . mysql_error()); 72 echo 'Erstellen erfolgreich'; 73 74 //user_permission_matches Table erstellen 75 require_once ('../core/config/connect.db.inc.php'); 76 $sql = " 77 CREATE TABLE IF NOT EXISTS `rpicms_user_permission_matches` ( 78 `id` int(11) NOT NULL AUTO_INCREMENT, 79 `user_id` int(11) NOT NULL, 80 `permission_id` int(11) NOT NULL, 81 PRIMARY KEY (`id`) 82 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2; 83 "; 84 $result = mysqli_query($connection, $sql) 85 or die("Anfrage fehlgeschlagen: " . mysql_error()); 86 echo 'Erstellen erfolgreich'; 87 88 //user_permission_matches Table füllen 89 require_once ('../core/config/connect.db.inc.php'); 90 $sql = " 91 INSERT INTO `rpicms_user_permission_matches` (`id`, `user_id`, `permission_id`) VALUES 92 (1, 1, 2); 93 "; 94 $result = mysqli_query($connection, $sql) 95 or die("Anfrage fehlgeschlagen: " . mysql_error()); 96 echo 'Erstellen erfolgreich'; 97 98 //configuration Table erstellen 99 require_once ('../core/config/connect.db.inc.php'); 100 $sql = " 101 CREATE TABLE IF NOT EXISTS `rpicms_configuration` ( 102 `id` int(11) NOT NULL AUTO_INCREMENT, 103 `name` varchar(150) NOT NULL, 104 `value` varchar(150) NOT NULL, 105 PRIMARY KEY (`id`) 106 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=8; 107 "; 108 $result = mysqli_query($connection, $sql) 109 or die("Anfrage fehlgeschlagen: " . mysql_error()); 110 echo 'Erstellen erfolgreich'; 111 112 //configuration Table füllen 113 require_once ('../core/config/connect.db.inc.php'); 114 $sql = " 115 INSERT INTO `rpicms_configuration` (`id`, `name`, `value`) VALUES 116 (1, 'website_name', '$blog_name'), 117 (2, 'website_url', 'localhost/'), 118 (3, 'email', '$blog_email'), 119 (4, 'activation', 'true'), 120 (5, 'resend_activation_threshold', '0'), 121 (6, 'language', '$root/core/backend/admin/modules/module_normal_login/models/languages/en.php'), 122 (7, 'template', '$root/core/backend/admin/modules/module_normal_loginmodels/site-templates/default.css'); 123 "; 124 $result = mysqli_query($connection, $sql) 125 or die("Anfrage fehlgeschlagen: " . mysql_error()); 126 echo 'Erstellen erfolgreich'; 127 128 //pages Table erstellen 129 require_once ('../core/config/connect.db.inc.php'); 130 $sql = " 131 CREATE TABLE IF NOT EXISTS `rpicms_pages` ( 132 `id` int(11) NOT NULL AUTO_INCREMENT, 133 `page` varchar(150) NOT NULL, 134 `private` tinyint(1) NOT NULL DEFAULT '0', 135 PRIMARY KEY (`id`) 136 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=18; 137 "; 138 $result = mysqli_query($connection, $sql) 139 or die("Anfrage fehlgeschlagen: " . mysql_error()); 140 echo 'Erstellen erfolgreich'; 141 142 //pages Table füllen 143 require_once ('../core/config/connect.db.inc.php'); 144 $sql = " 145 INSERT INTO `rpicms_pages` (`id`, `page`, `private`) VALUES 146 (1, '$theme/account.php', 1), 147 (2, '$theme/activate-account.php', 0), 148 (3, '$theme/admin_configuration.php', 1), 149 (4, '$theme/admin_page.php', 1), 150 (5, '$theme/admin_pages.php', 1), 151 (6, '$theme/admin_permission.php', 1), 152 (7, '$theme/admin_permissions.php', 1), 153 (8, '$theme/admin_user.php', 1), 154 (9, '$theme/admin_users.php', 1), 155 (10, '$theme/forgot-password.php', 0), 156 (11, '$theme/index.php', 0), 157 (12, '$theme/left-nav.php', 0), 158 (13, '$theme/login.php', 0), 159 (14, '$theme/logout.php', 1), 160 (15, '$theme/register.php', 0), 161 (16, '$theme/resend-activation.php', 0), 162 (17, '$theme/user_settings.php', 1); 163 "; 164 $result = mysqli_query($connection, $sql) 165 or die("Anfrage fehlgeschlagen: " . mysql_error()); 166 echo 'Erstellen erfolgreich'; 167 168 //permission_page_matches Table erstellen 169 require_once ('../core/config/connect.db.inc.php'); 170 $sql = " 171 CREATE TABLE IF NOT EXISTS `rpicms_permission_page_matches` ( 172 `id` int(11) NOT NULL AUTO_INCREMENT, 173 `permission_id` int(11) NOT NULL, 174 `page_id` int(11) NOT NULL, 175 PRIMARY KEY (`id`) 176 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=23; 177 "; 178 $result = mysqli_query($connection, $sql) 179 or die("Anfrage fehlgeschlagen: " . mysql_error()); 180 echo 'Erstellen erfolgreich'; 181 182 //permission_page_matches Table füllen 183 require_once ('../core/config/connect.db.inc.php'); 184 $sql = " 185 INSERT INTO `rpicms_permission_page_matches` (`id`, `permission_id`, `page_id`) VALUES 186 (1, 1, 1), 187 (2, 1, 14), 188 (3, 1, 17), 189 (4, 2, 1), 190 (5, 2, 3), 191 (6, 2, 4), 192 (7, 2, 5), 193 (8, 2, 6), 194 (9, 2, 7), 195 (10, 2, 8), 196 (11, 2, 9), 197 (12, 2, 14), 198 (13, 2, 17); 199 "; 200 $result = mysqli_query($connection, $sql) 201 or die("Anfrage fehlgeschlagen: " . mysql_error()); 202 echo 'Erstellen erfolgreich'; 203 204 205 header("HTTP/1.1 301 Moved Permanently"); 206 header("Location:../"); 207 exit; 208 ?>