Changeset 1355
- Timestamp:
- 05/24/2004 08:22:18 AM (21 years ago)
- Location:
- trunk
- Files:
-
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
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', '$comment_status', '$ping_status', '$post_name')"); 141 $post_id = $wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_title = '$title' AND post_date = '$post_date'");141 $post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'"); 142 142 if (!$post_id) die("couldn't get post ID"); 143 143 if (0 != count($categories)) : … … 145 145 $post_category = unhtmlentities($post_category); 146 146 // See if the category exists yet 147 $cat_id = $wpdb->get_var("SELECT cat_ID from $ tablecategories WHERE cat_name = '$post_category'");147 $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); 148 148 if (!$cat_id && '' != trim($post_category)) { 149 149 $cat_nicename = sanitize_title($post_category); 150 $wpdb->query("INSERT INTO $ tablecategories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");151 $cat_id = $wpdb->get_var("SELECT cat_ID from $ tablecategories WHERE cat_name = '$post_category'");150 $wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')"); 151 $cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'"); 152 152 } 153 153 if ('' == trim($post_category)) $cat_id = 1; 154 154 // Double check it's not there already 155 $exists = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post_id AND category_id = $cat_id");155 $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id"); 156 156 157 157 if (!$exists) { 158 158 $wpdb->query(" 159 INSERT INTO $ tablepost2cat159 INSERT INTO $wpdb->post2cat 160 160 (post_id, category_id) 161 161 VALUES … … 165 165 endforeach; 166 166 else: 167 $exists = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post_id AND category_id = 1");168 if (!$exists) $wpdb->query("INSERT INTO $ tablepost2cat (post_id, category_id) VALUES ($post_id, 1) ");167 $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1"); 168 if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) "); 169 169 endif; 170 170 echo 'Done!</li>'; -
trunk/wp-admin/import-textpattern.php
r1117 r1355 72 72 <?php 73 73 // For people running this on .72 74 $query = "ALTER TABLE `$ tableposts` ADD `post_name` VARCHAR(200) NOT NULL";75 maybe_add_column($ tableposts, 'post_name', $query);74 $query = "ALTER TABLE `$wpdb->posts` ADD `post_name` VARCHAR(200) NOT NULL"; 75 maybe_add_column($wpdb->posts, 'post_name', $query); 76 76 77 77 // Create post_name field … … 80 80 81 81 // For now we're going to give everything the same author and same category 82 $author = $wpdb->get_var("SELECT ID FROM $ tableusers WHERE user_level = 10 LIMIT 1");83 $category = $wpdb->get_var("SELECT cat_ID FROM $ tablecategories LIMIT 1");82 $author = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_level = 10 LIMIT 1"); 83 $category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1"); 84 84 85 85 $posts = mysql_query('SELECT * FROM textpattern', $connection); … … 102 102 $post_name = sanitize_title($title); 103 103 104 $wpdb->query("INSERT INTO $ tableposts104 $wpdb->query("INSERT INTO $wpdb->posts 105 105 (post_author, post_date, post_content, post_title, post_category, post_name, post_status) 106 106 VALUES … … 108 108 109 109 // Get wordpress post id 110 $wp_post_ID = $wpdb->get_var("SELECT ID FROM $ tableposts ORDER BY ID DESC LIMIT 1");110 $wp_post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1"); 111 111 112 112 // Now let's insert comments if there are any for the TP post … … 118 118 // For some reason here "posted" is a real MySQL date, so we don't have to do anything about it 119 119 // comment_post_ID comment_author comment_author_email comment_author_url comment_author_IP comment_date comment_content comment_karma 120 $wpdb->query("INSERT INTO $ tablecomments120 $wpdb->query("INSERT INTO $wpdb->comments 121 121 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content) 122 122 VALUES -
trunk/wp-admin/install-helper.php
r601 r1355 132 132 133 133 //check_column('wp_links', 'link_description', 'mediumtext'); 134 //if (check_column($ tablecomments, 'comment_author', 'tinytext'))134 //if (check_column($wpdb->comments, 'comment_author', 'tinytext')) 135 135 // echo "ok\n"; 136 136 $error_count = 0; 137 $tablename = $ tablelinks;137 $tablename = $wpdb->links; 138 138 // check the column 139 if (!check_column($ tablelinks, 'link_description', 'varchar(255)'))139 if (!check_column($wpdb->links, 'link_description', 'varchar(255)')) 140 140 { 141 $ddl = "ALTER TABLE $ tablelinks MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";141 $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' "; 142 142 $q = $wpdb->query($ddl); 143 143 } 144 if (check_column($ tablelinks, 'link_description', 'varchar(255)')) {144 if (check_column($wpdb->links, 'link_description', 'varchar(255)')) { 145 145 $res .= $tablename . ' - ok <br />'; 146 146 } else { -
trunk/wp-admin/install.php
r1308 r1355 51 51 52 52 $wpdb->hide_errors(); 53 $installed = $wpdb->get_results("SELECT * FROM $ tableusers");53 $installed = $wpdb->get_results("SELECT * FROM $wpdb->users"); 54 54 if ($installed) die(__('<p>You appear to already have WordPress installed. If you would like to reinstall please clear your old database files first.</p></body></html>')); 55 55 $wpdb->show_errors(); … … 89 89 90 90 while ($row = mysql_fetch_row($result)) { 91 if ($row[0] == $ tablelinks)91 if ($row[0] == $wpdb->links) 92 92 $got_links = true; 93 if ($row[0] == $ tablelinkcategories)93 if ($row[0] == $wpdb->linkcategories) 94 94 $got_cats = true; 95 95 //print "Table: $row[0]<br />\n"; 96 96 } 97 97 if (!$got_cats) { 98 echo "<p>Can't find table '$ tablelinkcategories', gonna create it...</p>\n";99 $sql = "CREATE TABLE $ tablelinkcategories ( " .98 echo "<p>Can't find table '$wpdb->linkcategories', gonna create it...</p>\n"; 99 $sql = "CREATE TABLE $wpdb->linkcategories ( " . 100 100 " cat_id int(11) NOT NULL auto_increment, " . 101 101 " cat_name tinytext NOT NULL, ". … … 113 113 " PRIMARY KEY (cat_id) ". 114 114 ") "; 115 $result = mysql_query($sql) or print ("Can't create the table '$ tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());115 $result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.<br />" . $sql . "<br />" . mysql_error()); 116 116 if ($result != false) { 117 echo "<p>Table '$ tablelinkcategories' created OK</p>\n";117 echo "<p>Table '$wpdb->linkcategories' created OK</p>\n"; 118 118 $got_cats = true; 119 119 } 120 120 } else { 121 echo "<p>Found table '$ tablelinkcategories', don't need to create it...</p>\n";121 echo "<p>Found table '$wpdb->linkcategories', don't need to create it...</p>\n"; 122 122 $got_cats = true; 123 123 } 124 124 if (!$got_links) { 125 echo "<p>Can't find '$ tablelinks', gonna create it...</p>\n";126 $sql = "CREATE TABLE $ tablelinks ( " .125 echo "<p>Can't find '$wpdb->links', gonna create it...</p>\n"; 126 $sql = "CREATE TABLE $wpdb->links ( " . 127 127 " link_id int(11) NOT NULL auto_increment, " . 128 128 " link_url varchar(255) NOT NULL default '', " . … … 140 140 " PRIMARY KEY (link_id) " . 141 141 ") "; 142 $result = mysql_query($sql) or print ("Can't create the table '$ tablelinks' in the database.<br />" . $sql . "<br />" . mysql_error());143 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");144 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");145 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://zed1.com/journalized/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");146 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://www.alexking.org/', 'Alex', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");147 $links = mysql_query("INSERT INTO $ tablelinks VALUES ('', 'http://dougal.gunters.org/', 'Dougal', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");142 $result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.<br />" . $sql . "<br />" . mysql_error()); 143 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 144 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 145 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/journalized/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 146 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://www.alexking.org/', 'Alex', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 147 $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://dougal.gunters.org/', 'Dougal', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 148 148 149 149 150 150 if ($result != false) { 151 echo "<p>Table '$ tablelinks' created OK</p>\n";151 echo "<p>Table '$wpdb->links' created OK</p>\n"; 152 152 $got_links = true; 153 153 } 154 154 } else { 155 echo "<p>Found table '$ tablelinks', don't need to create it...</p>\n";155 echo "<p>Found table '$wpdb->links', don't need to create it...</p>\n"; 156 156 $got_links = true; 157 157 } … … 159 159 if ($got_links && $got_cats) { 160 160 echo "<p>Looking for category 1...</p>\n"; 161 $sql = "SELECT * FROM $ tablelinkcategories WHERE cat_id=1 ";162 $result = mysql_query($sql) or print ("Can't query '$ tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error());161 $sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 "; 162 $result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.<br />" . $sql . "<br />" . mysql_error()); 163 163 if ($result != false) { 164 164 if ($row = mysql_fetch_object($result)) { … … 167 167 } else { 168 168 echo "<p>Gonna insert category 1...</p>\n"; 169 $sql = "INSERT INTO $ tablelinkcategories (cat_id, cat_name) VALUES (1, 'Links')";169 $sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Links')"; 170 170 $result = mysql_query($sql) or print ("Can't query insert category.<br />" . $sql . "<br />" . mysql_error()); 171 171 if ($result != false) { … … 194 194 # just remove the // in this file 195 195 196 // $query = "DROP TABLE IF EXISTS $ tableposts";197 // $q = mysql_query($query) or die ("doh, can't drop the table \"$ tableposts\" in the database.");198 199 $query = "CREATE TABLE $ tableposts (196 // $query = "DROP TABLE IF EXISTS $wpdb->posts"; 197 // $q = mysql_query($query) or die ("doh, can't drop the table \"$wpdb->posts\" in the database."); 198 199 $query = "CREATE TABLE $wpdb->posts ( 200 200 ID int(10) unsigned NOT NULL auto_increment, 201 201 post_author int(4) NOT NULL default '0', … … 233 233 $now = date('Y-m-d H:i:s'); 234 234 $now_gmt = gmdate('Y-m-d H:i:s'); 235 $query = "INSERT INTO $ tableposts (post_author, post_date, post_date_gmt, post_content, post_title, post_modified, post_modified_gmt) VALUES ('1', '$now', '$now_gmt', 'Welcome to WordPress. This is the first post. Edit or delete it, then start blogging!', 'Hello world!', '$now', '$now_gmt')";235 $query = "INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_modified, post_modified_gmt) VALUES ('1', '$now', '$now_gmt', 'Welcome to WordPress. This is the first post. Edit or delete it, then start blogging!', 'Hello world!', '$now', '$now_gmt')"; 236 236 237 237 $q = $wpdb->query($query); … … 241 241 242 242 <?php 243 // $query = "DROP TABLE IF EXISTS $ tablecategories";244 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$ tablecategories\" in the database.");245 246 $query = " 247 CREATE TABLE $ tablecategories (243 // $query = "DROP TABLE IF EXISTS $wpdb->categories"; 244 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->categories\" in the database."); 245 246 $query = " 247 CREATE TABLE $wpdb->categories ( 248 248 cat_ID int(4) NOT NULL auto_increment, 249 249 cat_name varchar(55) NOT NULL default '', … … 254 254 $q = $wpdb->query($query); 255 255 256 $query = "INSERT INTO $ tablecategories (cat_ID, cat_name) VALUES ('0', 'General')";257 $q = $wpdb->query($query); 258 259 $query = "UPDATE $ tableposts SET post_category = 1";256 $query = "INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'General')"; 257 $q = $wpdb->query($query); 258 259 $query = "UPDATE $wpdb->posts SET post_category = 1"; 260 260 $result = $wpdb->query($query); 261 261 ?> … … 264 264 265 265 <?php 266 // $query = "DROP TABLE IF EXISTS $ tablecomments";267 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$ tablecomments\" in the database.");268 269 $query = " 270 CREATE TABLE $ tablecomments (266 // $query = "DROP TABLE IF EXISTS $wpdb->comments"; 267 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->comments\" in the database."); 268 269 $query = " 270 CREATE TABLE $wpdb->comments ( 271 271 comment_ID int(11) unsigned NOT NULL auto_increment, 272 272 comment_post_ID int(11) NOT NULL default '0', … … 294 294 <?php 295 295 $query = " 296 CREATE TABLE $ tablepostmeta (296 CREATE TABLE $wpdb->postmeta ( 297 297 meta_id int(11) NOT NULL auto_increment, 298 298 post_id int(11) NOT NULL default 0, … … 313 313 314 314 <?php 315 // $query = "DROP TABLE IF EXISTS $ tableoptions";316 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$ tableoptions\" in the database.");317 318 $query = " 319 CREATE TABLE $ tableoptions (315 // $query = "DROP TABLE IF EXISTS $wpdb->options"; 316 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->options\" in the database."); 317 318 $query = " 319 CREATE TABLE $wpdb->options ( 320 320 option_id int(11) NOT NULL auto_increment, 321 321 blog_id int(11) NOT NULL default 0, … … 337 337 338 338 $query = " 339 CREATE TABLE $ tableoptiontypes (339 CREATE TABLE $wpdb->optiontypes ( 340 340 optiontype_id int(11) NOT NULL auto_increment, 341 341 optiontype_name varchar(64) NOT NULL, … … 350 350 351 351 $query = " 352 CREATE TABLE $ tableoptiongroups (352 CREATE TABLE $wpdb->optiongroups ( 353 353 group_id int(11) NOT NULL auto_increment, 354 354 group_name varchar(64) not null, … … 361 361 362 362 363 // $query = "DROP TABLE IF EXISTS $ tableoptiongroup_options";364 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$ tableoptiongroup_options\" in the database.");365 366 $query = " 367 CREATE TABLE $ tableoptiongroup_options (363 // $query = "DROP TABLE IF EXISTS $wpdb->optiongroup_options"; 364 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->optiongroup_options\" in the database."); 365 366 $query = " 367 CREATE TABLE $wpdb->optiongroup_options ( 368 368 group_id int(11) NOT NULL, 369 369 option_id int(11) NOT NULL, … … 375 375 376 376 377 // $query = "DROP TABLE IF EXISTS $ tableoptionvalues";378 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$ tableoptionvalues\" in the database.");379 380 $query = " 381 CREATE TABLE $ tableoptionvalues (377 // $query = "DROP TABLE IF EXISTS $wpdb->optionvalues"; 378 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->optionvalues\" in the database."); 379 380 $query = " 381 CREATE TABLE $wpdb->optionvalues ( 382 382 option_id int(11) NOT NULL, 383 383 optionvalue tinytext, … … 399 399 400 400 $option_data = array( 401 "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES (1, 'integer')",402 "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES (2, 'boolean')",403 "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES (3, 'string')",404 "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES (4, 'date')",405 "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES (5, 'select')",406 "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES (6, 'range')",407 "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES (7, 'sqlselect')",408 "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES (8, 'float')",401 "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (1, 'integer')", 402 "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (2, 'boolean')", 403 "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (3, 'string')", 404 "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (4, 'date')", 405 "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (5, 'select')", 406 "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (6, 'range')", 407 "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (7, 'sqlselect')", 408 "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (8, 'float')", 409 409 410 410 //base options from b2cofig 411 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(1,'siteurl', 3, 'http://example.com', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\' (no trailing slash !)', 8, 30)",412 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)",413 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(3,'blogname', 3, 'my weblog', 'blogname is the name of your blog', 8, 20)",414 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(4,'blogdescription', 3, 'babblings!', 'blogdescription is the description of your blog', 8, 40)",415 //"INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(6,'search_engine_friendly_urls', 2, '0', 'Querystring Configuration ** (don\'t change if you don\'t know what you\'re doing)', 8, 20)",416 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(7,'new_users_can_blog', 2, '0', 'whether you want new users to be able to post entries once they have registered', 8, 20)",417 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(8,'users_can_register', 2, '1', 'whether you want to allow users to register on your blog', 8, 20)",418 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(54,'admin_email', 3, 'you@example.com', 'Your email (obvious eh?)', 8, 20)",419 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level) VALUES (93, 'blog_charset', 3, 'utf-8', 'Your blog’s charset (here’s a <a href=\'http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html\'>list of possible charsets</a>)', 8)",411 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(1,'siteurl', 3, 'http://example.com', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\' (no trailing slash !)', 8, 30)", 412 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)", 413 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(3,'blogname', 3, 'my weblog', 'blogname is the name of your blog', 8, 20)", 414 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(4,'blogdescription', 3, 'babblings!', 'blogdescription is the description of your blog', 8, 40)", 415 //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(6,'search_engine_friendly_urls', 2, '0', 'Querystring Configuration ** (don\'t change if you don\'t know what you\'re doing)', 8, 20)", 416 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(7,'new_users_can_blog', 2, '0', 'whether you want new users to be able to post entries once they have registered', 8, 20)", 417 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(8,'users_can_register', 2, '1', 'whether you want to allow users to register on your blog', 8, 20)", 418 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(54,'admin_email', 3, 'you@example.com', 'Your email (obvious eh?)', 8, 20)", 419 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level) VALUES (93, 'blog_charset', 3, 'utf-8', 'Your blog’s charset (here’s a <a href=\'http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html\'>list of possible charsets</a>)', 8)", 420 420 // general blog setup 421 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(9 ,'start_of_week', 5, '1', 'day at the start of the week', 8, 20)",422 //"INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(10,'use_preview', 2, '1', 'Do you want to use the \'preview\' function', 8, 20)",423 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(14,'use_htmltrans', 2, '1', 'IMPORTANT! set this to false if you are using Chinese, Japanese, Korean, or other double-bytes languages', 8, 20)",424 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(15,'use_balanceTags', 2, '1', 'this could help balance your HTML code. if it gives bad results, set it to false', 8, 20)",425 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(16,'use_smilies', 2, '1', 'set this to 1 to enable smiley conversion in posts (note: this makes smiley conversion in ALL posts)', 8, 20)",426 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(18,'require_name_email', 2, '0', 'set this to true to require e-mail and name, or false to allow comments without e-mail/name', 8, 20)",427 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(20,'comments_notify', 2, '1', 'set this to true to let every author be notified about comments on their posts', 8, 20)",421 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(9 ,'start_of_week', 5, '1', 'day at the start of the week', 8, 20)", 422 //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(10,'use_preview', 2, '1', 'Do you want to use the \'preview\' function', 8, 20)", 423 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(14,'use_htmltrans', 2, '1', 'IMPORTANT! set this to false if you are using Chinese, Japanese, Korean, or other double-bytes languages', 8, 20)", 424 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(15,'use_balanceTags', 2, '1', 'this could help balance your HTML code. if it gives bad results, set it to false', 8, 20)", 425 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(16,'use_smilies', 2, '1', 'set this to 1 to enable smiley conversion in posts (note: this makes smiley conversion in ALL posts)', 8, 20)", 426 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(18,'require_name_email', 2, '0', 'set this to true to require e-mail and name, or false to allow comments without e-mail/name', 8, 20)", 427 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(20,'comments_notify', 2, '1', 'set this to true to let every author be notified about comments on their posts', 8, 20)", 428 428 //rss/rdf feeds 429 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(21,'posts_per_rss', 1, '10', 'number of last posts to syndicate', 8, 20)",430 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(22,'rss_language', 3, 'en', 'the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )', 8, 20)",431 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(23,'rss_encoded_html', 2, '0', 'for b2rss.php: allow encoded HTML in <description> tag?', 8, 20)",432 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(24,'rss_excerpt_length', 1, '50', 'length (in words) of excerpts in the RSS feed? 0=unlimited note: in b2rss.php, this will be set to 0 if you use encoded HTML', 8, 20)",433 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(25,'rss_use_excerpt', 2, '1', 'use the excerpt field for rss feed.', 8, 20)",434 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(29,'use_trackback', 2, '1', 'set this to 0 or 1, whether you want to allow your posts to be trackback\'able or not note: setting it to zero would also disable sending trackbacks', 8, 20)",435 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(30,'use_pingback', 2, '1', 'set this to 0 or 1, whether you want to allow your posts to be pingback\'able or not note: setting it to zero would also disable sending pingbacks', 8, 20)",429 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(21,'posts_per_rss', 1, '10', 'number of last posts to syndicate', 8, 20)", 430 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(22,'rss_language', 3, 'en', 'the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )', 8, 20)", 431 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(23,'rss_encoded_html', 2, '0', 'for b2rss.php: allow encoded HTML in <description> tag?', 8, 20)", 432 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(24,'rss_excerpt_length', 1, '50', 'length (in words) of excerpts in the RSS feed? 0=unlimited note: in b2rss.php, this will be set to 0 if you use encoded HTML', 8, 20)", 433 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(25,'rss_use_excerpt', 2, '1', 'use the excerpt field for rss feed.', 8, 20)", 434 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(29,'use_trackback', 2, '1', 'set this to 0 or 1, whether you want to allow your posts to be trackback\'able or not note: setting it to zero would also disable sending trackbacks', 8, 20)", 435 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(30,'use_pingback', 2, '1', 'set this to 0 or 1, whether you want to allow your posts to be pingback\'able or not note: setting it to zero would also disable sending pingbacks', 8, 20)", 436 436 //file upload 437 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(31,'use_fileupload', 2, '0', 'set this to false to disable file upload, or true to enable it', 8, 20)",438 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(32,'fileupload_realpath', 3, '/home/your/site/wordpress/images', 'enter the real path of the directory where you\'ll upload the pictures \nif you\'re unsure about what your real path is, please ask your host\'s support staff \nnote that the directory must be writable by the webserver (chmod 766) \nnote for windows-servers users: use forwardslashes instead of backslashes', 8, 40)",439 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(33,'fileupload_url', 3, 'http://example.com/images', 'enter the URL of that directory (it\'s used to generate the links to the uploded files)', 8, 40)",440 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(34,'fileupload_allowedtypes', 3, 'jpg jpeg gif png', 'accepted file types, separated by spaces. example: \'jpg gif png\'', 8, 20)",441 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(35,'fileupload_maxk', 1, '96', 'by default, most servers limit the size of uploads to 2048 KB, if you want to set it to a lower value, here it is (you cannot set a higher value than your server limit)', 8, 20)",442 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(36,'fileupload_minlevel', 1, '4', 'you may not want all users to upload pictures/files, so you can set a minimum level for this', 8, 20)",443 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(37,'fileupload_allowedusers', 3, '', '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'', 8, 30)",437 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(31,'use_fileupload', 2, '0', 'set this to false to disable file upload, or true to enable it', 8, 20)", 438 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(32,'fileupload_realpath', 3, '/home/your/site/wordpress/images', 'enter the real path of the directory where you\'ll upload the pictures \nif you\'re unsure about what your real path is, please ask your host\'s support staff \nnote that the directory must be writable by the webserver (chmod 766) \nnote for windows-servers users: use forwardslashes instead of backslashes', 8, 40)", 439 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(33,'fileupload_url', 3, 'http://example.com/images', 'enter the URL of that directory (it\'s used to generate the links to the uploded files)', 8, 40)", 440 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(34,'fileupload_allowedtypes', 3, 'jpg jpeg gif png', 'accepted file types, separated by spaces. example: \'jpg gif png\'', 8, 20)", 441 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(35,'fileupload_maxk', 1, '96', 'by default, most servers limit the size of uploads to 2048 KB, if you want to set it to a lower value, here it is (you cannot set a higher value than your server limit)', 8, 20)", 442 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(36,'fileupload_minlevel', 1, '4', 'you may not want all users to upload pictures/files, so you can set a minimum level for this', 8, 20)", 443 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(37,'fileupload_allowedusers', 3, '', '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'', 8, 30)", 444 444 // email settings 445 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(38,'mailserver_url', 3, 'mail.example.com', 'mailserver settings', 8, 20)",446 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(39,'mailserver_login', 3, 'login@example.com', 'mailserver settings', 8, 20)",447 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(40,'mailserver_pass', 3, 'password', 'mailserver settings', 8, 20)",448 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(41,'mailserver_port', 1, '110', 'mailserver settings', 8, 20)",449 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(42,'default_category', 1, '1', 'by default posts will have this category', 8, 20)",450 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(46,'use_phoneemail', 2, '0', 'some mobile phone email services will send identical subject & content on the same line if you use such a service, set use_phoneemail to true, and indicate a separator string', 8, 20)",445 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(38,'mailserver_url', 3, 'mail.example.com', 'mailserver settings', 8, 20)", 446 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(39,'mailserver_login', 3, 'login@example.com', 'mailserver settings', 8, 20)", 447 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(40,'mailserver_pass', 3, 'password', 'mailserver settings', 8, 20)", 448 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(41,'mailserver_port', 1, '110', 'mailserver settings', 8, 20)", 449 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(42,'default_category', 1, '1', 'by default posts will have this category', 8, 20)", 450 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(46,'use_phoneemail', 2, '0', 'some mobile phone email services will send identical subject & content on the same line if you use such a service, set use_phoneemail to true, and indicate a separator string', 8, 20)", 451 451 // original options from options page 452 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(48,'posts_per_page', 1, '20','How many posts/days to show on the index page.', 4, 20)",453 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(49,'what_to_show', 5, 'posts','Posts, days, or posts paged', 4, 20)",454 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(50,'archive_mode', 5, 'monthly','Which \'unit\' to use for archives.', 4, 20)",455 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(51,'time_difference', 6, '0', 'if you\'re not on the timezone of your server', 4, 20)",456 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(52,'date_format', 3, 'n/j/Y', 'see note for format characters', 4, 20)",457 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(53,'time_format', 3, 'g:i a', 'see note for format characters', 4, 20)",452 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(48,'posts_per_page', 1, '20','How many posts/days to show on the index page.', 4, 20)", 453 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(49,'what_to_show', 5, 'posts','Posts, days, or posts paged', 4, 20)", 454 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(50,'archive_mode', 5, 'monthly','Which \'unit\' to use for archives.', 4, 20)", 455 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(51,'time_difference', 6, '0', 'if you\'re not on the timezone of your server', 4, 20)", 456 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(52,'date_format', 3, 'n/j/Y', 'see note for format characters', 4, 20)", 457 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(53,'time_format', 3, 'g:i a', 'see note for format characters', 4, 20)", 458 458 459 459 //'pages' of options 460 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(1, 'Other Options', 'Posts per page etc. Original options page')",461 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(1,48,1 )",462 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(1,49,2 )",463 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(1,50,3 )",464 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(1,51,4 )",465 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(1,52,5 )",466 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(1,53,6 )",467 468 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(2, 'General blog settings', 'Things you\'ll probably want to tweak')",469 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,9 ,1 )",470 //"INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,10,2 )",471 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,11,3 )",472 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,12,4 )",473 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,13,5 )",474 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,14,6 )",475 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,15,7 )",476 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,16,8 )",477 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,17,9 )",478 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,18,10)",479 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,19,11)",480 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(2,20,12)",481 482 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(3, 'RSS/RDF Feeds, Track/Ping-backs', 'Settings for RSS/RDF Feeds, Track/ping-backs')",483 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,21,1 )",484 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,22,2 )",485 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,23,3 )",486 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,24,4 )",487 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,25,5 )",488 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,26,6 )",489 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,27,7 )",490 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,28,8 )",491 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,29,9 )",492 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(3,30,10)",493 494 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(4, 'File uploads', 'Settings for file uploads')",495 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(4,31,1 )",496 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(4,32,2 )",497 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(4,33,3 )",498 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(4,34,4 )",499 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(4,35,5 )",500 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(4,36,6 )",501 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(4,37,7 )",502 503 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(5, 'Blog-by-Email settings', 'Settings for blogging via email')",504 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,38,1 )",505 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,39,2 )",506 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,40,3 )",507 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,41,4 )",508 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,42,5 )",509 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,43,6 )",510 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,44,7 )",511 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,45,8 )",512 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,46,9 )",513 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(5,47,10)",514 515 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(6, 'Base settings', 'Basic settings required to get your blog working')",516 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(6,1,1)",517 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(6,2,2)",518 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(6,3,3)",519 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(6,4,4)",520 //"INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(6,6,5)",521 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(6,7,6)",522 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(6,8,7)",523 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(6,54,8)",460 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(1, 'Other Options', 'Posts per page etc. Original options page')", 461 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,48,1 )", 462 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,49,2 )", 463 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,50,3 )", 464 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,51,4 )", 465 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,52,5 )", 466 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,53,6 )", 467 468 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(2, 'General blog settings', 'Things you\'ll probably want to tweak')", 469 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,9 ,1 )", 470 //"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,10,2 )", 471 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,11,3 )", 472 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,12,4 )", 473 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,13,5 )", 474 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,14,6 )", 475 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,15,7 )", 476 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,16,8 )", 477 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,17,9 )", 478 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,18,10)", 479 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,19,11)", 480 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,20,12)", 481 482 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(3, 'RSS/RDF Feeds, Track/Ping-backs', 'Settings for RSS/RDF Feeds, Track/ping-backs')", 483 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,21,1 )", 484 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,22,2 )", 485 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,23,3 )", 486 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,24,4 )", 487 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,25,5 )", 488 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,26,6 )", 489 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,27,7 )", 490 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,28,8 )", 491 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,29,9 )", 492 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,30,10)", 493 494 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(4, 'File uploads', 'Settings for file uploads')", 495 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,31,1 )", 496 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,32,2 )", 497 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,33,3 )", 498 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,34,4 )", 499 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,35,5 )", 500 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,36,6 )", 501 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,37,7 )", 502 503 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(5, 'Blog-by-Email settings', 'Settings for blogging via email')", 504 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,38,1 )", 505 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,39,2 )", 506 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,40,3 )", 507 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,41,4 )", 508 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,42,5 )", 509 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,43,6 )", 510 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,44,7 )", 511 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,45,8 )", 512 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,46,9 )", 513 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,47,10)", 514 515 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(6, 'Base settings', 'Basic settings required to get your blog working')", 516 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,1,1)", 517 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,2,2)", 518 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,3,3)", 519 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,4,4)", 520 //"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,6,5)", 521 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,7,6)", 522 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,8,7)", 523 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,54,8)", 524 524 525 525 // select data for what to show 526 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'days', 'days', null,null,1)",527 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'posts', 'posts', null,null,2)",528 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'paged', 'posts paged', null,null,3)",526 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'days', 'days', null,null,1)", 527 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'posts', 'posts', null,null,2)", 528 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'paged', 'posts paged', null,null,3)", 529 529 // select data for archive mode 530 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'daily', 'daily', null,null,1)",531 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'weekly', 'weekly', null,null,2)",532 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'monthly', 'monthly', null,null,3)",533 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'postbypost','post by post',null,null,4)",530 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'daily', 'daily', null,null,1)", 531 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'weekly', 'weekly', null,null,2)", 532 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'monthly', 'monthly', null,null,3)", 533 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'postbypost','post by post',null,null,4)", 534 534 // select data for time diff 535 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (51, 'hours', 'hours', 23, -23, null)",535 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (51, 'hours', 'hours', 23, -23, null)", 536 536 // select data for start of week 537 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '0', 'Sunday', null,null,1)",538 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '1', 'Monday', null,null,2)",539 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '6', 'Saturday', null,null,3)",537 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '0', 'Sunday', null,null,1)", 538 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '1', 'Monday', null,null,2)", 539 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '6', 'Saturday', null,null,3)", 540 540 541 541 … … 546 546 // default_ping_status select one of open closed 547 547 // default_pingback_flag select one of checked unchecked 548 // default_post_category sql_select "SELECT cat_id AS value, cat_name AS label FROM $ tablecategories order by cat_name"549 550 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(55,'default_post_status', 5, 'publish', 'The default state of each new post', 8, 20)",551 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(56,'default_comment_status', 5, 'open', 'The default state of comments for each new post', 8, 20)",552 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(57,'default_ping_status', 5, 'open', 'The default ping state for each new post', 8, 20)",553 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(58,'default_pingback_flag', 5, '1', 'Whether the \'PingBack the URLs in this post\' checkbox should be checked by default', 8, 20)",554 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(59,'default_post_category', 7, '1', 'The default category for each new post', 8, 20)",555 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(83,'default_post_edit_rows', 1, '9', 'The number of rows in the edit post form (min 3, max 100)', 8, 5)",556 557 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(7, 'Default post options', 'Default settings for new posts.')",558 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(7,55,1 )",559 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(7,56,2 )",560 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(7,57,3 )",561 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(7,58,4 )",562 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(7,59,5 )",563 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(7,83,5 )",548 // default_post_category sql_select "SELECT cat_id AS value, cat_name AS label FROM $wpdb->categories order by cat_name" 549 550 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(55,'default_post_status', 5, 'publish', 'The default state of each new post', 8, 20)", 551 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(56,'default_comment_status', 5, 'open', 'The default state of comments for each new post', 8, 20)", 552 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(57,'default_ping_status', 5, 'open', 'The default ping state for each new post', 8, 20)", 553 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(58,'default_pingback_flag', 5, '1', 'Whether the \'PingBack the URLs in this post\' checkbox should be checked by default', 8, 20)", 554 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(59,'default_post_category', 7, '1', 'The default category for each new post', 8, 20)", 555 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(83,'default_post_edit_rows', 1, '9', 'The number of rows in the edit post form (min 3, max 100)', 8, 5)", 556 557 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(7, 'Default post options', 'Default settings for new posts.')", 558 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,55,1 )", 559 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,56,2 )", 560 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,57,3 )", 561 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,58,4 )", 562 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,59,5 )", 563 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,83,5 )", 564 564 565 565 // select data for post_status 566 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'publish', 'Publish', null,null,1)",567 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'draft', 'Draft', null,null,2)",568 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'private', 'Private', null,null,3)",566 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'publish', 'Publish', null,null,1)", 567 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'draft', 'Draft', null,null,2)", 568 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'private', 'Private', null,null,3)", 569 569 570 570 // select data for comment_status 571 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'open', 'Open', null,null,1)",572 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'closed', 'Closed', null,null,2)",571 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'open', 'Open', null,null,1)", 572 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'closed', 'Closed', null,null,2)", 573 573 574 574 // select data for ping_status (aargh duplication!) 575 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'open', 'Open', null,null,1)",576 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'closed', 'Closed', null,null,2)",575 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'open', 'Open', null,null,1)", 576 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'closed', 'Closed', null,null,2)", 577 577 578 578 // select data for pingback flag 579 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '1', 'Checked', null,null,1)",580 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '0', 'Unchecked', null,null,2)",579 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '1', 'Checked', null,null,1)", 580 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '0', 'Unchecked', null,null,2)", 581 581 582 582 // sql select data for default 583 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (59, 'SELECT cat_id AS value, cat_name AS label FROM $tablecategories order by cat_name', '', null,null,1)",583 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (59, 'SELECT cat_id AS value, cat_name AS label FROM $wpdb->categories order by cat_name', '', null,null,1)", 584 584 ); 585 585 … … 594 594 <?php 595 595 $links_option_data = array( 596 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(60,'links_minadminlevel', 1, '5', 'The minimum admin level to edit links', 8, 10)",597 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(61,'links_use_adminlevels', 2, '1', 'set this to false to have all links visible and editable to everyone in the link manager', 8, 20)",598 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(62,'links_rating_type', 5, 'image', 'Set this to the type of rating indication you wish to use', 8, 10)",599 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(63,'links_rating_char', 3, '*', 'If we are set to \'char\' which char to use.', 8, 5)",600 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(64,'links_rating_ignore_zero', 2, '1', 'What do we do with a value of zero? set this to true to output nothing, 0 to output as normal (number/image)', 8, 20)",601 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(65,'links_rating_single_image', 2, '1', 'Use the same image for each rating point? (Uses links_rating_image[0])', 8, 20)",602 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(66,'links_rating_image0', 3, 'wp-links/links-images/tick.png', 'Image for rating 0 (and for single image)', 8, 40)",603 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(67,'links_rating_image1', 3, 'wp-links/links-images/rating-1.gif', 'Image for rating 1', 8, 40)",604 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(68,'links_rating_image2', 3, 'wp-links/links-images/rating-2.gif', 'Image for rating 2', 8, 40)",605 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(69,'links_rating_image3', 3, 'wp-links/links-images/rating-3.gif', 'Image for rating 3', 8, 40)",606 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(70,'links_rating_image4', 3, 'wp-links/links-images/rating-4.gif', 'Image for rating 4', 8, 40)",607 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(71,'links_rating_image5', 3, 'wp-links/links-images/rating-5.gif', 'Image for rating 5', 8, 40)",608 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(72,'links_rating_image6', 3, 'wp-links/links-images/rating-6.gif', 'Image for rating 6', 8, 40)",609 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(73,'links_rating_image7', 3, 'wp-links/links-images/rating-7.gif', 'Image for rating 7', 8, 40)",610 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(74,'links_rating_image8', 3, 'wp-links/links-images/rating-8.gif', 'Image for rating 8', 8, 40)",611 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(75,'links_rating_image9', 3, 'wp-links/links-images/rating-9.gif', 'Image for rating 9', 8, 40)",612 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(77,'weblogs_xml_url', 3, 'http://www.weblogs.com/changes.xml', 'Which file to grab from weblogs.com', 8, 40)",613 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(78,'weblogs_cacheminutes', 1, '60', 'cache time in minutes (if it is older than this get a new copy)', 8, 10)",614 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(79,'links_updated_date_format', 3, 'd/m/Y h:i', 'The date format for the updated tooltip', 8, 25)",615 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(80,'links_recently_updated_prepend', 3, '>>', 'The text to prepend to a recently updated link', 8, 10)",616 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(81,'links_recently_updated_append', 3, '<<', 'The text to append to a recently updated link', 8, 20)",617 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(82,'links_recently_updated_time', 1, '120', 'The time in minutes to consider a link recently updated', 8, 20)",596 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(60,'links_minadminlevel', 1, '5', 'The minimum admin level to edit links', 8, 10)", 597 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(61,'links_use_adminlevels', 2, '1', 'set this to false to have all links visible and editable to everyone in the link manager', 8, 20)", 598 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(62,'links_rating_type', 5, 'image', 'Set this to the type of rating indication you wish to use', 8, 10)", 599 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(63,'links_rating_char', 3, '*', 'If we are set to \'char\' which char to use.', 8, 5)", 600 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(64,'links_rating_ignore_zero', 2, '1', 'What do we do with a value of zero? set this to true to output nothing, 0 to output as normal (number/image)', 8, 20)", 601 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(65,'links_rating_single_image', 2, '1', 'Use the same image for each rating point? (Uses links_rating_image[0])', 8, 20)", 602 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(66,'links_rating_image0', 3, 'wp-links/links-images/tick.png', 'Image for rating 0 (and for single image)', 8, 40)", 603 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(67,'links_rating_image1', 3, 'wp-links/links-images/rating-1.gif', 'Image for rating 1', 8, 40)", 604 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(68,'links_rating_image2', 3, 'wp-links/links-images/rating-2.gif', 'Image for rating 2', 8, 40)", 605 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(69,'links_rating_image3', 3, 'wp-links/links-images/rating-3.gif', 'Image for rating 3', 8, 40)", 606 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(70,'links_rating_image4', 3, 'wp-links/links-images/rating-4.gif', 'Image for rating 4', 8, 40)", 607 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(71,'links_rating_image5', 3, 'wp-links/links-images/rating-5.gif', 'Image for rating 5', 8, 40)", 608 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(72,'links_rating_image6', 3, 'wp-links/links-images/rating-6.gif', 'Image for rating 6', 8, 40)", 609 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(73,'links_rating_image7', 3, 'wp-links/links-images/rating-7.gif', 'Image for rating 7', 8, 40)", 610 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(74,'links_rating_image8', 3, 'wp-links/links-images/rating-8.gif', 'Image for rating 8', 8, 40)", 611 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(75,'links_rating_image9', 3, 'wp-links/links-images/rating-9.gif', 'Image for rating 9', 8, 40)", 612 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(77,'weblogs_xml_url', 3, 'http://www.weblogs.com/changes.xml', 'Which file to grab from weblogs.com', 8, 40)", 613 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(78,'weblogs_cacheminutes', 1, '60', 'cache time in minutes (if it is older than this get a new copy)', 8, 10)", 614 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(79,'links_updated_date_format', 3, 'd/m/Y h:i', 'The date format for the updated tooltip', 8, 25)", 615 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(80,'links_recently_updated_prepend', 3, '>>', 'The text to prepend to a recently updated link', 8, 10)", 616 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(81,'links_recently_updated_append', 3, '<<', 'The text to append to a recently updated link', 8, 20)", 617 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(82,'links_recently_updated_time', 1, '120', 'The time in minutes to consider a link recently updated', 8, 20)", 618 618 619 619 //group them together 620 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(8, 'Link Manager Settings', 'Various settings for the link manager.')",621 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,60,1 )",622 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,61,2 )",623 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,62,3 )",624 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,63,4 )",625 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,64,5 )",626 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,65,6 )",627 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,66,7 )",628 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,67,8 )",629 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,68,9 )",630 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,69,10)",631 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,70,11)",632 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,71,12)",633 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,72,13)",634 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,73,14)",635 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,74,15)",636 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,75,16)",637 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,76,17)",638 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,77,18)",639 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,78,19)",640 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,79,20)",641 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,80,21)",642 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,81,22)",643 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(8,82,23)",620 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(8, 'Link Manager Settings', 'Various settings for the link manager.')", 621 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,60,1 )", 622 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,61,2 )", 623 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,62,3 )", 624 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,63,4 )", 625 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,64,5 )", 626 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,65,6 )", 627 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,66,7 )", 628 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,67,8 )", 629 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,68,9 )", 630 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,69,10)", 631 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,70,11)", 632 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,71,12)", 633 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,72,13)", 634 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,73,14)", 635 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,74,15)", 636 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,75,16)", 637 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,76,17)", 638 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,77,18)", 639 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,78,19)", 640 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,79,20)", 641 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,80,21)", 642 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,81,22)", 643 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,82,23)", 644 644 645 645 // select data for rating_type 646 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'number', 'Number', null,null,1)",647 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'char', 'Character', null,null,2)",648 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'image', 'Image', null,null,3)",646 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'number', 'Number', null,null,1)", 647 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'char', 'Character', null,null,2)", 648 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'image', 'Image', null,null,3)", 649 649 ); 650 650 … … 659 659 $geo_option_data = array( 660 660 // data for geo settings 661 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(84,'use_geo_positions', 2, '0', 'Turns on the geo url features of WordPress', 8, 20)",662 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(85,'use_default_geourl', 2, '1','enables placement of default GeoURL ICBM location even when no other specified', 8, 20)",663 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(86,'default_geourl_lat ', 8, 0.0, 'The default Latitude ICBM value - <a href=\"http://www.geourl.org/resources.html\" target=\"_blank\">see here</a>', 8, 20)",664 "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(87,'default_geourl_lon', 8, 0.0, 'The default Longitude ICBM value', 8, 20)",665 666 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options', 'Settings which control the posting and display of Geo Options')",667 668 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(9,84,1)",669 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(9,85,1)",670 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(9,86,1)",671 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES(9,87,1)",661 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(84,'use_geo_positions', 2, '0', 'Turns on the geo url features of WordPress', 8, 20)", 662 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(85,'use_default_geourl', 2, '1','enables placement of default GeoURL ICBM location even when no other specified', 8, 20)", 663 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(86,'default_geourl_lat ', 8, 0.0, 'The default Latitude ICBM value - <a href=\"http://www.geourl.org/resources.html\" target=\"_blank\">see here</a>', 8, 20)", 664 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(87,'default_geourl_lon', 8, 0.0, 'The default Longitude ICBM value', 8, 20)", 665 666 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options', 'Settings which control the posting and display of Geo Options')", 667 668 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,84,1)", 669 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,85,1)", 670 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,86,1)", 671 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,87,1)", 672 672 673 673 ); … … 705 705 $url = $_REQUEST['url']; 706 706 if (isset($url)) { 707 $query= "UPDATE $ tableoptions set option_value='$url' where option_id=1"; //siteurl707 $query= "UPDATE $wpdb->options set option_value='$url' where option_id=1"; //siteurl 708 708 $q = $wpdb->query($query); 709 709 } 710 710 711 // $query = "DROP TABLE IF EXISTS $ tableusers";712 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$ tableusers\" in the database.");713 714 $query = " 715 CREATE TABLE $ tableusers (711 // $query = "DROP TABLE IF EXISTS $wpdb->users"; 712 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->users\" in the database."); 713 714 $query = " 715 CREATE TABLE $wpdb->users ( 716 716 ID int(10) unsigned NOT NULL auto_increment, 717 717 user_login varchar(20) NOT NULL default '', … … 740 740 $random_password = substr(md5(uniqid(microtime())),0,6); 741 741 742 $query = "INSERT INTO $ tableusers (ID, user_login, user_pass, user_firstname, user_lastname, user_nickname, user_icq, user_email, user_url, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_aim, user_msn, user_yim, user_idmode) VALUES ( '1', 'admin', MD5('$random_password'), '', '', 'site admin', '0', '$admin_email', '', '127.0.0.1', '127.0.0.1', '', '00-00-0000 00:00:01', '10', '', '', '', 'nickname')";742 $query = "INSERT INTO $wpdb->users (ID, user_login, user_pass, user_firstname, user_lastname, user_nickname, user_icq, user_email, user_url, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_aim, user_msn, user_yim, user_idmode) VALUES ( '1', 'admin', MD5('$random_password'), '', '', 'site admin', '0', '$admin_email', '', '127.0.0.1', '127.0.0.1', '', '00-00-0000 00:00:01', '10', '', '', '', 'nickname')"; 743 743 $q = $wpdb->query($query); 744 744 -
trunk/wp-admin/link-add.php
r1200 r1355 7 7 8 8 function category_dropdown($fieldname, $selected = 0) { 9 global $wpdb , $tablelinkcategories;10 11 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $ tablelinkcategories ORDER BY cat_id");9 global $wpdb; 10 11 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); 12 12 echo ' <select name="'.$fieldname.'" size="1">'."\n"; 13 13 foreach ($results as $row) { -
trunk/wp-admin/link-categories.php
r1175 r1355 72 72 $list_limit = -1; 73 73 74 $wpdb->query("INSERT INTO $ tablelinkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" .74 $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" . 75 75 " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit) \n" . 76 76 " VALUES ('0', '$cat_name', '$auto_toggle', '$show_images', '$show_description', \n" . … … 96 96 die (__("Cheatin' uh ?")); 97 97 98 $wpdb->query("DELETE FROM $ tablelinkcategories WHERE cat_id='$cat_id'");99 $wpdb->query("UPDATE $ tablelinks SET link_category=1 WHERE link_category='$cat_id'");98 $wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$cat_id'"); 99 $wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$cat_id'"); 100 100 101 101 header('Location: link-categories.php'); … … 108 108 $row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, " 109 109 . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, " 110 . " text_after_all, list_limit FROM $ tablelinkcategories WHERE cat_id=$cat_id");110 . " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$cat_id"); 111 111 if ($row) { 112 112 if ($row->list_limit == -1) { … … 264 264 $list_limit = -1; 265 265 266 $wpdb->query("UPDATE $ tablelinkcategories set266 $wpdb->query("UPDATE $wpdb->linkcategories set 267 267 cat_name='$cat_name', 268 268 auto_toggle='$auto_toggle', … … 325 325 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, " 326 326 . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, " 327 . " text_after_all, list_limit FROM $ tablelinkcategories ORDER BY cat_id");327 . " text_after_all, list_limit FROM $wpdb->linkcategories ORDER BY cat_id"); 328 328 $i = 1; 329 329 foreach ($results as $row) { -
trunk/wp-admin/link-import.php
r1182 r1355 59 59 <?php _e('Category:') ?> <?php echo gethelp_link($this_file,'link_category');?><select name="cat_id"> 60 60 <?php 61 $categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $ tablelinkcategories ORDER BY cat_id");61 $categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); 62 62 foreach ($categories as $category) { 63 63 ?> … … 123 123 if ('http' == substr($titles[$i], 0, 4)) 124 124 $titles[$i] = ''; 125 $query = "INSERT INTO $ tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)125 $query = "INSERT INTO $wpdb->links (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss) 126 126 VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n"; 127 127 $result = $wpdb->query($query); -
trunk/wp-admin/link-manager.php
r1352 r1355 21 21 22 22 function category_dropdown($fieldname, $selected = 0) { 23 global $wpdb , $tablelinkcategories;23 global $wpdb; 24 24 25 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $ tablelinkcategories ORDER BY cat_id");25 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); 26 26 echo "\n<select name='$fieldname' size='1'>"; 27 27 foreach ($results as $row) { … … 100 100 } 101 101 $all_links = join(',', $linkcheck); 102 $results = $wpdb->get_results("SELECT link_id, link_owner, user_level FROM $ tablelinks LEFT JOIN $tableusers ON link_owner = ID WHERE link_id in ($all_links)");102 $results = $wpdb->get_results("SELECT link_id, link_owner, user_level FROM $wpdb->links LEFT JOIN $wpdb->users ON link_owner = ID WHERE link_id in ($all_links)"); 103 103 foreach ($results as $row) { 104 104 if (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed … … 109 109 // should now have an array of links we can change 110 110 $all_links = join(',', $ids_to_change); 111 $q = $wpdb->query("update $ tablelinks SET link_owner='$newowner' WHERE link_id IN ($all_links)");111 $q = $wpdb->query("update $wpdb->links SET link_owner='$newowner' WHERE link_id IN ($all_links)"); 112 112 113 113 header('Location: ' . $this_file); … … 131 131 } 132 132 $all_links = join(',', $linkcheck); 133 $results = $wpdb->get_results("SELECT link_id, link_visible FROM $ tablelinks WHERE link_id in ($all_links)");133 $results = $wpdb->get_results("SELECT link_id, link_visible FROM $wpdb->links WHERE link_id in ($all_links)"); 134 134 foreach ($results as $row) { 135 135 if ($row->link_visible == 'Y') { // ok to proceed … … 143 143 if (count($ids_to_turnoff)) { 144 144 $all_linksoff = join(',', $ids_to_turnoff); 145 $q = $wpdb->query("update $ tablelinks SET link_visible='N' WHERE link_id IN ($all_linksoff)");145 $q = $wpdb->query("update $wpdb->links SET link_visible='N' WHERE link_id IN ($all_linksoff)"); 146 146 } 147 147 148 148 if (count($ids_to_turnon)) { 149 149 $all_linkson = join(',', $ids_to_turnon); 150 $q = $wpdb->query("update $ tablelinks SET link_visible='Y' WHERE link_id IN ($all_linkson)");150 $q = $wpdb->query("update $wpdb->links SET link_visible='Y' WHERE link_id IN ($all_linkson)"); 151 151 } 152 152 … … 172 172 $all_links = join(',', $linkcheck); 173 173 // should now have an array of links we can change 174 $q = $wpdb->query("update $ tablelinks SET link_category='$category' WHERE link_id IN ($all_links)");174 $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)"); 175 175 176 176 header('Location: ' . $this_file); … … 204 204 // need to make the others invisible before we add this new one. 205 205 if (($auto_toggle == 'Y') && ($link_visible == 'Y')) { 206 $wpdb->query("UPDATE $ tablelinks set link_visible = 'N' WHERE link_category = $link_category");207 } 208 $wpdb->query("INSERT INTO $ tablelinks (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) " .206 $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category"); 207 } 208 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) " . 209 209 " VALUES('" . addslashes($link_url) . "','" 210 210 . addslashes($link_name) . "', '" … … 254 254 // need to make the others invisible before we update this one. 255 255 if (($auto_toggle == 'Y') && ($link_visible == 'Y')) { 256 $wpdb->query("UPDATE $ tablelinks set link_visible = 'N' WHERE link_category = $link_category");256 $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category"); 257 257 } 258 258 259 $wpdb->query("UPDATE $ tablelinks SET link_url='" . addslashes($link_url) . "',259 $wpdb->query("UPDATE $wpdb->links SET link_url='" . addslashes($link_url) . "', 260 260 link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "', 261 261 link_target='$link_target',\n link_category=$link_category, … … 284 284 die (__("Cheatin' uh ?")); 285 285 286 $wpdb->query("DELETE FROM $ tablelinks WHERE link_id = $link_id");286 $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = $link_id"); 287 287 288 288 if (isset($links_show_cat_id) && ($links_show_cat_id != '')) … … 309 309 310 310 $row = $wpdb->get_row("SELECT * 311 FROM $ tablelinks311 FROM $wpdb->links 312 312 WHERE link_id = $link_id"); 313 313 … … 618 618 <td> 619 619 <?php 620 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $ tablelinkcategories ORDER BY cat_id");620 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); 621 621 echo " <select name=\"cat_id\">\n"; 622 622 echo " <option value=\"All\""; … … 676 676 <?php 677 677 $sql = "SELECT link_url, link_name, link_image, link_description, link_visible, 678 link_category AS cat_id, cat_name AS category, $ tableusers.user_login, link_id,679 link_rating, link_rel, $ tableusers.user_level680 FROM $ tablelinks681 LEFT JOIN $ tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id682 LEFT JOIN $ tableusers ON $tableusers.ID = $tablelinks.link_owner ";678 link_category AS cat_id, cat_name AS category, $wpdb->users.user_login, link_id, 679 link_rating, link_rel, $wpdb->users.user_level 680 FROM $wpdb->links 681 LEFT JOIN $wpdb->linkcategories ON $wpdb->links.link_category = $wpdb->linkcategories.cat_id 682 LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->links.link_owner "; 683 683 684 684 if (isset($cat_id) && ($cat_id != 'All')) { … … 748 748 <?php _e('Assign ownership to:'); echo ' ' . gethelp_link($this_file,'assign_ownership'); ?> 749 749 <?php 750 $results = $wpdb->get_results("SELECT ID, user_login FROM $ tableusers WHERE user_level > 0 ORDER BY ID");750 $results = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level > 0 ORDER BY ID"); 751 751 echo " <select name=\"newowner\" size=\"1\">\n"; 752 752 foreach ($results as $row) { -
trunk/wp-admin/moderation.php
r1239 r1355 135 135 <div class="wrap"> 136 136 <?php 137 $comments = $wpdb->get_results("SELECT * FROM $ tablecomments WHERE comment_approved = '0'");137 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'"); 138 138 139 139 if ($comments) { … … 148 148 foreach($comments as $comment) { 149 149 $comment_date = mysql2date(get_settings("date_format") . " @ " . get_settings("time_format"), $comment->comment_date); 150 $post_title = $wpdb->get_var("SELECT post_title FROM $ tableposts WHERE ID='$comment->comment_post_ID'");150 $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID'"); 151 151 152 152 echo "\n\t<li id='comment-$comment->comment_ID'>"; -
trunk/wp-admin/optionhandler.php
r700 r1355 10 10 function get_option_widget($option_result, $editable, $between) 11 11 { 12 global $wpdb , $tableoptionvalues;12 global $wpdb; 13 13 $disabled = $editable ? '' : 'disabled'; 14 14 … … 48 48 49 49 $select = $wpdb->get_results("SELECT optionvalue, optionvalue_desc " 50 ."FROM $ tableoptionvalues "50 ."FROM $wpdb->optionvalues " 51 51 ."WHERE option_id = $option_result->option_id " 52 52 ."ORDER BY optionvalue_seq"); … … 67 67 case 7: // SQL select 68 68 // first get the sql to run 69 $sql = $wpdb->get_var("SELECT optionvalue FROM $ tableoptionvalues WHERE option_id = $option_result->option_id");69 $sql = $wpdb->get_var("SELECT optionvalue FROM $wpdb->optionvalues WHERE option_id = $option_result->option_id"); 70 70 if (!$sql) { 71 71 return $option_result->option_name . $editable; … … 101 101 102 102 function validate_option($option, $name, $val) { 103 global $wpdb , $tableoptionvalues;103 global $wpdb; 104 104 $msg = ''; 105 105 switch ($option->option_type) { 106 106 case 6: // range 107 107 // get range 108 $range = $wpdb->get_row("SELECT optionvalue_max, optionvalue_min FROM $ tableoptionvalues WHERE option_id = $option->option_id");108 $range = $wpdb->get_row("SELECT optionvalue_max, optionvalue_min FROM $wpdb->optionvalues WHERE option_id = $option->option_id"); 109 109 if ($range) { 110 110 if (($val < $range->optionvalue_min) || ($val > $range->optionvalue_max)) { -
trunk/wp-admin/options-head.php
r1272 r1355 7 7 //we need to iterate through the available option groups. 8 8 $groups = ''; 9 $option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $ tableoptiongroups ORDER BY group_id");9 $option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $wpdb->optiongroups ORDER BY group_id"); 10 10 foreach ($option_groups as $option_group) { 11 11 if ($option_group->group_id == $option_group_id) { -
trunk/wp-admin/options-writing.php
r1240 r1355 108 108 <td><select name="default_category" id="default_category"> 109 109 <?php 110 $categories = $wpdb->get_results("SELECT * FROM $ tablecategories ORDER BY cat_name");110 $categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name"); 111 111 foreach ($categories as $category) : 112 112 if ($category->cat_ID == get_settings('default_category')) $selected = " selected='selected'"; -
trunk/wp-admin/options.php
r1273 r1355 64 64 } 65 65 66 $options = $wpdb->get_results("SELECT $ tableoptions.option_id, option_name, option_type, option_value, option_admin_level FROM $tableoptions WHERE option_name IN ($option_names)");66 $options = $wpdb->get_results("SELECT $wpdb->options.option_id, option_name, option_type, option_value, option_admin_level FROM $wpdb->options WHERE option_name IN ($option_names)"); 67 67 // die(var_dump($options)); 68 68 … … 84 84 if( in_array($option->option_name, $nonbools) && $new_val == 0 ) $new_value = 'closed'; 85 85 if ($new_val !== $old_val) { 86 $query = "UPDATE $ tableoptions SET option_value = '$new_val' WHERE option_name = '$option->option_name'";86 $query = "UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'"; 87 87 $result = $wpdb->query($query); 88 88 //if( in_array($option->option_name, $nonbools)) die('boo'.$query); … … 131 131 <?php 132 132 //iterate through the available option groups. output them as a definition list. 133 $option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $ tableoptiongroups ORDER BY group_id");133 $option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $wpdb->optiongroups ORDER BY group_id"); 134 134 foreach ($option_groups as $option_group) { 135 135 echo(" <dt><a href=\"$this_file?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></dt>\n"); … … 160 160 //Now display all the options for the selected group. 161 161 if ('all' == $_GET['option_group_id']) : 162 $options = $wpdb->get_results("SELECT * FROM $ tableoptions LEFT JOIN $tableoptiongroup_options ON $tableoptions.option_id = $tableoptiongroup_options.option_id ORDER BY option_name");162 $options = $wpdb->get_results("SELECT * FROM $wpdb->options LEFT JOIN $wpdb->optiongroup_options ON $wpdb->options.option_id = $wpdb->optiongroup_options.option_id ORDER BY option_name"); 163 163 else : 164 164 $options = $wpdb->get_results(" 165 165 SELECT 166 $ tableoptions.option_id, option_name, option_type, option_value, option_width, option_height, option_description, option_admin_level167 FROM $ tableoptions LEFT JOIN $tableoptiongroup_options ON $tableoptions.option_id = $tableoptiongroup_options.option_id166 $wpdb->options.option_id, option_name, option_type, option_value, option_width, option_height, option_description, option_admin_level 167 FROM $wpdb->options LEFT JOIN $wpdb->optiongroup_options ON $wpdb->options.option_id = $wpdb->optiongroup_options.option_id 168 168 WHERE group_id = $option_group_id 169 169 ORDER BY seq -
trunk/wp-admin/post.php
r1352 r1355 109 109 110 110 if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) { 111 $postquery ="INSERT INTO $ tableposts111 $postquery ="INSERT INTO $wpdb->posts 112 112 (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt) 113 113 VALUES … … 115 115 "; 116 116 } else { 117 $postquery ="INSERT INTO $ tableposts117 $postquery ="INSERT INTO $wpdb->posts 118 118 (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt) 119 119 VALUES … … 124 124 $result = $wpdb->query($postquery); 125 125 126 $post_ID = $wpdb->get_var("SELECT ID FROM $ tableposts ORDER BY ID DESC LIMIT 1");126 $post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1"); 127 127 128 128 if (!empty($_POST['mode'])) { … … 152 152 foreach ($post_categories as $post_category) { 153 153 // Double check it's not there already 154 $exists = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");154 $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category"); 155 155 156 156 if (!$exists && $result) { 157 157 $wpdb->query(" 158 INSERT INTO $ tablepost2cat158 INSERT INTO $wpdb->post2cat 159 159 (post_id, category_id) 160 160 VALUES … … 182 182 183 183 // Time for trackbacks 184 $to_ping = $wpdb->get_var("SELECT to_ping FROM $ tableposts WHERE ID = $post_ID");185 $pinged = $wpdb->get_var("SELECT pinged FROM $ tableposts WHERE ID = $post_ID");184 $to_ping = $wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_ID"); 185 $pinged = $wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_ID"); 186 186 $pinged = explode("\n", $pinged); 187 187 if ('' != $to_ping) { … … 214 214 $post = $post_ID = $p = (int) $_GET['post']; 215 215 if ($user_level > 0) { 216 $postdata = $wpdb->get_row("SELECT * FROM $ tableposts WHERE ID = '$post_ID'");216 $postdata = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'"); 217 217 $authordata = get_userdata($postdata->post_author); 218 218 if ($user_level < $authordata->user_level) … … 236 236 include('edit-form-advanced.php'); 237 237 238 $post = $wpdb->get_row("SELECT * FROM $ tableposts WHERE ID = '$post_ID'");238 $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'"); 239 239 ?> 240 240 <div id='preview' class='wrap'> … … 344 344 345 345 $result = $wpdb->query(" 346 UPDATE $ tableposts SET346 UPDATE $wpdb->posts SET 347 347 post_content = '$content', 348 348 post_excerpt = '$excerpt', … … 365 365 // Now it's category time! 366 366 // First the old categories 367 $old_categories = $wpdb->get_col("SELECT category_id FROM $ tablepost2cat WHERE post_id = $post_ID");367 $old_categories = $wpdb->get_col("SELECT category_id FROM $wpdb->post2cat WHERE post_id = $post_ID"); 368 368 369 369 // Delete any? 370 370 foreach ($old_categories as $old_cat) { 371 371 if (!in_array($old_cat, $post_categories)) // If a category was there before but isn't now 372 $wpdb->query("DELETE FROM $ tablepost2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1");372 $wpdb->query("DELETE FROM $wpdb->post2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1"); 373 373 } 374 374 … … 376 376 foreach ($post_categories as $new_cat) { 377 377 if (!in_array($new_cat, $old_categories)) 378 $wpdb->query("INSERT INTO $ tablepost2cat (post_id, category_id) VALUES ($post_ID, $new_cat)");378 $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_ID, $new_cat)"); 379 379 } 380 380 … … 393 393 do_action('publish_post', $post_ID); 394 394 // Trackback time. 395 $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $ tableposts WHERE ID = $post_ID"));396 $pinged = trim($wpdb->get_var("SELECT pinged FROM $ tableposts WHERE ID = $post_ID"));395 $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_ID")); 396 $pinged = trim($wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_ID")); 397 397 $pinged = explode("\n", $pinged); 398 398 if ('' != $to_ping) { … … 450 450 451 451 // send geoURL ping to "erase" from their DB 452 $query = "SELECT post_lat from $ tableposts WHERE ID=$post_id";452 $query = "SELECT post_lat from $wpdb->posts WHERE ID=$post_id"; 453 453 $rows = $wpdb->query($query); 454 454 $myrow = $rows[0]; … … 458 458 } 459 459 460 $result = $wpdb->query("DELETE FROM $ tableposts WHERE ID=$post_id");460 $result = $wpdb->query("DELETE FROM $wpdb->posts WHERE ID=$post_id"); 461 461 if (!$result) 462 462 die(__('Error in deleting...')); 463 463 464 $result = $wpdb->query("DELETE FROM $ tablecomments WHERE comment_post_ID=$post_id");465 466 $categories = $wpdb->query("DELETE FROM $ tablepost2cat WHERE post_id = $post_id");464 $result = $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID=$post_id"); 465 466 $categories = $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $post_id"); 467 467 468 468 if (isset($sleep_after_edit) && $sleep_after_edit > 0) { … … 695 695 696 696 $result = $wpdb->query(" 697 UPDATE $ tablecomments SET697 UPDATE $wpdb->comments SET 698 698 comment_content = '$content', 699 699 comment_author = '$newcomment_author', … … 717 717 $action = 'post'; 718 718 get_currentuserinfo(); 719 $drafts = $wpdb->get_results("SELECT ID, post_title FROM $ tableposts WHERE post_status = 'draft' AND post_author = $user_ID");719 $drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID"); 720 720 if ($drafts) { 721 721 ?> -
trunk/wp-admin/profile.php
r1352 r1355 96 96 $user_description = addslashes(stripslashes($_POST['user_description'])); 97 97 98 $query = "UPDATE $ tableusers SET user_firstname='$newuser_firstname', $updatepassword user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode', user_description = '$user_description' WHERE ID = $user_ID";98 $query = "UPDATE $wpdb->users SET user_firstname='$newuser_firstname', $updatepassword user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode', user_description = '$user_description' WHERE ID = $user_ID"; 99 99 $result = $wpdb->query($query); 100 100 if (!$result) { -
trunk/wp-admin/upgrade-functions.php
r1325 r1355 76 76 77 77 function upgrade_071() { 78 global $ tableposts;79 maybe_add_column($ tableposts, 'post_status', "ALTER TABLE $tableposts ADD `post_status` ENUM('publish','draft','private') NOT NULL");80 maybe_add_column($ tableposts, 'comment_status', "ALTER TABLE $tableposts ADD `comment_status` ENUM('open','closed') NOT NULL");81 maybe_add_column($ tableposts, 'ping_status', "ALTER TABLE $tableposts ADD `ping_status` ENUM('open','closed') NOT NULL");82 maybe_add_column($ tableposts, 'post_password', "ALTER TABLE $tableposts ADD post_password varchar(20) NOT NULL");78 global $wpdb; 79 maybe_add_column($wpdb->posts, 'post_status', "ALTER TABLE $wpdb->posts ADD `post_status` ENUM('publish','draft','private') NOT NULL"); 80 maybe_add_column($wpdb->posts, 'comment_status', "ALTER TABLE $wpdb->posts ADD `comment_status` ENUM('open','closed') NOT NULL"); 81 maybe_add_column($wpdb->posts, 'ping_status', "ALTER TABLE $wpdb->posts ADD `ping_status` ENUM('open','closed') NOT NULL"); 82 maybe_add_column($wpdb->posts, 'post_password', "ALTER TABLE $wpdb->posts ADD post_password varchar(20) NOT NULL"); 83 83 } 84 84 85 85 function upgrade_072() { 86 global $wpdb , $tableposts, $tablelinks, $tablelinkcategories, $tableoptions, $tableoptiontypes, $tableoptiongroups, $tableoptiongroup_options, $tableoptionvalues, $tablecategories;87 maybe_add_column($ tablelinks, 'link_notes', "ALTER TABLE $tablelinks ADD COLUMN link_notes MEDIUMTEXT NOT NULL DEFAULT '' ");88 maybe_add_column($ tablelinkcategories, 'show_images', "ALTER TABLE $tablelinkcategories ADD COLUMN show_images enum('Y','N') NOT NULL default 'Y'");89 maybe_add_column($ tablelinkcategories, 'show_description', "ALTER TABLE $tablelinkcategories ADD COLUMN show_description enum('Y','N') NOT NULL default 'Y'");90 maybe_add_column($ tablelinkcategories, 'show_rating', "ALTER TABLE $tablelinkcategories ADD COLUMN show_rating enum('Y','N') NOT NULL default 'Y'");91 maybe_add_column($ tablelinkcategories, 'show_updated', "ALTER TABLE $tablelinkcategories ADD COLUMN show_updated enum('Y','N') NOT NULL default 'Y'");92 maybe_add_column($ tablelinkcategories, 'sort_order', "ALTER TABLE $tablelinkcategories ADD COLUMN sort_order varchar(64) NOT NULL default 'name'");93 maybe_add_column($ tablelinkcategories, 'sort_desc', "ALTER TABLE $tablelinkcategories ADD COLUMN sort_desc enum('Y','N') NOT NULL default 'N'");94 maybe_add_column($ tablelinkcategories, 'text_before_link', "ALTER TABLE $tablelinkcategories ADD COLUMN text_before_link varchar(128) not null default '<li>'");95 maybe_add_column($ tablelinkcategories, 'text_after_link', "ALTER TABLE $tablelinkcategories ADD COLUMN text_after_link varchar(128) not null default '<br />'");96 maybe_add_column($ tablelinkcategories, 'text_after_all', "ALTER TABLE $tablelinkcategories ADD COLUMN text_after_all varchar(128) not null default '</li>'");97 maybe_add_column($ tablelinkcategories, 'list_limit', "ALTER TABLE $tablelinkcategories ADD COLUMN list_limit int not null default -1");98 maybe_add_column($ tableposts, 'post_lon', "ALTER TABLE $tableposts ADD COLUMN post_lon float");99 maybe_add_column($ tableposts, 'post_lat', "ALTER TABLE $tableposts ADD COLUMN post_lat float ");100 maybe_create_table($ tableoptions, "101 CREATE TABLE $ tableoptions (86 global $wpdb; 87 maybe_add_column($wpdb->links, 'link_notes', "ALTER TABLE $wpdb->links ADD COLUMN link_notes MEDIUMTEXT NOT NULL DEFAULT '' "); 88 maybe_add_column($wpdb->links, 'show_images', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_images enum('Y','N') NOT NULL default 'Y'"); 89 maybe_add_column($wpdb->links, 'show_description', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_description enum('Y','N') NOT NULL default 'Y'"); 90 maybe_add_column($wpdb->links, 'show_rating', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_rating enum('Y','N') NOT NULL default 'Y'"); 91 maybe_add_column($wpdb->links, 'show_updated', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_updated enum('Y','N') NOT NULL default 'Y'"); 92 maybe_add_column($wpdb->links, 'sort_order', "ALTER TABLE $wpdb->linkcategories ADD COLUMN sort_order varchar(64) NOT NULL default 'name'"); 93 maybe_add_column($wpdb->linkcategories, 'sort_desc', "ALTER TABLE $wpdb->linkcategories ADD COLUMN sort_desc enum('Y','N') NOT NULL default 'N'"); 94 maybe_add_column($wpdb->linkcategories, 'text_before_link', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_before_link varchar(128) not null default '<li>'"); 95 maybe_add_column($wpdb->linkcategories, 'text_after_link', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_after_link varchar(128) not null default '<br />'"); 96 maybe_add_column($wpdb->linkcategories, 'text_after_all', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_after_all varchar(128) not null default '</li>'"); 97 maybe_add_column($wpdb->linkcategories, 'list_limit', "ALTER TABLE $wpdb->linkcategories ADD COLUMN list_limit int not null default -1"); 98 maybe_add_column($wpdb->posts, 'post_lon', "ALTER TABLE $wpdb->posts ADD COLUMN post_lon float"); 99 maybe_add_column($wpdb->posts, 'post_lat', "ALTER TABLE $wpdb->posts ADD COLUMN post_lat float "); 100 maybe_create_table($wpdb->options, " 101 CREATE TABLE $wpdb->options ( 102 102 option_id int(11) NOT NULL auto_increment, 103 103 blog_id int(11) NOT NULL default 0, … … 113 113 ) 114 114 "); 115 maybe_create_table($ tableoptiontypes, "116 CREATE TABLE $ tableoptiontypes (115 maybe_create_table($wpdb->optiontypes, " 116 CREATE TABLE $wpdb->optiontypes ( 117 117 optiontype_id int(11) NOT NULL auto_increment, 118 118 optiontype_name varchar(64) NOT NULL, … … 120 120 ) 121 121 "); 122 maybe_create_table($ tableoptiongroups, "123 CREATE TABLE $ tableoptiongroups (122 maybe_create_table($wpdb->optiongroups, " 123 CREATE TABLE $wpdb->optiongroups ( 124 124 group_id int(11) NOT NULL auto_increment, 125 125 group_name varchar(64) not null, … … 129 129 ) 130 130 "); 131 maybe_create_table($ tableoptiongroup_options, "132 CREATE TABLE $ tableoptiongroup_options (131 maybe_create_table($wpdb->optiongroup_options, " 132 CREATE TABLE $wpdb->optiongroup_options ( 133 133 group_id int(11) NOT NULL, 134 134 option_id int(11) NOT NULL, … … 137 137 ) 138 138 "); 139 maybe_create_table($ tableoptionvalues, "140 CREATE TABLE $ tableoptionvalues (139 maybe_create_table($wpdb->optionvalues, " 140 CREATE TABLE $wpdb->optionvalues ( 141 141 option_id int(11) NOT NULL, 142 142 optionvalue tinytext, … … 152 152 // TODO: REWRITE THIS 153 153 $option_types = array( 154 "1" => "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES ('1', 'integer')",155 "2" => "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES ('2', 'boolean')",156 "3" => "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES ('3', 'string')",157 "4" => "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES ('4', 'date')",158 "5" => "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES ('5', 'select')",159 "6" => "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES ('6', 'range')",160 "7" => "INSERT INTO $ tableoptiontypes (optiontype_id, optiontype_name) VALUES ('7', 'sqlselect')");154 "1" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('1', 'integer')", 155 "2" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('2', 'boolean')", 156 "3" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('3', 'string')", 157 "4" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('4', 'date')", 158 "5" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('5', 'select')", 159 "6" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('6', 'range')", 160 "7" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('7', 'sqlselect')"); 161 161 162 162 foreach ($option_types as $option_id => $query) { 163 if(!$wpdb->get_var("SELECT * FROM $ tableoptiontypes WHERE optiontype_id = '$option_id'")) {163 if(!$wpdb->get_var("SELECT * FROM $wpdb->optiontypes WHERE optiontype_id = '$option_id'")) { 164 164 $wpdb->query($query); 165 165 } … … 169 169 $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $HTTP_HOST . $REQUEST_URI); 170 170 $option_data = array( //base options from b2cofig 171 "1" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (1,'siteurl', 3, '$guessurl', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\'', 8, 30)",172 "2" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)",173 "3" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (3,'blogname', 3, 'my weblog', 'blogname is the name of your blog', 8, 20)",174 "4" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (4,'blogdescription', 3, 'babblings!', 'blogdescription is the description of your blog', 8, 40)",175 //"INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (6,'search_engine_friendly_urls', 2, '0', 'Querystring Configuration ** (don\'t change if you don\'t know what you\'re doing)', 8, 20)",176 "7" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (7,'new_users_can_blog', 2, '0', 'whether you want new users to be able to post entries once they have registered', 8, 20)",177 "8" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (8,'users_can_register', 2, '1', 'whether you want to allow users to register on your blog', 8, 20)",178 "54" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (54,'admin_email', 3, 'you@example.com', 'Your email (obvious eh?)', 8, 20)",171 "1" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (1,'siteurl', 3, '$guessurl', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\'', 8, 30)", 172 "2" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)", 173 "3" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (3,'blogname', 3, 'my weblog', 'blogname is the name of your blog', 8, 20)", 174 "4" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (4,'blogdescription', 3, 'babblings!', 'blogdescription is the description of your blog', 8, 40)", 175 //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (6,'search_engine_friendly_urls', 2, '0', 'Querystring Configuration ** (don\'t change if you don\'t know what you\'re doing)', 8, 20)", 176 "7" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (7,'new_users_can_blog', 2, '0', 'whether you want new users to be able to post entries once they have registered', 8, 20)", 177 "8" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (8,'users_can_register', 2, '1', 'whether you want to allow users to register on your blog', 8, 20)", 178 "54" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (54,'admin_email', 3, 'you@example.com', 'Your email (obvious eh?)', 8, 20)", 179 179 // general blog setup 180 "9" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (9 ,'start_of_week', 5, '1', 'day at the start of the week', 8, 20)",181 //"INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (10,'use_preview', 2, '1', 'Do you want to use the \'preview\' function', 8, 20)",182 "14" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (14,'use_htmltrans', 2, '1', 'IMPORTANT! set this to false if you are using Chinese, Japanese, Korean, or other double-bytes languages', 8, 20)",183 "15" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (15,'use_balanceTags', 2, '1', 'this could help balance your HTML code. if it gives bad results, set it to false', 8, 20)",184 "16" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (16,'use_smilies', 2, '1', 'set this to true to enable smiley conversion in posts (note: this makes smiley conversion in ALL posts)', 8, 20)",185 "17" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (17,'smilies_directory', 3, 'http://example.com/wp-images/smilies', 'the directory where your smilies are (no trailing slash)', 8, 40)",186 "18" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (18,'require_name_email', 2, '0', 'set this to true to require e-mail and name, or false to allow comments without e-mail/name', 8, 20)",187 "20" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (20,'comments_notify', 2, '1', 'set this to true to let every author be notified about comments on their posts', 8, 20)",180 "9" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (9 ,'start_of_week', 5, '1', 'day at the start of the week', 8, 20)", 181 //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (10,'use_preview', 2, '1', 'Do you want to use the \'preview\' function', 8, 20)", 182 "14" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (14,'use_htmltrans', 2, '1', 'IMPORTANT! set this to false if you are using Chinese, Japanese, Korean, or other double-bytes languages', 8, 20)", 183 "15" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (15,'use_balanceTags', 2, '1', 'this could help balance your HTML code. if it gives bad results, set it to false', 8, 20)", 184 "16" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (16,'use_smilies', 2, '1', 'set this to true to enable smiley conversion in posts (note: this makes smiley conversion in ALL posts)', 8, 20)", 185 "17" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (17,'smilies_directory', 3, 'http://example.com/wp-images/smilies', 'the directory where your smilies are (no trailing slash)', 8, 40)", 186 "18" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (18,'require_name_email', 2, '0', 'set this to true to require e-mail and name, or false to allow comments without e-mail/name', 8, 20)", 187 "20" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (20,'comments_notify', 2, '1', 'set this to true to let every author be notified about comments on their posts', 8, 20)", 188 188 //rss/rdf feeds 189 "21" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (21,'posts_per_rss', 1, '10', 'number of last posts to syndicate', 8, 20)",190 "22" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (22,'rss_language', 3, 'en', 'the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )', 8, 20)",191 "23" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (23,'rss_encoded_html', 2, '0', 'for b2rss.php: allow encoded HTML in <description> tag?', 8, 20)",192 "24" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (24,'rss_excerpt_length', 1, '50', 'length (in words) of excerpts in the RSS feed? 0=unlimited note: in b2rss.php, this will be set to 0 if you use encoded HTML', 8, 20)",193 "25" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (25,'rss_use_excerpt', 2, '1', 'use the excerpt field for rss feed.', 8, 20)",194 "29" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (29,'use_trackback', 2, '1', 'set this to false or true, whether you want to allow your posts to be trackback\'able or not note: setting it to false would also disable sending trackbacks', 8, 20)",195 "30" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (30,'use_pingback', 2, '1', 'set this to false or true, whether you want to allow your posts to be pingback\'able or not note: setting it to false would also disable sending pingbacks', 8, 20)",189 "21" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (21,'posts_per_rss', 1, '10', 'number of last posts to syndicate', 8, 20)", 190 "22" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (22,'rss_language', 3, 'en', 'the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )', 8, 20)", 191 "23" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (23,'rss_encoded_html', 2, '0', 'for b2rss.php: allow encoded HTML in <description> tag?', 8, 20)", 192 "24" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (24,'rss_excerpt_length', 1, '50', 'length (in words) of excerpts in the RSS feed? 0=unlimited note: in b2rss.php, this will be set to 0 if you use encoded HTML', 8, 20)", 193 "25" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (25,'rss_use_excerpt', 2, '1', 'use the excerpt field for rss feed.', 8, 20)", 194 "29" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (29,'use_trackback', 2, '1', 'set this to false or true, whether you want to allow your posts to be trackback\'able or not note: setting it to false would also disable sending trackbacks', 8, 20)", 195 "30" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (30,'use_pingback', 2, '1', 'set this to false or true, whether you want to allow your posts to be pingback\'able or not note: setting it to false would also disable sending pingbacks', 8, 20)", 196 196 //file upload 197 "31" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (31,'use_fileupload', 2, '0', 'set this to false to disable file upload, or true to enable it', 8, 20)",198 "32" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (32,'fileupload_realpath', 3, '/home/your/site/wordpress/images', 'enter the real path of the directory where you\'ll upload the pictures \nif you\'re unsure about what your real path is, please ask your host\'s support staff \nnote that the directory must be writable by the webserver (chmod 766) \nnote for windows-servers users: use forwardslashes instead of backslashes', 8, 40)",199 "33" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (33,'fileupload_url', 3, 'http://example.com/images', 'enter the URL of that directory (it\'s used to generate the links to the uploded files)', 8, 40)",200 "34" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (34,'fileupload_allowedtypes', 3, ' jpg gif png ', 'accepted file types, separated by spaces. example: \'jpg gif png\'', 8, 20)",201 "35" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (35,'fileupload_maxk', 1, '96', 'by default, most servers limit the size of uploads to 2048 KB, if you want to set it to a lower value, here it is (you cannot set a higher value than your server limit)', 8, 20)",202 "36" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (36,'fileupload_minlevel', 1, '1', 'you may not want all users to upload pictures/files, so you can set a minimum level for this', 8, 20)",203 "37" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (37,'fileupload_allowedusers', 3, '', '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'', 8, 30)",197 "31" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (31,'use_fileupload', 2, '0', 'set this to false to disable file upload, or true to enable it', 8, 20)", 198 "32" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (32,'fileupload_realpath', 3, '/home/your/site/wordpress/images', 'enter the real path of the directory where you\'ll upload the pictures \nif you\'re unsure about what your real path is, please ask your host\'s support staff \nnote that the directory must be writable by the webserver (chmod 766) \nnote for windows-servers users: use forwardslashes instead of backslashes', 8, 40)", 199 "33" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (33,'fileupload_url', 3, 'http://example.com/images', 'enter the URL of that directory (it\'s used to generate the links to the uploded files)', 8, 40)", 200 "34" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (34,'fileupload_allowedtypes', 3, ' jpg gif png ', 'accepted file types, separated by spaces. example: \'jpg gif png\'', 8, 20)", 201 "35" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (35,'fileupload_maxk', 1, '96', 'by default, most servers limit the size of uploads to 2048 KB, if you want to set it to a lower value, here it is (you cannot set a higher value than your server limit)', 8, 20)", 202 "36" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (36,'fileupload_minlevel', 1, '1', 'you may not want all users to upload pictures/files, so you can set a minimum level for this', 8, 20)", 203 "37" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (37,'fileupload_allowedusers', 3, '', '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'', 8, 30)", 204 204 // email settings 205 "38" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (38,'mailserver_url', 3, 'mail.example.com', 'mailserver settings', 8, 20)",206 "39" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (39,'mailserver_login', 3, 'login@example.com', 'mailserver settings', 8, 20)",207 "40" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (40,'mailserver_pass', 3, 'password', 'mailserver settings', 8, 20)",208 "41" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (41,'mailserver_port', 1, '110', 'mailserver settings', 8, 20)",209 "42" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (42,'default_category', 1, '1', 'by default posts will have this category', 8, 20)",210 "46" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (46,'use_phoneemail', 2, '0', 'some mobile phone email services will send identical subject & content on the same line if you use such a service, set use_phoneemail to true, and indicate a separator string', 8, 20)",205 "38" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (38,'mailserver_url', 3, 'mail.example.com', 'mailserver settings', 8, 20)", 206 "39" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (39,'mailserver_login', 3, 'login@example.com', 'mailserver settings', 8, 20)", 207 "40" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (40,'mailserver_pass', 3, 'password', 'mailserver settings', 8, 20)", 208 "41" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (41,'mailserver_port', 1, '110', 'mailserver settings', 8, 20)", 209 "42" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (42,'default_category', 1, '1', 'by default posts will have this category', 8, 20)", 210 "46" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (46,'use_phoneemail', 2, '0', 'some mobile phone email services will send identical subject & content on the same line if you use such a service, set use_phoneemail to true, and indicate a separator string', 8, 20)", 211 211 212 212 // default post stuff 213 213 214 "55" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(55,'default_post_status', 5, 'publish', 'The default state of each new post', 8, 20)",215 "56" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(56,'default_comment_status', 5, 'open', 'The default state of comments for each new post', 8, 20)",216 "57" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(57,'default_ping_status', 5, 'open', 'The default ping state for each new post', 8, 20)",217 "58" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(58,'default_pingback_flag', 5, '1', 'Whether the \'PingBack the URLs in this post\' checkbox should be checked by default', 8, 20)",218 "59" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(59,'default_post_category', 7, '1', 'The default category for each new post', 8, 20)",219 "83" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(83,'default_post_edit_rows', 1, '9', 'The number of rows in the edit post form (min 3, max 100)', 8, 5)",214 "55" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(55,'default_post_status', 5, 'publish', 'The default state of each new post', 8, 20)", 215 "56" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(56,'default_comment_status', 5, 'open', 'The default state of comments for each new post', 8, 20)", 216 "57" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(57,'default_ping_status', 5, 'open', 'The default ping state for each new post', 8, 20)", 217 "58" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(58,'default_pingback_flag', 5, '1', 'Whether the \'PingBack the URLs in this post\' checkbox should be checked by default', 8, 20)", 218 "59" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(59,'default_post_category', 7, '1', 'The default category for each new post', 8, 20)", 219 "83" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(83,'default_post_edit_rows', 1, '9', 'The number of rows in the edit post form (min 3, max 100)', 8, 5)", 220 220 221 221 // original options from options page 222 "48" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (48,'posts_per_page', 1, '20','How many posts/days to show on the index page.', 4, 20)",223 "49" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (49,'what_to_show', 5, 'posts','Posts, days, or posts paged', 4, 20)",224 "50" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (50,'archive_mode', 5, 'monthly','Which \'unit\' to use for archives.', 4, 20)",225 "51" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (51,'time_difference', 6, '0', 'if you\'re not on the timezone of your server', 4, 20)",226 "52" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (52,'date_format', 3, 'n/j/Y', 'see note for format characters', 4, 20)",227 "53" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (53,'time_format', 3, 'g:i a', 'see note for format characters', 4, 20)", "INSERT INTO $tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (84,'use_geo_positions', 2, '0', 'Turns on the geo url features of WordPress', 8, 20)",228 "85" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (85,'use_default_geourl', 2, '1','enables placement of default GeoURL ICBM location even when no other specified', 8, 20)",229 "86" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (86,'default_geourl_lat ', 8, 0.0, 'The default Latitude ICBM value - <a href=\"http://www.geourl.org/resources.html\" target=\"_blank\">see here</a>', 8, 20)",230 "87" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (87,'default_geourl_lon', 8, 0.0, 'The default Longitude ICBM value', 8, 20)",231 "60" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (60,'links_minadminlevel', 1, '5', 'The minimum admin level to edit links', 8, 10)",232 "61" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (61,'links_use_adminlevels', 2, '1', 'set this to false to have all links visible and editable to everyone in the link manager', 8, 20)",233 "62" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (62,'links_rating_type', 5, 'image', 'Set this to the type of rating indication you wish to use', 8, 10)",234 "63" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (63,'links_rating_char', 3, '*', 'If we are set to \'char\' which char to use.', 8, 5)",235 "64" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (64,'links_rating_ignore_zero', 2, '1', 'What do we do with a value of zero? set this to true to output nothing, 0 to output as normal (number/image)', 8, 20)",236 "65" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (65,'links_rating_single_image', 2, '1', 'Use the same image for each rating point? (Uses links_rating_image[0])', 8, 20)",237 "66" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (66,'links_rating_image0', 3, 'wp-links/links-images/tick.png', 'Image for rating 0 (and for single image)', 8, 40)",238 "67" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (67,'links_rating_image1', 3, 'wp-links/links-images/rating-1.gif', 'Image for rating 1', 8, 40)",239 "68" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (68,'links_rating_image2', 3, 'wp-links/links-images/rating-2.gif', 'Image for rating 2', 8, 40)",240 "69" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (69,'links_rating_image3', 3, 'wp-links/links-images/rating-3.gif', 'Image for rating 3', 8, 40)",241 "70" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (70,'links_rating_image4', 3, 'wp-links/links-images/rating-4.gif', 'Image for rating 4', 8, 40)",242 "71" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (71,'links_rating_image5', 3, 'wp-links/links-images/rating-5.gif', 'Image for rating 5', 8, 40)",243 "72" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (72,'links_rating_image6', 3, 'wp-links/links-images/rating-6.gif', 'Image for rating 6', 8, 40)",244 "73" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (73,'links_rating_image7', 3, 'wp-links/links-images/rating-7.gif', 'Image for rating 7', 8, 40)",245 "74" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (74,'links_rating_image8', 3, 'wp-links/links-images/rating-8.gif', 'Image for rating 8', 8, 40)",246 "75" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (75,'links_rating_image9', 3, 'wp-links/links-images/rating-9.gif', 'Image for rating 9', 8, 40)",247 "77" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (77,'weblogs_xml_url', 3, 'http://www.weblogs.com/changes.xml', 'Which file to grab from weblogs.com', 8, 40)",248 "78" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (78,'weblogs_cacheminutes', 1, '60', 'cache time in minutes (if it is older than this get a new copy)', 8, 10)",249 "79" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (79,'links_updated_date_format', 3, 'd/m/Y h:i', 'The date format for the updated tooltip', 8, 25)",250 "80" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (80,'links_recently_updated_prepend', 3, '>>', 'The text to prepend to a recently updated link', 8, 10)",251 "81" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (81,'links_recently_updated_append', 3, '<<', 'The text to append to a recently updated link', 8, 20)",252 "82" => "INSERT INTO $ tableoptions (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (82,'links_recently_updated_time', 1, '120', 'The time in minutes to consider a link recently updated', 8, 20)"222 "48" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (48,'posts_per_page', 1, '20','How many posts/days to show on the index page.', 4, 20)", 223 "49" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (49,'what_to_show', 5, 'posts','Posts, days, or posts paged', 4, 20)", 224 "50" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (50,'archive_mode', 5, 'monthly','Which \'unit\' to use for archives.', 4, 20)", 225 "51" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (51,'time_difference', 6, '0', 'if you\'re not on the timezone of your server', 4, 20)", 226 "52" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (52,'date_format', 3, 'n/j/Y', 'see note for format characters', 4, 20)", 227 "53" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (53,'time_format', 3, 'g:i a', 'see note for format characters', 4, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (84,'use_geo_positions', 2, '0', 'Turns on the geo url features of WordPress', 8, 20)", 228 "85" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (85,'use_default_geourl', 2, '1','enables placement of default GeoURL ICBM location even when no other specified', 8, 20)", 229 "86" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (86,'default_geourl_lat ', 8, 0.0, 'The default Latitude ICBM value - <a href=\"http://www.geourl.org/resources.html\" target=\"_blank\">see here</a>', 8, 20)", 230 "87" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (87,'default_geourl_lon', 8, 0.0, 'The default Longitude ICBM value', 8, 20)", 231 "60" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (60,'links_minadminlevel', 1, '5', 'The minimum admin level to edit links', 8, 10)", 232 "61" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (61,'links_use_adminlevels', 2, '1', 'set this to false to have all links visible and editable to everyone in the link manager', 8, 20)", 233 "62" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (62,'links_rating_type', 5, 'image', 'Set this to the type of rating indication you wish to use', 8, 10)", 234 "63" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (63,'links_rating_char', 3, '*', 'If we are set to \'char\' which char to use.', 8, 5)", 235 "64" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (64,'links_rating_ignore_zero', 2, '1', 'What do we do with a value of zero? set this to true to output nothing, 0 to output as normal (number/image)', 8, 20)", 236 "65" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (65,'links_rating_single_image', 2, '1', 'Use the same image for each rating point? (Uses links_rating_image[0])', 8, 20)", 237 "66" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (66,'links_rating_image0', 3, 'wp-links/links-images/tick.png', 'Image for rating 0 (and for single image)', 8, 40)", 238 "67" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (67,'links_rating_image1', 3, 'wp-links/links-images/rating-1.gif', 'Image for rating 1', 8, 40)", 239 "68" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (68,'links_rating_image2', 3, 'wp-links/links-images/rating-2.gif', 'Image for rating 2', 8, 40)", 240 "69" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (69,'links_rating_image3', 3, 'wp-links/links-images/rating-3.gif', 'Image for rating 3', 8, 40)", 241 "70" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (70,'links_rating_image4', 3, 'wp-links/links-images/rating-4.gif', 'Image for rating 4', 8, 40)", 242 "71" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (71,'links_rating_image5', 3, 'wp-links/links-images/rating-5.gif', 'Image for rating 5', 8, 40)", 243 "72" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (72,'links_rating_image6', 3, 'wp-links/links-images/rating-6.gif', 'Image for rating 6', 8, 40)", 244 "73" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (73,'links_rating_image7', 3, 'wp-links/links-images/rating-7.gif', 'Image for rating 7', 8, 40)", 245 "74" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (74,'links_rating_image8', 3, 'wp-links/links-images/rating-8.gif', 'Image for rating 8', 8, 40)", 246 "75" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (75,'links_rating_image9', 3, 'wp-links/links-images/rating-9.gif', 'Image for rating 9', 8, 40)", 247 "77" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (77,'weblogs_xml_url', 3, 'http://www.weblogs.com/changes.xml', 'Which file to grab from weblogs.com', 8, 40)", 248 "78" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (78,'weblogs_cacheminutes', 1, '60', 'cache time in minutes (if it is older than this get a new copy)', 8, 10)", 249 "79" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (79,'links_updated_date_format', 3, 'd/m/Y h:i', 'The date format for the updated tooltip', 8, 25)", 250 "80" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (80,'links_recently_updated_prepend', 3, '>>', 'The text to prepend to a recently updated link', 8, 10)", 251 "81" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (81,'links_recently_updated_append', 3, '<<', 'The text to append to a recently updated link', 8, 20)", 252 "82" => "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES (82,'links_recently_updated_time', 1, '120', 'The time in minutes to consider a link recently updated', 8, 20)" 253 253 ); 254 254 255 255 foreach ($option_data as $option_id => $query) { 256 if(!$wpdb->get_var("SELECT * FROM $ tableoptions WHERE option_id = '$option_id'")) {256 if(!$wpdb->get_var("SELECT * FROM $wpdb->options WHERE option_id = '$option_id'")) { 257 257 $wpdb->query($query); 258 258 } … … 260 260 261 261 $option_groups = array( 262 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (1, 'Other Options', 'Posts per page etc. Original options page')",263 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (2, 'General blog settings', 'Things you\'ll probably want to tweak')",264 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (3, 'RSS/RDF Feeds, Track/Ping-backs', 'Settings for RSS/RDF Feeds, Track/ping-backs')",265 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (4, 'File uploads', 'Settings for file uploads')",266 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (5, 'Blog-by-Email settings', 'Settings for blogging via email')",267 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (6, 'Base settings', 'Basic settings required to get your blog working')",268 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (7, 'Default post options', 'Default settings for new posts.')",269 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (8, 'Link Manager Settings', 'Various settings for the link manager.')",270 "INSERT INTO $ tableoptiongroups (group_id, group_name, group_desc) VALUES (9, 'Geo Options', 'Settings which control the posting and display of Geo Options')");262 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (1, 'Other Options', 'Posts per page etc. Original options page')", 263 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (2, 'General blog settings', 'Things you\'ll probably want to tweak')", 264 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (3, 'RSS/RDF Feeds, Track/Ping-backs', 'Settings for RSS/RDF Feeds, Track/ping-backs')", 265 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (4, 'File uploads', 'Settings for file uploads')", 266 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (5, 'Blog-by-Email settings', 'Settings for blogging via email')", 267 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (6, 'Base settings', 'Basic settings required to get your blog working')", 268 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (7, 'Default post options', 'Default settings for new posts.')", 269 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (8, 'Link Manager Settings', 'Various settings for the link manager.')", 270 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (9, 'Geo Options', 'Settings which control the posting and display of Geo Options')"); 271 271 272 272 foreach ($option_groups as $query) { 273 273 $option_id = preg_match('|VALUES \(([0-9]+)|', $query, $matches); 274 274 $option_id = $matches[1]; 275 if(!$wpdb->get_var("SELECT * FROM $ tableoptiongroups WHERE group_id = '$option_id'")) {275 if(!$wpdb->get_var("SELECT * FROM $wpdb->optiongroups WHERE group_id = '$option_id'")) { 276 276 $wpdb->query($query); 277 277 } 278 278 } 279 279 280 $optiongroup_options = array ( "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (1,48,1 )",281 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (1,49,2 )",282 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (1,50,3 )",283 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (1,51,4 )",284 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (1,52,5 )",285 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (1,53,6 )",286 287 288 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,9 ,1 )",289 //"INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,10,2 )",290 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,11,3 )",291 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,12,4 )",292 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,13,5 )",293 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,14,6 )",294 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,15,7 )",295 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,16,8 )",296 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,17,9 )",297 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,18,10)",298 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,19,11)",299 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (2,20,12)",300 301 302 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,21,1 )",303 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,22,2 )",304 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,23,3 )",305 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,24,4 )",306 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,25,5 )",307 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,26,6 )",308 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,27,7 )",309 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,28,8 )",310 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,29,9 )",311 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (3,30,10)",312 313 314 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (4,31,1 )",315 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (4,32,2 )",316 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (4,33,3 )",317 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (4,34,4 )",318 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (4,35,5 )",319 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (4,36,6 )",320 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (4,37,7 )",321 322 323 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,38,1 )",324 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,39,2 )",325 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,40,3 )",326 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,41,4 )",327 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,42,5 )",328 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,43,6 )",329 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,44,7 )",330 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,45,8 )",331 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,46,9 )",332 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (5,47,10)",333 334 335 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (6,1,1)",336 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (6,2,2)",337 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (6,3,3)",338 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (6,4,4)",339 //"INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (6,6,5)",340 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (6,7,6)",341 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (6,8,7)",342 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (6,54,8)",343 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (7,55,1 )",344 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (7,56,2 )",345 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (7,57,3 )",346 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (7,58,4 )",347 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (7,59,5 )",348 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (7,83,5 )",349 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,60,1 )",350 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,61,2 )",351 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,62,3 )",352 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,63,4 )",353 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,64,5 )",354 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,65,6 )",355 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,66,7 )",356 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,67,8 )",357 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,68,9 )",358 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,69,10)",359 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,70,11)",360 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,71,12)",361 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,72,13)",362 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,73,14)",363 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,74,15)",364 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,75,16)",365 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,76,17)",366 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,77,18)",367 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,78,19)",368 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,79,20)",369 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,80,21)",370 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,81,22)",371 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (8,82,23)",372 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (9,84,1)",373 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (9,85,1)",374 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (9,86,1)",375 "INSERT INTO $ tableoptiongroup_options (group_id, option_id, seq) VALUES (9,87,1)",280 $optiongroup_options = array ( "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (1,48,1 )", 281 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (1,49,2 )", 282 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (1,50,3 )", 283 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (1,51,4 )", 284 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (1,52,5 )", 285 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (1,53,6 )", 286 287 288 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,9 ,1 )", 289 //"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,10,2 )", 290 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,11,3 )", 291 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,12,4 )", 292 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,13,5 )", 293 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,14,6 )", 294 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,15,7 )", 295 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,16,8 )", 296 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,17,9 )", 297 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,18,10)", 298 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,19,11)", 299 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (2,20,12)", 300 301 302 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,21,1 )", 303 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,22,2 )", 304 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,23,3 )", 305 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,24,4 )", 306 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,25,5 )", 307 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,26,6 )", 308 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,27,7 )", 309 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,28,8 )", 310 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,29,9 )", 311 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (3,30,10)", 312 313 314 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (4,31,1 )", 315 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (4,32,2 )", 316 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (4,33,3 )", 317 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (4,34,4 )", 318 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (4,35,5 )", 319 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (4,36,6 )", 320 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (4,37,7 )", 321 322 323 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,38,1 )", 324 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,39,2 )", 325 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,40,3 )", 326 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,41,4 )", 327 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,42,5 )", 328 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,43,6 )", 329 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,44,7 )", 330 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,45,8 )", 331 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,46,9 )", 332 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (5,47,10)", 333 334 335 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (6,1,1)", 336 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (6,2,2)", 337 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (6,3,3)", 338 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (6,4,4)", 339 //"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (6,6,5)", 340 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (6,7,6)", 341 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (6,8,7)", 342 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (6,54,8)", 343 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (7,55,1 )", 344 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (7,56,2 )", 345 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (7,57,3 )", 346 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (7,58,4 )", 347 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (7,59,5 )", 348 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (7,83,5 )", 349 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,60,1 )", 350 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,61,2 )", 351 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,62,3 )", 352 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,63,4 )", 353 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,64,5 )", 354 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,65,6 )", 355 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,66,7 )", 356 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,67,8 )", 357 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,68,9 )", 358 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,69,10)", 359 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,70,11)", 360 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,71,12)", 361 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,72,13)", 362 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,73,14)", 363 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,74,15)", 364 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,75,16)", 365 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,76,17)", 366 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,77,18)", 367 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,78,19)", 368 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,79,20)", 369 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,80,21)", 370 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,81,22)", 371 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (8,82,23)", 372 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (9,84,1)", 373 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (9,85,1)", 374 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (9,86,1)", 375 "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (9,87,1)", 376 376 ); 377 377 … … 379 379 preg_match('|VALUES \([0-9]+,([0-9]+)|', $query, $matches); 380 380 $option_id = $matches[1]; 381 if(!$wpdb->get_var("SELECT * FROM $ tableoptiongroup_options WHERE option_id = '$option_id'")) {381 if(!$wpdb->get_var("SELECT * FROM $wpdb->optiongroup_options WHERE option_id = '$option_id'")) { 382 382 $wpdb->query($query); 383 383 } … … 386 386 $option_values = array( 387 387 // select data for what to show 388 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'days', 'days', null,null,1)",389 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'posts', 'posts', null,null,2)",390 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'paged', 'posts paged', null,null,3)",388 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'days', 'days', null,null,1)", 389 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'posts', 'posts', null,null,2)", 390 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'paged', 'posts paged', null,null,3)", 391 391 // select data for archive mode 392 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'daily', 'daily', null,null,1)",393 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'weekly', 'weekly', null,null,2)",394 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'monthly', 'monthly', null,null,3)",395 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'postbypost','post by post',null,null,4)",392 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'daily', 'daily', null,null,1)", 393 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'weekly', 'weekly', null,null,2)", 394 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'monthly', 'monthly', null,null,3)", 395 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'postbypost','post by post',null,null,4)", 396 396 // select data for time diff 397 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (51, 'hours', 'hours', 23, -23, null)",397 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (51, 'hours', 'hours', 23, -23, null)", 398 398 // select data for start of week 399 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '0', 'Sunday', null,null,1)",400 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '1', 'Monday', null,null,2)",401 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '6', 'Saturday', null,null,3)",399 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '0', 'Sunday', null,null,1)", 400 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '1', 'Monday', null,null,2)", 401 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '6', 'Saturday', null,null,3)", 402 402 403 403 … … 408 408 // default_ping_status select one of open closed 409 409 // default_pingback_flag select one of checked unchecked 410 // default_post_category sql_select "SELECT cat_id AS value, cat_name AS label FROM $ tablecategories order by cat_name"410 // default_post_category sql_select "SELECT cat_id AS value, cat_name AS label FROM $wpdb->categories order by cat_name" 411 411 412 412 … … 414 414 415 415 // select data for post_status 416 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'publish', 'Publish', null,null,1)",417 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'draft', 'Draft', null,null,2)",418 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'private', 'Private', null,null,3)",416 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'publish', 'Publish', null,null,1)", 417 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'draft', 'Draft', null,null,2)", 418 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'private', 'Private', null,null,3)", 419 419 420 420 // select data for comment_status 421 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'open', 'Open', null,null,1)",422 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'closed', 'Closed', null,null,2)",421 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'open', 'Open', null,null,1)", 422 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'closed', 'Closed', null,null,2)", 423 423 424 424 // select data for ping_status (aargh duplication!) 425 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'open', 'Open', null,null,1)",426 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'closed', 'Closed', null,null,2)",425 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'open', 'Open', null,null,1)", 426 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'closed', 'Closed', null,null,2)", 427 427 428 428 // select data for pingback flag 429 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '1', 'Checked', null,null,1)",430 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '0', 'Unchecked', null,null,2)",429 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '1', 'Checked', null,null,1)", 430 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '0', 'Unchecked', null,null,2)", 431 431 432 432 // sql select data for default 433 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (59, 'SELECT cat_id AS value, cat_name AS label FROM $tablecategories order by cat_name', '', null,null,1)",434 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'number', 'Number', null,null,1)",435 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'char', 'Character', null,null,2)",436 "INSERT INTO $ tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'image', 'Image', null,null,3)"433 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (59, 'SELECT cat_id AS value, cat_name AS label FROM $wpdb->categories order by cat_name', '', null,null,1)", 434 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'number', 'Number', null,null,1)", 435 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'char', 'Character', null,null,2)", 436 "INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'image', 'Image', null,null,3)" 437 437 ); 438 438 … … 441 441 $option_id = $matches[1]; 442 442 $value = $matches[2]; 443 if(!$wpdb->get_var("SELECT * FROM $ tableoptionvalues WHERE option_id = '$option_id' AND optionvalue = '$value'")) {443 if(!$wpdb->get_var("SELECT * FROM $wpdb->optionvalues WHERE option_id = '$option_id' AND optionvalue = '$value'")) { 444 444 $wpdb->query($query); 445 445 } … … 451 451 452 452 // now update the database with those settings 453 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_minadminlevel )."' WHERE option_id=60"; $q = $wpdb->query($query);454 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_use_adminlevels )."' WHERE option_id=61"; $q = $wpdb->query($query);455 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_type )."' WHERE option_id=62"; $q = $wpdb->query($query);456 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_char )."' WHERE option_id=63"; $q = $wpdb->query($query);457 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_ignore_zero )."' WHERE option_id=64"; $q = $wpdb->query($query);458 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_single_image )."' WHERE option_id=65"; $q = $wpdb->query($query);459 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image0 )."' WHERE option_id=66"; $q = $wpdb->query($query);460 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image1 )."' WHERE option_id=67"; $q = $wpdb->query($query);461 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image2 )."' WHERE option_id=68"; $q = $wpdb->query($query);462 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image3 )."' WHERE option_id=69"; $q = $wpdb->query($query);463 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image4 )."' WHERE option_id=70"; $q = $wpdb->query($query);464 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image5 )."' WHERE option_id=71"; $q = $wpdb->query($query);465 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image6 )."' WHERE option_id=72"; $q = $wpdb->query($query);466 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image7 )."' WHERE option_id=73"; $q = $wpdb->query($query);467 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image8 )."' WHERE option_id=74"; $q = $wpdb->query($query);468 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_rating_image9 )."' WHERE option_id=75"; $q = $wpdb->query($query);469 $query = "UPDATE $ tableoptions SET option_value='".addslashes($weblogs_cache_file )."' WHERE option_id=76"; $q = $wpdb->query($query);470 $query = "UPDATE $ tableoptions SET option_value='".addslashes($weblogs_xml_url )."' WHERE option_id=77"; $q = $wpdb->query($query);471 $query = "UPDATE $ tableoptions SET option_value='".addslashes($weblogs_cacheminutes )."' WHERE option_id=78"; $q = $wpdb->query($query);472 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_updated_date_format )."' WHERE option_id=79"; $q = $wpdb->query($query);473 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_recently_updated_prepend)."' WHERE option_id=80"; $q = $wpdb->query($query);474 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_recently_updated_append )."' WHERE option_id=81"; $q = $wpdb->query($query);475 $query = "UPDATE $ tableoptions SET option_value='".addslashes($links_recently_updated_time )."' WHERE option_id=82"; $q = $wpdb->query($query);453 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_minadminlevel )."' WHERE option_id=60"; $q = $wpdb->query($query); 454 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_use_adminlevels )."' WHERE option_id=61"; $q = $wpdb->query($query); 455 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_type )."' WHERE option_id=62"; $q = $wpdb->query($query); 456 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_char )."' WHERE option_id=63"; $q = $wpdb->query($query); 457 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_ignore_zero )."' WHERE option_id=64"; $q = $wpdb->query($query); 458 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_single_image )."' WHERE option_id=65"; $q = $wpdb->query($query); 459 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image0 )."' WHERE option_id=66"; $q = $wpdb->query($query); 460 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image1 )."' WHERE option_id=67"; $q = $wpdb->query($query); 461 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image2 )."' WHERE option_id=68"; $q = $wpdb->query($query); 462 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image3 )."' WHERE option_id=69"; $q = $wpdb->query($query); 463 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image4 )."' WHERE option_id=70"; $q = $wpdb->query($query); 464 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image5 )."' WHERE option_id=71"; $q = $wpdb->query($query); 465 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image6 )."' WHERE option_id=72"; $q = $wpdb->query($query); 466 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image7 )."' WHERE option_id=73"; $q = $wpdb->query($query); 467 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image8 )."' WHERE option_id=74"; $q = $wpdb->query($query); 468 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_rating_image9 )."' WHERE option_id=75"; $q = $wpdb->query($query); 469 $query = "UPDATE $wpdb->options SET option_value='".addslashes($weblogs_cache_file )."' WHERE option_id=76"; $q = $wpdb->query($query); 470 $query = "UPDATE $wpdb->options SET option_value='".addslashes($weblogs_xml_url )."' WHERE option_id=77"; $q = $wpdb->query($query); 471 $query = "UPDATE $wpdb->options SET option_value='".addslashes($weblogs_cacheminutes )."' WHERE option_id=78"; $q = $wpdb->query($query); 472 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_updated_date_format )."' WHERE option_id=79"; $q = $wpdb->query($query); 473 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_recently_updated_prepend)."' WHERE option_id=80"; $q = $wpdb->query($query); 474 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_recently_updated_append )."' WHERE option_id=81"; $q = $wpdb->query($query); 475 $query = "UPDATE $wpdb->options SET option_value='".addslashes($links_recently_updated_time )."' WHERE option_id=82"; $q = $wpdb->query($query); 476 476 // end if links.config.php exists 477 477 } … … 480 480 481 481 function upgrade_100() { 482 global $wpdb , $tableposts, $tablecomments, $tablecategories, $tableoptionvalues, $tableoptiongroups, $tableoptiongroup_options, $tableoptions, $tablepost2cat, $tablelinks, $tableusers;483 maybe_add_column($ tableposts, 'post_name', "ALTER TABLE `$tableposts` ADD `post_name` VARCHAR(200) NOT NULL");484 maybe_add_column($ tableposts, 'to_ping', "ALTER TABLE $tableposts ADD `to_ping` TEXT NOT NULL");485 maybe_add_column($ tableposts, 'pinged', "ALTER TABLE $tableposts ADD `pinged` TEXT NOT NULL");486 maybe_add_column($ tableposts, 'post_modified', "ALTER TABLE $tableposts ADD `post_modified` DATETIME NOT NULL");487 maybe_add_column($ tableposts, 'post_content_filtered', "ALTER TABLE $tableposts ADD `post_content_filtered` TEXT NOT NULL");488 maybe_add_column($ tablecategories, 'category_nicename', "ALTER TABLE `$tablecategories` ADD `category_nicename` VARCHAR(200) NOT NULL");489 maybe_add_column($ tablecategories, 'category_description', "ALTER TABLE `$tablecategories` ADD `category_description` TEXT NOT NULL");490 maybe_add_column($ tablecategories, 'category_parent', "ALTER TABLE `$tablecategories` ADD `category_parent` INT(4) NOT NULL");491 maybe_add_column($ tablelinks, 'link_rss', "ALTER TABLE `$tablelinks` ADD `link_rss` VARCHAR( 255 ) NOT NULL;");492 maybe_add_column($ tableusers, 'user_description', "ALTER TABLE `$tableusers` ADD `user_description` TEXT NOT NULL");493 maybe_add_column($ tablecomments, 'comment_approved', "ALTER TABLE $tablecomments ADD COLUMN comment_approved ENUM('0', '1') DEFAULT '1' NOT NULL");482 global $wpdb; 483 maybe_add_column($wpdb->posts, 'post_name', "ALTER TABLE `$wpdb->posts` ADD `post_name` VARCHAR(200) NOT NULL"); 484 maybe_add_column($wpdb->posts, 'to_ping', "ALTER TABLE $wpdb->posts ADD `to_ping` TEXT NOT NULL"); 485 maybe_add_column($wpdb->posts, 'pinged', "ALTER TABLE $wpdb->posts ADD `pinged` TEXT NOT NULL"); 486 maybe_add_column($wpdb->posts, 'post_modified', "ALTER TABLE $wpdb->posts ADD `post_modified` DATETIME NOT NULL"); 487 maybe_add_column($wpdb->posts, 'post_content_filtered', "ALTER TABLE $wpdb->posts ADD `post_content_filtered` TEXT NOT NULL"); 488 maybe_add_column($wpdb->categories, 'category_nicename', "ALTER TABLE `$wpdb->categories` ADD `category_nicename` VARCHAR(200) NOT NULL"); 489 maybe_add_column($wpdb->categories, 'category_description', "ALTER TABLE `$wpdb->categories` ADD `category_description` TEXT NOT NULL"); 490 maybe_add_column($wpdb->categories, 'category_parent', "ALTER TABLE `$wpdb->categories` ADD `category_parent` INT(4) NOT NULL"); 491 maybe_add_column($wpdb->links, 'link_rss', "ALTER TABLE `$wpdb->links` ADD `link_rss` VARCHAR( 255 ) NOT NULL;"); 492 maybe_add_column($wpdb->users, 'user_description', "ALTER TABLE `$wpdb->users` ADD `user_description` TEXT NOT NULL"); 493 maybe_add_column($wpdb->comments, 'comment_approved', "ALTER TABLE $wpdb->comments ADD COLUMN comment_approved ENUM('0', '1') DEFAULT '1' NOT NULL"); 494 494 495 495 // Create indicies 496 add_clean_index($ tableposts, 'post_name');497 add_clean_index($ tablecategories, 'category_nicename');498 add_clean_index($ tablecomments, 'comment_approved');496 add_clean_index($wpdb->posts, 'post_name'); 497 add_clean_index($wpdb->categories, 'category_nicename'); 498 add_clean_index($wpdb->comments, 'comment_approved'); 499 499 500 500 501 501 // Options stuff 502 if (!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'comment_moderation'")) {503 $wpdb->query("INSERT INTO $ tableoptions502 if (!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'comment_moderation'")) { 503 $wpdb->query("INSERT INTO $wpdb->options 504 504 (option_id, blog_id, option_name, option_can_override, option_type, option_value, option_width, option_height, option_description, option_admin_level) 505 505 VALUES … … 507 507 } 508 508 509 $oid = $wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'comment_moderation'");510 $gid = $wpdb->get_var("SELECT group_id FROM $ tableoptiongroups WHERE group_name = 'General blog settings'");511 $seq = $wpdb->get_var("SELECT MAX(seq) FROM $ tableoptiongroup_options WHERE group_id = '$gid'");509 $oid = $wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'comment_moderation'"); 510 $gid = $wpdb->get_var("SELECT group_id FROM $wpdb->optiongroups WHERE group_name = 'General blog settings'"); 511 $seq = $wpdb->get_var("SELECT MAX(seq) FROM $wpdb->optiongroup_options WHERE group_id = '$gid'"); 512 512 ++$seq; 513 if (!$wpdb->get_row("SELECT * FROM $ tableoptiongroup_options WHERE group_id = '$gid' AND option_id = '$oid'")) {514 $wpdb->query("INSERT INTO $ tableoptiongroup_options513 if (!$wpdb->get_row("SELECT * FROM $wpdb->optiongroup_options WHERE group_id = '$gid' AND option_id = '$oid'")) { 514 $wpdb->query("INSERT INTO $wpdb->optiongroup_options 515 515 (group_id, option_id, seq) 516 516 VALUES … … 518 518 } 519 519 520 if (!$wpdb->get_row("SELECT * FROM $ tableoptionvalues WHERE option_id = $oid AND optionvalue = 'auto'")) {521 $wpdb->query("INSERT INTO $ tableoptionvalues520 if (!$wpdb->get_row("SELECT * FROM $wpdb->optionvalues WHERE option_id = $oid AND optionvalue = 'auto'")) { 521 $wpdb->query("INSERT INTO $wpdb->optionvalues 522 522 (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) 523 523 VALUES 524 524 ('$oid','auto', 'Automatic', NULL, NULL, 3)"); 525 525 } 526 if (!$wpdb->get_row("SELECT * FROM $ tableoptionvalues WHERE option_id = $oid AND optionvalue = 'none'")) {527 $wpdb->query("INSERT INTO $ tableoptionvalues526 if (!$wpdb->get_row("SELECT * FROM $wpdb->optionvalues WHERE option_id = $oid AND optionvalue = 'none'")) { 527 $wpdb->query("INSERT INTO $wpdb->optionvalues 528 528 (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) 529 529 VALUES 530 530 ('$oid', 'none', 'None', NULL, NULL, 1)"); 531 531 } 532 if (!$wpdb->get_row("SELECT * FROM $ tableoptionvalues WHERE option_id = $oid AND optionvalue = 'manual'")) {533 $wpdb->query("INSERT INTO $ tableoptionvalues532 if (!$wpdb->get_row("SELECT * FROM $wpdb->optionvalues WHERE option_id = $oid AND optionvalue = 'manual'")) { 533 $wpdb->query("INSERT INTO $wpdb->optionvalues 534 534 (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) 535 535 VALUES … … 537 537 } 538 538 539 if (!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'moderation_notify'")) {540 $wpdb->query("INSERT INTO $ tableoptions539 if (!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'moderation_notify'")) { 540 $wpdb->query("INSERT INTO $wpdb->options 541 541 (option_id, blog_id, option_name, option_can_override, option_type, option_value, option_width, option_height, option_description, option_admin_level) 542 542 VALUES … … 544 544 } 545 545 546 $oid = $wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'moderation_notify'");547 $seq = $wpdb->get_var("SELECT MAX(seq) FROM $ tableoptiongroup_options WHERE group_id = '$gid'");546 $oid = $wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'moderation_notify'"); 547 $seq = $wpdb->get_var("SELECT MAX(seq) FROM $wpdb->optiongroup_options WHERE group_id = '$gid'"); 548 548 ++$seq; 549 if (!$wpdb->get_row("SELECT * FROM $ tableoptiongroup_options WHERE group_id = '$gid' AND option_id = '$oid'")) {550 $wpdb->query("INSERT INTO $ tableoptiongroup_options549 if (!$wpdb->get_row("SELECT * FROM $wpdb->optiongroup_options WHERE group_id = '$gid' AND option_id = '$oid'")) { 550 $wpdb->query("INSERT INTO $wpdb->optiongroup_options 551 551 (group_id, option_id, seq) 552 552 VALUES … … 554 554 } 555 555 // Get the title and ID of every post, post_name to check if it already has a value 556 $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $ tableposts WHERE post_name = ''");556 $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''"); 557 557 if ($posts) { 558 558 foreach($posts as $post) { 559 559 if ('' == $post->post_name) { 560 560 $newtitle = sanitize_title($post->post_title); 561 $wpdb->query("UPDATE $ tableposts SET post_name = '$newtitle' WHERE ID = '$post->ID'");561 $wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'"); 562 562 } 563 563 } 564 564 } 565 565 566 $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $ tablecategories");566 $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories"); 567 567 foreach ($categories as $category) { 568 568 if ('' == $category->category_nicename) { 569 569 $newtitle = sanitize_title($category->cat_name); 570 $wpdb->query("UPDATE $ tablecategories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");571 } 572 } 573 574 if (!$wpdb->get_var("SELECT option_name FROM $ tableoptions WHERE option_name = 'permalink_structure'")) { // If it's not already there575 $wpdb->query("INSERT INTO `$ tableoptions`570 $wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'"); 571 } 572 } 573 574 if (!$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = 'permalink_structure'")) { // If it's not already there 575 $wpdb->query("INSERT INTO `$wpdb->options` 576 576 (`option_id`, `blog_id`, `option_name`, `option_can_override`, `option_type`, `option_value`, `option_width`, `option_height`, `option_description`, `option_admin_level`) 577 577 VALUES … … 579 579 } 580 580 581 if (!$wpdb->get_var("SELECT option_name FROM $ tableoptions WHERE option_name = 'gzipcompression'")) { // If it's not already there582 $wpdb->query("INSERT INTO `$ tableoptions`581 if (!$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = 'gzipcompression'")) { // If it's not already there 582 $wpdb->query("INSERT INTO `$wpdb->options` 583 583 (`option_id`, `blog_id`, `option_name`, `option_can_override`, `option_type`, `option_value`, `option_width`, `option_height`, `option_description`, `option_admin_level`) 584 584 VALUES 585 585 ('', '0', 'gzipcompression', 'Y', '2', '0', '20', '8', 'Whether your output should be gzipped or not. Enable this if you don’t already have mod_gzip running.', '8');"); 586 $optionid = $wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'gzipcompression'");587 $wpdb->query("INSERT INTO $ tableoptiongroup_options586 $optionid = $wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'gzipcompression'"); 587 $wpdb->query("INSERT INTO $wpdb->optiongroup_options 588 588 (group_id, option_id, seq) 589 589 VALUES 590 590 (2, $optionid, 5)"); 591 591 } 592 if (!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'hack_file'")) {593 $wpdb->query("INSERT INTO `$ tableoptions`592 if (!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'hack_file'")) { 593 $wpdb->query("INSERT INTO `$wpdb->options` 594 594 ( `option_id` , `blog_id` , `option_name` , `option_can_override` , `option_type` , `option_value` , `option_width` , `option_height` , `option_description` , `option_admin_level` ) 595 595 VALUES 596 596 ('', '0', 'hack_file', 'Y', '2', '0', '20', '8', 'Set this to true if you plan to use a hacks file. This is a place for you to store code hacks that won’t be overwritten when you upgrade. The file must be in your wordpress root and called <code>my-hacks.php</code>', '8')"); 597 $optionid = $wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'hack_file'");598 $wpdb->query("INSERT INTO $ tableoptiongroup_options597 $optionid = $wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'hack_file'"); 598 $wpdb->query("INSERT INTO $wpdb->optiongroup_options 599 599 (group_id, option_id, seq) 600 600 VALUES … … 602 602 } 603 603 604 $wpdb->query("UPDATE $ tableoptionvalues SET optionvalue_max = 23 , optionvalue_min = -23 WHERE option_id = 51");604 $wpdb->query("UPDATE $wpdb->optionvalues SET optionvalue_max = 23 , optionvalue_min = -23 WHERE option_id = 51"); 605 605 // fix upload users description 606 $wpdb->query("UPDATE $ tableoptions SET option_description = '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'' WHERE option_id = 37");606 $wpdb->query("UPDATE $wpdb->options SET option_description = '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'' WHERE option_id = 37"); 607 607 // and file types 608 $wpdb->query("UPDATE $ tableoptions SET option_description = 'accepted file types, separated by spaces. example: \'jpg gif png\'' WHERE option_id = 34");608 $wpdb->query("UPDATE $wpdb->options SET option_description = 'accepted file types, separated by spaces. example: \'jpg gif png\'' WHERE option_id = 34"); 609 609 // add link to php date format. this could be to a wordpress.org page in the future 610 $wpdb->query("UPDATE $ tableoptions SET option_description = 'see <a href=\"http://php.net/date\">help</a> for format characters' WHERE option_id = 52");611 $wpdb->query("UPDATE $ tableoptions SET option_description = 'see <a href=\"http://php.net/date\">help</a> for format characters' WHERE option_id = 53");612 $wpdb->query("UPDATE $ tableoptions SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')610 $wpdb->query("UPDATE $wpdb->options SET option_description = 'see <a href=\"http://php.net/date\">help</a> for format characters' WHERE option_id = 52"); 611 $wpdb->query("UPDATE $wpdb->options SET option_description = 'see <a href=\"http://php.net/date\">help</a> for format characters' WHERE option_id = 53"); 612 $wpdb->query("UPDATE $wpdb->options SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/') 613 613 WHERE option_name LIKE 'links_rating_image%' 614 614 AND option_value LIKE 'wp-links/links-images/%'"); 615 $wpdb->query("DELETE FROM $ tableoptions WHERE option_name = 'comment_allowed_tags'");616 $wpdb->query("DELETE FROM $ tableoptions WHERE option_name = 'use_preview'");617 $wpdb->query("DELETE FROM $ tableoptions WHERE option_name = 'search_engine_friendly_urls'");615 $wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'comment_allowed_tags'"); 616 $wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'use_preview'"); 617 $wpdb->query("DELETE FROM $wpdb->options WHERE option_name = 'search_engine_friendly_urls'"); 618 618 // Multiple categories 619 maybe_create_table($ tablepost2cat, "620 CREATE TABLE `$ tablepost2cat` (619 maybe_create_table($wpdb->post2cat, " 620 CREATE TABLE `$wpdb->post2cat` ( 621 621 `rel_id` INT NOT NULL AUTO_INCREMENT , 622 622 `post_id` INT NOT NULL , … … 627 627 "); 628 628 629 $done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $ tablepost2cat");629 $done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $wpdb->post2cat"); 630 630 if ($done_ids) : 631 631 foreach ($done_ids as $done_id) : … … 637 637 endif; 638 638 639 $allposts = $wpdb->get_results("SELECT ID, post_category FROM $ tableposts WHERE post_category != '0' $catwhere");639 $allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere"); 640 640 if ($allposts) : 641 641 foreach ($allposts as $post) { 642 642 // Check to see if it's already been imported 643 $cat = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post->ID AND category_id = $post->post_category");643 $cat = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post->ID AND category_id = $post->post_category"); 644 644 if (!$cat && 0 != $post->post_category) { // If there's no result 645 645 $wpdb->query(" 646 INSERT INTO $ tablepost2cat646 INSERT INTO $wpdb->post2cat 647 647 (post_id, category_id) 648 648 VALUES … … 655 655 656 656 function upgrade_101() { 657 global $wpdb , $tableoptionvalues, $tablelinkcategories, $tableposts, $tablecategories, $tablecomments, $tablelinks;657 global $wpdb; 658 658 // Fix possible duplicate problem from CVS, we can REMOVE this later 659 $option59 = $wpdb->get_results("SELECT * FROM $ tableoptionvalues WHERE option_id = '59'");659 $option59 = $wpdb->get_results("SELECT * FROM $wpdb->optionvalues WHERE option_id = '59'"); 660 660 if (1 < count($option59)) { 661 $wpdb->query("DELETE FROM $ tableoptionvalues WHERE option_id = '59' AND optionvalue LIKE('%FROM order%')");661 $wpdb->query("DELETE FROM $wpdb->optionvalues WHERE option_id = '59' AND optionvalue LIKE('%FROM order%')"); 662 662 } 663 663 664 664 // Remove 'automatic' option for comment moderation until it actually does something 665 $wpdb->query("DELETE FROM $ tableoptionvalues WHERE optionvalue = 'auto'");665 $wpdb->query("DELETE FROM $wpdb->optionvalues WHERE optionvalue = 'auto'"); 666 666 // Less intrusive default 667 $wpdb->query("ALTER TABLE `$ tablelinkcategories` CHANGE `show_description` `show_description` ENUM( 'Y', 'N' ) DEFAULT 'N' NOT NULL");667 $wpdb->query("ALTER TABLE `$wpdb->linkcategories` CHANGE `show_description` `show_description` ENUM( 'Y', 'N' ) DEFAULT 'N' NOT NULL"); 668 668 669 669 // Clean up indices, add a few 670 add_clean_index($ tableposts, 'post_name');671 add_clean_index($ tableposts, 'post_status');672 add_clean_index($ tablecategories, 'category_nicename');673 add_clean_index($ tablecomments, 'comment_approved');674 add_clean_index($ tablecomments, 'comment_post_ID');675 add_clean_index($ tablelinks , 'link_category');676 add_clean_index($ tablelinks , 'link_visible');670 add_clean_index($wpdb->posts, 'post_name'); 671 add_clean_index($wpdb->posts, 'post_status'); 672 add_clean_index($wpdb->categories, 'category_nicename'); 673 add_clean_index($wpdb->comments, 'comment_approved'); 674 add_clean_index($wpdb->comments, 'comment_post_ID'); 675 add_clean_index($wpdb->links , 'link_category'); 676 add_clean_index($wpdb->links , 'link_visible'); 677 677 } 678 678 679 679 680 680 function upgrade_110() { 681 global $wpdb , $tableusers, $tablecomments, $tableposts, $tableoptiongroups, $tableoptiongroup_options, $tableoptions, $tablepostmeta;682 683 maybe_add_column($ tablecomments, 'user_id', "ALTER TABLE `$tablecomments` ADD `user_id` INT DEFAULT '0' NOT NULL ;");684 maybe_add_column($ tableusers, 'user_activation_key', "ALTER TABLE `$tableusers` ADD `user_activation_key` VARCHAR( 60 ) NOT NULL ;");685 maybe_add_column($ tableusers, 'user_status', "ALTER TABLE `$tableusers` ADD `user_status` INT DEFAULT '0' NOT NULL ;");686 $wpdb->query("ALTER TABLE `$ tableposts` CHANGE `comment_status` `comment_status` ENUM( 'open', 'closed', 'registered_only' ) DEFAULT 'open' NOT NULL");687 688 maybe_add_column($ tableusers, 'user_nicename', "ALTER TABLE `$tableusers` ADD `user_nicename` VARCHAR(50) DEFAULT '' NOT NULL ;");689 maybe_add_column($ tableposts, 'post_date_gmt', "ALTER TABLE $tableposts ADD post_date_gmt DATETIME NOT NULL AFTER post_date");690 maybe_add_column($ tableposts, 'post_modified_gmt', "ALTER TABLE $tableposts ADD post_modified_gmt DATETIME NOT NULL AFTER post_modified");691 maybe_add_column($ tablecomments, 'comment_date_gmt', "ALTER TABLE $tablecomments ADD comment_date_gmt DATETIME NOT NULL AFTER comment_date");681 global $wpdb; 682 683 maybe_add_column($wpdb->comments, 'user_id', "ALTER TABLE `$wpdb->comments` ADD `user_id` INT DEFAULT '0' NOT NULL ;"); 684 maybe_add_column($wpdb->users, 'user_activation_key', "ALTER TABLE `$wpdb->users` ADD `user_activation_key` VARCHAR( 60 ) NOT NULL ;"); 685 maybe_add_column($wpdb->users, 'user_status', "ALTER TABLE `$wpdb->users` ADD `user_status` INT DEFAULT '0' NOT NULL ;"); 686 $wpdb->query("ALTER TABLE `$wpdb->posts` CHANGE `comment_status` `comment_status` ENUM( 'open', 'closed', 'registered_only' ) DEFAULT 'open' NOT NULL"); 687 688 maybe_add_column($wpdb->users, 'user_nicename', "ALTER TABLE `$wpdb->users` ADD `user_nicename` VARCHAR(50) DEFAULT '' NOT NULL ;"); 689 maybe_add_column($wpdb->posts, 'post_date_gmt', "ALTER TABLE $wpdb->posts ADD post_date_gmt DATETIME NOT NULL AFTER post_date"); 690 maybe_add_column($wpdb->posts, 'post_modified_gmt', "ALTER TABLE $wpdb->posts ADD post_modified_gmt DATETIME NOT NULL AFTER post_modified"); 691 maybe_add_column($wpdb->comments, 'comment_date_gmt', "ALTER TABLE $wpdb->comments ADD comment_date_gmt DATETIME NOT NULL AFTER comment_date"); 692 692 693 693 // Set user_nicename. 694 $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $ tableusers");694 $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); 695 695 foreach ($users as $user) { 696 696 if ('' == $user->user_nicename) { 697 697 $newname = sanitize_title($user->user_nickname); 698 $wpdb->query("UPDATE $ tableusers SET user_nicename = '$newname' WHERE ID = '$user->ID'");698 $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'"); 699 699 } 700 700 } 701 701 702 702 // Convert passwords to MD5 and update table appropiately 703 $query = 'DESCRIBE '.$ tableusers.' user_pass';703 $query = 'DESCRIBE '.$wpdb->users.' user_pass'; 704 704 $res = $wpdb->get_results($query); 705 705 if ($res[0]['Type'] != 'varchar(32)') { 706 $wpdb->query('ALTER TABLE '.$ tableusers.' MODIFY user_pass varchar(64) not null');707 } 708 709 $query = 'SELECT ID, user_pass from '.$ tableusers;706 $wpdb->query('ALTER TABLE '.$wpdb->users.' MODIFY user_pass varchar(64) not null'); 707 } 708 709 $query = 'SELECT ID, user_pass from '.$wpdb->users; 710 710 foreach ($wpdb->get_results($query) as $row) { 711 711 if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) { 712 $wpdb->query('UPDATE '.$tableusers.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\''); 713 } 714 } 715 716 $wpdb->query("DELETE FROM $tableoptiongroups WHERE group_id = 1"); 717 $wpdb->query("DELETE FROM $tableoptiongroups WHERE group_id = 2"); 718 $wpdb->query("DELETE FROM $tableoptiongroups WHERE group_id = 3"); 719 $wpdb->query("DELETE FROM $tableoptiongroups WHERE group_id = 4"); 720 $wpdb->query("DELETE FROM $tableoptiongroups WHERE group_id = 5"); 721 $wpdb->query("DELETE FROM $tableoptiongroups WHERE group_id = 6"); 722 $wpdb->query("DELETE FROM $tableoptiongroups WHERE group_id = 7"); 723 $wpdb->query("DELETE FROM $tableoptiongroups WHERE group_id = 9"); 724 725 $wpdb->query("UPDATE $tableoptiongroups SET group_name = 'Link Manager' WHERE group_id = 8"); 726 $wpdb->query("UPDATE $tableoptiongroups SET group_name = 'Geo-data' WHERE group_id = 9"); 712 $wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\''); 713 } 714 } 715 716 $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 1"); 717 $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 2"); 718 $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 3"); 719 $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 4"); 720 $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 5"); 721 $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 6"); 722 $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 7"); 723 $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 9"); 724 725 $wpdb->query("UPDATE $wpdb->optiongroups SET group_name = 'Link Manager' WHERE group_id = 8"); 727 726 728 727 // Add blog_charset option 729 if(!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'blog_charset'")) {730 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('blog_charset', 3, 'utf-8', 8)");728 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'blog_charset'")) { 729 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('blog_charset', 3, 'utf-8', 8)"); 731 730 } 732 731 … … 746 745 // Add a gmt_offset option, with value $gmt_offset 747 746 if (!get_settings('gmt_offset')) { 748 if(!$wpdb->get_var("SELECT * FROM $ tableoptions WHERE option_name = 'gmt_offset'")) {749 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_description, option_admin_level) VALUES ('gmt_offset', 8, $gmt_offset, 'The difference in hours between GMT and your timezone', 8)");747 if(!$wpdb->get_var("SELECT * FROM $wpdb->options WHERE option_name = 'gmt_offset'")) { 748 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_description, option_admin_level) VALUES ('gmt_offset', 8, $gmt_offset, 'The difference in hours between GMT and your timezone', 8)"); 750 749 } 751 750 … … 755 754 // MAX(post_date_gmt) can't be '0000-00-00 00:00:00' 756 755 // <michel_v> I just slapped myself silly for not thinking about it earlier 757 $got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $ tableposts") == '0000-00-00 00:00:00') ? false : true;756 $got_gmt_fields = ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00') ? false : true; 758 757 759 758 if (!$got_gmt_fields) { … … 762 761 $add_hours = intval($diff_gmt_weblogger); 763 762 $add_minutes = intval(60 * ($diff_gmt_weblogger - $add_hours)); 764 $wpdb->query("UPDATE $ tableposts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");765 $wpdb->query("UPDATE $ tableposts SET post_modified = post_date");766 $wpdb->query("UPDATE $ tableposts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'");767 $wpdb->query("UPDATE $ tablecomments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");768 $wpdb->query("UPDATE $ tableusers SET dateYMDhour = DATE_ADD(dateYMDhour, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)");763 $wpdb->query("UPDATE $wpdb->posts SET post_date_gmt = DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"); 764 $wpdb->query("UPDATE $wpdb->posts SET post_modified = post_date"); 765 $wpdb->query("UPDATE $wpdb->posts SET post_modified_gmt = DATE_ADD(post_modified, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE) WHERE post_modified != '0000-00-00 00:00:00'"); 766 $wpdb->query("UPDATE $wpdb->comments SET comment_date_gmt = DATE_ADD(comment_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"); 767 $wpdb->query("UPDATE $wpdb->users SET dateYMDhour = DATE_ADD(dateYMDhour, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"); 769 768 } 770 769 771 770 // post-meta 772 maybe_create_table($ tablepostmeta, "773 CREATE TABLE $ tablepostmeta (771 maybe_create_table($wpdb->postmeta, " 772 CREATE TABLE $wpdb->postmeta ( 774 773 meta_id int(11) NOT NULL auto_increment, 775 774 post_id int(11) NOT NULL default 0, … … 783 782 784 783 // First we need to enlarge option_value so it can hold larger values: 785 $wpdb->query("ALTER TABLE `$ tableoptions` CHANGE `option_value` `option_value` TEXT NOT NULL");784 $wpdb->query("ALTER TABLE `$wpdb->options` CHANGE `option_value` `option_value` TEXT NOT NULL"); 786 785 787 786 // Now an option for blog pinging 788 if(!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'ping_sites'")) {789 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('ping_sites', 3, 'http://rpc.pingomatic.com/', 8)");787 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'ping_sites'")) { 788 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('ping_sites', 3, 'http://rpc.pingomatic.com/', 8)"); 790 789 } 791 790 792 791 // Option for using the advanced edit screen by default 793 if(!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'advanced_edit'")) {794 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('advanced_edit', 5, '0', 8)");792 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'advanced_edit'")) { 793 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('advanced_edit', 5, '0', 8)"); 795 794 } 796 795 // Fix for CVS versions 797 $wpdb->query("UPDATE $ tableoptions SET option_type = '5' WHERE option_name = 'advanced_edit'");796 $wpdb->query("UPDATE $wpdb->options SET option_type = '5' WHERE option_name = 'advanced_edit'"); 798 797 799 798 // Now an option for moderation words 800 if(!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'moderation_keys'")) {801 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('moderation_keys', 3, '', 8)");799 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'moderation_keys'")) { 800 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('moderation_keys', 3, '', 8)"); 802 801 } 803 802 804 803 // Option for plugins 805 if(!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'active_plugins'")) {806 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('active_plugins', 3, '', 8)");804 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'active_plugins'")) { 805 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('active_plugins', 3, '', 8)"); 807 806 } 808 807 809 808 // Option for max # of links per comment 810 if(!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'comment_max_links'")) {811 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('comment_max_links', 3, '5', 8)");809 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'comment_max_links'")) { 810 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('comment_max_links', 3, '5', 8)"); 812 811 } 813 812 814 813 // Option for different blog URL 815 if(!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'home'")) {816 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('home', 3, '', 8)");814 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'home'")) { 815 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('home', 3, '', 8)"); 817 816 } 818 817 819 818 // Option for category base 820 if(!$wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = 'category_base'")) {821 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_type, option_value, option_admin_level) VALUES ('category_base', 3, '', 8)");819 if(!$wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'category_base'")) { 820 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_type, option_value, option_admin_level) VALUES ('category_base', 3, '', 8)"); 822 821 } 823 822 … … 829 828 830 829 // Forward-thinking 831 $wpdb->query("ALTER TABLE `$ tableposts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL");832 maybe_add_column($ tableposts, 'post_parent', "ALTER TABLE `$tableposts` ADD `post_parent` INT NOT NULL ;");833 834 835 $wpdb->query("ALTER TABLE `$ tablecomments` CHANGE `comment_author_url` `comment_author_url` VARCHAR( 200 ) NOT NULL");830 $wpdb->query("ALTER TABLE `$wpdb->posts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL"); 831 maybe_add_column($wpdb->posts, 'post_parent', "ALTER TABLE `$wpdb->posts` ADD `post_parent` INT NOT NULL ;"); 832 833 834 $wpdb->query("ALTER TABLE `$wpdb->comments` CHANGE `comment_author_url` `comment_author_url` VARCHAR( 200 ) NOT NULL"); 836 835 } 837 836 -
trunk/wp-admin/users.php
r1303 r1355 56 56 57 57 /* checking the login isn't already used by another user */ 58 $loginthere = $wpdb->get_var("SELECT user_login FROM $ tableusers WHERE user_login = '$user_login'");58 $loginthere = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'"); 59 59 if ($loginthere) { 60 60 die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.')); … … 79 79 $new_users_can_blog = get_settings('new_users_can_blog'); 80 80 81 $result = $wpdb->query("INSERT INTO $ tableusers81 $result = $wpdb->query("INSERT INTO $wpdb->users 82 82 (user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode, user_firstname, user_lastname, user_nicename) 83 83 VALUES … … 123 123 if ('up' == $prom) { 124 124 $new_level = $usertopromote_level + 1; 125 $sql="UPDATE $ tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";125 $sql="UPDATE $wpdb->users SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level"; 126 126 } elseif ('down' == $prom) { 127 127 $new_level = $usertopromote_level - 1; 128 $sql="UPDATE $ tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";128 $sql="UPDATE $wpdb->users SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level"; 129 129 } 130 130 $result = $wpdb->query($sql); … … 153 153 die(__('Can’t delete a user whose level is higher than yours.')); 154 154 155 $post_ids = $wpdb->get_col("SELECT ID FROM $ tableposts WHERE post_author = $id");155 $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id"); 156 156 if ($post_ids) { 157 157 $post_ids = implode(',', $post_ids); 158 158 159 159 // Delete comments, *backs 160 $wpdb->query("DELETE FROM $ tablecomments WHERE comment_post_ID IN ($post_ids)");160 $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID IN ($post_ids)"); 161 161 // Clean cats 162 $wpdb->query("DELETE FROM $ tablepost2cat WHERE post_id IN ($post_ids)");162 $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id IN ($post_ids)"); 163 163 // Clean post_meta 164 $wpdb->query("DELETE FROM $ tablepostmeta WHERE post_id IN ($post_ids)");164 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id IN ($post_ids)"); 165 165 // Clean links 166 $wpdb->query("DELETE FROM $ tablelinks WHERE link_owner = $id");166 $wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id"); 167 167 // Delete posts 168 $wpdb->query("DELETE FROM $ tableposts WHERE post_author = $id");168 $wpdb->query("DELETE FROM $wpdb->posts WHERE post_author = $id"); 169 169 } 170 170 171 171 // FINALLY, delete user 172 $wpdb->query("DELETE FROM $ tableusers WHERE ID = $id");172 $wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id"); 173 173 header('Location: users.php?deleted=true'); 174 174 … … 196 196 </tr> 197 197 <?php 198 $users = $wpdb->get_results("SELECT ID FROM $ tableusers WHERE user_level > 0 ORDER BY ID");198 $users = $wpdb->get_results("SELECT ID FROM $wpdb->users WHERE user_level > 0 ORDER BY ID"); 199 199 $style = ''; 200 200 foreach ($users as $user) { … … 209 209 $short_url = substr($short_url, 0, 32).'...'; 210 210 $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; 211 $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $ tableposts WHERE post_author = $user->ID and post_status = 'publish'");211 $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $user->ID and post_status = 'publish'"); 212 212 if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_data->ID' title='" . __('View posts') . "'>$numposts</a>"; 213 213 echo " … … 234 234 235 235 <?php 236 $users = $wpdb->get_results("SELECT * FROM $ tableusers WHERE user_level = 0 ORDER BY ID");236 $users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level = 0 ORDER BY ID"); 237 237 if ($users) { 238 238 ?> -
trunk/wp-blog-header.php
r1354 r1355 167 167 } 168 168 } 169 169 170 ?> -
trunk/wp-comments-popup.php
r1108 r1355 35 35 $comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : ''; 36 36 $comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : ''; 37 $comments = $wpdb->get_results("SELECT * FROM $ tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");38 $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $ tableposts WHERE ID = $id");37 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); 38 $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $wpdb->posts WHERE ID = $id"); 39 39 if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'.$cookiehash] != $commentstatus->post_password) { // and it doesn't match the cookie 40 40 echo(get_the_password_form()); -
trunk/wp-comments-post.php
r1237 r1355 33 33 $user_ip = $_SERVER['REMOTE_ADDR']; 34 34 35 if ( 'closed' == $wpdb->get_var("SELECT comment_status FROM $ tableposts WHERE ID = '$comment_post_ID'") )35 if ( 'closed' == $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'") ) 36 36 die( __('Sorry, comments are closed for this item.') ); 37 37 … … 52 52 53 53 // Simple flood-protection 54 $lasttime = $wpdb->get_var("SELECT comment_date FROM $ tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1");54 $lasttime = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1"); 55 55 if (!empty($lasttime)) { 56 56 $time_lastcomment= mysql2date('U', $lasttime); … … 69 69 } 70 70 71 $wpdb->query("INSERT INTO $ tablecomments71 $wpdb->query("INSERT INTO $wpdb->comments 72 72 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved) 73 73 VALUES -
trunk/wp-comments-reply.php
r1203 r1355 35 35 $comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : ''; 36 36 $comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : ''; 37 $comments = $wpdb->get_results("SELECT * FROM $ tablecomments WHERE comment_post_ID = '$id' AND comment_approved = '1' AND comment_ID = '$comment_reply_ID' ORDER BY comment_date");37 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$id' AND comment_approved = '1' AND comment_ID = '$comment_reply_ID' ORDER BY comment_date"); 38 38 ?> 39 39 -
trunk/wp-comments.php
r1311 r1355 18 18 $comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : ''; 19 19 20 $comments = $wpdb->get_results("SELECT * FROM $ tablecomments WHERE comment_post_ID = '$id' AND comment_approved = '1' ORDER BY comment_date");20 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$id' AND comment_approved = '1' ORDER BY comment_date"); 21 21 ?> 22 22 -
trunk/wp-commentsrss2.php
r1223 r1355 29 29 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 30 30 comment_author_url, comment_date, comment_content, comment_post_ID, 31 $ tableposts.ID, $tableposts.post_password FROM $tablecomments32 LEFT JOIN $ tableposts ON comment_post_id = id WHERE comment_post_ID = '$id'33 AND $ tablecomments.comment_approved = '1' AND $tableposts.post_status = 'publish'31 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 32 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id' 33 AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish' 34 34 AND post_date < '".date("Y-m-d H:i:59")."' 35 35 ORDER BY comment_date LIMIT " . get_settings('posts_per_rss') ); … … 37 37 $comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email, 38 38 comment_author_url, comment_date, comment_content, comment_post_ID, 39 $ tableposts.ID, $tableposts.post_password FROM $tablecomments40 LEFT JOIN $ tableposts ON comment_post_id = id WHERE $tableposts.post_status = 'publish'41 AND $ tablecomments.comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s")."'39 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 40 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' 41 AND $wpdb->comments.comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s")."' 42 42 ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') ); 43 43 } -
trunk/wp-includes/functions-post.php
r1353 r1355 7 7 */ 8 8 function wp_insert_post($postarr = array()) { 9 global $wpdb, $ tableposts, $post_default_category;9 global $wpdb, $post_default_category; 10 10 11 11 // export array as variables … … 32 32 $post_date_gmt = get_gmt_from_date($post_date); 33 33 34 $sql = "INSERT INTO $ tableposts34 $sql = "INSERT INTO $wpdb->posts 35 35 (post_author, post_date, post_date_gmt, post_modified, post_modified_gmt, post_content, post_title, post_excerpt, post_category, post_status, post_name) 36 36 VALUES ('$post_author', '$post_date', '$post_date_gmt', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_cat', '$post_status', '$post_name')"; … … 50 50 51 51 function wp_get_single_post($postid = 0, $mode = OBJECT) { 52 global $wpdb , $tableposts;53 54 $sql = "SELECT * FROM $ tableposts WHERE ID=$postid";52 global $wpdb; 53 54 $sql = "SELECT * FROM $wpdb->posts WHERE ID=$postid"; 55 55 $result = $wpdb->get_row($sql, $mode); 56 56 … … 62 62 63 63 function wp_get_recent_posts($num = 10) { 64 global $wpdb , $tableposts;64 global $wpdb; 65 65 66 66 // Set the limit clause, if we got a limit … … 69 69 } 70 70 71 $sql = "SELECT * FROM $ tableposts ORDER BY post_date DESC $limit";71 $sql = "SELECT * FROM $wpdb->posts ORDER BY post_date DESC $limit"; 72 72 $result = $wpdb->get_results($sql,ARRAY_A); 73 73 … … 76 76 77 77 function wp_update_post($postarr = array()) { 78 global $wpdb , $tableposts;78 global $wpdb; 79 79 80 80 // First get all of the original fields … … 97 97 $post_modified_gmt = current_time('mysql', 1); 98 98 99 $sql = "UPDATE $ tableposts99 $sql = "UPDATE $wpdb->posts 100 100 SET post_content = '$post_content', 101 101 post_title = '$post_title', … … 119 119 120 120 function wp_get_post_cats($blogid = '1', $post_ID = 0) { 121 global $wpdb , $tablepost2cat;121 global $wpdb; 122 122 123 123 $sql = "SELECT category_id 124 FROM $ tablepost2cat124 FROM $wpdb->post2cat 125 125 WHERE post_id = $post_ID 126 126 ORDER BY category_id"; … … 132 132 133 133 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { 134 global $wpdb , $tablepost2cat;134 global $wpdb; 135 135 // If $post_categories isn't already an array, make it one: 136 136 if (!is_array($post_categories)) { … … 146 146 $old_categories = $wpdb->get_col(" 147 147 SELECT category_id 148 FROM $ tablepost2cat148 FROM $wpdb->post2cat 149 149 WHERE post_id = $post_ID"); 150 150 … … 169 169 foreach ($delete_cats as $del) { 170 170 $wpdb->query(" 171 DELETE FROM $ tablepost2cat171 DELETE FROM $wpdb->post2cat 172 172 WHERE category_id = $del 173 173 AND post_id = $post_ID … … 186 186 foreach ($add_cats as $new_cat) { 187 187 $wpdb->query(" 188 INSERT INTO $ tablepost2cat (post_id, category_id)188 INSERT INTO $wpdb->post2cat (post_id, category_id) 189 189 VALUES ($post_ID, $new_cat)"); 190 190 … … 195 195 196 196 function wp_delete_post($postid = 0) { 197 global $wpdb , $tableposts, $tablepost2cat;198 199 $sql = "DELETE FROM $ tablepost2cat WHERE post_id = $postid";197 global $wpdb; 198 199 $sql = "DELETE FROM $wpdb->post2cat WHERE post_id = $postid"; 200 200 $wpdb->query($sql); 201 201 202 $sql = "DELETE FROM $ tableposts WHERE ID = $postid";202 $sql = "DELETE FROM $wpdb->posts WHERE ID = $postid"; 203 203 204 204 $wpdb->query($sql); … … 216 216 function post_permalink($post_ID=0, $mode = 'id') { 217 217 global $wpdb; 218 global $tableposts;219 218 global $querystring_start, $querystring_equal, $querystring_separator; 220 219 … … 266 265 // Get the name of a category from its ID 267 266 function get_cat_name($cat_id) { 268 global $wpdb ,$tablecategories;267 global $wpdb; 269 268 270 269 $cat_id -= 0; // force numeric 271 $name = $wpdb->get_var("SELECT cat_name FROM $ tablecategories WHERE cat_ID=$cat_id");270 $name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID=$cat_id"); 272 271 273 272 return $name; … … 276 275 // Get the ID of a category from its name 277 276 function get_cat_ID($cat_name='General') { 278 global $wpdb ,$tablecategories;279 280 $cid = $wpdb->get_var("SELECT cat_ID FROM $ tablecategories WHERE cat_name='$cat_name'");277 global $wpdb; 278 279 $cid = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'"); 281 280 282 281 return $cid?$cid:1; // default to cat 1 -
trunk/wp-includes/functions.php
r1354 r1355 96 96 97 97 function get_lastpostdate($timezone = 'server') { 98 global $ tableposts, $cache_lastpostdate, $pagenow, $wpdb;98 global $cache_lastpostdate, $pagenow, $wpdb; 99 99 $add_seconds_blog = get_settings('gmt_offset') * 3600; 100 100 $add_seconds_server = date('Z'); … … 103 103 switch(strtolower($timezone)) { 104 104 case 'gmt': 105 $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $ tableposts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");105 $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1"); 106 106 break; 107 107 case 'blog': 108 $lastpostdate = $wpdb->get_var("SELECT post_date FROM $ tableposts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");108 $lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1"); 109 109 break; 110 110 case 'server': 111 $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $ tableposts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");111 $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1"); 112 112 break; 113 113 } … … 120 120 121 121 function get_lastpostmodified($timezone = 'server') { 122 global $ tableposts, $cache_lastpostmodified, $pagenow, $wpdb;122 global $cache_lastpostmodified, $pagenow, $wpdb; 123 123 $add_seconds_blog = get_settings('gmt_offset') * 3600; 124 124 $add_seconds_server = date('Z'); … … 127 127 switch(strtolower($timezone)) { 128 128 case 'gmt': 129 $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $ tableposts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");129 $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1"); 130 130 break; 131 131 case 'blog': 132 $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $ tableposts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");132 $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1"); 133 133 break; 134 134 case 'server': 135 $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $ tableposts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");135 $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1"); 136 136 break; 137 137 } … … 173 173 174 174 function get_userdata($userid) { 175 global $wpdb, $cache_userdata , $tableusers;175 global $wpdb, $cache_userdata; 176 176 if ( empty($cache_userdata[$userid]) ) { 177 $user = $wpdb->get_row("SELECT * FROM $ tableusers WHERE ID = '$userid'");177 $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = '$userid'"); 178 178 $user->user_nickname = stripslashes($user->user_nickname); 179 179 $user->user_firstname = stripslashes($user->user_firstname); … … 188 188 189 189 function get_userdatabylogin($user_login) { 190 global $ tableusers, $cache_userdata, $wpdb;190 global $cache_userdata, $wpdb; 191 191 if ( empty($cache_userdata["$user_login"]) ) { 192 $user = $wpdb->get_row("SELECT * FROM $ tableusers WHERE user_login = '$user_login'");192 $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'"); 193 193 $cache_userdata["$user_login"] = $user; 194 194 } else { … … 199 199 200 200 function get_userid($user_login) { 201 global $ tableusers, $cache_userdata, $wpdb;201 global $cache_userdata, $wpdb; 202 202 if ( empty($cache_userdata["$user_login"]) ) { 203 $user_id = $wpdb->get_var("SELECT ID FROM $ tableusers WHERE user_login = '$user_login'");203 $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$user_login'"); 204 204 205 205 $cache_userdata["$user_login"] = $user_id; … … 211 211 212 212 function get_usernumposts($userid) { 213 global $ tableposts, $tablecomments, $wpdb;214 return $wpdb->get_var("SELECT COUNT(*) FROM $ tableposts WHERE post_author = '$userid'");213 global $wpdb; 214 return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid'"); 215 215 } 216 216 … … 218 218 // determine the post ID it represents. 219 219 function url_to_postid($url = '') { 220 global $wpdb , $tableposts;220 global $wpdb; 221 221 222 222 $siteurl = get_settings('home'); … … 291 291 292 292 // Run the query to get the post ID: 293 $id = intval($wpdb->get_var("SELECT ID FROM $ tableposts WHERE 1 = 1 " . $where));293 $id = intval($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE 1 = 1 " . $where)); 294 294 295 295 return $id; … … 322 322 323 323 function get_alloptions() { 324 global $ tableoptions, $wpdb;325 $options = $wpdb->get_results("SELECT option_name, option_value FROM $ tableoptions");324 global $wpdb; 325 $options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options"); 326 326 if ($options) { 327 327 foreach ($options as $option) { … … 339 339 340 340 function update_option($option_name, $newvalue) { 341 global $wpdb, $ tableoptions, $cache_settings;341 global $wpdb, $cache_settings; 342 342 $newvalue = stripslashes($newvalue); 343 343 $newvalue = trim($newvalue); // I can't think of any situation we wouldn't want to trim 344 344 $newvalue = $wpdb->escape($newvalue); 345 $wpdb->query("UPDATE $ tableoptions SET option_value = '$newvalue' WHERE option_name = '$option_name'");345 $wpdb->query("UPDATE $wpdb->options SET option_value = '$newvalue' WHERE option_name = '$option_name'"); 346 346 $cache_settings = get_alloptions(); // Re cache settings 347 347 return true; … … 352 352 function add_option($name, $value='') { 353 353 // Adds an option if it doesn't already exist 354 global $wpdb , $tableoptions;354 global $wpdb; 355 355 if(!get_settings($name)) { 356 356 $name = $wpdb->escape($name); 357 357 $value = $wpdb->escape($value); 358 $wpdb->query("INSERT INTO $ tableoptions (option_name, option_value) VALUES ('$name', '$value')");358 $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value) VALUES ('$name', '$value')"); 359 359 360 360 if($wpdb->insert_id) { … … 367 367 368 368 function delete_option($name) { 369 global $wpdb , $tableoptions, $tableoptiongroup_options;369 global $wpdb; 370 370 // Get the ID, if no ID then return 371 $option_id = $wpdb->get_var("SELECT option_id FROM $ tableoptions WHERE option_name = '$name'");371 $option_id = $wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = '$name'"); 372 372 if (!$option_id) return false; 373 $wpdb->query("DELETE FROM $ tableoptiongroup_options WHERE option_id = '$option_id'");374 $wpdb->query("DELETE FROM $ tableoptions WHERE option_name = '$name'");373 $wpdb->query("DELETE FROM $wpdb->optiongroup_options WHERE option_id = '$option_id'"); 374 $wpdb->query("DELETE FROM $wpdb->options WHERE option_name = '$name'"); 375 375 return true; 376 376 } 377 377 378 378 function get_postdata($postid) { 379 global $post, $ tableposts, $wpdb;380 381 $post = $wpdb->get_row("SELECT * FROM $ tableposts WHERE ID = '$postid'");379 global $post, $wpdb; 380 381 $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$postid'"); 382 382 383 383 $postdata = array ( … … 403 403 404 404 function get_commentdata($comment_ID,$no_cache=0,$include_unapproved=false) { // less flexible, but saves DB queries 405 global $postc,$id,$commentdata, $tablecomments,$wpdb;405 global $postc,$id,$commentdata, $wpdb; 406 406 if ($no_cache) { 407 $query = "SELECT * FROM $ tablecomments WHERE comment_ID = '$comment_ID'";407 $query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'"; 408 408 if (false == $include_unapproved) { 409 409 $query .= " AND comment_approved = '1'"; … … 432 432 433 433 function get_catname($cat_ID) { 434 global $ tablecategories, $cache_catnames, $wpdb;434 global $cache_catnames, $wpdb; 435 435 if ( !$cache_catnames ) { 436 $results = $wpdb->get_results("SELECT * FROM $ tablecategories") or die('Oops, couldn\'t query the db for categories.');436 $results = $wpdb->get_results("SELECT * FROM $wpdb->categories") or die('Oops, couldn\'t query the db for categories.'); 437 437 foreach ($results as $post) { 438 438 $cache_catnames[$post->cat_ID] = $post->cat_name; … … 545 545 // Send a Trackback 546 546 function trackback($trackback_url, $title, $excerpt, $ID) { 547 global $wpdb , $tableposts;547 global $wpdb; 548 548 $title = urlencode(stripslashes($title)); 549 549 $excerpt = urlencode(stripslashes($excerpt)); … … 573 573 @fclose($fs); 574 574 575 $wpdb->query("UPDATE $ tableposts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'");576 $wpdb->query("UPDATE $ tableposts SET to_ping = REPLACE(to_ping, '$tb_url', '') WHERE ID = '$ID'");575 $wpdb->query("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'"); 576 $wpdb->query("UPDATE $wpdb->posts SET to_ping = REPLACE(to_ping, '$tb_url', '') WHERE ID = '$ID'"); 577 577 return $result; 578 578 } … … 899 899 */ 900 900 function wp_set_comment_status($comment_id, $comment_status) { 901 global $wpdb , $tablecomments;901 global $wpdb; 902 902 903 903 switch($comment_status) { 904 904 case 'hold': 905 $query = "UPDATE $ tablecomments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";905 $query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1"; 906 906 break; 907 907 case 'approve': 908 $query = "UPDATE $ tablecomments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";908 $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1"; 909 909 break; 910 910 case 'delete': 911 $query = "DELETE FROM $ tablecomments WHERE comment_ID='$comment_id' LIMIT 1";911 $query = "DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"; 912 912 break; 913 913 default: … … 935 935 */ 936 936 function wp_get_comment_status($comment_id) { 937 global $wpdb , $tablecomments;937 global $wpdb; 938 938 939 $result = $wpdb->get_var("SELECT comment_approved FROM $ tablecomments WHERE comment_ID='$comment_id' LIMIT 1");939 $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 940 940 if ($result == NULL) { 941 941 return "deleted"; … … 950 950 951 951 function wp_notify_postauthor($comment_id, $comment_type='comment') { 952 global $wpdb , $tablecomments, $tableposts, $tableusers;952 global $wpdb; 953 953 global $querystring_start, $querystring_equal, $querystring_separator; 954 954 955 $comment = $wpdb->get_row("SELECT * FROM $ tablecomments WHERE comment_ID='$comment_id' LIMIT 1");956 $post = $wpdb->get_row("SELECT * FROM $ tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");957 $user = $wpdb->get_row("SELECT * FROM $ tableusers WHERE ID='$post->post_author' LIMIT 1");955 $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 956 $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1"); 957 $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1"); 958 958 959 959 if ('' == $user->user_email) return false; // If there's no email to send the comment to … … 1010 1010 */ 1011 1011 function wp_notify_moderator($comment_id) { 1012 global $wpdb , $tablecomments, $tableposts, $tableusers;1012 global $wpdb; 1013 1013 global $querystring_start, $querystring_equal, $querystring_separator; 1014 1014 1015 $comment = $wpdb->get_row("SELECT * FROM $ tablecomments WHERE comment_ID='$comment_id' LIMIT 1");1016 $post = $wpdb->get_row("SELECT * FROM $ tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");1017 $user = $wpdb->get_row("SELECT * FROM $ tableusers WHERE ID='$post->post_author' LIMIT 1");1015 $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 1016 $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1"); 1017 $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1"); 1018 1018 1019 1019 $comment_author_domain = gethostbyaddr($comment->comment_author_IP); 1020 $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $ tablecomments WHERE comment_approved = '0'");1020 $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); 1021 1021 1022 1022 $notify_message = "A new comment on the post #$comment->comment_post_ID \"".stripslashes($post->post_title)."\" is waiting for your approval\r\n\r\n"; … … 1317 1317 1318 1318 function get_posts($args) { 1319 global $wpdb , $tableposts;1319 global $wpdb; 1320 1320 parse_str($args, $r); 1321 1321 if (!isset($r['numberposts'])) $r['numberposts'] = 5; … … 1328 1328 $now = current_time('mysql'); 1329 1329 1330 $posts = $wpdb->get_results("SELECT DISTINCT * FROM $ tableposts WHERE post_date <= '$now' AND (post_status = 'publish') GROUP BY $tableposts.ID ORDER BY post_date DESC LIMIT " . $r['offset'] . ',' . $r['numberposts']);1330 $posts = $wpdb->get_results("SELECT DISTINCT * FROM $wpdb->posts WHERE post_date <= '$now' AND (post_status = 'publish') GROUP BY $wpdb->posts.ID ORDER BY post_date DESC LIMIT " . $r['offset'] . ',' . $r['numberposts']); 1331 1331 1332 1332 return $posts; … … 1355 1355 1356 1356 function query_posts($query) { 1357 global $wpdb, $tablepost2cat, $tableposts, $tablecategories, $tableusers,1357 global $wpdb, 1358 1358 $pagenow; 1359 1359 … … 1486 1486 $andor = 'OR'; 1487 1487 } 1488 $join = " LEFT JOIN $ tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) ";1488 $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) "; 1489 1489 $cat_array = explode(' ',$cat); 1490 1490 $whichcat .= ' AND (category_id '.$eq.' '.intval($cat_array[0]); … … 1512 1512 } 1513 1513 $category_name = preg_replace('|[^a-z0-9-_]|i', '', $category_name); 1514 $tables = ", $ tablepost2cat, $tablecategories";1515 $join = " LEFT JOIN $ tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) LEFT JOIN $tablecategories ON ($tablepost2cat.category_id = $tablecategories.cat_ID) ";1514 $tables = ", $wpdb->post2cat, $wpdb->categories"; 1515 $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) "; 1516 1516 $whichcat = " AND (category_nicename = '$category_name'"; 1517 $cat = $wpdb->get_var("SELECT cat_ID FROM $ tablecategories WHERE category_nicename = '$category_name'");1517 $cat = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_name'"); 1518 1518 $whichcat .= get_category_children($cat, " OR category_id = "); 1519 1519 $whichcat .= ")"; … … 1556 1556 } 1557 1557 $author_name = preg_replace('|[^a-z0-9-_]|', '', strtolower($author_name)); 1558 $author = $wpdb->get_var("SELECT ID FROM $ tableusers WHERE user_nicename='".$author_name."'");1558 $author = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$author_name."'"); 1559 1559 $whichauthor .= ' AND (post_author = '.intval($author).')'; 1560 1560 } … … 1663 1663 else 1664 1664 $where .= ')'; 1665 $where .= " GROUP BY $ tableposts.ID";1666 $request = " SELECT $distinct * FROM $ tableposts $join WHERE 1=1".$where." ORDER BY post_$orderby $limits";1665 $where .= " GROUP BY $wpdb->posts.ID"; 1666 $request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where." ORDER BY post_$orderby $limits"; 1667 1667 1668 1668 … … 1683 1683 function update_post_caches($posts) { 1684 1684 global $category_cache, $comment_count_cache, $post_meta_cache; 1685 global $tablecategories, $tablepost2cat, $tableposts, $tablecomments, 1686 $tablepostmeta, $wpdb; 1685 global $wpdb; 1687 1686 1688 1687 // No point in doing all this work if we didn't match any posts. … … 1699 1698 $dogs = $wpdb->get_results("SELECT DISTINCT 1700 1699 ID, category_id, cat_name, category_nicename, category_description, category_parent 1701 FROM $ tablecategories, $tablepost2cat, $tableposts1700 FROM $wpdb->categories, $wpdb->post2cat, $wpdb->posts 1702 1701 WHERE category_id = cat_ID AND post_id = ID AND post_id IN ($post_id_list)"); 1703 1702 … … 1708 1707 // Do the same for comment numbers 1709 1708 $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount 1710 FROM $ tableposts1711 LEFT JOIN $ tablecomments ON ( comment_post_ID = ID AND comment_approved = '1')1709 FROM $wpdb->posts 1710 LEFT JOIN $wpdb->comments ON ( comment_post_ID = ID AND comment_approved = '1') 1712 1711 WHERE post_status = 'publish' AND ID IN ($post_id_list) 1713 1712 GROUP BY ID"); … … 1722 1721 if ( $meta_list = $wpdb->get_results(" 1723 1722 SELECT post_id,meta_key,meta_value 1724 FROM $ tablepostmeta1723 FROM $wpdb->postmeta 1725 1724 WHERE post_id IN($post_id_list) 1726 1725 ORDER BY post_id,meta_key … … 1747 1746 1748 1747 function update_category_cache() { 1749 global $cache_categories, $ tablecategories, $wpdb;1750 $dogs = $wpdb->get_results("SELECT * FROM $ tablecategories WHERE 1=1");1748 global $cache_categories, $wpdb; 1749 $dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE 1=1"); 1751 1750 foreach ($dogs as $catt) { 1752 1751 $cache_categories[$catt->cat_ID] = $catt; … … 1755 1754 1756 1755 function update_user_cache() { 1757 global $cache_userdata, $ tableusers, $wpdb;1758 1759 $users = $wpdb->get_results("SELECT * FROM $ tableusers WHERE user_level > 0");1756 global $cache_userdata, $wpdb; 1757 1758 $users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level > 0"); 1760 1759 foreach ($users as $user) { 1761 1760 $cache_userdata[$user->ID] = $user; -
trunk/wp-includes/links-update-xml.php
r1225 r1355 20 20 **/ 21 21 function preload_links() { 22 global $ tablelinks, $all_links, $wpdb;23 $links = $wpdb->get_results("SELECT link_id, link_url FROM $ tablelinks WHERE link_visible = 'Y' AND link_url <> ''");22 global $all_links, $wpdb; 23 $links = $wpdb->get_results("SELECT link_id, link_url FROM $wpdb->links WHERE link_visible = 'Y' AND link_url <> ''"); 24 24 foreach ($links as $link) { 25 25 $link_url = transform_url($link->link_url); … … 33 33 **/ 34 34 function update_links() { 35 global $ tablelinks, $all_links, $wpdb;35 global $all_links, $wpdb; 36 36 reset($all_links); 37 37 while (list($id, $val) = each($all_links)) { 38 38 if ($val[1]) { 39 $wpdb->query("UPDATE $ tablelinks SET link_updated = '$val[1]' WHERE link_id = $val[0]");39 $wpdb->query("UPDATE $wpdb->links SET link_updated = '$val[1]' WHERE link_id = $val[0]"); 40 40 } 41 41 } // end while -
trunk/wp-includes/links.php
r1258 r1355 27 27 $show_description = true, $show_rating = false, 28 28 $limit = -1, $show_updated = 0) { 29 global $ tablelinkcategories, $wpdb;29 global $wpdb; 30 30 $cat_id = -1; 31 $results = $wpdb->get_results("SELECT cat_id FROM $ tablelinkcategories WHERE cat_name='$cat_name'");31 $results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'"); 32 32 if ($results) { 33 33 foreach ($results as $result) { … … 50 50 **/ 51 51 function wp_get_linksbyname($category) { 52 global $wpdb , $tablelinkcategories;52 global $wpdb; 53 53 54 54 $cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, " 55 55 . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, " 56 . " text_after_all, list_limit FROM $ tablelinkcategories WHERE cat_name='$category'");56 . " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_name='$category'"); 57 57 if ($cat) { 58 58 if ($cat->sort_desc == 'Y') { … … 72 72 **/ 73 73 function wp_get_links($category) { 74 global $wpdb , $tablelinkcategories;74 global $wpdb; 75 75 76 76 $cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, " 77 77 . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, " 78 . " text_after_all, list_limit FROM $ tablelinkcategories WHERE cat_id=$category");78 . " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$category"); 79 79 if ($cat) { 80 80 if ($cat->sort_desc == 'Y') { … … 115 115 $limit = -1, $show_updated = 1, $echo = true) { 116 116 117 global $ tablelinks, $wpdb;117 global $wpdb; 118 118 119 119 $direction = ' ASC'; … … 156 156 $sql = "SELECT link_url, link_name, link_image, link_target, 157 157 link_description, link_rating, link_rel $length $recently_updated_test $get_updated 158 FROM $ tablelinks158 FROM $wpdb->links 159 159 WHERE link_visible = 'Y' " . 160 160 $category_query; … … 278 278 **/ 279 279 function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) { 280 global $ tablelinkcategories, $wpdb;280 global $wpdb; 281 281 $cat_id = -1; 282 $results = $wpdb->get_results("SELECT cat_id FROM $ tablelinkcategories WHERE cat_name='$cat_name'");282 $results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'"); 283 283 if ($results) { 284 284 foreach ($results as $result) { … … 325 325 **/ 326 326 function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) { 327 global $ tablelinks, $wpdb;328 329 $sql = "SELECT * FROM $ tablelinks WHERE link_visible = 'Y'";327 global $wpdb; 328 329 $sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'"; 330 330 if ($category != -1) { 331 331 $sql .= " AND link_category = $category "; … … 460 460 */ 461 461 function get_linkcatname($id = 0) { 462 global $ tablelinkcategories, $wpdb;462 global $wpdb; 463 463 $cat_name = ''; 464 464 if ('' != $id) { 465 $cat_name = $wpdb->get_var("SELECT cat_name FROM $ tablelinkcategories WHERE cat_id=$id");465 $cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->linkcategories WHERE cat_id=$id"); 466 466 } 467 467 return stripslashes($cat_name); … … 474 474 */ 475 475 function get_autotoggle($id = 0) { 476 global $ tablelinkcategories, $wpdb;477 $auto_toggle = $wpdb->get_var("SELECT auto_toggle FROM $ tablelinkcategories WHERE cat_id=$id");476 global $wpdb; 477 $auto_toggle = $wpdb->get_var("SELECT auto_toggle FROM $wpdb->linkcategories WHERE cat_id=$id"); 478 478 if ('' == $auto_toggle) 479 479 $auto_toggle = 'N'; … … 493 493 function links_popup_script($text = 'Links', $width=400, $height=400, 494 494 $file='links.all.php', $count = true) { 495 global $tablelinks;496 495 if ($count == true) { 497 $counts = $wpdb->get_var("SELECT count(*) FROM $ tablelinks");496 $counts = $wpdb->get_var("SELECT count(*) FROM $wpdb->links"); 498 497 } 499 498 … … 519 518 * 520 519 * Output a list of all links, listed by category, using the 521 * settings in $ tablelinkcategories and output it as a nested520 * settings in $wpdb->linkcategories and output it as a nested 522 521 * HTML unordered list. 523 522 * … … 527 526 */ 528 527 function get_links_list($order = 'name', $hide_if_empty = 'obsolete') { 529 global $ tablelinkcategories, $tablelinks, $wpdb;528 global $wpdb; 530 529 531 530 $order = strtolower($order); … … 546 545 show_description, show_rating, show_updated, sort_order, 547 546 sort_desc, list_limit 548 FROM `$ tablelinks`549 LEFT JOIN `$ tablelinkcategories` ON (link_category = cat_id)547 FROM `$wpdb->links` 548 LEFT JOIN `$wpdb->linkcategories` ON (link_category = cat_id) 550 549 WHERE link_visible = 'Y' 551 550 AND list_limit <> 0 -
trunk/wp-includes/template-functions-author.php
r1203 r1355 78 78 79 79 function get_author_link($echo = false, $author_id, $author_nicename) { 80 global $wpdb, $ tableusers, $post, $querystring_start, $querystring_equal, $cache_userdata;80 global $wpdb, $post, $querystring_start, $querystring_equal, $cache_userdata; 81 81 $auth_ID = $author_id; 82 82 $permalink_structure = get_settings('permalink_structure'); … … 127 127 128 128 function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') { 129 global $ tableusers, $wpdb, $blogfilename;129 global $wpdb, $blogfilename; 130 130 131 $query = "SELECT ID, user_nickname, user_firstname, user_lastname, user_nicename from $ tableusers " . ($exclude_admin ? "WHERE user_nickname <> 'admin' " : '') . "ORDER BY user_nickname";131 $query = "SELECT ID, user_nickname, user_firstname, user_lastname, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_nickname <> 'admin' " : '') . "ORDER BY user_nickname"; 132 132 $authors = $wpdb->get_results($query); 133 133 -
trunk/wp-includes/template-functions-category.php
r1328 r1355 2 2 3 3 function get_the_category() { 4 global $post, $ tablecategories, $tablepost2cat, $wpdb, $category_cache;4 global $post, $wpdb, $category_cache; 5 5 if ($category_cache[$post->ID]) { 6 6 return $category_cache[$post->ID]; … … 8 8 $categories = $wpdb->get_results(" 9 9 SELECT category_id, cat_name, category_nicename, category_description, category_parent 10 FROM $ tablecategories, $tablepost2cat11 WHERE $ tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID10 FROM $wpdb->categories, $wpdb->post2cat 11 WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = $post->ID 12 12 "); 13 13 … … 17 17 18 18 function get_category_link($echo = false, $category_id, $category_nicename) { 19 global $wpdb, $ tablecategories, $post, $querystring_start, $querystring_equal, $cache_categories;19 global $wpdb, $post, $querystring_start, $querystring_equal, $cache_categories; 20 20 $cat_ID = $category_id; 21 21 $permalink_structure = get_settings('permalink_structure'); … … 124 124 125 125 function get_the_category_by_ID($cat_ID) { 126 global $ tablecategories, $cache_categories, $wpdb;126 global $cache_categories, $wpdb; 127 127 if ( !$cache_categories[$cat_ID] ) { 128 $cat_name = $wpdb->get_var("SELECT cat_name FROM $ tablecategories WHERE cat_ID = '$cat_ID'");128 $cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID = '$cat_ID'"); 129 129 $cache_categories[$cat_ID]->cat_name = $cat_name; 130 130 } else { … … 135 135 136 136 function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){ 137 global $ tablecategories, $cache_categories;138 $chain = "";137 global $cache_categories; 138 $chain = ''; 139 139 $parent = $cache_categories[$id]; 140 140 if ($nicename) { … … 153 153 154 154 function get_category_children($id, $before = '/', $after = '') { 155 global $ tablecategories, $cache_categories;155 global $cache_categories; 156 156 $c_cache = $cache_categories; // Can't do recursive foreach on a global, have to make a copy 157 157 $chain = ''; … … 185 185 186 186 function category_description($category = 0) { 187 global $cat, $wpdb, $ tablecategories, $cache_categories;187 global $cat, $wpdb, $cache_categories; 188 188 if (!$category) $category = $cat; 189 189 $category_description = $cache_categories[$category]->category_description; … … 196 196 $optiondates = 0, $optioncount = 0, $hide_empty = 1, $optionnone=FALSE, 197 197 $selected=0, $hide=0) { 198 global $ tablecategories, $tableposts, $tablepost2cat, $wpdb;198 global $wpdb; 199 199 global $querystring_start, $querystring_equal, $querystring_separator; 200 200 if (($file == 'blah') || ($file == '')) $file = get_settings('home') . '/' . get_settings('blogfilename'); … … 204 204 $query = " 205 205 SELECT cat_ID, cat_name, category_nicename,category_parent, 206 COUNT($ tablepost2cat.post_id) AS cat_count,206 COUNT($wpdb->post2cat.post_id) AS cat_count, 207 207 DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth 208 FROM $ tablecategories LEFT JOIN $tablepost2cat ON (cat_ID = category_id)209 LEFT JOIN $ tableposts ON (ID = post_id)208 FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (cat_ID = category_id) 209 LEFT JOIN $wpdb->posts ON (ID = post_id) 210 210 WHERE cat_ID > 0 211 211 "; … … 266 266 267 267 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '') { 268 global $ tablecategories, $tableposts, $tablepost2cat, $wpdb, $category_posts;268 global $wpdb, $category_posts; 269 269 global $querystring_start, $querystring_equal, $querystring_separator; 270 270 // Optiondates now works … … 288 288 $query = " 289 289 SELECT cat_ID, cat_name, category_nicename, category_description, category_parent 290 FROM $ tablecategories290 FROM $wpdb->categories 291 291 WHERE cat_ID > 0 $exclusions 292 292 ORDER BY $sort_column $sort_order"; … … 296 296 if (!count($category_posts)) { 297 297 $cat_counts = $wpdb->get_results(" SELECT cat_ID, 298 COUNT($ tablepost2cat.post_id) AS cat_count299 FROM $ tablecategories300 INNER JOIN $ tablepost2cat ON (cat_ID = category_id)301 INNER JOIN $ tableposts ON (ID = post_id)298 COUNT($wpdb->post2cat.post_id) AS cat_count 299 FROM $wpdb->categories 300 INNER JOIN $wpdb->post2cat ON (cat_ID = category_id) 301 INNER JOIN $wpdb->posts ON (ID = post_id) 302 302 WHERE post_status = 'publish' $exclusions 303 303 GROUP BY category_id"); … … 312 312 $cat_dates = $wpdb->get_results(" SELECT cat_ID, 313 313 DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth 314 FROM $ tablecategories315 LEFT JOIN $ tablepost2cat ON (cat_ID = category_id)316 LEFT JOIN $ tableposts ON (ID = post_id)314 FROM $wpdb->categories 315 LEFT JOIN $wpdb->post2cat ON (cat_ID = category_id) 316 LEFT JOIN $wpdb->posts ON (ID = post_id) 317 317 WHERE post_status = 'publish' $exclusions 318 318 GROUP BY category_id"); -
trunk/wp-includes/template-functions-comment.php
r1255 r1355 27 27 28 28 function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $number='') { 29 global $id, $comment, $ tablecomments, $wpdb, $comment_count_cache;30 if ('' == $comment_count_cache["$id"]) $number = $wpdb->get_var("SELECT COUNT(*) FROM $ tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");29 global $id, $comment, $wpdb, $comment_count_cache; 30 if ('' == $comment_count_cache["$id"]) $number = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1'"); 31 31 else $number = $comment_count_cache["$id"]; 32 32 if ($number == 0) { … … 57 57 58 58 function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { 59 global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $ tablecomments, $cookiehash;59 global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $cookiehash; 60 60 global $querystring_start, $querystring_equal, $querystring_separator; 61 61 global $comment_count_cache, $single; 62 62 if (!$single) { 63 63 if ('' == $comment_count_cache["$id"]) { 64 $number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $ tablecomments WHERE comment_post_ID = $id AND comment_approved = '1';");64 $number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';"); 65 65 } else { 66 66 $number = $comment_count_cache["$id"]; -
trunk/wp-includes/template-functions-general.php
r1301 r1355 92 92 93 93 function wp_title($sep = '»', $display = true) { 94 global $wpdb , $tableposts, $tablecategories;94 global $wpdb; 95 95 global $year, $monthnum, $day, $cat, $p, $name, $month, $posts, $single; 96 96 … … 102 102 } 103 103 if (!empty($category_name)) { 104 $title = stripslashes($wpdb->get_var("SELECT cat_name FROM $ tablecategories WHERE category_nicename = '$category_name'"));104 $title = stripslashes($wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'")); 105 105 } 106 106 … … 137 137 138 138 function single_post_title($prefix = '', $display = true) { 139 global $p, $name, $wpdb , $tableposts;139 global $p, $name, $wpdb; 140 140 if (intval($p) || '' != $name) { 141 141 if (!$p) { 142 $p = $wpdb->get_var("SELECT ID FROM $ tableposts WHERE post_name = '$name'");142 $p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'"); 143 143 } 144 144 $post_data = get_postdata($p); … … 203 203 204 204 function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) { 205 global $tableposts;206 205 global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb; 207 206 … … 244 243 245 244 if ('monthly' == $type) { 246 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $ tableposts WHERE post_date < '$now' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);245 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 247 246 if ($arcresults) { 248 247 $afterafter = $after; … … 259 258 } 260 259 } elseif ('daily' == $type) { 261 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $ tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);260 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 262 261 if ($arcresults) { 263 262 foreach ($arcresults as $arcresult) { … … 270 269 } elseif ('weekly' == $type) { 271 270 $start_of_week = get_settings('start_of_week'); 272 $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $ tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);271 $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 273 272 $arc_w_last = ''; 274 273 if ($arcresults) { … … 289 288 } 290 289 } elseif ('postbypost' == $type) { 291 $arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $ tableposts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);290 $arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 292 291 if ($arcresults) { 293 292 foreach ($arcresults as $arcresult) { … … 308 307 309 308 function get_calendar($daylength = 1) { 310 global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $ tableposts, $posts;309 global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $posts; 311 310 312 311 // Quick check. If we have no posts at all, abort! 313 312 if (!$posts) { 314 $gotsome = $wpdb->get_var("SELECT ID from $ tableposts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1");313 $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); 315 314 if (!$gotsome) 316 315 return; … … 350 349 // Get the next and previous month and year with at least one post 351 350 $previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year 352 FROM $ tableposts351 FROM $wpdb->posts 353 352 WHERE post_date < '$thisyear-$thismonth-01' 354 353 AND post_status = 'publish' … … 356 355 LIMIT 1"); 357 356 $next = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year 358 FROM $ tableposts357 FROM $wpdb->posts 359 358 WHERE post_date > '$thisyear-$thismonth-01' 360 359 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) … … 410 409 // Get days with posts 411 410 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 412 FROM $ tableposts WHERE MONTH(post_date) = $thismonth411 FROM $wpdb->posts WHERE MONTH(post_date) = $thismonth 413 412 AND YEAR(post_date) = $thisyear 414 413 AND post_status = 'publish' … … 434 433 $ak_titles_for_day = array(); 435 434 $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom " 436 ."FROM $ tableposts "435 ."FROM $wpdb->posts " 437 436 ."WHERE YEAR(post_date) = '$thisyear' " 438 437 ."AND MONTH(post_date) = '$thismonth' " -
trunk/wp-includes/template-functions-links.php
r1305 r1355 28 28 29 29 function get_permalink($id=false) { 30 global $post, $wpdb , $tableposts;30 global $post, $wpdb; 31 31 global $querystring_start, $querystring_equal; 32 32 … … 59 59 } 60 60 } else { // if an ID is given 61 $idpost = $wpdb->get_row("SELECT post_date, post_name FROM $ tableposts WHERE ID = $id");61 $idpost = $wpdb->get_row("SELECT post_date, post_name FROM $wpdb->posts WHERE ID = $id"); 62 62 if ('' != get_settings('permalink_structure')) { 63 63 $unixtime = strtotime($idpost->post_date); -
trunk/wp-includes/template-functions-post.php
r1254 r1355 276 276 277 277 function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') { 278 global $ tableposts, $id, $post, $wpdb;278 global $id, $post, $wpdb; 279 279 global $p, $posts, $posts_per_page, $s, $single; 280 280 global $querystring_start, $querystring_equal, $querystring_separator; … … 300 300 301 301 $limitprev--; 302 $lastpost = @$wpdb->get_row("SELECT ID, post_title FROM $ tableposts WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev, 1");302 $lastpost = @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev, 1"); 303 303 if ($lastpost) { 304 304 $string = '<a href="'.get_permalink($lastpost->ID).'">'.$previous; … … 314 314 315 315 function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { 316 global $ tableposts, $posts_per_page, $post, $wpdb, $single;316 global $posts_per_page, $post, $wpdb, $single; 317 317 if(1 == $posts_per_page || 1 == $single) { 318 318 … … 338 338 $limitnext--; 339 339 340 $nextpost = @$wpdb->get_row("SELECT ID,post_title FROM $ tableposts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_status = 'publish' $sqlcat $sql_exclude_cats AND ID != $post->ID ORDER BY post_date ASC LIMIT $limitnext,1");340 $nextpost = @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_status = 'publish' $sqlcat $sql_exclude_cats AND ID != $post->ID ORDER BY post_date ASC LIMIT $limitnext,1"); 341 341 if ($nextpost) { 342 342 $string = '<a href="'.get_permalink($nextpost->ID).'">'.$next; -
trunk/wp-includes/wp-db.php
r1218 r1355 19 19 var $last_query; 20 20 var $col_info; 21 22 // Our tables 23 var $posts; 24 var $users; 25 var $categories; 26 var $post2cat; 27 var $comments; 28 var $links; 29 var $linkcategories; 30 var $options; 31 var $optiontypes; 32 var $optionvalues; 33 var $optiongroups; 34 var $optiongroup_options; 35 var $postmeta; 21 36 22 37 // ================================================================== -
trunk/wp-links-opml.php
r1121 r1355 13 13 $link_cat = intval($link_cat); 14 14 if ($link_cat != 0) { 15 $sql_cat = "AND $ tablelinks.link_category = $link_cat";16 $cat_name = $wpdb->get_var("SELECT $ tablelinkcategories.cat_name FROM $tablelinkcategories WHERE $tablelinkcategories.cat_id = $link_cat");15 $sql_cat = "AND $wpdb->links.link_category = $link_cat"; 16 $cat_name = $wpdb->get_var("SELECT $wpdb->linkcategories.cat_name FROM $wpdb->linkcategories WHERE $wpdb->linkcategories.cat_id = $link_cat"); 17 17 if (!empty($cat_name)) { 18 18 $cat_name = ": category $cat_name"; … … 28 28 </head> 29 29 <body> 30 <?php $sql = "SELECT $ tablelinks.link_url, link_rss, $tablelinks.link_name, $tablelinks.link_category, $tablelinkcategories.cat_name31 FROM $ tablelinks32 LEFT JOIN $ tablelinkcategories on $tablelinks.link_category = $tablelinkcategories.cat_id30 <?php $sql = "SELECT $wpdb->links.link_url, link_rss, $wpdb->links.link_name, $wpdb->links.link_category, $wpdb->linkcategories.cat_name 31 FROM $wpdb->links 32 LEFT JOIN $wpdb->linkcategories on $wpdb->links.link_category = $wpdb->linkcategories.cat_id 33 33 $sql_cat 34 ORDER BY $ tablelinkcategories.cat_name, $tablelinks.link_name \n";34 ORDER BY $wpdb->linkcategories.cat_name, $wpdb->links.link_name \n"; 35 35 //echo("<!-- $sql -->"); 36 36 $prev_cat_id = 0; -
trunk/wp-login.php
r1302 r1355 73 73 function login() { 74 74 global $wpdb, $log, $pwd, $error, $user_ID; 75 global $ tableusers, $pass_is_md5;75 global $pass_is_md5; 76 76 $user_login = &$log; 77 77 $pwd = md5($pwd); … … 87 87 } 88 88 89 $query = "SELECT ID, user_login, user_pass FROM $ tableusers WHERE user_login = '$user_login' AND user_pass = '$password'";89 $query = "SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$user_login' AND user_pass = '$password'"; 90 90 91 91 $login = $wpdb->get_row($query); … … 209 209 $user_pass = substr((MD5("time" . rand(1,16000))), 0, 6); 210 210 // now insert the new pass md5'd into the db 211 $wpdb->query("UPDATE $ tableusers SET user_pass = MD5('$user_pass') WHERE user_login = '$user_login'");211 $wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$user_pass') WHERE user_login = '$user_login'"); 212 212 $message = "Login: $user_login\r\n"; 213 213 $message .= "Password: $user_pass\r\n"; -
trunk/wp-mail.php
r1313 r1355 122 122 123 123 124 $sql = "INSERT INTO $ tableposts (post_author, post_date, post_date_gmt, post_content, post_title, post_modified, post_modified_gmt) VALUES (1, '$post_date', '$post_date_gmt', '$content', '$post_title', '$post_date', '$post_date_gmt')";124 $sql = "INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_modified, post_modified_gmt) VALUES (1, '$post_date', '$post_date_gmt', '$content', '$post_title', '$post_date', '$post_date_gmt')"; 125 125 126 126 $result = $wpdb->query($sql); … … 139 139 140 140 // Double check it's not there already 141 $exists = $wpdb->get_row("SELECT * FROM $ tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");141 $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category"); 142 142 143 143 if (!$exists && $result) { 144 144 $wpdb->query(" 145 INSERT INTO $ tablepost2cat145 INSERT INTO $wpdb->post2cat 146 146 (post_id, category_id) 147 147 VALUES -
trunk/wp-register.php
r1309 r1355 72 72 73 73 /* checking the login isn't already used by another user */ 74 $result = $wpdb->get_results("SELECT user_login FROM $ tableusers WHERE user_login = '$user_login'");74 $result = $wpdb->get_results("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'"); 75 75 if (count($result) >= 1) { 76 76 die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.')); … … 87 87 $new_users_can_blog = get_settings('new_users_can_blog'); 88 88 89 $result = $wpdb->query("INSERT INTO $ tableusers89 $result = $wpdb->query("INSERT INTO $wpdb->users 90 90 (user_login, user_pass, user_nickname, user_email, user_ip, user_browser, dateYMDhour, user_level, user_idmode) 91 91 VALUES -
trunk/wp-settings.php
r1243 r1355 10 10 error_reporting(E_ALL ^ E_NOTICE); 11 11 12 // Table names13 $tableposts = $table_prefix . 'posts';14 $tableusers = $table_prefix . 'users';15 $tablesettings = $table_prefix . 'settings'; // only used during upgrade16 $tablecategories = $table_prefix . 'categories';17 $tablepost2cat = $table_prefix . 'post2cat';18 $tablecomments = $table_prefix . 'comments';19 $tablelinks = $table_prefix . 'links';20 $tablelinkcategories = $table_prefix . 'linkcategories';21 $tableoptions = $table_prefix . 'options';22 $tableoptiontypes = $table_prefix . 'optiontypes';23 $tableoptionvalues = $table_prefix . 'optionvalues';24 $tableoptiongroups = $table_prefix . 'optiongroups';25 $tableoptiongroup_options = $table_prefix . 'optiongroup_options';26 $tablepostmeta = $table_prefix . 'postmeta';27 28 12 define('WPINC', 'wp-includes'); 29 30 13 require_once (ABSPATH . WPINC . '/wp-db.php'); 31 14 15 // Table names 16 $wpdb->posts = $table_prefix . 'posts'; 17 $wpdb->users = $table_prefix . 'users'; 18 $wpdb->categories = $table_prefix . 'categories'; 19 $wpdb->post2cat = $table_prefix . 'post2cat'; 20 $wpdb->comments = $table_prefix . 'comments'; 21 $wpdb->links = $table_prefix . 'links'; 22 $wpdb->linkcategories = $table_prefix . 'linkcategories'; 23 $wpdb->options = $table_prefix . 'options'; 24 $wpdb->optiontypes = $table_prefix . 'optiontypes'; 25 $wpdb->optionvalues = $table_prefix . 'optionvalues'; 26 $wpdb->optiongroups = $table_prefix . 'optiongroups'; 27 $wpdb->optiongroup_options = $table_prefix . 'optiongroup_options'; 28 $wpdb->postmeta = $table_prefix . 'postmeta'; 29 32 30 $wpdb->hide_errors(); 33 $users = $wpdb->get_results("SELECT * FROM $ tableusers");31 $users = $wpdb->get_results("SELECT * FROM $wpdb->users"); 34 32 if (!$users && !strstr($_SERVER['PHP_SELF'], 'install.php')) { 35 33 die("It doesn't look like you've installed WP yet. Try running <a href='wp-admin/install.php'>install.php</a>."); -
trunk/wp-trackback.php
r1150 r1355 29 29 trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.'); 30 30 31 $pingstatus = $wpdb->get_var("SELECT ping_status FROM $ tableposts WHERE ID = $tb_id");31 $pingstatus = $wpdb->get_var("SELECT ping_status FROM $wpdb->posts WHERE ID = $tb_id"); 32 32 33 33 if ('closed' == $pingstatus) … … 73 73 } 74 74 75 $result = $wpdb->query("INSERT INTO $ tablecomments75 $result = $wpdb->query("INSERT INTO $wpdb->comments 76 76 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved) 77 77 VALUES -
trunk/xmlrpc.php
r1351 r1355 164 164 function blogger_getRecentPosts($args) { 165 165 166 global $ tableposts, $wpdb;166 global $wpdb; 167 167 168 168 $blog_ID = $args[1]; /* though we don't use it yet */ … … 181 181 } 182 182 183 $sql = "SELECT * FROM $ tableposts ORDER BY post_date DESC".$limit;183 $sql = "SELECT * FROM $wpdb->posts ORDER BY post_date DESC".$limit; 184 184 $result = $wpdb->get_results($sql); 185 185 … … 323 323 function blogger_newPost($args) { 324 324 325 global $ tableposts, $wpdb;325 global $wpdb; 326 326 327 327 $blog_ID = $args[1]; /* though we don't use it yet */ … … 376 376 377 377 function wp_insert_post($postarr = array()) { 378 global $wpdb, $ tableposts, $post_default_category;378 global $wpdb, $post_default_category; 379 379 380 380 // export array as variables … … 401 401 $post_date_gmt = get_gmt_from_date($post_date); 402 402 403 $sql = "INSERT INTO $ tableposts403 $sql = "INSERT INTO $wpdb->posts 404 404 (post_author, post_date, post_date_gmt, post_modified, post_modified_gmt, post_content, post_title, post_excerpt, post_category, post_status, post_name) 405 405 VALUES ('$post_author', '$post_date', '$post_date_gmt', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_cat', '$post_status', '$post_name')"; … … 417 417 418 418 function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) { 419 global $wpdb , $tablepost2cat;419 global $wpdb; 420 420 // If $post_categories isn't already an array, make it one: 421 421 if (!is_array($post_categories)) { … … 431 431 $old_categories = $wpdb->get_col(" 432 432 SELECT category_id 433 FROM $ tablepost2cat433 FROM $wpdb->post2cat 434 434 WHERE post_id = $post_ID"); 435 435 … … 454 454 foreach ($delete_cats as $del) { 455 455 $wpdb->query(" 456 DELETE FROM $ tablepost2cat456 DELETE FROM $wpdb->post2cat 457 457 WHERE category_id = $del 458 458 AND post_id = $post_ID … … 471 471 foreach ($add_cats as $new_cat) { 472 472 $wpdb->query(" 473 INSERT INTO $ tablepost2cat (post_id, category_id)473 INSERT INTO $wpdb->post2cat (post_id, category_id) 474 474 VALUES ($post_ID, $new_cat)"); 475 475 … … 481 481 482 482 function wp_get_post_cats($blogid = '1', $post_ID = 0) { 483 global $wpdb , $tablepost2cat;483 global $wpdb; 484 484 485 485 $sql = "SELECT category_id 486 FROM $ tablepost2cat486 FROM $wpdb->post2cat 487 487 WHERE post_id = $post_ID 488 488 ORDER BY category_id";
Note: See TracChangeset
for help on using the changeset viewer.