| [ Index ] |
WordPress Source Cross Reference |
[Summary view] [Print] [Text view]
1 <?php 2 // Here we keep the DB structure and option values 3 4 $wp_queries="CREATE TABLE $wpdb->categories ( 5 cat_ID bigint(20) NOT NULL auto_increment, 6 cat_name varchar(55) NOT NULL default '', 7 category_nicename varchar(200) NOT NULL default '', 8 category_description longtext NOT NULL, 9 category_parent bigint(20) NOT NULL default '0', 10 category_count bigint(20) NOT NULL default '0', 11 link_count bigint(20) NOT NULL default '0', 12 posts_private tinyint(1) NOT NULL default '0', 13 links_private tinyint(1) NOT NULL default '0', 14 PRIMARY KEY (cat_ID), 15 KEY category_nicename (category_nicename) 16 ); 17 CREATE TABLE $wpdb->comments ( 18 comment_ID bigint(20) unsigned NOT NULL auto_increment, 19 comment_post_ID int(11) NOT NULL default '0', 20 comment_author tinytext NOT NULL, 21 comment_author_email varchar(100) NOT NULL default '', 22 comment_author_url varchar(200) NOT NULL default '', 23 comment_author_IP varchar(100) NOT NULL default '', 24 comment_date datetime NOT NULL default '0000-00-00 00:00:00', 25 comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 26 comment_content text NOT NULL, 27 comment_karma int(11) NOT NULL default '0', 28 comment_approved enum('0','1','spam') NOT NULL default '1', 29 comment_agent varchar(255) NOT NULL default '', 30 comment_type varchar(20) NOT NULL default '', 31 comment_parent bigint(20) NOT NULL default '0', 32 user_id bigint(20) NOT NULL default '0', 33 PRIMARY KEY (comment_ID), 34 KEY comment_approved (comment_approved), 35 KEY comment_post_ID (comment_post_ID) 36 ); 37 CREATE TABLE $wpdb->link2cat ( 38 rel_id bigint(20) NOT NULL auto_increment, 39 link_id bigint(20) NOT NULL default '0', 40 category_id bigint(20) NOT NULL default '0', 41 PRIMARY KEY (rel_id), 42 KEY link_id (link_id,category_id) 43 ); 44 CREATE TABLE $wpdb->links ( 45 link_id bigint(20) NOT NULL auto_increment, 46 link_url varchar(255) NOT NULL default '', 47 link_name varchar(255) NOT NULL default '', 48 link_image varchar(255) NOT NULL default '', 49 link_target varchar(25) NOT NULL default '', 50 link_category bigint(20) NOT NULL default '0', 51 link_description varchar(255) NOT NULL default '', 52 link_visible enum('Y','N') NOT NULL default 'Y', 53 link_owner int(11) NOT NULL default '1', 54 link_rating int(11) NOT NULL default '0', 55 link_updated datetime NOT NULL default '0000-00-00 00:00:00', 56 link_rel varchar(255) NOT NULL default '', 57 link_notes mediumtext NOT NULL, 58 link_rss varchar(255) NOT NULL default '', 59 PRIMARY KEY (link_id), 60 KEY link_category (link_category), 61 KEY link_visible (link_visible) 62 ); 63 CREATE TABLE $wpdb->options ( 64 option_id bigint(20) NOT NULL auto_increment, 65 blog_id int(11) NOT NULL default '0', 66 option_name varchar(64) NOT NULL default '', 67 option_can_override enum('Y','N') NOT NULL default 'Y', 68 option_type int(11) NOT NULL default '1', 69 option_value longtext NOT NULL, 70 option_width int(11) NOT NULL default '20', 71 option_height int(11) NOT NULL default '8', 72 option_description tinytext NOT NULL, 73 option_admin_level int(11) NOT NULL default '1', 74 autoload enum('yes','no') NOT NULL default 'yes', 75 PRIMARY KEY (option_id,blog_id,option_name), 76 KEY option_name (option_name) 77 ); 78 CREATE TABLE $wpdb->post2cat ( 79 rel_id bigint(20) NOT NULL auto_increment, 80 post_id bigint(20) NOT NULL default '0', 81 category_id bigint(20) NOT NULL default '0', 82 PRIMARY KEY (rel_id), 83 KEY post_id (post_id,category_id) 84 ); 85 CREATE TABLE $wpdb->postmeta ( 86 meta_id bigint(20) NOT NULL auto_increment, 87 post_id bigint(20) NOT NULL default '0', 88 meta_key varchar(255) default NULL, 89 meta_value longtext, 90 PRIMARY KEY (meta_id), 91 KEY post_id (post_id), 92 KEY meta_key (meta_key) 93 ); 94 CREATE TABLE $wpdb->posts ( 95 ID bigint(20) unsigned NOT NULL auto_increment, 96 post_author bigint(20) NOT NULL default '0', 97 post_date datetime NOT NULL default '0000-00-00 00:00:00', 98 post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 99 post_content longtext NOT NULL, 100 post_title text NOT NULL, 101 post_category int(4) NOT NULL default '0', 102 post_excerpt text NOT NULL, 103 post_status enum('publish','draft','private','static','object','attachment','inherit','future') NOT NULL default 'publish', 104 comment_status enum('open','closed','registered_only') NOT NULL default 'open', 105 ping_status enum('open','closed') NOT NULL default 'open', 106 post_password varchar(20) NOT NULL default '', 107 post_name varchar(200) NOT NULL default '', 108 to_ping text NOT NULL, 109 pinged text NOT NULL, 110 post_modified datetime NOT NULL default '0000-00-00 00:00:00', 111 post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', 112 post_content_filtered text NOT NULL, 113 post_parent bigint(20) NOT NULL default '0', 114 guid varchar(255) NOT NULL default '', 115 menu_order int(11) NOT NULL default '0', 116 post_type varchar(20) NOT NULL default 'post', 117 post_mime_type varchar(100) NOT NULL default '', 118 comment_count bigint(20) NOT NULL default '0', 119 PRIMARY KEY (ID), 120 KEY post_name (post_name), 121 KEY type_status_date (post_type, post_status, post_date, ID) 122 ); 123 CREATE TABLE $wpdb->users ( 124 ID bigint(20) unsigned NOT NULL auto_increment, 125 user_login varchar(60) NOT NULL default '', 126 user_pass varchar(64) NOT NULL default '', 127 user_nicename varchar(50) NOT NULL default '', 128 user_email varchar(100) NOT NULL default '', 129 user_url varchar(100) NOT NULL default '', 130 user_registered datetime NOT NULL default '0000-00-00 00:00:00', 131 user_activation_key varchar(60) NOT NULL default '', 132 user_status int(11) NOT NULL default '0', 133 display_name varchar(250) NOT NULL default '', 134 PRIMARY KEY (ID), 135 KEY user_login_key (user_login) 136 ); 137 CREATE TABLE $wpdb->usermeta ( 138 umeta_id bigint(20) NOT NULL auto_increment, 139 user_id bigint(20) NOT NULL default '0', 140 meta_key varchar(255) default NULL, 141 meta_value longtext, 142 PRIMARY KEY (umeta_id), 143 KEY user_id (user_id), 144 KEY meta_key (meta_key) 145 );"; 146 147 function populate_options() { 148 global $wpdb, $wp_db_version; 149 150 $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://'; 151 $guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 152 add_option('siteurl', $guessurl, __('WordPress web address')); 153 add_option('blogname', __('My Weblog'), __('Blog title')); 154 add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline')); 155 add_option('new_users_can_blog', 0); 156 add_option('users_can_register', 0); 157 add_option('admin_email', 'you@example.com'); 158 add_option('start_of_week', 1); 159 add_option('use_balanceTags', 0); 160 add_option('use_smilies', 1); 161 add_option('require_name_email', 1); 162 add_option('comments_notify', 1); 163 add_option('posts_per_rss', 10); 164 add_option('rss_excerpt_length', 50); 165 add_option('rss_use_excerpt', 0); 166 add_option('mailserver_url', 'mail.example.com'); 167 add_option('mailserver_login', 'login@example.com'); 168 add_option('mailserver_pass', 'password'); 169 add_option('mailserver_port', 110); 170 add_option('default_category', 1); 171 add_option('default_comment_status', 'open'); 172 add_option('default_ping_status', 'open'); 173 add_option('default_pingback_flag', 1); 174 add_option('default_post_edit_rows', 10); 175 add_option('posts_per_page', 10); 176 add_option('what_to_show', 'posts'); 177 add_option('date_format', __('F j, Y')); 178 add_option('time_format', __('g:i a')); 179 add_option('links_updated_date_format', __('F j, Y g:i a')); 180 add_option('links_recently_updated_prepend', '<em>'); 181 add_option('links_recently_updated_append', '</em>'); 182 add_option('links_recently_updated_time', 120); 183 add_option('comment_moderation', 0); 184 add_option('moderation_notify', 1); 185 add_option('permalink_structure'); 186 add_option('gzipcompression', 0); 187 add_option('hack_file', 0); 188 add_option('blog_charset', 'UTF-8'); 189 add_option('moderation_keys'); 190 add_option('active_plugins'); 191 add_option('home', $guessurl); 192 // in case it is set, but blank, update "home" 193 if ( !__get_option('home') ) update_option('home', $guessurl); 194 add_option('category_base'); 195 add_option('ping_sites', 'http://rpc.pingomatic.com/'); 196 add_option('advanced_edit', 0); 197 add_option('comment_max_links', 2); 198 add_option('gmt_offset', date('Z') / 3600); 199 // 1.5 200 add_option('default_email_category', 1, __('Posts by email go to this category')); 201 add_option('recently_edited'); 202 add_option('use_linksupdate', 0); 203 add_option('template', 'default'); 204 add_option('stylesheet', 'default'); 205 add_option('comment_whitelist', 1); 206 add_option('page_uris'); 207 add_option('blacklist_keys'); 208 add_option('comment_registration', 0); 209 add_option('open_proxy_check', 0); 210 add_option('rss_language', 'en'); 211 add_option('html_type', 'text/html'); 212 // 1.5.1 213 add_option('use_trackback', 0); 214 // 2.0 215 add_option('default_role', 'subscriber'); 216 add_option('rich_editing', 'true'); 217 add_option('db_version', $wp_db_version); 218 // 2.0.1 219 if ( ini_get('safe_mode') ) { 220 // Safe mode screws up mkdir(), so we must use a flat structure. 221 add_option('uploads_use_yearmonth_folders', 0); 222 add_option('upload_path', 'wp-content'); 223 } else { 224 add_option('uploads_use_yearmonth_folders', 1); 225 add_option('upload_path', 'wp-content/uploads'); 226 } 227 228 // 2.0.3 229 add_option('secret', md5(uniqid(microtime()))); 230 231 // 2.1 232 add_option('blog_public', '1'); 233 add_option('default_link_category', 2); 234 add_option('show_on_front', 'posts'); 235 236 // Delete unused options 237 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog'); 238 foreach ($unusedoptions as $option) : 239 delete_option($option); 240 endforeach; 241 242 // Set up a few options not to load by default 243 $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' ); 244 foreach ($fatoptions as $fatoption) : 245 $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'"); 246 endforeach; 247 } 248 249 function populate_roles() { 250 populate_roles_160(); 251 populate_roles_210(); 252 } 253 254 function populate_roles_160() { 255 global $wp_roles; 256 257 // Add roles 258 add_role('administrator', __('Administrator')); 259 add_role('editor', __('Editor')); 260 add_role('author', __('Author')); 261 add_role('contributor', __('Contributor')); 262 add_role('subscriber', __('Subscriber')); 263 264 // Add caps for Administrator role 265 $role = get_role('administrator'); 266 $role->add_cap('switch_themes'); 267 $role->add_cap('edit_themes'); 268 $role->add_cap('activate_plugins'); 269 $role->add_cap('edit_plugins'); 270 $role->add_cap('edit_users'); 271 $role->add_cap('edit_files'); 272 $role->add_cap('manage_options'); 273 $role->add_cap('moderate_comments'); 274 $role->add_cap('manage_categories'); 275 $role->add_cap('manage_links'); 276 $role->add_cap('upload_files'); 277 $role->add_cap('import'); 278 $role->add_cap('unfiltered_html'); 279 $role->add_cap('edit_posts'); 280 $role->add_cap('edit_others_posts'); 281 $role->add_cap('edit_published_posts'); 282 $role->add_cap('publish_posts'); 283 $role->add_cap('edit_pages'); 284 $role->add_cap('read'); 285 $role->add_cap('level_10'); 286 $role->add_cap('level_9'); 287 $role->add_cap('level_8'); 288 $role->add_cap('level_7'); 289 $role->add_cap('level_6'); 290 $role->add_cap('level_5'); 291 $role->add_cap('level_4'); 292 $role->add_cap('level_3'); 293 $role->add_cap('level_2'); 294 $role->add_cap('level_1'); 295 $role->add_cap('level_0'); 296 297 // Add caps for Editor role 298 $role = get_role('editor'); 299 $role->add_cap('moderate_comments'); 300 $role->add_cap('manage_categories'); 301 $role->add_cap('manage_links'); 302 $role->add_cap('upload_files'); 303 $role->add_cap('unfiltered_html'); 304 $role->add_cap('edit_posts'); 305 $role->add_cap('edit_others_posts'); 306 $role->add_cap('edit_published_posts'); 307 $role->add_cap('publish_posts'); 308 $role->add_cap('edit_pages'); 309 $role->add_cap('read'); 310 $role->add_cap('level_7'); 311 $role->add_cap('level_6'); 312 $role->add_cap('level_5'); 313 $role->add_cap('level_4'); 314 $role->add_cap('level_3'); 315 $role->add_cap('level_2'); 316 $role->add_cap('level_1'); 317 $role->add_cap('level_0'); 318 319 // Add caps for Author role 320 $role = get_role('author'); 321 $role->add_cap('upload_files'); 322 $role->add_cap('edit_posts'); 323 $role->add_cap('edit_published_posts'); 324 $role->add_cap('publish_posts'); 325 $role->add_cap('read'); 326 $role->add_cap('level_2'); 327 $role->add_cap('level_1'); 328 $role->add_cap('level_0'); 329 330 // Add caps for Contributor role 331 $role = get_role('contributor'); 332 $role->add_cap('edit_posts'); 333 $role->add_cap('read'); 334 $role->add_cap('level_1'); 335 $role->add_cap('level_0'); 336 337 // Add caps for Subscriber role 338 $role = get_role('subscriber'); 339 $role->add_cap('read'); 340 $role->add_cap('level_0'); 341 } 342 343 function populate_roles_210() { 344 $roles = array('administrator', 'editor'); 345 foreach ($roles as $role) { 346 $role = get_role($role); 347 if ( empty($role) ) 348 continue; 349 350 $role->add_cap('edit_others_pages'); 351 $role->add_cap('edit_published_pages'); 352 $role->add_cap('publish_pages'); 353 $role->add_cap('delete_pages'); 354 $role->add_cap('delete_others_pages'); 355 $role->add_cap('delete_published_pages'); 356 $role->add_cap('delete_posts'); 357 $role->add_cap('delete_others_posts'); 358 $role->add_cap('delete_published_posts'); 359 $role->add_cap('delete_private_posts'); 360 $role->add_cap('edit_private_posts'); 361 $role->add_cap('read_private_posts'); 362 $role->add_cap('delete_private_pages'); 363 $role->add_cap('edit_private_pages'); 364 $role->add_cap('read_private_pages'); 365 } 366 367 $role = get_role('administrator'); 368 if ( ! empty($role) ) { 369 $role->add_cap('delete_users'); 370 $role->add_cap('create_users'); 371 } 372 373 $role = get_role('author'); 374 if ( ! empty($role) ) { 375 $role->add_cap('delete_posts'); 376 $role->add_cap('delete_published_posts'); 377 } 378 379 $role = get_role('contributor'); 380 if ( ! empty($role) ) { 381 $role->add_cap('delete_posts'); 382 } 383 } 384 385 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Jul 15 11:57:04 2006 | Courtesy of Taragana |