Changeset 1355
- Timestamp:
- 05/24/04 08:22:18 (4 years ago)
- Files:
-
- trunk/wp-admin/admin-functions.php (modified) (10 diffs)
- trunk/wp-admin/admin-header.php (modified) (1 diff)
- trunk/wp-admin/auth.php (modified) (2 diffs)
- trunk/wp-admin/categories.php (modified) (5 diffs)
- trunk/wp-admin/edit-comments.php (modified) (6 diffs)
- trunk/wp-admin/edit.php (modified) (3 diffs)
- trunk/wp-admin/import-b2.php (modified) (11 diffs)
- trunk/wp-admin/import-blogger.php (modified) (6 diffs)
- trunk/wp-admin/import-greymatter.php (modified) (9 diffs)
- trunk/wp-admin/import-livejournal.php (modified) (1 diff)
- trunk/wp-admin/import-mt.php (modified) (6 diffs)
- trunk/wp-admin/import-rss.php (modified) (4 diffs)
- trunk/wp-admin/import-textpattern.php (modified) (5 diffs)
- trunk/wp-admin/install-helper.php (modified) (1 diff)
- trunk/wp-admin/install.php (modified) (23 diffs)
- trunk/wp-admin/link-add.php (modified) (1 diff)
- trunk/wp-admin/link-categories.php (modified) (5 diffs)
- trunk/wp-admin/link-import.php (modified) (2 diffs)
- trunk/wp-admin/link-manager.php (modified) (13 diffs)
- trunk/wp-admin/moderation.php (modified) (2 diffs)
- trunk/wp-admin/optionhandler.php (modified) (4 diffs)
- trunk/wp-admin/options-head.php (modified) (1 diff)
- trunk/wp-admin/options-writing.php (modified) (1 diff)
- trunk/wp-admin/options.php (modified) (4 diffs)
- trunk/wp-admin/post.php (modified) (15 diffs)
- trunk/wp-admin/profile.php (modified) (1 diff)
- trunk/wp-admin/upgrade-functions.php (modified) (30 diffs)
- trunk/wp-admin/users.php (modified) (7 diffs)
- trunk/wp-blog-header.php (modified) (1 diff)
- trunk/wp-comments-popup.php (modified) (1 diff)
- trunk/wp-comments-post.php (modified) (3 diffs)
- trunk/wp-comments-reply.php (modified) (1 diff)
- trunk/wp-comments.php (modified) (1 diff)
- trunk/wp-commentsrss2.php (modified) (2 diffs)
- trunk/wp-includes/functions-post.php (modified) (16 diffs)
- trunk/wp-includes/functions.php (modified) (35 diffs)
- trunk/wp-includes/links-update-xml.php (modified) (2 diffs)
- trunk/wp-includes/links.php (modified) (13 diffs)
- trunk/wp-includes/template-functions-author.php (modified) (2 diffs)
- trunk/wp-includes/template-functions-category.php (modified) (13 diffs)
- trunk/wp-includes/template-functions-comment.php (modified) (2 diffs)
- trunk/wp-includes/template-functions-general.php (modified) (13 diffs)
- trunk/wp-includes/template-functions-links.php (modified) (2 diffs)
- trunk/wp-includes/template-functions-post.php (modified) (4 diffs)
- trunk/wp-includes/wp-db.php (modified) (1 diff)
- trunk/wp-links-opml.php (modified) (2 diffs)
- trunk/wp-login.php (modified) (3 diffs)
- trunk/wp-mail.php (modified) (2 diffs)
- trunk/wp-register.php (modified) (2 diffs)
- trunk/wp-settings.php (modified) (1 diff)
- trunk/wp-trackback.php (modified) (2 diffs)
- trunk/xmlrpc.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-functions.php
r1340 r1355 20 20 21 21 function get_nested_categories($default = 0) { 22 global $post_ID, $ tablecategories, $tablepost2cat, $mode, $wpdb;22 global $post_ID, $mode, $wpdb; 23 23 24 24 if ($post_ID) { 25 25 $checked_categories = $wpdb->get_col(" 26 26 SELECT category_id 27 FROM $ tablecategories, $tablepost2cat28 WHERE $ tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = '$post_ID'27 FROM $wpdb->categories, $wpdb->post2cat 28 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID' 29 29 "); 30 30 } else { … … 32 32 } 33 33 34 $categories = $wpdb->get_results("SELECT * FROM $ tablecategories ORDER BY category_parent DESC, cat_name ASC");34 $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY category_parent DESC, cat_name ASC"); 35 35 $result = array(); 36 36 foreach($categories as $category) { … … 67 67 // Dandy new recursive multiple category stuff. 68 68 function cat_rows($parent = 0, $level = 0, $categories = 0) { 69 global $wpdb, $ tablecategories, $tablepost2cat, $bgcolor;69 global $wpdb, $bgcolor; 70 70 if (!$categories) { 71 $categories = $wpdb->get_results("SELECT * FROM $ tablecategories ORDER BY cat_name");71 $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); 72 72 } 73 73 if ($categories) { 74 74 foreach ($categories as $category) { 75 75 if ($category->category_parent == $parent) { 76 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $ tablepost2cat WHERE category_id = $category->cat_ID");76 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); 77 77 $pad = str_repeat('— ', $level); 78 78 … … 92 92 93 93 function wp_dropdown_cats($currentcat, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) { 94 global $wpdb, $ tablecategories, $tablepost2cat, $bgcolor;94 global $wpdb, $bgcolor; 95 95 if (!$categories) { 96 $categories = $wpdb->get_results("SELECT * FROM $ tablecategories ORDER BY cat_name");96 $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); 97 97 } 98 98 if ($categories) { 99 99 foreach ($categories as $category) { if ($currentcat != $category->cat_ID && $parent == $category->category_parent) { 100 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $ tablepost2cat WHERE category_id = $category->cat_ID");100 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); 101 101 $pad = str_repeat('– ', $level); 102 102 echo "\n\t<option value='$category->cat_ID'"; … … 200 200 // Some postmeta stuff 201 201 function has_meta($postid) { 202 global $wpdb , $tablepostmeta;202 global $wpdb; 203 203 204 204 return $wpdb->get_results(" 205 205 SELECT meta_key, meta_value, meta_id, post_id 206 FROM $ tablepostmeta206 FROM $wpdb->postmeta 207 207 WHERE post_id = '$postid' 208 208 ORDER BY meta_key,meta_id",ARRAY_A); … … 241 241 // Get a list of previously defined keys 242 242 function get_meta_keys() { 243 global $wpdb , $tablepostmeta;243 global $wpdb; 244 244 245 245 $keys = $wpdb->get_col(" 246 246 SELECT meta_key 247 FROM $ tablepostmeta247 FROM $wpdb->postmeta 248 248 GROUP BY meta_key 249 249 ORDER BY meta_key"); … … 253 253 254 254 function meta_form() { 255 global $wpdb , $tablepostmeta;255 global $wpdb; 256 256 $keys = $wpdb->get_col(" 257 257 SELECT meta_key 258 FROM $ tablepostmeta258 FROM $wpdb->postmeta 259 259 GROUP BY meta_key 260 260 ORDER BY meta_id DESC … … 290 290 291 291 function add_meta($post_ID) { 292 global $wpdb , $tablepostmeta;292 global $wpdb; 293 293 294 294 $metakeyselect = $wpdb->escape( stripslashes( trim($_POST['metakeyselect']) ) ); … … 307 307 308 308 $result = $wpdb->query(" 309 INSERT INTO $ tablepostmeta309 INSERT INTO $wpdb->postmeta 310 310 (post_id,meta_key,meta_value) 311 311 VALUES ('$post_ID','$metakey','$metavalue') … … 315 315 316 316 function delete_meta($mid) { 317 global $wpdb , $tablepostmeta;318 319 $result = $wpdb->query("DELETE FROM $ tablepostmeta WHERE meta_id = '$mid'");317 global $wpdb; 318 319 $result = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'"); 320 320 } 321 321 322 322 function update_meta($mid, $mkey, $mvalue) { 323 global $wpdb , $tablepostmeta;324 325 return $wpdb->query("UPDATE $ tablepostmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");323 global $wpdb; 324 325 return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'"); 326 326 } 327 327 trunk/wp-admin/admin-header.php
r1340 r1355 15 15 timer_start(); 16 16 17 $dogs = $wpdb->get_results("SELECT * FROM $ tablecategories WHERE 1=1");17 $dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE 1=1"); 18 18 foreach ($dogs as $catt) { 19 19 $cache_categories[$catt->cat_ID] = $catt; trunk/wp-admin/auth.php
r1317 r1355 6 6 function veriflog() { 7 7 global $cookiehash; 8 global $ tableusers, $wpdb;8 global $wpdb; 9 9 10 10 if (!empty($_COOKIE['wordpressuser_' . $cookiehash])) { … … 20 20 return false; 21 21 22 $login = $wpdb->get_row("SELECT user_login, user_pass FROM $ tableusers WHERE user_login = '$user_login'");22 $login = $wpdb->get_row("SELECT user_login, user_pass FROM $wpdb->users WHERE user_login = '$user_login'"); 23 23 24 24 if (!$login) { trunk/wp-admin/categories.php
r1352 r1355 52 52 $cat = intval($_POST['cat']); 53 53 54 $wpdb->query("INSERT INTO $ tablecategories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')");54 $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')"); 55 55 56 56 header('Location: categories.php?message=1#addcat'); … … 68 68 $cat_name = get_catname($cat_ID); 69 69 $cat_name = addslashes($cat_name); 70 $category = $wpdb->get_row("SELECT * FROM $ tablecategories WHERE cat_ID = '$cat_ID'");70 $category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'"); 71 71 $cat_parent = $category->category_parent; 72 72 … … 77 77 die (__('Cheatin’ uh?')); 78 78 79 $wpdb->query("DELETE FROM $ tablecategories WHERE cat_ID = '$cat_ID'");80 $wpdb->query("UPDATE $ tablecategories SET category_parent = '$cat_parent' WHERE category_parent = '$cat_ID'");81 $wpdb->query("UPDATE $ tablepost2cat SET category_id='1' WHERE category_id='$cat_ID'");79 $wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'"); 80 $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$cat_parent' WHERE category_parent = '$cat_ID'"); 81 $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'"); 82 82 83 83 header('Location: categories.php?message=2'); … … 89 89 require_once ('admin-header.php'); 90 90 $cat_ID = intval($_GET['cat_ID']); 91 $category = $wpdb->get_row("SELECT * FROM $ tablecategories WHERE cat_ID = '$cat_ID'");91 $category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'"); 92 92 $cat_name = stripslashes($category->cat_name); 93 93 ?> … … 130 130 $category_description = $wpdb->escape(stripslashes($_POST['category_description'])); 131 131 132 $wpdb->query("UPDATE $ tablecategories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$cat' WHERE cat_ID = '$cat_ID'");132 $wpdb->query("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$cat' WHERE cat_ID = '$cat_ID'"); 133 133 134 134 header('Location: categories.php?message=3'); trunk/wp-admin/edit-comments.php
r1271 r1355 46 46 foreach ($delete_comments as $comment) { // Check the permissions on each 47 47 $comment = intval($comment); 48 $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $ tablecomments WHERE comment_ID = $comment");49 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $ tableposts WHERE ID = $post_id"));48 $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment"); 49 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id")); 50 50 if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { 51 $wpdb->query("DELETE FROM $ tablecomments WHERE comment_ID = $comment");51 $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = $comment"); 52 52 ++$i; 53 53 } … … 58 58 if (isset($_GET['s'])) { 59 59 $s = $wpdb->escape($_GET['s']); 60 $comments = $wpdb->get_results("SELECT * FROM $ tablecomments WHERE60 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE 61 61 comment_author LIKE '%$s%' OR 62 62 comment_author_email LIKE '%$s%' OR … … 66 66 ORDER BY comment_date DESC"); 67 67 } else { 68 $comments = $wpdb->get_results("SELECT * FROM $ tablecomments ORDER BY comment_date DESC LIMIT 20");68 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments ORDER BY comment_date DESC LIMIT 20"); 69 69 } 70 70 if ('view' == $mode) { … … 72 72 echo '<ol>'; 73 73 foreach ($comments as $comment) { 74 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $ tableposts WHERE ID = $comment->comment_post_ID"));74 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); 75 75 $comment_status = wp_get_comment_status($comment->comment_ID); 76 76 if ('unapproved' == $comment_status) { … … 90 90 } // end if any comments to show 91 91 // Get post title 92 $post_title = $wpdb->get_var("SELECT post_title FROM $ tableposts WHERE ID = $comment->comment_post_ID");92 $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"); 93 93 $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; 94 94 ?> <a href="post.php?action=edit&post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post “%s”'), stripslashes($post_title)); ?></a> | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p> … … 120 120 </tr>'; 121 121 foreach ($comments as $comment) { 122 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $ tableposts WHERE ID = $comment->comment_post_ID"));122 $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID")); 123 123 $bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee'; 124 124 ?> trunk/wp-admin/edit.php
r1271 r1355 13 13 <?php 14 14 get_currentuserinfo(); 15 $drafts = $wpdb->get_results("SELECT ID, post_title FROM $ tableposts WHERE post_status = 'draft' AND post_author = $user_ID");15 $drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID"); 16 16 if ($drafts) { 17 17 ?> … … 48 48 <select name='m'> 49 49 <?php 50 $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $ tableposts ORDER BY post_date DESC");50 $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC"); 51 51 foreach ($arc_result as $arc_row) { 52 52 $arc_year = $arc_row->yyear; … … 126 126 if ( 1 == count($posts) ) { 127 127 128 $comments = $wpdb->get_results("SELECT * FROM $ tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");128 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id ORDER BY comment_date"); 129 129 if ($comments) { 130 130 ?> trunk/wp-admin/import-b2.php
r1117 r1355 83 83 84 84 while ($row = mysql_fetch_row($result)) { 85 if ($row[0] == $ tablelinks)85 if ($row[0] == $wpdb->links) 86 86 $got_links = true; 87 if ($row[0] == $ tablelinkcategories)87 if ($row[0] == $wpdb->linkcategories) 88 88 $got_cats = true; 89 89 //print "Table: $row[0]<br />\n"; 90 90 } 91 91 if (!$got_cats) { 92 echo "<p>Can't find table '$ tablelinkcategories', gonna create it...</p>\n";93 $sql = "CREATE TABLE $ tablelinkcategories ( " .92 echo "<p>Can't find table '$wpdb->linkcategories', gonna create it...</p>\n"; 93 $sql = "CREATE TABLE $wpdb->linkcategories ( " . 94 94 " cat_id int(11) NOT NULL auto_increment, " . 95 95 " cat_name tinytext NOT NULL, ". … … 97 97 " PRIMARY KEY (cat_id) ". 98 98 ") "; 99 $result = mysql_query($sql) or print ("Can't create the table '$ tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());99 $result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.<br />" . $sql . "<br />" . mysql_error()); 100 100 if ($result != false) { 101 echo "<p>Table '$ tablelinkcategories' created OK</p>\n";101 echo "<p>Table '$wpdb->linkcategories' created OK</p>\n"; 102 102 $got_cats = true; 103 103 } 104 104 } else { 105 echo "<p>Found table '$ tablelinkcategories', don't need to create it...</p>\n";105 echo "<p>Found table '$wpdb->linkcategories', don't need to create it...</p>\n"; 106 106 $got_cats = true; 107 107 } 108 108 if (!$got_links) { 109 echo "<p>Can't find '$ tablelinks', gonna create it...</p>\n";110 $sql = "CREATE TABLE $ tablelinks ( " .109 echo "<p>Can't find '$wpdb->links', gonna create it...</p>\n"; 110 $sql = "CREATE TABLE $wpdb->links ( " . 111 111 " link_id int(11) NOT NULL auto_increment, " . 112 112 " link_url varchar(255) NOT NULL default '', " . … … 124 124 " PRIMARY KEY (link_id) " . 125 125 ") "; 126 $result = mysql_query($sql) or print ("Can't create the table '$ tablelinks' in the database.<br />" . $sql . "<br />" . mysql_error());127 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");128 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");129 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://zed1.com/b2/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");126 $result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.<br />" . $sql . "<br />" . mysql_error()); 127 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); 128 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); 129 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/b2/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');"); 130 130 131 131 if ($result != false) { 132 echo "<p>Table '$ tablelinks' created OK</p>\n";132 echo "<p>Table '$wpdb->links' created OK</p>\n"; 133 133 $got_links = true; 134 134 } 135 135 } else { 136 echo "<p>Found table '$ tablelinks', don't need to create it...</p>\n";136 echo "<p>Found table '$wpdb->links', don't need to create it...</p>\n"; 137 137 echo "<p>... may need to update it though. Looking for column link_updated...</p>\n"; 138 $query = "SELECT link_updated FROM $ tablelinks LIMIT 1";138 $query = "SELECT link_updated FROM $wpdb->links LIMIT 1"; 139 139 $q = @mysql_query($query); 140 140 if ($q != false) { … … 143 143 } 144 144 } else { 145 $query = "ALTER TABLE $ tablelinks ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'";145 $query = "ALTER TABLE $wpdb->links ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'"; 146 146 $q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error()); 147 147 echo "<p>Added column link_updated...</p>\n"; 148 148 } 149 149 echo "<p>Looking for column link_rel...</p>\n"; 150 $query = "SELECT link_rel FROM $ tablelinks LIMIT 1";150 $query = "SELECT link_rel FROM $wpdb->links LIMIT 1"; 151 151 $q = @mysql_query($query); 152 152 if ($q != false) { … … 155 155 } 156 156 } else { 157 $query = "ALTER TABLE $ tablelinks ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '' ";157 $query = "ALTER TABLE $wpdb->links ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '' "; 158 158 $q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error()); 159 159 echo "<p>Added column link_rel...</p>\n"; … … 164 164 if ($got_links && $got_cats) { 165 165 echo "<p>Looking for category 1...</p>\n"; 166 $sql = "SELECT * FROM $ tablelinkcategories WHERE cat_id=1 ";167 $result = mysql_query($sql) or print ("Can't query '$ tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error());166 $sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 "; 167 $result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.<br />" . $sql . "<br />" . mysql_error()); 168 168 if ($result != false) { 169 169 if ($row = mysql_fetch_object($result)) { … … 172 172 } else { 173 173 echo "<p>Gonna insert category 1...</p>\n"; 174 $sql = "INSERT INTO $ tablelinkcategories (cat_id, cat_name) VALUES (1, 'General')";174 $sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'General')"; 175 175 $result = mysql_query($sql) or print ("Can't query insert category.<br />" . $sql . "<br />" . mysql_error()); 176 176 if ($result != false) { … … 197 197 <?php 198 198 199 $query = "ALTER TABLE $ tableposts ADD COLUMN post_excerpt text NOT NULL;";199 $query = "ALTER TABLE $wpdb->posts ADD COLUMN post_excerpt text NOT NULL;"; 200 200 $q = $wpdb->query($query); 201 201 // 0.71 mods 202 $query = "ALTER TABLE $ tableposts ADD post_status ENUM('publish','draft','private') NOT NULL,202 $query = "ALTER TABLE $wpdb->posts ADD post_status ENUM('publish','draft','private') NOT NULL, 203 203 ADD comment_status ENUM('open','closed') NOT NULL, 204 204 ADD ping_status ENUM('open','closed') NOT NULL, … … 210 210 211 211 <?php 212 $query = "ALTER TABLE $ tableposts DROP INDEX ID";212 $query = "ALTER TABLE $wpdb->posts DROP INDEX ID"; 213 213 214 214 $q = $wpdb->query($query); … … 218 218 <p>One down, two to go...</p> 219 219 220 <?php221 222 $query="ALTER TABLE $tablesettings DROP INDEX ID";223 $q = $wpdb->query($query);224 225 ?>226 220 227 221 <p>So far so good.</p> 228 222 <?php 229 223 230 $query="ALTER TABLE $ tableposts DROP post_karma";224 $query="ALTER TABLE $wpdb->posts DROP post_karma"; 231 225 $q = $wpdb->query($query); 232 226 flush(); … … 237 231 <?php 238 232 239 $query = "ALTER TABLE $ tableusers DROP INDEX ID";233 $query = "ALTER TABLE $wpdb->users DROP INDEX ID"; 240 234 241 235 $q = $wpdb->query($query); trunk/wp-admin/import-blogger.php
r1285 r1355 64 64 $post_author = trim(addslashes($postinfo[1])); 65 65 // we'll check the author is registered already 66 $user = $wpdb->get_row("SELECT * FROM $ tableusers WHERE user_login = '$post_author'");66 $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$post_author'"); 67 67 if (!$user) { // seems s/he's not, so let's register 68 68 $user_ip = '127.0.0.1'; … … 77 77 $user_joindate = addslashes($user_joindate); 78 78 $result = $wpdb->query(" 79 INSERT INTO $ tableusers (79 INSERT INTO $wpdb->users ( 80 80 user_login, 81 81 user_pass, … … 106 106 } 107 107 108 $post_author_ID = $wpdb->get_var("SELECT ID FROM $ tableusers WHERE user_login = '$post_author'");108 $post_author_ID = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$post_author'"); 109 109 110 110 $post_date = explode(' ', $post_date); … … 129 129 130 130 // Quick-n-dirty check for dups: 131 $dupcheck = $wpdb->get_results("SELECT ID,post_date,post_title FROM $ tableposts WHERE post_date='$post_date' AND post_title='$post_title' LIMIT 1",ARRAY_A);131 $dupcheck = $wpdb->get_results("SELECT ID,post_date,post_title FROM $wpdb->posts WHERE post_date='$post_date' AND post_title='$post_title' LIMIT 1",ARRAY_A); 132 132 if ($dupcheck[0]['ID']) { 133 133 print "<br />\nSkipping duplicate post, ID = '" . $dupcheck[0]['ID'] . "'<br />\n"; … … 138 138 139 139 $result = $wpdb->query(" 140 INSERT INTO $ tableposts140 INSERT INTO $wpdb->posts 141 141 (post_author,post_date,post_content,post_title,post_category) 142 142 VALUES … … 152 152 /* we've still got a bug that adds some empty posts with the date 0000-00-00 00:00:00 153 153 here's the bugfix: */ 154 $result = $wpdb->query("DELETE FROM $ tableposts WHERE post_date=\"0000-00-00 00:00:00\"");154 $result = $wpdb->query("DELETE FROM $wpdb->posts WHERE post_date=\"0000-00-00 00:00:00\""); 155 155 156 156 upgrade_all(); trunk/wp-admin/import-greymatter.php
r1190 r1355 88 88 $user_joindate=addslashes($user_joindate); 89 89 90 $loginthere = $wpdb->get_var("SELECT user_login FROM $ tableusers WHERE user_login = '$user_login'");90 $loginthere = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'"); 91 91 if ($loginthere) { 92 92 echo "<li>user <i>$user_login</i>... <b>Already exists</b></li>"; … … 94 94 } 95 95 96 $query = "INSERT INTO $ tableusers (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";96 $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')"; 97 97 $result = mysql_query($query); 98 98 if ($result==false) { … … 140 140 $post_author=trim(addslashes($postinfo[1])); 141 141 // we'll check the author is registered, or if it's a deleted author 142 $sql = "SELECT * FROM $ tableusers WHERE user_login = '$post_author'";142 $sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'"; 143 143 $result = mysql_query($sql); 144 144 if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2 … … 153 153 $user_url=addslashes(""); 154 154 $user_joindate=addslashes($user_joindate); 155 $query = "INSERT INTO $ tableusers (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')";155 $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')"; 156 156 $result = mysql_query($query); 157 157 if ($result==false) { … … 161 161 } 162 162 163 $sql = "SELECT * FROM $ tableusers WHERE user_login = '$post_author'";163 $sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'"; 164 164 $result = mysql_query($sql); 165 165 $myrow = mysql_fetch_array($result); … … 188 188 $post_karma=$postinfo[12]; 189 189 190 $query = "INSERT INTO $ tableposts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')";190 $query = "INSERT INTO $wpdb->posts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')"; 191 191 $result = mysql_query($query) or die(mysql_error()); 192 192 … … 194 194 die ("Error in posting..."); 195 195 196 $sql2 = "SELECT * FROM $ tableposts WHERE 1=1 ORDER BY ID DESC LIMIT 1";196 $sql2 = "SELECT * FROM $wpdb->posts WHERE 1=1 ORDER BY ID DESC LIMIT 1"; 197 197 $result2 = mysql_query($sql2); 198 198 $myrow2 = mysql_fetch_array($result2); … … 200 200 201 201 // Grab a default category. 202 $post_category = $wpdb->get_var("SELECT cat_ID FROM $ tablecategories LIMIT 1");202 $post_category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1"); 203 203 204 204 // Update the post2cat table. 205 $exists = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");205 $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category"); 206 206 207 207 if (!$exists) { 208 208 $wpdb->query(" 209 INSERT INTO $ tablepost2cat209 INSERT INTO $wpdb->post2cat 210 210 (post_id, category_id) 211 211 VALUES … … 237 237 $comment_content=addslashes($commentinfo[12]); 238 238 239 $sql3 = "INSERT INTO $ tablecomments (comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content) VALUES ('$comment_post_ID','$comment_author','$comment_author_email','$comment_author_url','$comment_author_IP','$comment_date','$comment_content')";239 $sql3 = "INSERT INTO $wpdb->comments (comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content) VALUES ('$comment_post_ID','$comment_author','$comment_author_email','$comment_author_url','$comment_author_IP','$comment_date','$comment_content')"; 240 240 $result3 = mysql_query($sql3); 241 241 if (!$result3) trunk/wp-admin/import-livejournal.php
r1147 r1355 95 95 96 96 // Now lets put it in the DB 97 if ($wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_title = '$title' AND post_date = '$post_date'")) :97 if ($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'")) : 98 98 echo 'Post already imported'; 99 99 else : 100 100 101 $wpdb->query("INSERT INTO $ tableposts101 $wpdb->query("INSERT INTO $wpdb->posts 102 102 (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name) 103 103 VALUES 104 104 ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')"); 105 $post_id = $wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_title = '$title' AND post_date = '$post_date'");105 $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); 106 106 if (!$post_id) die("couldn't get post ID"); 107 $exists = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post_id AND category_id = 1");108 if (!$exists) $wpdb->query("INSERT INTO $ tablepost2cat (post_id, category_id) VALUES ($post_id, 1) ");107 $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1"); 108 if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) "); 109 109 echo 'Done!</li>'; 110 110 endif; trunk/wp-admin/import-mt.php
r1292 r1355 72 72 73 73 function users_form($n) { 74 global $wpdb, $t ableusers, $testing;75 $users = $wpdb->get_results("SELECT * FROM $ tableusers ORDER BY ID");74 global $wpdb, $testing; 75 $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID"); 76 76 ?><select name="userselect[<?php echo $n; ?>]"> 77 77 <option value="#NONE#">- Select -</option> … … 148 148 //function to check the authorname and do the mapping 149 149 function checkauthor($author) { 150 global $wpdb, $ tableusers, $mtnames, $newauthornames, $j;//mtnames is an array with the names in the mt import file150 global $wpdb, $mtnames, $newauthornames, $j;//mtnames is an array with the names in the mt import file 151 151 $md5pass = md5(changeme); 152 152 if (!(in_array($author, $mtnames))) { //a new mt author name is found 153 153 ++$j; 154 154 $mtnames[$j] = $author; //add that new mt author name to an array 155 $user_id = $wpdb->get_var("SELECT ID FROM $ tableusers WHERE user_login = '$newauthornames[$j]'"); //check if the new author name defined by the user is a pre-existing wp user155 $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$j]'"); //check if the new author name defined by the user is a pre-existing wp user 156 156 if (!$user_id) { //banging my head against the desk now. 157 157 if ($newauthornames[$j] == 'left_blank') { //check if the user does not want to change the authorname 158 $wpdb->query("INSERT INTO $ tableusers (user_level, user_login, user_pass, user_nickname) VALUES ('1', '$author', '$md5pass', '$author')"); // if user does not want to change, insert the authorname $author159 $user_id = $wpdb->get_var("SELECT ID FROM $ tableusers WHERE user_login = '$author'");158 $wpdb->query("INSERT INTO $wpdb->users (user_level, user_login, user_pass, user_nickname) VALUES ('1', '$author', '$md5pass', '$author')"); // if user does not want to change, insert the authorname $author 159 $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$author'"); 160 160 $newauthornames[$j] = $author; //now we have a name, in the place of left_blank. 161 161 } else { 162 $wpdb->query("INSERT INTO $ tableusers (user_level, user_login, user_pass, user_nickname) VALUES ('1', '$newauthornames[$j]', '$md5pass', '$newauthornames[$j]')"); //if not left_blank, insert the user specified name163 $user_id = $wpdb->get_var("SELECT ID FROM $ tableusers WHERE user_login = '$newauthornames[$j]'");162 $wpdb->query("INSERT INTO $wpdb->users (user_level, user_login, user_pass, user_nickname) VALUES ('1', '$newauthornames[$j]', '$md5pass', '$newauthornames[$j]')"); //if not left_blank, insert the user specified name 163 $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$j]'"); 164 164 } 165 165 } else return $user_id; // return pre-existing wp username if it exists 166 166 } else { 167 167 $key = array_search($author, $mtnames); //find the array key for $author in the $mtnames array 168 $user_id = $wpdb->get_var("SELECT ID FROM $ tableusers WHERE user_login = '$newauthornames[$key]'");//use that key to get the value of the author's name from $newauthornames168 $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$key]'");//use that key to get the value of the author's name from $newauthornames 169 169 } 170 170 return $user_id; … … 273 273 274 274 // Let's check to see if it's in already 275 if ($wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_title = '$post_title' AND post_date = '$post_date'")) {275 if ($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'")) { 276 276 echo "Post already imported."; 277 277 } else { 278 278 $post_author = checkauthor($post_author);//just so that if a post already exists, new users are not created by checkauthor 279 $wpdb->query("INSERT INTO $ tableposts (279 $wpdb->query("INSERT INTO $wpdb->posts ( 280 280 post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_name, post_modified, post_modified_gmt) 281 281 VALUES 282 282 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_name','$post_date', '$post_date_gmt')"); 283 $post_id = $wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_title = '$post_title' AND post_date = '$post_date'");283 $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'"); 284 284 if (0 != count($post_categories)) { 285 285 foreach ($post_categories as $post_category) { 286 286 // See if the category exists yet 287 $cat_id = $wpdb->get_var("SELECT cat_ID from $ tablecategories WHERE cat_name = '$post_category'");287 $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); 288 288 if (!$cat_id && '' != trim($post_category)) { 289 289 $cat_nicename = sanitize_title($post_category); 290 $wpdb->query("INSERT INTO $ tablecategories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");291 $cat_id = $wpdb->get_var("SELECT cat_ID from $ tablecategories WHERE cat_name = '$post_category'");290 $wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')"); 291 $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); 292 292 } 293 293 if ('' == trim($post_category)) $cat_id = 1; 294 294 // Double check it's not there already 295 $exists = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post_id AND category_id = $cat_id");295 $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id"); 296 296 297 297 if (!$exists) { 298 298 $wpdb->query(" 299 INSERT INTO $ tablepost2cat299 INSERT INTO $wpdb->post2cat 300 300 (post_id, category_id) 301 301 VALUES … … 305 305 } // end category loop 306 306 } else { 307 $exists = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post_id AND category_id = 1");308 if (!$exists) $wpdb->query("INSERT INTO $ tablepost2cat (post_id, category_id) VALUES ($post_id, 1) ");307 $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1"); 308 if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) "); 309 309 } 310 310 echo " Post imported successfully..."; … … 339 339 340 340 // Check if it's already there 341 if (!$wpdb->get_row("SELECT * FROM $ tablecomments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) {342 $wpdb->query("INSERT INTO $ tablecomments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved)341 if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) { 342 $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved) 343 343 VALUES 344 344 ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')"); … … 384 384 385 385 // Check if it's already there 386 if (!$wpdb->get_row("SELECT * FROM $ tablecomments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) {387 $wpdb->query("INSERT INTO $ tablecomments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved)386 if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) { 387 $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content, comment_approved) 388 388 VALUES 389 389 ($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')"); trunk/wp-admin/import-rss.php
r1264 r1355 125 125 // So we do it as a last resort 126 126 if ('' == $title) : 127 $dupe = $wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_content = '$content' AND post_date = '$post_date'");127 $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' AND post_date = '$post_date'"); 128 128 else : 129 $dupe = $wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_title = '$title' AND post_date = '$post_date'");129 $dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); 130 130 endif; 131 131 … … 135 135 else : 136 136 137 $wpdb->query("INSERT INTO $ tableposts137 $wpdb->query("INSERT INTO $wpdb->posts 138 138 (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name) 139 139 VALUES 140 140 ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comme
