Giant commit, sorry mailing list people. Move all table names to new $wpdb versions. Works but the whole app needs thorough testing now.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-05-24 08:22:18 +00:00
parent 89d5a6fd88
commit 25ae03ee65
52 changed files with 1099 additions and 1096 deletions

View File

@ -19,19 +19,19 @@ function checked($checked, $current) {
}
function get_nested_categories($default = 0) {
global $post_ID, $tablecategories, $tablepost2cat, $mode, $wpdb;
global $post_ID, $mode, $wpdb;
if ($post_ID) {
$checked_categories = $wpdb->get_col("
SELECT category_id
FROM $tablecategories, $tablepost2cat
WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = '$post_ID'
FROM $wpdb->categories, $wpdb->post2cat
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID'
");
} else {
$checked_categories[] = $default;
}
$categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY category_parent DESC, cat_name ASC");
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY category_parent DESC, cat_name ASC");
$result = array();
foreach($categories as $category) {
$array_category = get_object_vars($category);
@ -66,14 +66,14 @@ function dropdown_categories($default = 0) {
// Dandy new recursive multiple category stuff.
function cat_rows($parent = 0, $level = 0, $categories = 0) {
global $wpdb, $tablecategories, $tablepost2cat, $bgcolor;
global $wpdb, $bgcolor;
if (!$categories) {
$categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY cat_name");
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
}
if ($categories) {
foreach ($categories as $category) {
if ($category->category_parent == $parent) {
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $tablepost2cat WHERE category_id = $category->cat_ID");
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
$pad = str_repeat('— ', $level);
$bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee';
@ -91,13 +91,13 @@ function cat_rows($parent = 0, $level = 0, $categories = 0) {
}
function wp_dropdown_cats($currentcat, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) {
global $wpdb, $tablecategories, $tablepost2cat, $bgcolor;
global $wpdb, $bgcolor;
if (!$categories) {
$categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY cat_name");
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
}
if ($categories) {
foreach ($categories as $category) { if ($currentcat != $category->cat_ID && $parent == $category->category_parent) {
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $tablepost2cat WHERE category_id = $category->cat_ID");
$count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID");
$pad = str_repeat('– ', $level);
echo "\n\t<option value='$category->cat_ID'";
if ($currentparent == $category->cat_ID)
@ -199,11 +199,11 @@ function wp_create_thumbnail($file, $max_side, $effect = '') {
// Some postmeta stuff
function has_meta($postid) {
global $wpdb, $tablepostmeta;
global $wpdb;
return $wpdb->get_results("
SELECT meta_key, meta_value, meta_id, post_id
FROM $tablepostmeta
FROM $wpdb->postmeta
WHERE post_id = '$postid'
ORDER BY meta_key,meta_id",ARRAY_A);
@ -240,11 +240,11 @@ function list_meta($meta) {
// Get a list of previously defined keys
function get_meta_keys() {
global $wpdb, $tablepostmeta;
global $wpdb;
$keys = $wpdb->get_col("
SELECT meta_key
FROM $tablepostmeta
FROM $wpdb->postmeta
GROUP BY meta_key
ORDER BY meta_key");
@ -252,10 +252,10 @@ function get_meta_keys() {
}
function meta_form() {
global $wpdb, $tablepostmeta;
global $wpdb;
$keys = $wpdb->get_col("
SELECT meta_key
FROM $tablepostmeta
FROM $wpdb->postmeta
GROUP BY meta_key
ORDER BY meta_id DESC
LIMIT 10");
@ -289,7 +289,7 @@ function meta_form() {
}
function add_meta($post_ID) {
global $wpdb, $tablepostmeta;
global $wpdb;
$metakeyselect = $wpdb->escape( stripslashes( trim($_POST['metakeyselect']) ) );
$metakeyinput = $wpdb->escape( stripslashes( trim($_POST['metakeyinput']) ) );
@ -306,7 +306,7 @@ function add_meta($post_ID) {
$metakey = $metakeyinput; // default
$result = $wpdb->query("
INSERT INTO $tablepostmeta
INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value)
VALUES ('$post_ID','$metakey','$metavalue')
");
@ -314,15 +314,15 @@ function add_meta($post_ID) {
} // add_meta
function delete_meta($mid) {
global $wpdb, $tablepostmeta;
global $wpdb;
$result = $wpdb->query("DELETE FROM $tablepostmeta WHERE meta_id = '$mid'");
$result = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'");
}
function update_meta($mid, $mkey, $mvalue) {
global $wpdb, $tablepostmeta;
global $wpdb;
return $wpdb->query("UPDATE $tablepostmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
return $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
}
function touch_time($edit = 1) {

View File

@ -14,7 +14,7 @@ if (!isset($blogID)) $blog_ID=1;
if (!isset($debug)) $debug=0;
timer_start();
$dogs = $wpdb->get_results("SELECT * FROM $tablecategories WHERE 1=1");
$dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE 1=1");
foreach ($dogs as $catt) {
$cache_categories[$catt->cat_ID] = $catt;
}

View File

@ -5,7 +5,7 @@ require_once('../wp-config.php');
/* Checking login & pass in the database */
function veriflog() {
global $cookiehash;
global $tableusers, $wpdb;
global $wpdb;
if (!empty($_COOKIE['wordpressuser_' . $cookiehash])) {
$user_login = $_COOKIE['wordpressuser_' . $cookiehash];
@ -19,7 +19,7 @@ function veriflog() {
if (!$user_pass_md5)
return false;
$login = $wpdb->get_row("SELECT user_login, user_pass FROM $tableusers WHERE user_login = '$user_login'");
$login = $wpdb->get_row("SELECT user_login, user_pass FROM $wpdb->users WHERE user_login = '$user_login'");
if (!$login) {
return false;

View File

@ -51,7 +51,7 @@ case 'addcat':
$category_description = addslashes(stripslashes(stripslashes($_POST['category_description'])));
$cat = intval($_POST['cat']);
$wpdb->query("INSERT INTO $tablecategories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$cat')");
$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')");
header('Location: categories.php?message=1#addcat');
@ -67,7 +67,7 @@ case 'Delete':
$cat_ID = intval($_GET["cat_ID"]);
$cat_name = get_catname($cat_ID);
$cat_name = addslashes($cat_name);
$category = $wpdb->get_row("SELECT * FROM $tablecategories WHERE cat_ID = '$cat_ID'");
$category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
$cat_parent = $category->category_parent;
if (1 == $cat_ID)
@ -76,9 +76,9 @@ case 'Delete':
if ($user_level < 3)
die (__('Cheatin&#8217; uh?'));
$wpdb->query("DELETE FROM $tablecategories WHERE cat_ID = '$cat_ID'");
$wpdb->query("UPDATE $tablecategories SET category_parent = '$cat_parent' WHERE category_parent = '$cat_ID'");
$wpdb->query("UPDATE $tablepost2cat SET category_id='1' WHERE category_id='$cat_ID'");
$wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
$wpdb->query("UPDATE $wpdb->categories SET category_parent = '$cat_parent' WHERE category_parent = '$cat_ID'");
$wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'");
header('Location: categories.php?message=2');
@ -88,7 +88,7 @@ case 'edit':
require_once ('admin-header.php');
$cat_ID = intval($_GET['cat_ID']);
$category = $wpdb->get_row("SELECT * FROM $tablecategories WHERE cat_ID = '$cat_ID'");
$category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
$cat_name = stripslashes($category->cat_name);
?>
@ -129,7 +129,7 @@ case 'editedcat':
$category_nicename = sanitize_title($cat_name);
$category_description = $wpdb->escape(stripslashes($_POST['category_description']));
$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'");
$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'");
header('Location: categories.php?message=3');

View File

@ -45,10 +45,10 @@ if (!empty($delete_comments)) {
$del_comments = ''; $safe_delete_commeents = ''; $i = 0;
foreach ($delete_comments as $comment) { // Check the permissions on each
$comment = intval($comment);
$post_id = $wpdb->get_var("SELECT comment_post_ID FROM $tablecomments WHERE comment_ID = $comment");
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $tableposts WHERE ID = $post_id"));
$post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id"));
if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {
$wpdb->query("DELETE FROM $tablecomments WHERE comment_ID = $comment");
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID = $comment");
++$i;
}
}
@ -57,7 +57,7 @@ if (!empty($delete_comments)) {
if (isset($_GET['s'])) {
$s = $wpdb->escape($_GET['s']);
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE
comment_author LIKE '%$s%' OR
comment_author_email LIKE '%$s%' OR
comment_author_url LIKE ('%$s%') OR
@ -65,13 +65,13 @@ if (isset($_GET['s'])) {
comment_content LIKE ('%$s%')
ORDER BY comment_date DESC");
} else {
$comments = $wpdb->get_results("SELECT * FROM $tablecomments ORDER BY comment_date DESC LIMIT 20");
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments ORDER BY comment_date DESC LIMIT 20");
}
if ('view' == $mode) {
if ($comments) {
echo '<ol>';
foreach ($comments as $comment) {
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $tableposts WHERE ID = $comment->comment_post_ID"));
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$comment_status = wp_get_comment_status($comment->comment_ID);
if ('unapproved' == $comment_status) {
echo '<li class="unapproved" style="border-bottom: 1px solid #ccc;">';
@ -89,7 +89,7 @@ if ('view' == $mode) {
echo " | <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), $comment->comment_author) . "')\">" . __('Delete Comment') . "</a> &#8212; ";
} // end if any comments to show
// Get post title
$post_title = $wpdb->get_var("SELECT post_title FROM $tableposts WHERE ID = $comment->comment_post_ID");
$post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID");
$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?> <a href="post.php?action=edit&amp;post=<?php echo $comment->comment_post_ID; ?>"><?php printf(__('Edit Post &#8220;%s&#8221;'), stripslashes($post_title)); ?></a> | <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php _e('View Post') ?></a></p>
</li>
@ -119,7 +119,7 @@ if ('view' == $mode) {
<th scope="col" colspan="3">' . __('Actions') . '</th>
</tr>';
foreach ($comments as $comment) {
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $tableposts WHERE ID = $comment->comment_post_ID"));
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
$bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee';
?>
<tr style='background-color: <?php echo $bgcolor; ?>'>

View File

@ -12,7 +12,7 @@ require_once('admin-header.php');
</ul>
<?php
get_currentuserinfo();
$drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID");
$drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID");
if ($drafts) {
?>
<div class="wrap">
@ -47,7 +47,7 @@ if( isset( $_GET['m'] ) )
<legend><?php _e('Show Posts From Month of...') ?></legend>
<select name='m'>
<?php
$arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $tableposts ORDER BY post_date DESC");
$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");
foreach ($arc_result as $arc_row) {
$arc_year = $arc_row->yyear;
$arc_month = $arc_row->mmonth;
@ -125,7 +125,7 @@ $bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee';
<?php
if ( 1 == count($posts) ) {
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id ORDER BY comment_date");
if ($comments) {
?>
<h3><?php _e('Comments') ?></h3>

View File

@ -82,32 +82,32 @@ if (!$result) {
}
while ($row = mysql_fetch_row($result)) {
if ($row[0] == $tablelinks)
if ($row[0] == $wpdb->links)
$got_links = true;
if ($row[0] == $tablelinkcategories)
if ($row[0] == $wpdb->linkcategories)
$got_cats = true;
//print "Table: $row[0]<br />\n";
}
if (!$got_cats) {
echo "<p>Can't find table '$tablelinkcategories', gonna create it...</p>\n";
$sql = "CREATE TABLE $tablelinkcategories ( " .
echo "<p>Can't find table '$wpdb->linkcategories', gonna create it...</p>\n";
$sql = "CREATE TABLE $wpdb->linkcategories ( " .
" cat_id int(11) NOT NULL auto_increment, " .
" cat_name tinytext NOT NULL, ".
" auto_toggle enum ('Y','N') NOT NULL default 'N', ".
" PRIMARY KEY (cat_id) ".
") ";
$result = mysql_query($sql) or print ("Can't create the table '$tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
$result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
echo "<p>Table '$tablelinkcategories' created OK</p>\n";
echo "<p>Table '$wpdb->linkcategories' created OK</p>\n";
$got_cats = true;
}
} else {
echo "<p>Found table '$tablelinkcategories', don't need to create it...</p>\n";
echo "<p>Found table '$wpdb->linkcategories', don't need to create it...</p>\n";
$got_cats = true;
}
if (!$got_links) {
echo "<p>Can't find '$tablelinks', gonna create it...</p>\n";
$sql = "CREATE TABLE $tablelinks ( " .
echo "<p>Can't find '$wpdb->links', gonna create it...</p>\n";
$sql = "CREATE TABLE $wpdb->links ( " .
" link_id int(11) NOT NULL auto_increment, " .
" link_url varchar(255) NOT NULL default '', " .
" link_name varchar(255) NOT NULL default '', " .
@ -123,38 +123,38 @@ if (!$got_links) {
" link_notes MEDIUMTEXT NOT NULL default '', " .
" PRIMARY KEY (link_id) " .
") ";
$result = mysql_query($sql) or print ("Can't create the table '$tablelinks' in the database.<br />" . $sql . "<br />" . mysql_error());
$links = mysql_query("INSERT INTO $tablelinks VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
$links = mysql_query("INSERT INTO $tablelinks VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
$links = mysql_query("INSERT INTO $tablelinks VALUES ('', 'http://zed1.com/b2/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
$result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.<br />" . $sql . "<br />" . mysql_error());
$links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
$links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
$links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/b2/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '');");
if ($result != false) {
echo "<p>Table '$tablelinks' created OK</p>\n";
echo "<p>Table '$wpdb->links' created OK</p>\n";
$got_links = true;
}
} else {
echo "<p>Found table '$tablelinks', don't need to create it...</p>\n";
echo "<p>Found table '$wpdb->links', don't need to create it...</p>\n";
echo "<p>... may need to update it though. Looking for column link_updated...</p>\n";
$query = "SELECT link_updated FROM $tablelinks LIMIT 1";
$query = "SELECT link_updated FROM $wpdb->links LIMIT 1";
$q = @mysql_query($query);
if ($q != false) {
if ($row = mysql_fetch_object($q)) {
echo "<p>You have column link_updated. Good!</p>\n";
}
} else {
$query = "ALTER TABLE $tablelinks ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'";
$query = "ALTER TABLE $wpdb->links ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'";
$q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error());
echo "<p>Added column link_updated...</p>\n";
}
echo "<p>Looking for column link_rel...</p>\n";
$query = "SELECT link_rel FROM $tablelinks LIMIT 1";
$query = "SELECT link_rel FROM $wpdb->links LIMIT 1";
$q = @mysql_query($query);
if ($q != false) {
if ($row = mysql_fetch_object($q)) {
echo "<p>You have column link_rel. Good!</p>\n";
}
} else {
$query = "ALTER TABLE $tablelinks ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '' ";
$query = "ALTER TABLE $wpdb->links ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '' ";
$q = mysql_query($query) or mysql_doh("Doh, couldn't add column.", $query, mysql_error());
echo "<p>Added column link_rel...</p>\n";
}
@ -163,15 +163,15 @@ if (!$got_links) {
if ($got_links && $got_cats) {
echo "<p>Looking for category 1...</p>\n";
$sql = "SELECT * FROM $tablelinkcategories WHERE cat_id=1 ";
$result = mysql_query($sql) or print ("Can't query '$tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error());
$sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 ";
$result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
if ($row = mysql_fetch_object($result)) {
echo "<p>You have at least 1 category. Good!</p>\n";
$got_row = true;
} else {
echo "<p>Gonna insert category 1...</p>\n";
$sql = "INSERT INTO $tablelinkcategories (cat_id, cat_name) VALUES (1, 'General')";
$sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'General')";
$result = mysql_query($sql) or print ("Can't query insert category.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
echo "<p>Inserted category Ok</p>\n";
@ -196,10 +196,10 @@ if ($got_row) {
<?php
$query = "ALTER TABLE $tableposts ADD COLUMN post_excerpt text NOT NULL;";
$query = "ALTER TABLE $wpdb->posts ADD COLUMN post_excerpt text NOT NULL;";
$q = $wpdb->query($query);
// 0.71 mods
$query = "ALTER TABLE $tableposts ADD post_status ENUM('publish','draft','private') NOT NULL,
$query = "ALTER TABLE $wpdb->posts ADD post_status ENUM('publish','draft','private') NOT NULL,
ADD comment_status ENUM('open','closed') NOT NULL,
ADD ping_status ENUM('open','closed') NOT NULL,
ADD post_password varchar(20) NOT NULL;";
@ -209,7 +209,7 @@ $q = $wpdb->query($query);
<p>That went well! Now let's clean up the b2 database structure a bit...</p>
<?php
$query = "ALTER TABLE $tableposts DROP INDEX ID";
$query = "ALTER TABLE $wpdb->posts DROP INDEX ID";
$q = $wpdb->query($query);
@ -217,17 +217,11 @@ $q = $wpdb->query($query);
<p>One down, two to go...</p>
<?php
$query="ALTER TABLE $tablesettings DROP INDEX ID";
$q = $wpdb->query($query);
?>
<p>So far so good.</p>
<?php
$query="ALTER TABLE $tableposts DROP post_karma";
$query="ALTER TABLE $wpdb->posts DROP post_karma";
$q = $wpdb->query($query);
flush();
?>
@ -236,7 +230,7 @@ flush();
<?php
$query = "ALTER TABLE $tableusers DROP INDEX ID";
$query = "ALTER TABLE $wpdb->users DROP INDEX ID";
$q = $wpdb->query($query);
upgrade_all();

View File

@ -63,7 +63,7 @@ case "step1":
$post_author = trim(addslashes($postinfo[1]));
// we'll check the author is registered already
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$post_author'");
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$post_author'");
if (!$user) { // seems s/he's not, so let's register
$user_ip = '127.0.0.1';
$user_domain = 'localhost';
@ -76,7 +76,7 @@ case "step1":
$user_url = addslashes('');
$user_joindate = addslashes($user_joindate);
$result = $wpdb->query("
INSERT INTO $tableusers (
INSERT INTO $wpdb->users (
user_login,
user_pass,
user_nickname,
@ -105,7 +105,7 @@ case "step1":
echo ": Registered user <strong>$user_login</strong>";
}
$post_author_ID = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$post_author'");
$post_author_ID = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$post_author'");
$post_date = explode(' ', $post_date);
$post_date_Ymd = explode('/', $post_date[0]);
@ -128,7 +128,7 @@ case "step1":
$post_title = addslashes($post_title);
// Quick-n-dirty check for dups:
$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);
$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);
if ($dupcheck[0]['ID']) {
print "<br />\nSkipping duplicate post, ID = '" . $dupcheck[0]['ID'] . "'<br />\n";
print "Timestamp: " . $post_date . "<br />\n";
@ -137,7 +137,7 @@ case "step1":
}
$result = $wpdb->query("
INSERT INTO $tableposts
INSERT INTO $wpdb->posts
(post_author,post_date,post_content,post_title,post_category)
VALUES
('$post_author_ID','$post_date','$post_content','$post_title','1')
@ -151,7 +151,7 @@ case "step1":
/* we've still got a bug that adds some empty posts with the date 0000-00-00 00:00:00
here's the bugfix: */
$result = $wpdb->query("DELETE FROM $tableposts WHERE post_date=\"0000-00-00 00:00:00\"");
$result = $wpdb->query("DELETE FROM $wpdb->posts WHERE post_date=\"0000-00-00 00:00:00\"");
upgrade_all();
?>

View File

@ -87,13 +87,13 @@ textarea,input,select {
$user_url=addslashes($userdata[3]);
$user_joindate=addslashes($user_joindate);
$loginthere = $wpdb->get_var("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
$loginthere = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
if ($loginthere) {
echo "<li>user <i>$user_login</i>... <b>Already exists</b></li>";
continue;
}
$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')";
$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')";
$result = mysql_query($query);
if ($result==false) {
die ("<strong>ERROR</strong>: couldn't register an user!");
@ -139,7 +139,7 @@ textarea,input,select {
$post_author=trim(addslashes($postinfo[1]));
// we'll check the author is registered, or if it's a deleted author
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
$sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
$result = mysql_query($sql);
if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2
$user_ip="127.0.0.1";
@ -152,7 +152,7 @@ textarea,input,select {
$user_email=addslashes("user@deleted.com");
$user_url=addslashes("");
$user_joindate=addslashes($user_joindate);
$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')";
$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')";
$result = mysql_query($query);
if ($result==false) {
die ("<strong>ERROR</strong>: couldn't register an user!");
@ -160,7 +160,7 @@ textarea,input,select {
echo ": registered deleted user <i>$user_login</i> at level 0 ";
}
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
$sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$post_author_ID=$myrow[0];
@ -187,26 +187,26 @@ textarea,input,select {
$post_karma=$postinfo[12];
$query = "INSERT INTO $tableposts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')";
$query = "INSERT INTO $wpdb->posts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')";
$result = mysql_query($query) or die(mysql_error());
if (!$result)
die ("Error in posting...");
$sql2 = "SELECT * FROM $tableposts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
$sql2 = "SELECT * FROM $wpdb->posts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
$result2 = mysql_query($sql2);
$myrow2 = mysql_fetch_array($result2);
$post_ID=$myrow2[0];
// Grab a default category.
$post_category = $wpdb->get_var("SELECT cat_ID FROM $tablecategories LIMIT 1");
$post_category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
// Update the post2cat table.
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");
$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
if (!$exists) {
$wpdb->query("
INSERT INTO $tablepost2cat
INSERT INTO $wpdb->post2cat
(post_id, category_id)
VALUES
($post_ID, $post_category)
@ -236,7 +236,7 @@ textarea,input,select {
$comment_content=addslashes($commentinfo[12]);
$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')";
$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')";
$result3 = mysql_query($sql3);
if (!$result3)
die ("There is an error with the database, it can't store your comment..");

View File

@ -94,18 +94,18 @@ preg_match('|<event>(.*?)</event>|is', $post, $content);
$content = str_replace( array('<![CDATA[', ']]>'), '', addslashes( trim($content[1]) ) );
// Now lets put it in the DB
if ($wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$title' AND post_date = '$post_date'")) :
if ($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'")) :
echo 'Post already imported';
else :
$wpdb->query("INSERT INTO $tableposts
$wpdb->query("INSERT INTO $wpdb->posts
(post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name)
VALUES
('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')");
$post_id = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$title' AND post_date = '$post_date'");
$post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
if (!$post_id) die("couldn't get post ID");
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_id AND category_id = 1");
if (!$exists) $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_id, 1) ");
$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1");
if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) ");
echo 'Done!</li>';
endif;

View File

@ -71,8 +71,8 @@ $temp = array();
$posts = explode("--------", $importdata);
function users_form($n) {
global $wpdb, $tableusers, $testing;
$users = $wpdb->get_results("SELECT * FROM $tableusers ORDER BY ID");
global $wpdb, $testing;
$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
?><select name="userselect[<?php echo $n; ?>]">
<option value="#NONE#">- Select -</option>
<?php foreach($users as $user) {
@ -147,25 +147,25 @@ for ($x = 1; $x < $y; $x++) {
$j = -1;
//function to check the authorname and do the mapping
function checkauthor($author) {
global $wpdb, $tableusers, $mtnames, $newauthornames, $j;//mtnames is an array with the names in the mt import file
global $wpdb, $mtnames, $newauthornames, $j;//mtnames is an array with the names in the mt import file
$md5pass = md5(changeme);
if (!(in_array($author, $mtnames))) { //a new mt author name is found
++$j;
$mtnames[$j] = $author; //add that new mt author name to an array
$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 user
$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
if (!$user_id) { //banging my head against the desk now.
if ($newauthornames[$j] == 'left_blank') { //check if the user does not want to change the authorname
$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 $author
$user_id = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$author'");
$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
$user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$author'");
$newauthornames[$j] = $author; //now we have a name, in the place of left_blank.
} else {
$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 name
$user_id = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$newauthornames[$j]'");
$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
$user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$newauthornames[$j]'");
}
} else return $user_id; // return pre-existing wp username if it exists
} else {
$key = array_search($author, $mtnames); //find the array key for $author in the $mtnames array
$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 $newauthornames
$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
}
return $user_id;
}//function checkauthor ends here
@ -272,31 +272,31 @@ foreach ($posts as $post) { if ('' != trim($post)) {
} // End foreach
// Let's check to see if it's in already
if ($wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$post_title' AND post_date = '$post_date'")) {
if ($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'")) {
echo "Post already imported.";
} else {
$post_author = checkauthor($post_author);//just so that if a post already exists, new users are not created by checkauthor
$wpdb->query("INSERT INTO $tableposts (
$wpdb->query("INSERT INTO $wpdb->posts (
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)
VALUES
('$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')");
$post_id = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$post_title' AND post_date = '$post_date'");
$post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$post_title' AND post_date = '$post_date'");
if (0 != count($post_categories)) {
foreach ($post_categories as $post_category) {
// See if the category exists yet
$cat_id = $wpdb->get_var("SELECT cat_ID from $tablecategories WHERE cat_name = '$post_category'");
$cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
if (!$cat_id && '' != trim($post_category)) {
$cat_nicename = sanitize_title($post_category);
$wpdb->query("INSERT INTO $tablecategories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");
$cat_id = $wpdb->get_var("SELECT cat_ID from $tablecategories WHERE cat_name = '$post_category'");
$wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");
$cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
}
if ('' == trim($post_category)) $cat_id = 1;
// Double check it's not there already
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_id AND category_id = $cat_id");
$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id");
if (!$exists) {
$wpdb->query("
INSERT INTO $tablepost2cat
INSERT INTO $wpdb->post2cat
(post_id, category_id)
VALUES
($post_id, $cat_id)
@ -304,8 +304,8 @@ foreach ($posts as $post) { if ('' != trim($post)) {
}
} // end category loop
} else {
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_id AND category_id = 1");
if (!$exists) $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_id, 1) ");
$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1");
if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) ");
}
echo " Post imported successfully...";
// Now for comments
@ -338,8 +338,8 @@ foreach ($posts as $post) { if ('' != trim($post)) {
$comment_content = str_replace('-----', '', $comment_content);
// Check if it's already there
if (!$wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) {
$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)
if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) {
$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)
VALUES
($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')");
echo " Comment added.";
@ -383,8 +383,8 @@ foreach ($posts as $post) { if ('' != trim($post)) {
$comment_content = "<trackback /><strong>$ping_title</strong>\n$comment_content";
// Check if it's already there
if (!$wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) {
$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)
if (!$wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_date = '$comment_date' AND comment_content = '$comment_content'")) {
$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)
VALUES
($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')");
echo " Comment added.";

View File

@ -124,9 +124,9 @@ $content = str_replace('<hr>', '<hr />', $content);
// This can mess up on posts with no titles, but checking content is much slower
// So we do it as a last resort
if ('' == $title) :
$dupe = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_content = '$content' AND post_date = '$post_date'");
$dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' AND post_date = '$post_date'");
else :
$dupe = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$title' AND post_date = '$post_date'");
$dupe = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
endif;
// Now lets put it in the DB
@ -134,29 +134,29 @@ if ($dupe) :
echo 'Post already imported';
else :
$wpdb->query("INSERT INTO $tableposts
$wpdb->query("INSERT INTO $wpdb->posts
(post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name)
VALUES
('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')");
$post_id = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$title' AND post_date = '$post_date'");
$post_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' AND post_date = '$post_date'");
if (!$post_id) die("couldn't get post ID");
if (0 != count($categories)) :
foreach ($categories as $post_category) :
$post_category = unhtmlentities($post_category);
// See if the category exists yet
$cat_id = $wpdb->get_var("SELECT cat_ID from $tablecategories WHERE cat_name = '$post_category'");
$cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
if (!$cat_id && '' != trim($post_category)) {
$cat_nicename = sanitize_title($post_category);
$wpdb->query("INSERT INTO $tablecategories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");
$cat_id = $wpdb->get_var("SELECT cat_ID from $tablecategories WHERE cat_name = '$post_category'");
$wpdb->query("INSERT INTO $wpdb->categories (cat_name, category_nicename) VALUES ('$post_category', '$cat_nicename')");
$cat_id = $wpdb->get_var("SELECT cat_ID from $wpdb->categories WHERE cat_name = '$post_category'");
}
if ('' == trim($post_category)) $cat_id = 1;
// Double check it's not there already
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_id AND category_id = $cat_id");
$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id");
if (!$exists) {
$wpdb->query("
INSERT INTO $tablepost2cat
INSERT INTO $wpdb->post2cat
(post_id, category_id)
VALUES
($post_id, $cat_id)
@ -164,8 +164,8 @@ else :
}
endforeach;
else:
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_id AND category_id = 1");
if (!$exists) $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_id, 1) ");
$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_id AND category_id = 1");
if (!$exists) $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_id, 1) ");
endif;
echo 'Done!</li>';
endif;

View File

@ -71,16 +71,16 @@ if ($connection && $database) {
<p>First let's get posts and comments.</p>
<?php
// For people running this on .72
$query = "ALTER TABLE `$tableposts` ADD `post_name` VARCHAR(200) NOT NULL";
maybe_add_column($tableposts, 'post_name', $query);
$query = "ALTER TABLE `$wpdb->posts` ADD `post_name` VARCHAR(200) NOT NULL";
maybe_add_column($wpdb->posts, 'post_name', $query);
// Create post_name field
$connection = @mysql_connect($tp_database_host, $tp_database_username, $tp_database_password);
$database = @mysql_select_db($tp_database_name);
// For now we're going to give everything the same author and same category
$author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_level = 10 LIMIT 1");
$category = $wpdb->get_var("SELECT cat_ID FROM $tablecategories LIMIT 1");
$author = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_level = 10 LIMIT 1");
$category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
$posts = mysql_query('SELECT * FROM textpattern', $connection);
@ -101,13 +101,13 @@ while ($post = mysql_fetch_array($posts)) {
$title = $post['Title'];
$post_name = sanitize_title($title);
$wpdb->query("INSERT INTO $tableposts
$wpdb->query("INSERT INTO $wpdb->posts
(post_author, post_date, post_content, post_title, post_category, post_name, post_status)
VALUES
('$author', '$posted', '$content', '$title', '$category', '$post_name', 'publish')");
// Get wordpress post id
$wp_post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
$wp_post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1");
// Now let's insert comments if there are any for the TP post
$tp_id = $post['ID'];
@ -117,7 +117,7 @@ while ($post = mysql_fetch_array($posts)) {
// discussid, parentid, name, email, web, ip, posted, message
// For some reason here "posted" is a real MySQL date, so we don't have to do anything about it
// comment_post_ID comment_author comment_author_email comment_author_url comment_author_IP comment_date comment_content comment_karma
$wpdb->query("INSERT INTO $tablecomments
$wpdb->query("INSERT INTO $wpdb->comments
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content)
VALUES
($wp_post_ID, '$comment->name', '$comment->email', '$comment->web', '$comment->ip', '$comment->posted', '$comment->message')");

View File

@ -131,17 +131,17 @@ echo "<p>testing</p>";
echo "<pre>";
//check_column('wp_links', 'link_description', 'mediumtext');
//if (check_column($tablecomments, 'comment_author', 'tinytext'))
//if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
// echo "ok\n";
$error_count = 0;
$tablename = $tablelinks;
$tablename = $wpdb->links;
// check the column
if (!check_column($tablelinks, 'link_description', 'varchar(255)'))
if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
{
$ddl = "ALTER TABLE $tablelinks MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
$q = $wpdb->query($ddl);
}
if (check_column($tablelinks, 'link_description', 'varchar(255)')) {
if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
$res .= $tablename . ' - ok <br />';
} else {
$res .= 'There was a problem with ' . $tablename . '<br />';

View File

@ -50,7 +50,7 @@ else
// Let's check to make sure WP isn't already installed.
$wpdb->hide_errors();
$installed = $wpdb->get_results("SELECT * FROM $tableusers");
$installed = $wpdb->get_results("SELECT * FROM $wpdb->users");
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>'));
$wpdb->show_errors();
switch($step) {
@ -88,15 +88,15 @@ if (!$result) {
}
while ($row = mysql_fetch_row($result)) {
if ($row[0] == $tablelinks)
if ($row[0] == $wpdb->links)
$got_links = true;
if ($row[0] == $tablelinkcategories)
if ($row[0] == $wpdb->linkcategories)
$got_cats = true;
//print "Table: $row[0]<br />\n";
}
if (!$got_cats) {
echo "<p>Can't find table '$tablelinkcategories', gonna create it...</p>\n";
$sql = "CREATE TABLE $tablelinkcategories ( " .
echo "<p>Can't find table '$wpdb->linkcategories', gonna create it...</p>\n";
$sql = "CREATE TABLE $wpdb->linkcategories ( " .
" cat_id int(11) NOT NULL auto_increment, " .
" cat_name tinytext NOT NULL, ".
" auto_toggle enum ('Y','N') NOT NULL default 'N', ".
@ -112,18 +112,18 @@ if (!$got_cats) {
" list_limit int not null default '-1', " .
" PRIMARY KEY (cat_id) ".
") ";
$result = mysql_query($sql) or print ("Can't create the table '$tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
$result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
echo "<p>Table '$tablelinkcategories' created OK</p>\n";
echo "<p>Table '$wpdb->linkcategories' created OK</p>\n";
$got_cats = true;
}
} else {
echo "<p>Found table '$tablelinkcategories', don't need to create it...</p>\n";
echo "<p>Found table '$wpdb->linkcategories', don't need to create it...</p>\n";
$got_cats = true;
}
if (!$got_links) {
echo "<p>Can't find '$tablelinks', gonna create it...</p>\n";
$sql = "CREATE TABLE $tablelinks ( " .
echo "<p>Can't find '$wpdb->links', gonna create it...</p>\n";
$sql = "CREATE TABLE $wpdb->links ( " .
" link_id int(11) NOT NULL auto_increment, " .
" link_url varchar(255) NOT NULL default '', " .
" link_name varchar(255) NOT NULL default '', " .
@ -139,34 +139,34 @@ if (!$got_links) {
" link_notes MEDIUMTEXT NOT NULL default '', " .
" PRIMARY KEY (link_id) " .
") ";
$result = mysql_query($sql) or print ("Can't create the table '$tablelinks' in the database.<br />" . $sql . "<br />" . mysql_error());
$links = mysql_query("INSERT INTO $tablelinks VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$links = mysql_query("INSERT INTO $tablelinks VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$links = mysql_query("INSERT INTO $tablelinks VALUES ('', 'http://zed1.com/journalized/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$links = mysql_query("INSERT INTO $tablelinks VALUES ('', 'http://www.alexking.org/', 'Alex', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$links = mysql_query("INSERT INTO $tablelinks VALUES ('', 'http://dougal.gunters.org/', 'Dougal', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.<br />" . $sql . "<br />" . mysql_error());
$links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/journalized/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://www.alexking.org/', 'Alex', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
$links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://dougal.gunters.org/', 'Dougal', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');");
if ($result != false) {
echo "<p>Table '$tablelinks' created OK</p>\n";
echo "<p>Table '$wpdb->links' created OK</p>\n";
$got_links = true;
}
} else {
echo "<p>Found table '$tablelinks', don't need to create it...</p>\n";
echo "<p>Found table '$wpdb->links', don't need to create it...</p>\n";
$got_links = true;
}
if ($got_links && $got_cats) {
echo "<p>Looking for category 1...</p>\n";
$sql = "SELECT * FROM $tablelinkcategories WHERE cat_id=1 ";
$result = mysql_query($sql) or print ("Can't query '$tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error());
$sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 ";
$result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
if ($row = mysql_fetch_object($result)) {
echo "<p>You have at least 1 category. Good!</p>\n";
$got_row = true;
} else {
echo "<p>Gonna insert category 1...</p>\n";
$sql = "INSERT INTO $tablelinkcategories (cat_id, cat_name) VALUES (1, 'Links')";
$sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Links')";
$result = mysql_query($sql) or print ("Can't query insert category.<br />" . $sql . "<br />" . mysql_error());
if ($result != false) {
echo "<p>Inserted category Ok</p>\n";
@ -193,10 +193,10 @@ if ($got_row) {
# Note: if you want to start again with a clean b2 database,
# just remove the // in this file
// $query = "DROP TABLE IF EXISTS $tableposts";
// $q = mysql_query($query) or die ("doh, can't drop the table \"$tableposts\" in the database.");
// $query = "DROP TABLE IF EXISTS $wpdb->posts";
// $q = mysql_query($query) or die ("doh, can't drop the table \"$wpdb->posts\" in the database.");
$query = "CREATE TABLE $tableposts (
$query = "CREATE TABLE $wpdb->posts (
ID int(10) unsigned NOT NULL auto_increment,
post_author int(4) NOT NULL default '0',
post_date datetime NOT NULL default '0000-00-00 00:00:00',
@ -232,7 +232,7 @@ $q = $wpdb->query($query);
<?php
$now = date('Y-m-d H:i:s');
$now_gmt = gmdate('Y-m-d H:i:s');
$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')";
$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')";
$q = $wpdb->query($query);
?>
@ -240,11 +240,11 @@ $q = $wpdb->query($query);
<p>The test post has been inserted correctly...</p>
<?php
// $query = "DROP TABLE IF EXISTS $tablecategories";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tablecategories\" in the database.");
// $query = "DROP TABLE IF EXISTS $wpdb->categories";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->categories\" in the database.");
$query = "
CREATE TABLE $tablecategories (
CREATE TABLE $wpdb->categories (
cat_ID int(4) NOT NULL auto_increment,
cat_name varchar(55) NOT NULL default '',
PRIMARY KEY (cat_ID),
@ -253,21 +253,21 @@ CREATE TABLE $tablecategories (
";
$q = $wpdb->query($query);
$query = "INSERT INTO $tablecategories (cat_ID, cat_name) VALUES ('0', 'General')";
$query = "INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'General')";
$q = $wpdb->query($query);
$query = "UPDATE $tableposts SET post_category = 1";
$query = "UPDATE $wpdb->posts SET post_category = 1";
$result = $wpdb->query($query);
?>
<p>Categories are up and running...</p>
<?php
// $query = "DROP TABLE IF EXISTS $tablecomments";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tablecomments\" in the database.");
// $query = "DROP TABLE IF EXISTS $wpdb->comments";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->comments\" in the database.");
$query = "
CREATE TABLE $tablecomments (
CREATE TABLE $wpdb->comments (
comment_ID int(11) unsigned NOT NULL auto_increment,
comment_post_ID int(11) NOT NULL default '0',
comment_author tinytext NOT NULL,
@ -293,7 +293,7 @@ $q = $wpdb->query($query);
<?php
$query = "
CREATE TABLE $tablepostmeta (
CREATE TABLE $wpdb->postmeta (
meta_id int(11) NOT NULL auto_increment,
post_id int(11) NOT NULL default 0,
meta_key varchar(255),
@ -312,11 +312,11 @@ $q = $wpdb->query($query);
<p>Post metadata table ready to go...</p>
<?php
// $query = "DROP TABLE IF EXISTS $tableoptions";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableoptions\" in the database.");
// $query = "DROP TABLE IF EXISTS $wpdb->options";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->options\" in the database.");
$query = "
CREATE TABLE $tableoptions (
CREATE TABLE $wpdb->options (
option_id int(11) NOT NULL auto_increment,
blog_id int(11) NOT NULL default 0,
option_name varchar(64) NOT NULL default '',
@ -336,7 +336,7 @@ $q = $wpdb->query($query);
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableoptiontypes\" in the database.");
$query = "
CREATE TABLE $tableoptiontypes (
CREATE TABLE $wpdb->optiontypes (
optiontype_id int(11) NOT NULL auto_increment,
optiontype_name varchar(64) NOT NULL,
PRIMARY KEY (optiontype_id)
@ -349,7 +349,7 @@ $q = $wpdb->query($query);
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableoptiongroups\" in the database.");
$query = "
CREATE TABLE $tableoptiongroups (
CREATE TABLE $wpdb->optiongroups (
group_id int(11) NOT NULL auto_increment,
group_name varchar(64) not null,
group_desc varchar(255),
@ -360,11 +360,11 @@ CREATE TABLE $tableoptiongroups (
$q = $wpdb->query($query);
// $query = "DROP TABLE IF EXISTS $tableoptiongroup_options";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableoptiongroup_options\" in the database.");
// $query = "DROP TABLE IF EXISTS $wpdb->optiongroup_options";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->optiongroup_options\" in the database.");
$query = "
CREATE TABLE $tableoptiongroup_options (
CREATE TABLE $wpdb->optiongroup_options (
group_id int(11) NOT NULL,
option_id int(11) NOT NULL,
seq int(11) NOT NULL,
@ -374,11 +374,11 @@ CREATE TABLE $tableoptiongroup_options (
$q = $wpdb->query($query);
// $query = "DROP TABLE IF EXISTS $tableoptionvalues";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableoptionvalues\" in the database.");
// $query = "DROP TABLE IF EXISTS $wpdb->optionvalues";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->optionvalues\" in the database.");
$query = "
CREATE TABLE $tableoptionvalues (
CREATE TABLE $wpdb->optionvalues (
option_id int(11) NOT NULL,
optionvalue tinytext,
optionvalue_desc varchar(255),
@ -398,145 +398,145 @@ $q = $wpdb->query($query);
<?php
$option_data = array(
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (1, 'integer')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (2, 'boolean')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (3, 'string')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (4, 'date')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (5, 'select')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (6, 'range')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (7, 'sqlselect')",
"INSERT INTO $tableoptiontypes (optiontype_id, optiontype_name) VALUES (8, 'float')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (1, 'integer')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (2, 'boolean')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (3, 'string')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (4, 'date')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (5, 'select')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (6, 'range')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (7, 'sqlselect')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (8, 'float')",
//base options from b2cofig
"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)",
"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)",
"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)",
"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)",
//"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)",
"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)",
"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)",
"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)",
"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&#8217;s charset (here&#8217;s a <a href=\'http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html\'>list of possible charsets</a>)', 8)",
"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)",
"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)",
"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)",
"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)",
//"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)",
"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)",
"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)",
"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)",
"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&#8217;s charset (here&#8217;s a <a href=\'http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html\'>list of possible charsets</a>)', 8)",
// general blog setup
"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)",
//"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
//"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
//rss/rdf feeds
"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)",
"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)",
"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 &lt;description> tag?', 8, 20)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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 &lt;description> tag?', 8, 20)",
"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)",
"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)",
"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)",
"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)",
//file upload
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
// email settings
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
// original options from options page
"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)",
"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)",
"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)",
"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)",
"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)",
"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 $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)",
"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)",
"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)",
"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)",
"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)",
"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)",
//'pages' of options
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(1, 'Other Options', 'Posts per page etc. Original options page')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(1,48,1 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(1,49,2 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(1,50,3 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(1,51,4 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(1,52,5 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(1,53,6 )",
"INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(1, 'Other Options', 'Posts per page etc. Original options page')",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,48,1 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,49,2 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,50,3 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,51,4 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,52,5 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,53,6 )",
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(2, 'General blog settings', 'Things you\'ll probably want to tweak')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,9 ,1 )",
//"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,10,2 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,11,3 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,12,4 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,13,5 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,14,6 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,15,7 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,16,8 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,17,9 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,18,10)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,19,11)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(2,20,12)",
"INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(2, 'General blog settings', 'Things you\'ll probably want to tweak')",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,9 ,1 )",
//"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,10,2 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,11,3 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,12,4 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,13,5 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,14,6 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,15,7 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,16,8 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,17,9 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,18,10)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,19,11)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,20,12)",
"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')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,21,1 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,22,2 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,23,3 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,24,4 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,25,5 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,26,6 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,27,7 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,28,8 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,29,9 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(3,30,10)",
"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')",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,21,1 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,22,2 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,23,3 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,24,4 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,25,5 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,26,6 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,27,7 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,28,8 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,29,9 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,30,10)",
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(4, 'File uploads', 'Settings for file uploads')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(4,31,1 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(4,32,2 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(4,33,3 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(4,34,4 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(4,35,5 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(4,36,6 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(4,37,7 )",
"INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(4, 'File uploads', 'Settings for file uploads')",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,31,1 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,32,2 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,33,3 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,34,4 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,35,5 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,36,6 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,37,7 )",
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(5, 'Blog-by-Email settings', 'Settings for blogging via email')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,38,1 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,39,2 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,40,3 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,41,4 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,42,5 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,43,6 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,44,7 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,45,8 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,46,9 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(5,47,10)",
"INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(5, 'Blog-by-Email settings', 'Settings for blogging via email')",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,38,1 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,39,2 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,40,3 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,41,4 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,42,5 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,43,6 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,44,7 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,45,8 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,46,9 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,47,10)",
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(6, 'Base settings', 'Basic settings required to get your blog working')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(6,1,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(6,2,2)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(6,3,3)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(6,4,4)",
//"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(6,6,5)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(6,7,6)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(6,8,7)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(6,54,8)",
"INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(6, 'Base settings', 'Basic settings required to get your blog working')",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,1,1)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,2,2)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,3,3)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,4,4)",
//"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,6,5)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,7,6)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,8,7)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,54,8)",
// select data for what to show
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'days', 'days', null,null,1)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'posts', 'posts', null,null,2)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'paged', 'posts paged', null,null,3)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'days', 'days', null,null,1)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'posts', 'posts', null,null,2)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (49, 'paged', 'posts paged', null,null,3)",
// select data for archive mode
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'daily', 'daily', null,null,1)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'weekly', 'weekly', null,null,2)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'monthly', 'monthly', null,null,3)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'postbypost','post by post',null,null,4)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'daily', 'daily', null,null,1)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'weekly', 'weekly', null,null,2)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'monthly', 'monthly', null,null,3)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (50, 'postbypost','post by post',null,null,4)",
// select data for time diff
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (51, 'hours', 'hours', 23, -23, null)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (51, 'hours', 'hours', 23, -23, null)",
// select data for start of week
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '0', 'Sunday', null,null,1)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '1', 'Monday', null,null,2)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '6', 'Saturday', null,null,3)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '0', 'Sunday', null,null,1)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '1', 'Monday', null,null,2)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (9, '6', 'Saturday', null,null,3)",
// Add in a new page for POST DEFAULTS
@ -545,42 +545,42 @@ $option_data = array(
// default_comment_status select one of open closed
// default_ping_status select one of open closed
// default_pingback_flag select one of checked unchecked
// default_post_category sql_select "SELECT cat_id AS value, cat_name AS label FROM $tablecategories order by cat_name"
// default_post_category sql_select "SELECT cat_id AS value, cat_name AS label FROM $wpdb->categories order by cat_name"
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(7, 'Default post options', 'Default settings for new posts.')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(7,55,1 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(7,56,2 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(7,57,3 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(7,58,4 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(7,59,5 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(7,83,5 )",
"INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(7, 'Default post options', 'Default settings for new posts.')",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,55,1 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,56,2 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,57,3 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,58,4 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,59,5 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,83,5 )",
// select data for post_status
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'publish', 'Publish', null,null,1)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'draft', 'Draft', null,null,2)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'private', 'Private', null,null,3)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'publish', 'Publish', null,null,1)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'draft', 'Draft', null,null,2)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (55, 'private', 'Private', null,null,3)",
// select data for comment_status
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'open', 'Open', null,null,1)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'closed', 'Closed', null,null,2)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'open', 'Open', null,null,1)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (56, 'closed', 'Closed', null,null,2)",
// select data for ping_status (aargh duplication!)
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'open', 'Open', null,null,1)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'closed', 'Closed', null,null,2)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'open', 'Open', null,null,1)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (57, 'closed', 'Closed', null,null,2)",
// select data for pingback flag
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '1', 'Checked', null,null,1)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '0', 'Unchecked', null,null,2)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '1', 'Checked', null,null,1)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (58, '0', 'Unchecked', null,null,2)",
// sql select data for default
"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)",
"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)",
);
foreach ($option_data as $query) {
@ -593,59 +593,59 @@ foreach ($option_data as $query) {
<?php
$links_option_data = array(
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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, '&gt;&gt;', 'The text to prepend to a recently updated link', 8, 10)",
"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, '&lt;&lt;', 'The text to append to a recently updated link', 8, 20)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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, '&gt;&gt;', 'The text to prepend to a recently updated link', 8, 10)",
"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, '&lt;&lt;', 'The text to append to a recently updated link', 8, 20)",
"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)",
//group them together
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(8, 'Link Manager Settings', 'Various settings for the link manager.')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,60,1 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,61,2 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,62,3 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,63,4 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,64,5 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,65,6 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,66,7 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,67,8 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,68,9 )",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,69,10)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,70,11)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,71,12)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,72,13)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,73,14)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,74,15)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,75,16)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,76,17)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,77,18)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,78,19)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,79,20)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,80,21)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,81,22)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(8,82,23)",
"INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(8, 'Link Manager Settings', 'Various settings for the link manager.')",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,60,1 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,61,2 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,62,3 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,63,4 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,64,5 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,65,6 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,66,7 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,67,8 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,68,9 )",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,69,10)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,70,11)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,71,12)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,72,13)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,73,14)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,74,15)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,75,16)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,76,17)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,77,18)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,78,19)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,79,20)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,80,21)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,81,22)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,82,23)",
// select data for rating_type
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'number', 'Number', null,null,1)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'char', 'Character', null,null,2)",
"INSERT INTO $tableoptionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'image', 'Image', null,null,3)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'number', 'Number', null,null,1)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'char', 'Character', null,null,2)",
"INSERT INTO $wpdb->optionvalues (option_id, optionvalue, optionvalue_desc, optionvalue_max, optionvalue_min, optionvalue_seq) VALUES (62, 'image', 'Image', null,null,3)",
);
foreach ($links_option_data as $query) {
@ -658,17 +658,17 @@ foreach ($links_option_data as $query) {
<?php
$geo_option_data = array(
// data for geo settings
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"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)",
"INSERT INTO $tableoptiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options', 'Settings which control the posting and display of Geo Options')",
"INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options', 'Settings which control the posting and display of Geo Options')",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,84,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,85,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,86,1)",
"INSERT INTO $tableoptiongroup_options (group_id, option_id, seq) VALUES(9,87,1)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,84,1)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,85,1)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,86,1)",
"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,87,1)",
);
@ -704,15 +704,15 @@ $guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $HTTP_HO
<?php
$url = $_REQUEST['url'];
if (isset($url)) {
$query= "UPDATE $tableoptions set option_value='$url' where option_id=1"; //siteurl
$query= "UPDATE $wpdb->options set option_value='$url' where option_id=1"; //siteurl
$q = $wpdb->query($query);
}
// $query = "DROP TABLE IF EXISTS $tableusers";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableusers\" in the database.");
// $query = "DROP TABLE IF EXISTS $wpdb->users";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->users\" in the database.");
$query = "
CREATE TABLE $tableusers (
CREATE TABLE $wpdb->users (
ID int(10) unsigned NOT NULL auto_increment,
user_login varchar(20) NOT NULL default '',
user_pass varchar(64) NOT NULL default '',
@ -739,7 +739,7 @@ $q = $wpdb->query($query);
$random_password = substr(md5(uniqid(microtime())),0,6);
$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')";
$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')";
$q = $wpdb->query($query);
// Do final updates

View File

@ -6,9 +6,9 @@ $this_file = 'link-manager.php';
$parent_file = 'link-manager.php';
function category_dropdown($fieldname, $selected = 0) {
global $wpdb, $tablelinkcategories;
global $wpdb;
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
echo ' <select name="'.$fieldname.'" size="1">'."\n";
foreach ($results as $row) {
echo " <option value=\"".$row->cat_id."\"";

View File

@ -71,7 +71,7 @@ switch ($action) {
if ($list_limit == '')
$list_limit = -1;
$wpdb->query("INSERT INTO $tablelinkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" .
$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" .
" show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit) \n" .
" VALUES ('0', '$cat_name', '$auto_toggle', '$show_images', '$show_description', \n" .
" '$show_rating', '$show_updated', '$sort_order', '$sort_desc', '$text_before_link', '$text_after_link', \n" .
@ -95,8 +95,8 @@ switch ($action) {
if ($user_level < get_settings('links_minadminlevel'))
die (__("Cheatin' uh ?"));
$wpdb->query("DELETE FROM $tablelinkcategories WHERE cat_id='$cat_id'");
$wpdb->query("UPDATE $tablelinks SET link_category=1 WHERE link_category='$cat_id'");
$wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$cat_id'");
$wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$cat_id'");
header('Location: link-categories.php');
break;
@ -107,7 +107,7 @@ switch ($action) {
$cat_id = $_GET['cat_id'];
$row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$cat_id");
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$cat_id");
if ($row) {
if ($row->list_limit == -1) {
$row->list_limit = '';
@ -263,7 +263,7 @@ switch ($action) {
if ($list_limit == '')
$list_limit = -1;
$wpdb->query("UPDATE $tablelinkcategories set
$wpdb->query("UPDATE $wpdb->linkcategories set
cat_name='$cat_name',
auto_toggle='$auto_toggle',
show_images='$show_images',
@ -324,7 +324,7 @@ switch ($action) {
<?php
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories ORDER BY cat_id");
. " text_after_all, list_limit FROM $wpdb->linkcategories ORDER BY cat_id");
$i = 1;
foreach ($results as $row) {
if ($row->list_limit == -1) {

View File

@ -58,7 +58,7 @@ switch ($step) {
<li><?php _e('Now select a category you want to put these links in.') ?><br />
<?php _e('Category:') ?> <?php echo gethelp_link($this_file,'link_category');?><select name="cat_id">
<?php
$categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
$categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
foreach ($categories as $category) {
?>
<option value="<?php echo $category->cat_id; ?>"><?php echo $category->cat_id.': '.$category->cat_name; ?></option>
@ -122,7 +122,7 @@ switch ($step) {
$titles[$i] = '';
if ('http' == substr($titles[$i], 0, 4))
$titles[$i] = '';
$query = "INSERT INTO $tablelinks (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
$query = "INSERT INTO $wpdb->links (link_url, link_name, link_target, link_category, link_description, link_owner, link_rss)
VALUES('{$urls[$i]}', '".addslashes($names[$i])."', '', $cat_id, '".addslashes($descriptions[$i])."', $user_ID, '{$feeds[$i]}')\n";
$result = $wpdb->query($query);
echo sprintf(__("<p>Inserted <strong>%s</strong></p>"), $names[$i]);

View File

@ -20,9 +20,9 @@ function xfn_check($class, $value = '', $type = 'check') {
}
function category_dropdown($fieldname, $selected = 0) {
global $wpdb, $tablelinkcategories;
global $wpdb;
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
echo "\n<select name='$fieldname' size='1'>";
foreach ($results as $row) {
echo "\n\t<option value='$row->cat_id'";
@ -99,7 +99,7 @@ switch ($action) {
exit;
}
$all_links = join(',', $linkcheck);
$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)");
$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)");
foreach ($results as $row) {
if (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed
$ids_to_change[] = $row->link_id;
@ -108,7 +108,7 @@ switch ($action) {
// should now have an array of links we can change
$all_links = join(',', $ids_to_change);
$q = $wpdb->query("update $tablelinks SET link_owner='$newowner' WHERE link_id IN ($all_links)");
$q = $wpdb->query("update $wpdb->links SET link_owner='$newowner' WHERE link_id IN ($all_links)");
header('Location: ' . $this_file);
break;
@ -130,7 +130,7 @@ switch ($action) {
exit;
}
$all_links = join(',', $linkcheck);
$results = $wpdb->get_results("SELECT link_id, link_visible FROM $tablelinks WHERE link_id in ($all_links)");
$results = $wpdb->get_results("SELECT link_id, link_visible FROM $wpdb->links WHERE link_id in ($all_links)");
foreach ($results as $row) {
if ($row->link_visible == 'Y') { // ok to proceed
$ids_to_turnoff[] = $row->link_id;
@ -142,12 +142,12 @@ switch ($action) {
// should now have two arrays of links to change
if (count($ids_to_turnoff)) {
$all_linksoff = join(',', $ids_to_turnoff);
$q = $wpdb->query("update $tablelinks SET link_visible='N' WHERE link_id IN ($all_linksoff)");
$q = $wpdb->query("update $wpdb->links SET link_visible='N' WHERE link_id IN ($all_linksoff)");
}
if (count($ids_to_turnon)) {
$all_linkson = join(',', $ids_to_turnon);
$q = $wpdb->query("update $tablelinks SET link_visible='Y' WHERE link_id IN ($all_linkson)");
$q = $wpdb->query("update $wpdb->links SET link_visible='Y' WHERE link_id IN ($all_linkson)");
}
header('Location: ' . $this_file);
@ -171,7 +171,7 @@ switch ($action) {
}
$all_links = join(',', $linkcheck);
// should now have an array of links we can change
$q = $wpdb->query("update $tablelinks SET link_category='$category' WHERE link_id IN ($all_links)");
$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
header('Location: ' . $this_file);
break;
@ -203,9 +203,9 @@ switch ($action) {
// if we are in an auto toggle category and this one is visible then we
// need to make the others invisible before we add this new one.
if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
$wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category");
$wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
}
$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) " .
$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) " .
" VALUES('" . addslashes($link_url) . "','"
. addslashes($link_name) . "', '"
. addslashes($link_image) . "', '$link_target', $link_category, '"
@ -253,10 +253,10 @@ switch ($action) {
// if we are in an auto toggle category and this one is visible then we
// need to make the others invisible before we update this one.
if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
$wpdb->query("UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category");
$wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
}
$wpdb->query("UPDATE $tablelinks SET link_url='" . addslashes($link_url) . "',
$wpdb->query("UPDATE $wpdb->links SET link_url='" . addslashes($link_url) . "',
link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "',
link_target='$link_target',\n link_category=$link_category,
link_visible='$link_visible',\n link_description='" . addslashes($link_description) . "',
@ -283,7 +283,7 @@ switch ($action) {
if ($user_level < get_settings('links_minadminlevel'))
die (__("Cheatin' uh ?"));
$wpdb->query("DELETE FROM $tablelinks WHERE link_id = $link_id");
$wpdb->query("DELETE FROM $wpdb->links WHERE link_id = $link_id");
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
@ -308,7 +308,7 @@ switch ($action) {
}
$row = $wpdb->get_row("SELECT *
FROM $tablelinks
FROM $wpdb->links
WHERE link_id = $link_id");
if ($row) {
@ -617,7 +617,7 @@ function checkAll(form)
<tr>
<td>
<?php
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
echo " <select name=\"cat_id\">\n";
echo " <option value=\"All\"";
if ($cat_id == 'All')
@ -675,11 +675,11 @@ function checkAll(form)
</tr>
<?php
$sql = "SELECT link_url, link_name, link_image, link_description, link_visible,
link_category AS cat_id, cat_name AS category, $tableusers.user_login, link_id,
link_rating, link_rel, $tableusers.user_level
FROM $tablelinks
LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id
LEFT JOIN $tableusers ON $tableusers.ID = $tablelinks.link_owner ";
link_category AS cat_id, cat_name AS category, $wpdb->users.user_login, link_id,
link_rating, link_rel, $wpdb->users.user_level
FROM $wpdb->links
LEFT JOIN $wpdb->linkcategories ON $wpdb->links.link_category = $wpdb->linkcategories.cat_id
LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->links.link_owner ";
if (isset($cat_id) && ($cat_id != 'All')) {
$sql .= " WHERE link_category = $cat_id ";
@ -747,7 +747,7 @@ LINKS;
<td>
<?php _e('Assign ownership to:'); echo ' ' . gethelp_link($this_file,'assign_ownership'); ?>
<?php
$results = $wpdb->get_results("SELECT ID, user_login FROM $tableusers WHERE user_level > 0 ORDER BY ID");
$results = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level > 0 ORDER BY ID");
echo " <select name=\"newowner\" size=\"1\">\n";
foreach ($results as $row) {
echo " <option value=\"".$row->ID."\"";

View File

@ -134,7 +134,7 @@ if (isset($deleted) || isset($approved) || isset($ignored)) {
<div class="wrap">
<?php
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_approved = '0'");
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'");
if ($comments) {
// list all comments that are waiting for approval
@ -147,7 +147,7 @@ if ($comments) {
<?php
foreach($comments as $comment) {
$comment_date = mysql2date(get_settings("date_format") . " @ " . get_settings("time_format"), $comment->comment_date);
$post_title = $wpdb->get_var("SELECT post_title FROM $tableposts WHERE ID='$comment->comment_post_ID'");
$post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID'");
echo "\n\t<li id='comment-$comment->comment_ID'>";
?>

View File

@ -9,7 +9,7 @@ require_once('../wp-config.php');
**/
function get_option_widget($option_result, $editable, $between)
{
global $wpdb, $tableoptionvalues;
global $wpdb;
$disabled = $editable ? '' : 'disabled';
switch ($option_result->option_type) {
@ -47,7 +47,7 @@ BOOLSELECT;
SELECT;
$select = $wpdb->get_results("SELECT optionvalue, optionvalue_desc "
."FROM $tableoptionvalues "
."FROM $wpdb->optionvalues "
."WHERE option_id = $option_result->option_id "
."ORDER BY optionvalue_seq");
if ($select) {
@ -66,7 +66,7 @@ SELECT;
case 7: // SQL select
// first get the sql to run
$sql = $wpdb->get_var("SELECT optionvalue FROM $tableoptionvalues WHERE option_id = $option_result->option_id");
$sql = $wpdb->get_var("SELECT optionvalue FROM $wpdb->optionvalues WHERE option_id = $option_result->option_id");
if (!$sql) {
return $option_result->option_name . $editable;
}
@ -100,12 +100,12 @@ SELECT;
function validate_option($option, $name, $val) {
global $wpdb, $tableoptionvalues;
global $wpdb;
$msg = '';
switch ($option->option_type) {
case 6: // range
// get range
$range = $wpdb->get_row("SELECT optionvalue_max, optionvalue_min FROM $tableoptionvalues WHERE option_id = $option->option_id");
$range = $wpdb->get_row("SELECT optionvalue_max, optionvalue_min FROM $wpdb->optionvalues WHERE option_id = $option->option_id");
if ($range) {
if (($val < $range->optionvalue_min) || ($val > $range->optionvalue_max)) {
$msg = "$name is outside the valid range ($range->optionvalue_min - $range->optionvalue_max). ";

View File

@ -6,7 +6,7 @@ if ($user_level <= 6) {
//we need to iterate through the available option groups.
$groups = '';
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $wpdb->optiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
if ($option_group->group_id == $option_group_id) {
$current_desc = $option_group->group_desc;

View File

@ -107,7 +107,7 @@ include('options-head.php');
<th scope="row"><?php _e('Usual category:') ?></th>
<td><select name="default_category" id="default_category">
<?php
$categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY cat_name");
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_name");
foreach ($categories as $category) :
if ($category->cat_ID == get_settings('default_category')) $selected = " selected='selected'";
else $selected = '';

View File

@ -63,7 +63,7 @@ case 'update':
$option_names = stripslashes($_POST['page_options']);
}
$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)");
$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)");
// die(var_dump($options));
// HACK
@ -83,7 +83,7 @@ $nonbools = array('default_ping_status', 'default_comment_status');
}
if( in_array($option->option_name, $nonbools) && $new_val == 0 ) $new_value = 'closed';
if ($new_val !== $old_val) {
$query = "UPDATE $tableoptions SET option_value = '$new_val' WHERE option_name = '$option->option_name'";
$query = "UPDATE $wpdb->options SET option_value = '$new_val' WHERE option_name = '$option->option_name'";
$result = $wpdb->query($query);
//if( in_array($option->option_name, $nonbools)) die('boo'.$query);
if (!$result) {
@ -130,7 +130,7 @@ if ($non_was_selected) { // no group pre-selected, display opening page
<dl>
<?php
//iterate through the available option groups. output them as a definition list.
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $tableoptiongroups ORDER BY group_id");
$option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $wpdb->optiongroups ORDER BY group_id");
foreach ($option_groups as $option_group) {
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");
$current_long_desc = $option_group->group_longdesc;
@ -159,12 +159,12 @@ include('options-head.php');
<?php
//Now display all the options for the selected group.
if ('all' == $_GET['option_group_id']) :
$options = $wpdb->get_results("SELECT * FROM $tableoptions LEFT JOIN $tableoptiongroup_options ON $tableoptions.option_id = $tableoptiongroup_options.option_id ORDER BY option_name");
$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");
else :
$options = $wpdb->get_results("
SELECT
$tableoptions.option_id, option_name, option_type, option_value, option_width, option_height, option_description, option_admin_level
FROM $tableoptions LEFT JOIN $tableoptiongroup_options ON $tableoptions.option_id = $tableoptiongroup_options.option_id
$wpdb->options.option_id, option_name, option_type, option_value, option_width, option_height, option_description, option_admin_level
FROM $wpdb->options LEFT JOIN $wpdb->optiongroup_options ON $wpdb->options.option_id = $wpdb->optiongroup_options.option_id
WHERE group_id = $option_group_id
ORDER BY seq
");

View File

@ -108,13 +108,13 @@ case 'post':
if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) {
$postquery ="INSERT INTO $tableposts
$postquery ="INSERT INTO $wpdb->posts
(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)
VALUES
('0', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt')
";
} else {
$postquery ="INSERT INTO $tableposts
$postquery ="INSERT INTO $wpdb->posts
(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)
VALUES
('0', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt')
@ -123,7 +123,7 @@ case 'post':
$postquery =
$result = $wpdb->query($postquery);
$post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
$post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1");
if (!empty($_POST['mode'])) {
switch($_POST['mode']) {
@ -151,11 +151,11 @@ case 'post':
if (!$post_categories) $post_categories[] = 1;
foreach ($post_categories as $post_category) {
// Double check it's not there already
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");
$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
if (!$exists && $result) {
$wpdb->query("
INSERT INTO $tablepost2cat
INSERT INTO $wpdb->post2cat
(post_id, category_id)
VALUES
($post_ID, $post_category)
@ -181,8 +181,8 @@ case 'post':
do_action('publish_post', $post_ID);
// Time for trackbacks
$to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID");
$pinged = $wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID");
$to_ping = $wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_ID");
$pinged = $wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_ID");
$pinged = explode("\n", $pinged);
if ('' != $to_ping) {
if (strlen($excerpt) > 0) {
@ -213,7 +213,7 @@ case 'edit':
$post = $post_ID = $p = (int) $_GET['post'];
if ($user_level > 0) {
$postdata = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = '$post_ID'");
$postdata = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
$authordata = get_userdata($postdata->post_author);
if ($user_level < $authordata->user_level)
die ('You don&#8217;t have the right to edit <strong>'.$authordata[1].'</strong>&#8217;s posts.');
@ -235,7 +235,7 @@ case 'edit':
include('edit-form-advanced.php');
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = '$post_ID'");
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
?>
<div id='preview' class='wrap'>
<h2><?php _e('Post Preview (updated when post is saved)'); ?></h2>
@ -343,7 +343,7 @@ $now = current_time('mysql');
$now_gmt = current_time('mysql', 1);
$result = $wpdb->query("
UPDATE $tableposts SET
UPDATE $wpdb->posts SET
post_content = '$content',
post_excerpt = '$excerpt',
post_title = '$post_title'"
@ -364,18 +364,18 @@ $now_gmt = current_time('mysql', 1);
// Now it's category time!
// First the old categories
$old_categories = $wpdb->get_col("SELECT category_id FROM $tablepost2cat WHERE post_id = $post_ID");
$old_categories = $wpdb->get_col("SELECT category_id FROM $wpdb->post2cat WHERE post_id = $post_ID");
// Delete any?
foreach ($old_categories as $old_cat) {
if (!in_array($old_cat, $post_categories)) // If a category was there before but isn't now
$wpdb->query("DELETE FROM $tablepost2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1");
$wpdb->query("DELETE FROM $wpdb->post2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1");
}
// Add any?
foreach ($post_categories as $new_cat) {
if (!in_array($new_cat, $old_categories))
$wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_ID, $new_cat)");
$wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_ID, $new_cat)");
}
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
@ -392,8 +392,8 @@ $now_gmt = current_time('mysql', 1);
if ($post_status == 'publish') {
do_action('publish_post', $post_ID);
// Trackback time.
$to_ping = trim($wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID"));
$pinged = trim($wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID"));
$to_ping = trim($wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_ID"));
$pinged = trim($wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_ID"));
$pinged = explode("\n", $pinged);
if ('' != $to_ping) {
if (strlen($excerpt) > 0) {
@ -449,7 +449,7 @@ case 'delete':
die (sprintf(__('You don&#8217;t have the right to delete <strong>%s</strong>&#8217;s posts.'), $authordata[1]));
// send geoURL ping to "erase" from their DB
$query = "SELECT post_lat from $tableposts WHERE ID=$post_id";
$query = "SELECT post_lat from $wpdb->posts WHERE ID=$post_id";
$rows = $wpdb->query($query);
$myrow = $rows[0];
$latf = $myrow->post_lat;
@ -457,13 +457,13 @@ case 'delete':
pingGeoUrl($post);
}
$result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post_id");
$result = $wpdb->query("DELETE FROM $wpdb->posts WHERE ID=$post_id");
if (!$result)
die(__('Error in deleting...'));
$result = $wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID=$post_id");
$result = $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID=$post_id");
$categories = $wpdb->query("DELETE FROM $tablepost2cat WHERE post_id = $post_id");
$categories = $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $post_id");
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit);
@ -694,7 +694,7 @@ case 'editedcomment':
$content = format_to_post($content);
$result = $wpdb->query("
UPDATE $tablecomments SET
UPDATE $wpdb->comments SET
comment_content = '$content',
comment_author = '$newcomment_author',
comment_author_email = '$newcomment_author_email',
@ -716,7 +716,7 @@ default:
if ($user_level > 0) {
$action = 'post';
get_currentuserinfo();
$drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID");
$drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID");
if ($drafts) {
?>
<div class="wrap">

View File

@ -95,7 +95,7 @@ case 'update':
$newuser_idmode=addslashes(stripslashes($_POST['newuser_idmode']));
$user_description = addslashes(stripslashes($_POST['user_description']));
$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";
$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";
$result = $wpdb->query($query);
if (!$result) {
die (__("<strong>ERROR</strong>: couldn't update your profile..."));

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@ case 'adduser':
$user_nickname = $user_login;
/* checking the login isn't already used by another user */
$loginthere = $wpdb->get_var("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
$loginthere = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
if ($loginthere) {
die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.'));
}
@ -78,7 +78,7 @@ case 'adduser':
$now = gmdate('Y-m-d H:i:s');
$new_users_can_blog = get_settings('new_users_can_blog');
$result = $wpdb->query("INSERT INTO $tableusers
$result = $wpdb->query("INSERT INTO $wpdb->users
(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)
VALUES
('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_domain', '$user_browser', '$now', '$new_users_can_blog', 'nickname', '$user_firstname', '$user_lastname', '$user_nicename')");
@ -122,10 +122,10 @@ case 'promote':
if ('up' == $prom) {
$new_level = $usertopromote_level + 1;
$sql="UPDATE $tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
$sql="UPDATE $wpdb->users SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
} elseif ('down' == $prom) {
$new_level = $usertopromote_level - 1;
$sql="UPDATE $tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
$sql="UPDATE $wpdb->users SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
}
$result = $wpdb->query($sql);
@ -152,24 +152,24 @@ case 'delete':
if ($user_level <= $usertodelete_level)
die(__('Can&#8217;t delete a user whose level is higher than yours.'));
$post_ids = $wpdb->get_col("SELECT ID FROM $tableposts WHERE post_author = $id");
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
if ($post_ids) {
$post_ids = implode(',', $post_ids);
// Delete comments, *backs
$wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID IN ($post_ids)");
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID IN ($post_ids)");
// Clean cats
$wpdb->query("DELETE FROM $tablepost2cat WHERE post_id IN ($post_ids)");
$wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id IN ($post_ids)");
// Clean post_meta
$wpdb->query("DELETE FROM $tablepostmeta WHERE post_id IN ($post_ids)");
$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id IN ($post_ids)");
// Clean links
$wpdb->query("DELETE FROM $tablelinks WHERE link_owner = $id");
$wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
// Delete posts
$wpdb->query("DELETE FROM $tableposts WHERE post_author = $id");
$wpdb->query("DELETE FROM $wpdb->posts WHERE post_author = $id");
}
// FINALLY, delete user
$wpdb->query("DELETE FROM $tableusers WHERE ID = $id");
$wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
header('Location: users.php?deleted=true');
break;
@ -195,7 +195,7 @@ default:
<th><?php _e('Posts') ?></th>
</tr>
<?php
$users = $wpdb->get_results("SELECT ID FROM $tableusers WHERE user_level > 0 ORDER BY ID");
$users = $wpdb->get_results("SELECT ID FROM $wpdb->users WHERE user_level > 0 ORDER BY ID");
$style = '';
foreach ($users as $user) {
$user_data = get_userdata($user->ID);
@ -208,7 +208,7 @@ default:
if (strlen($short_url) > 35)
$short_url = substr($short_url, 0, 32).'...';
$style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $tableposts WHERE post_author = $user->ID and post_status = 'publish'");
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $user->ID and post_status = 'publish'");
if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_data->ID' title='" . __('View posts') . "'>$numposts</a>";
echo "
<tr $style>
@ -233,7 +233,7 @@ default:
</div>
<?php
$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level = 0 ORDER BY ID");
$users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level = 0 ORDER BY ID");
if ($users) {
?>
<div class="wrap">

View File

@ -166,4 +166,5 @@ if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
gzip_compression();
}
}
?>
?>

View File

@ -34,8 +34,8 @@ foreach ($posts as $post) { start_wp();
$comment_author = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
$comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
$comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");
$commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id");
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");
$commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $wpdb->posts WHERE ID = $id");
if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'.$cookiehash] != $commentstatus->post_password) { // and it doesn't match the cookie
echo(get_the_password_form());
} else { ?>

View File

@ -32,7 +32,7 @@ $comment = trim($_POST['comment']);
$comment_post_ID = intval($_POST['comment_post_ID']);
$user_ip = $_SERVER['REMOTE_ADDR'];
if ( 'closed' == $wpdb->get_var("SELECT comment_status FROM $tableposts WHERE ID = '$comment_post_ID'") )
if ( 'closed' == $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'") )
die( __('Sorry, comments are closed for this item.') );
if ( get_settings('require_name_email') && ('' == $email || '' == $author) )
@ -51,7 +51,7 @@ $comment = format_to_post($comment);
$comment = apply_filters('post_comment_text', $comment);
// Simple flood-protection
$lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1");
$lasttime = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1");
if (!empty($lasttime)) {
$time_lastcomment= mysql2date('U', $lasttime);
$time_newcomment= mysql2date('U', $now);
@ -68,7 +68,7 @@ if(check_comment($author, $email, $url, $comment, $user_ip)) {
$approved = 0;
}
$wpdb->query("INSERT INTO $tablecomments
$wpdb->query("INSERT INTO $wpdb->comments
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved)
VALUES
('$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved')

View File

@ -34,7 +34,7 @@ require ('wp-blog-header.php');
$comment_author = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
$comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
$comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';
$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");
$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");
?>
<!-- You can start editing here. -->

View File

@ -17,7 +17,7 @@
$comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
$comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = '$id' AND comment_approved = '1' ORDER BY comment_date");
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$id' AND comment_approved = '1' ORDER BY comment_date");
?>
<!-- You can start editing here. -->

View File

@ -28,17 +28,17 @@ foreach ($posts as $post) { start_wp();
if (isset($_REQUEST["p"]) || isset($_REQUEST["name"])) {
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
comment_author_url, comment_date, comment_content, comment_post_ID,
$tableposts.ID, $tableposts.post_password FROM $tablecomments
LEFT JOIN $tableposts ON comment_post_id = id WHERE comment_post_ID = '$id'
AND $tablecomments.comment_approved = '1' AND $tableposts.post_status = 'publish'
$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id'
AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish'
AND post_date < '".date("Y-m-d H:i:59")."'
ORDER BY comment_date LIMIT " . get_settings('posts_per_rss') );
} else { // if no post id passed in, we'll just ue the last 10 comments.
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_author_email,
comment_author_url, comment_date, comment_content, comment_post_ID,
$tableposts.ID, $tableposts.post_password FROM $tablecomments
LEFT JOIN $tableposts ON comment_post_id = id WHERE $tableposts.post_status = 'publish'
AND $tablecomments.comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s")."'
$wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments
LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->comments.comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s")."'
ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') );
}
// this line is WordPress' motor, do not delete it.

View File

@ -6,7 +6,7 @@
* generic function for inserting data into the posts table.
*/
function wp_insert_post($postarr = array()) {
global $wpdb, $tableposts, $post_default_category;
global $wpdb, $post_default_category;
// export array as variables
extract($postarr);
@ -31,7 +31,7 @@ function wp_insert_post($postarr = array()) {
if (empty($post_date_gmt))
$post_date_gmt = get_gmt_from_date($post_date);
$sql = "INSERT INTO $tableposts
$sql = "INSERT INTO $wpdb->posts
(post_author, post_date, post_date_gmt, post_modified, post_modified_gmt, post_content, post_title, post_excerpt, post_category, post_status, post_name)
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')";
@ -49,9 +49,9 @@ function wp_insert_post($postarr = array()) {
}
function wp_get_single_post($postid = 0, $mode = OBJECT) {
global $wpdb, $tableposts;
global $wpdb;
$sql = "SELECT * FROM $tableposts WHERE ID=$postid";
$sql = "SELECT * FROM $wpdb->posts WHERE ID=$postid";
$result = $wpdb->get_row($sql, $mode);
// Set categories
@ -61,21 +61,21 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
}
function wp_get_recent_posts($num = 10) {
global $wpdb, $tableposts;
global $wpdb;
// Set the limit clause, if we got a limit
if ($num) {
$limit = "LIMIT $num";
}
$sql = "SELECT * FROM $tableposts ORDER BY post_date DESC $limit";
$sql = "SELECT * FROM $wpdb->posts ORDER BY post_date DESC $limit";
$result = $wpdb->get_results($sql,ARRAY_A);
return $result?$result:array();
}
function wp_update_post($postarr = array()) {
global $wpdb, $tableposts;
global $wpdb;
// First get all of the original fields
extract(wp_get_single_post($postarr['ID'],ARRAY_A));
@ -96,7 +96,7 @@ function wp_update_post($postarr = array()) {
$post_modified = current_time('mysql');
$post_modified_gmt = current_time('mysql', 1);
$sql = "UPDATE $tableposts
$sql = "UPDATE $wpdb->posts
SET post_content = '$post_content',
post_title = '$post_title',
post_category = $post_category[0],
@ -118,10 +118,10 @@ function wp_update_post($postarr = array()) {
}
function wp_get_post_cats($blogid = '1', $post_ID = 0) {
global $wpdb, $tablepost2cat;
global $wpdb;
$sql = "SELECT category_id
FROM $tablepost2cat
FROM $wpdb->post2cat
WHERE post_id = $post_ID
ORDER BY category_id";
@ -131,7 +131,7 @@ function wp_get_post_cats($blogid = '1', $post_ID = 0) {
}
function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
global $wpdb, $tablepost2cat;
global $wpdb;
// If $post_categories isn't already an array, make it one:
if (!is_array($post_categories)) {
if (!$post_categories) {
@ -145,7 +145,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
// First the old categories
$old_categories = $wpdb->get_col("
SELECT category_id
FROM $tablepost2cat
FROM $wpdb->post2cat
WHERE post_id = $post_ID");
if (!$old_categories) {
@ -168,7 +168,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
if ($delete_cats) {
foreach ($delete_cats as $del) {
$wpdb->query("
DELETE FROM $tablepost2cat
DELETE FROM $wpdb->post2cat
WHERE category_id = $del
AND post_id = $post_ID
");
@ -185,7 +185,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
if ($add_cats) {
foreach ($add_cats as $new_cat) {
$wpdb->query("
INSERT INTO $tablepost2cat (post_id, category_id)
INSERT INTO $wpdb->post2cat (post_id, category_id)
VALUES ($post_ID, $new_cat)");
logio("O","adding post/cat: $post_ID, $new_cat");
@ -194,12 +194,12 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
} // wp_set_post_cats()
function wp_delete_post($postid = 0) {
global $wpdb, $tableposts, $tablepost2cat;
global $wpdb;
$sql = "DELETE FROM $tablepost2cat WHERE post_id = $postid";
$sql = "DELETE FROM $wpdb->post2cat WHERE post_id = $postid";
$wpdb->query($sql);
$sql = "DELETE FROM $tableposts WHERE ID = $postid";
$sql = "DELETE FROM $wpdb->posts WHERE ID = $postid";
$wpdb->query($sql);
@ -215,7 +215,6 @@ function wp_delete_post($postid = 0) {
// get permalink from post ID
function post_permalink($post_ID=0, $mode = 'id') {
global $wpdb;
global $tableposts;
global $querystring_start, $querystring_equal, $querystring_separator;
$blog_URL = get_settings('home') .'/'. get_settings('blogfilename');
@ -265,19 +264,19 @@ function post_permalink($post_ID=0, $mode = 'id') {
// Get the name of a category from its ID
function get_cat_name($cat_id) {
global $wpdb,$tablecategories;
global $wpdb;
$cat_id -= 0; // force numeric
$name = $wpdb->get_var("SELECT cat_name FROM $tablecategories WHERE cat_ID=$cat_id");
$name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID=$cat_id");
return $name;
}
// Get the ID of a category from its name
function get_cat_ID($cat_name='General') {
global $wpdb,$tablecategories;
global $wpdb;
$cid = $wpdb->get_var("SELECT cat_ID FROM $tablecategories WHERE cat_name='$cat_name'");
$cid = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
return $cid?$cid:1; // default to cat 1
}

View File

@ -95,20 +95,20 @@ function get_weekstartend($mysqlstring, $start_of_week) {
}
function get_lastpostdate($timezone = 'server') {
global $tableposts, $cache_lastpostdate, $pagenow, $wpdb;
global $cache_lastpostdate, $pagenow, $wpdb;
$add_seconds_blog = get_settings('gmt_offset') * 3600;
$add_seconds_server = date('Z');
$now = current_time('mysql', 1);
if ( !isset($cache_lastpostdate[$timezone]) ) {
switch(strtolower($timezone)) {
case 'gmt':
$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");
$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");
break;
case 'blog':
$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");
$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");
break;
case 'server':
$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");
$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");
break;
}
$cache_lastpostdate[$timezone] = $lastpostdate;
@ -119,20 +119,20 @@ function get_lastpostdate($timezone = 'server') {
}
function get_lastpostmodified($timezone = 'server') {
global $tableposts, $cache_lastpostmodified, $pagenow, $wpdb;
global $cache_lastpostmodified, $pagenow, $wpdb;
$add_seconds_blog = get_settings('gmt_offset') * 3600;
$add_seconds_server = date('Z');
$now = current_time('mysql', 1);
if ( !isset($cache_lastpostmodified[$timezone]) ) {
switch(strtolower($timezone)) {
case 'gmt':
$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");
$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");
break;
case 'blog':
$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");
$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");
break;
case 'server':
$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");
$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");
break;
}
$lastpostdate = get_lastpostdate($timezone);
@ -172,9 +172,9 @@ function get_currentuserinfo() { // a bit like get_userdata(), on steroids
}
function get_userdata($userid) {
global $wpdb, $cache_userdata, $tableusers;
global $wpdb, $cache_userdata;
if ( empty($cache_userdata[$userid]) ) {
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID = '$userid'");
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = '$userid'");
$user->user_nickname = stripslashes($user->user_nickname);
$user->user_firstname = stripslashes($user->user_firstname);
$user->user_lastname = stripslashes($user->user_lastname);
@ -187,9 +187,9 @@ function get_userdata($userid) {
}
function get_userdatabylogin($user_login) {
global $tableusers, $cache_userdata, $wpdb;
global $cache_userdata, $wpdb;
if ( empty($cache_userdata["$user_login"]) ) {
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$user_login'");
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'");
$cache_userdata["$user_login"] = $user;
} else {
$user = $cache_userdata["$user_login"];
@ -198,9 +198,9 @@ function get_userdatabylogin($user_login) {
}
function get_userid($user_login) {
global $tableusers, $cache_userdata, $wpdb;
global $cache_userdata, $wpdb;
if ( empty($cache_userdata["$user_login"]) ) {
$user_id = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$user_login'");
$user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$user_login'");
$cache_userdata["$user_login"] = $user_id;
} else {
@ -210,14 +210,14 @@ function get_userid($user_login) {
}
function get_usernumposts($userid) {
global $tableposts, $tablecomments, $wpdb;
return $wpdb->get_var("SELECT COUNT(*) FROM $tableposts WHERE post_author = '$userid'");
global $wpdb;
return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid'");
}
// examine a url (supposedly from this blog) and try to
// determine the post ID it represents.
function url_to_postid($url = '') {
global $wpdb, $tableposts;
global $wpdb;
$siteurl = get_settings('home');
// Take a link like 'http://example.com/blog/something'
@ -290,7 +290,7 @@ function url_to_postid($url = '') {
if ($postname) $where .= " AND post_name = '" . $wpdb->escape($postname) . "' ";
// Run the query to get the post ID:
$id = intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where));
$id = intval($wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE 1 = 1 " . $where));
return $id;
}
@ -321,8 +321,8 @@ function get_settings($setting) {
}
function get_alloptions() {
global $tableoptions, $wpdb;
$options = $wpdb->get_results("SELECT option_name, option_value FROM $tableoptions");
global $wpdb;
$options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options");
if ($options) {
foreach ($options as $option) {
// "When trying to design a foolproof system,
@ -338,11 +338,11 @@ function get_alloptions() {
}
function update_option($option_name, $newvalue) {
global $wpdb, $tableoptions, $cache_settings;
global $wpdb, $cache_settings;
$newvalue = stripslashes($newvalue);
$newvalue = trim($newvalue); // I can't think of any situation we wouldn't want to trim
$newvalue = $wpdb->escape($newvalue);
$wpdb->query("UPDATE $tableoptions SET option_value = '$newvalue' WHERE option_name = '$option_name'");
$wpdb->query("UPDATE $wpdb->options SET option_value = '$newvalue' WHERE option_name = '$option_name'");
$cache_settings = get_alloptions(); // Re cache settings
return true;
}
@ -351,11 +351,11 @@ function update_option($option_name, $newvalue) {
// thx Alex Stapleton, http://alex.vort-x.net/blog/
function add_option($name, $value='') {
// Adds an option if it doesn't already exist
global $wpdb, $tableoptions;
global $wpdb;
if(!get_settings($name)) {
$name = $wpdb->escape($name);
$value = $wpdb->escape($value);
$wpdb->query("INSERT INTO $tableoptions (option_name, option_value) VALUES ('$name', '$value')");
$wpdb->query("INSERT INTO $wpdb->options (option_name, option_value) VALUES ('$name', '$value')");
if($wpdb->insert_id) {
global $cache_settings;
@ -366,19 +366,19 @@ function add_option($name, $value='') {
}
function delete_option($name) {
global $wpdb, $tableoptions, $tableoptiongroup_options;
global $wpdb;
// Get the ID, if no ID then return
$option_id = $wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = '$name'");
$option_id = $wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = '$name'");
if (!$option_id) return false;
$wpdb->query("DELETE FROM $tableoptiongroup_options WHERE option_id = '$option_id'");
$wpdb->query("DELETE FROM $tableoptions WHERE option_name = '$name'");
$wpdb->query("DELETE FROM $wpdb->optiongroup_options WHERE option_id = '$option_id'");
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name = '$name'");
return true;
}
function get_postdata($postid) {
global $post, $tableposts, $wpdb;
global $post, $wpdb;
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = '$postid'");
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$postid'");
$postdata = array (
'ID' => $post->ID,
@ -402,9 +402,9 @@ function get_postdata($postid) {
}
function get_commentdata($comment_ID,$no_cache=0,$include_unapproved=false) { // less flexible, but saves DB queries
global $postc,$id,$commentdata,$tablecomments, $wpdb;
global $postc,$id,$commentdata, $wpdb;
if ($no_cache) {
$query = "SELECT * FROM $tablecomments WHERE comment_ID = '$comment_ID'";
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
if (false == $include_unapproved) {
$query .= " AND comment_approved = '1'";
}
@ -431,9 +431,9 @@ function get_commentdata($comment_ID,$no_cache=0,$include_unapproved=false) { //
}
function get_catname($cat_ID) {
global $tablecategories, $cache_catnames, $wpdb;
global $cache_catnames, $wpdb;
if ( !$cache_catnames ) {
$results = $wpdb->get_results("SELECT * FROM $tablecategories") or die('Oops, couldn\'t query the db for categories.');
$results = $wpdb->get_results("SELECT * FROM $wpdb->categories") or die('Oops, couldn\'t query the db for categories.');
foreach ($results as $post) {
$cache_catnames[$post->cat_ID] = $post->cat_name;
}
@ -544,7 +544,7 @@ add_action('publish_post', 'generic_ping');
// Send a Trackback
function trackback($trackback_url, $title, $excerpt, $ID) {
global $wpdb, $tableposts;
global $wpdb;
$title = urlencode(stripslashes($title));
$excerpt = urlencode(stripslashes($excerpt));
$blog_name = urlencode(stripslashes(get_settings('blogname')));
@ -572,8 +572,8 @@ function trackback($trackback_url, $title, $excerpt, $ID) {
*/
@fclose($fs);
$wpdb->query("UPDATE $tableposts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'");
$wpdb->query("UPDATE $tableposts SET to_ping = REPLACE(to_ping, '$tb_url', '') WHERE ID = '$ID'");
$wpdb->query("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'");
$wpdb->query("UPDATE $wpdb->posts SET to_ping = REPLACE(to_ping, '$tb_url', '') WHERE ID = '$ID'");
return $result;
}
@ -898,17 +898,17 @@ function pingGeoURL($blog_ID) {
returns false on database error or invalid value for $comment_status
*/
function wp_set_comment_status($comment_id, $comment_status) {
global $wpdb, $tablecomments;
global $wpdb;
switch($comment_status) {
case 'hold':
$query = "UPDATE $tablecomments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
break;
case 'approve':
$query = "UPDATE $tablecomments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
break;
case 'delete':
$query = "DELETE FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1";
$query = "DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1";
break;
default:
return false;
@ -934,9 +934,9 @@ function wp_set_comment_status($comment_id, $comment_status) {
a (boolean) false signals an error
*/
function wp_get_comment_status($comment_id) {
global $wpdb, $tablecomments;
global $wpdb;
$result = $wpdb->get_var("SELECT comment_approved FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
$result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
if ($result == NULL) {
return "deleted";
} else if ($result == "1") {
@ -949,12 +949,12 @@ function wp_get_comment_status($comment_id) {
}
function wp_notify_postauthor($comment_id, $comment_type='comment') {
global $wpdb, $tablecomments, $tableposts, $tableusers;
global $wpdb;
global $querystring_start, $querystring_equal, $querystring_separator;
$comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID='$post->post_author' LIMIT 1");
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
if ('' == $user->user_email) return false; // If there's no email to send the comment to
@ -1009,15 +1009,15 @@ function wp_notify_postauthor($comment_id, $comment_type='comment') {
always returns true
*/
function wp_notify_moderator($comment_id) {
global $wpdb, $tablecomments, $tableposts, $tableusers;
global $wpdb;
global $querystring_start, $querystring_equal, $querystring_separator;
$comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID='$post->post_author' LIMIT 1");
$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID='$post->post_author' LIMIT 1");
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $tablecomments WHERE comment_approved = '0'");
$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
$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";
$notify_message .= "Author : $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n";
@ -1316,7 +1316,7 @@ function rewrite_rules($matches = '', $permalink_structure = '') {
}
function get_posts($args) {
global $wpdb, $tableposts;
global $wpdb;
parse_str($args, $r);
if (!isset($r['numberposts'])) $r['numberposts'] = 5;
if (!isset($r['offset'])) $r['offset'] = 0;
@ -1327,7 +1327,7 @@ function get_posts($args) {
$now = current_time('mysql');
$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']);
$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']);
return $posts;
}
@ -1354,7 +1354,7 @@ function check_comment($author, $email, $url, $comment, $user_ip) {
}
function query_posts($query) {
global $wpdb, $tablepost2cat, $tableposts, $tablecategories, $tableusers,
global $wpdb,
$pagenow;
parse_str($query);
@ -1485,7 +1485,7 @@ function query_posts($query) {
$eq = '=';
$andor = 'OR';
}
$join = " LEFT JOIN $tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) ";
$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) ";
$cat_array = explode(' ',$cat);
$whichcat .= ' AND (category_id '.$eq.' '.intval($cat_array[0]);
$whichcat .= get_category_children($cat_array[0], ' '.$andor.' category_id '.$eq.' ');
@ -1511,10 +1511,10 @@ function query_posts($query) {
}
}
$category_name = preg_replace('|[^a-z0-9-_]|i', '', $category_name);
$tables = ", $tablepost2cat, $tablecategories";
$join = " LEFT JOIN $tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) LEFT JOIN $tablecategories ON ($tablepost2cat.category_id = $tablecategories.cat_ID) ";
$tables = ", $wpdb->post2cat, $wpdb->categories";
$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) ";
$whichcat = " AND (category_nicename = '$category_name'";
$cat = $wpdb->get_var("SELECT cat_ID FROM $tablecategories WHERE category_nicename = '$category_name'");
$cat = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_name'");
$whichcat .= get_category_children($cat, " OR category_id = ");
$whichcat .= ")";
}
@ -1555,7 +1555,7 @@ function query_posts($query) {
}
}
$author_name = preg_replace('|[^a-z0-9-_]|', '', strtolower($author_name));
$author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_nicename='".$author_name."'");
$author = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$author_name."'");
$whichauthor .= ' AND (post_author = '.intval($author).')';
}
@ -1662,8 +1662,8 @@ function query_posts($query) {
$where .= " OR post_author = $user_ID AND post_status != 'draft')";
else
$where .= ')';
$where .= " GROUP BY $tableposts.ID";
$request = " SELECT $distinct * FROM $tableposts $join WHERE 1=1".$where." ORDER BY post_$orderby $limits";
$where .= " GROUP BY $wpdb->posts.ID";
$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where." ORDER BY post_$orderby $limits";
if ($preview) {
@ -1682,8 +1682,7 @@ function query_posts($query) {
function update_post_caches($posts) {
global $category_cache, $comment_count_cache, $post_meta_cache;
global $tablecategories, $tablepost2cat, $tableposts, $tablecomments,
$tablepostmeta, $wpdb;
global $wpdb;
// No point in doing all this work if we didn't match any posts.
if (! $posts) {
@ -1698,7 +1697,7 @@ function update_post_caches($posts) {
$dogs = $wpdb->get_results("SELECT DISTINCT
ID, category_id, cat_name, category_nicename, category_description, category_parent
FROM $tablecategories, $tablepost2cat, $tableposts
FROM $wpdb->categories, $wpdb->post2cat, $wpdb->posts
WHERE category_id = cat_ID AND post_id = ID AND post_id IN ($post_id_list)");
foreach ($dogs as $catt) {
@ -1707,8 +1706,8 @@ function update_post_caches($posts) {
// Do the same for comment numbers
$comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount
FROM $tableposts
LEFT JOIN $tablecomments ON ( comment_post_ID = ID AND comment_approved = '1')
FROM $wpdb->posts
LEFT JOIN $wpdb->comments ON ( comment_post_ID = ID AND comment_approved = '1')
WHERE post_status = 'publish' AND ID IN ($post_id_list)
GROUP BY ID");
@ -1721,7 +1720,7 @@ function update_post_caches($posts) {
// Get post-meta info
if ( $meta_list = $wpdb->get_results("
SELECT post_id,meta_key,meta_value
FROM $tablepostmeta
FROM $wpdb->postmeta
WHERE post_id IN($post_id_list)
ORDER BY post_id,meta_key
", ARRAY_A) ) {
@ -1746,17 +1745,17 @@ function update_post_caches($posts) {
}
function update_category_cache() {
global $cache_categories, $tablecategories, $wpdb;
$dogs = $wpdb->get_results("SELECT * FROM $tablecategories WHERE 1=1");
global $cache_categories, $wpdb;
$dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE 1=1");
foreach ($dogs as $catt) {
$cache_categories[$catt->cat_ID] = $catt;
}
}
function update_user_cache() {
global $cache_userdata, $tableusers, $wpdb;
global $cache_userdata, $wpdb;
$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level > 0");
$users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level > 0");
foreach ($users as $user) {
$cache_userdata[$user->ID] = $user;
}

View File

@ -19,8 +19,8 @@ $all_links = array();
** the db) the ones which have been updated (on weblogs.com).
**/
function preload_links() {
global $tablelinks, $all_links, $wpdb;
$links = $wpdb->get_results("SELECT link_id, link_url FROM $tablelinks WHERE link_visible = 'Y' AND link_url <> ''");
global $all_links, $wpdb;
$links = $wpdb->get_results("SELECT link_id, link_url FROM $wpdb->links WHERE link_visible = 'Y' AND link_url <> ''");
foreach ($links as $link) {
$link_url = transform_url($link->link_url);
$all_links[$link_url] = array($link->link_id, 0);
@ -32,11 +32,11 @@ function preload_links() {
** Update in the db the links which have been updated ($all_links[url][1] != 0)
**/
function update_links() {
global $tablelinks, $all_links, $wpdb;
global $all_links, $wpdb;
reset($all_links);
while (list($id, $val) = each($all_links)) {
if ($val[1]) {
$wpdb->query("UPDATE $tablelinks SET link_updated = '$val[1]' WHERE link_id = $val[0]");
$wpdb->query("UPDATE $wpdb->links SET link_updated = '$val[1]' WHERE link_id = $val[0]");
}
} // end while
}

View File

@ -26,9 +26,9 @@ function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
$between = " ", $show_images = true, $orderby = 'id',
$show_description = true, $show_rating = false,
$limit = -1, $show_updated = 0) {
global $tablelinkcategories, $wpdb;
global $wpdb;
$cat_id = -1;
$results = $wpdb->get_results("SELECT cat_id FROM $tablelinkcategories WHERE cat_name='$cat_name'");
$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
if ($results) {
foreach ($results as $result) {
$cat_id = $result->cat_id;
@ -49,11 +49,11 @@ function bool_from_yn($yn) {
** category (no default) - The category to use.
**/
function wp_get_linksbyname($category) {
global $wpdb, $tablelinkcategories;
global $wpdb;
$cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_name='$category'");
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_name='$category'");
if ($cat) {
if ($cat->sort_desc == 'Y') {
$cat->sort_order = '_'.$cat->sort_order;
@ -71,11 +71,11 @@ function wp_get_linksbyname($category) {
** category (no default) - The category to use.
**/
function wp_get_links($category) {
global $wpdb, $tablelinkcategories;
global $wpdb;
$cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$category");
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$category");
if ($cat) {
if ($cat->sort_desc == 'Y') {
$cat->sort_order = '_'.$cat->sort_order;
@ -114,7 +114,7 @@ function get_links($category = -1, $before = '', $after = '<br />',
$show_description = true, $show_rating = false,
$limit = -1, $show_updated = 1, $echo = true) {
global $tablelinks, $wpdb;
global $wpdb;
$direction = ' ASC';
$category_query = "";
@ -155,7 +155,7 @@ function get_links($category = -1, $before = '', $after = '<br />',
$sql = "SELECT link_url, link_name, link_image, link_target,
link_description, link_rating, link_rel $length $recently_updated_test $get_updated
FROM $tablelinks
FROM $wpdb->links
WHERE link_visible = 'Y' " .
$category_query;
$sql .= ' ORDER BY ' . $orderby;
@ -277,9 +277,9 @@ function get_links($category = -1, $before = '', $after = '<br />',
** }
**/
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
global $tablelinkcategories, $wpdb;
global $wpdb;
$cat_id = -1;
$results = $wpdb->get_results("SELECT cat_id FROM $tablelinkcategories WHERE cat_name='$cat_name'");
$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
if ($results) {
foreach ($results as $result) {
$cat_id = $result->cat_id;
@ -324,9 +324,9 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
** link_notes
**/
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
global $tablelinks, $wpdb;
global $wpdb;
$sql = "SELECT * FROM $tablelinks WHERE link_visible = 'Y'";
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
if ($category != -1) {
$sql .= " AND link_category = $category ";
}
@ -459,10 +459,10 @@ function get_links_withrating($category = -1, $before = '', $after = '<br />',
** uses 0
*/
function get_linkcatname($id = 0) {
global $tablelinkcategories, $wpdb;
global $wpdb;
$cat_name = '';
if ('' != $id) {
$cat_name = $wpdb->get_var("SELECT cat_name FROM $tablelinkcategories WHERE cat_id=$id");
$cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->linkcategories WHERE cat_id=$id");
}
return stripslashes($cat_name);
}
@ -473,8 +473,8 @@ function get_linkcatname($id = 0) {
** uses 0
*/
function get_autotoggle($id = 0) {
global $tablelinkcategories, $wpdb;
$auto_toggle = $wpdb->get_var("SELECT auto_toggle FROM $tablelinkcategories WHERE cat_id=$id");
global $wpdb;
$auto_toggle = $wpdb->get_var("SELECT auto_toggle FROM $wpdb->linkcategories WHERE cat_id=$id");
if ('' == $auto_toggle)
$auto_toggle = 'N';
return $auto_toggle;
@ -492,9 +492,8 @@ function get_autotoggle($id = 0) {
*/
function links_popup_script($text = 'Links', $width=400, $height=400,
$file='links.all.php', $count = true) {
global $tablelinks;
if ($count == true) {
$counts = $wpdb->get_var("SELECT count(*) FROM $tablelinks");
$counts = $wpdb->get_var("SELECT count(*) FROM $wpdb->links");
}
$javascript = "<a href=\"#\" " .
@ -518,7 +517,7 @@ function links_popup_script($text = 'Links', $width=400, $height=400,
* added by Dougal
*
* Output a list of all links, listed by category, using the
* settings in $tablelinkcategories and output it as a nested
* settings in $wpdb->linkcategories and output it as a nested
* HTML unordered list.
*
* Parameters:
@ -526,7 +525,7 @@ function links_popup_script($text = 'Links', $width=400, $height=400,
* hide_if_empty (default true) - Supress listing empty link categories
*/
function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
global $tablelinkcategories, $tablelinks, $wpdb;
global $wpdb;
$order = strtolower($order);
@ -545,8 +544,8 @@ function get_links_list($order = 'name', $hide_if_empty = 'obsolete') {
SELECT DISTINCT link_category, cat_name, show_images,
show_description, show_rating, show_updated, sort_order,
sort_desc, list_limit
FROM `$tablelinks`
LEFT JOIN `$tablelinkcategories` ON (link_category = cat_id)
FROM `$wpdb->links`
LEFT JOIN `$wpdb->linkcategories` ON (link_category = cat_id)
WHERE link_visible = 'Y'
AND list_limit <> 0
ORDER BY $cat_order $direction ", ARRAY_A);

View File

@ -77,7 +77,7 @@ function the_author_posts_link($idmode='') {
function get_author_link($echo = false, $author_id, $author_nicename) {
global $wpdb, $tableusers, $post, $querystring_start, $querystring_equal, $cache_userdata;
global $wpdb, $post, $querystring_start, $querystring_equal, $cache_userdata;
$auth_ID = $author_id;
$permalink_structure = get_settings('permalink_structure');
@ -126,9 +126,9 @@ function wp_list_authors($args = '') {
}
function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
global $tableusers, $wpdb, $blogfilename;
global $wpdb, $blogfilename;
$query = "SELECT ID, user_nickname, user_firstname, user_lastname, user_nicename from $tableusers " . ($exclude_admin ? "WHERE user_nickname <> 'admin' " : '') . "ORDER BY user_nickname";
$query = "SELECT ID, user_nickname, user_firstname, user_lastname, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_nickname <> 'admin' " : '') . "ORDER BY user_nickname";
$authors = $wpdb->get_results($query);
foreach($authors as $author) {

View File

@ -1,14 +1,14 @@
<?php
function get_the_category() {
global $post, $tablecategories, $tablepost2cat, $wpdb, $category_cache;
global $post, $wpdb, $category_cache;
if ($category_cache[$post->ID]) {
return $category_cache[$post->ID];
} else {
$categories = $wpdb->get_results("
SELECT category_id, cat_name, category_nicename, category_description, category_parent
FROM $tablecategories, $tablepost2cat
WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID
FROM $wpdb->categories, $wpdb->post2cat
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = $post->ID
");
return $categories;
@ -16,7 +16,7 @@ function get_the_category() {
}
function get_category_link($echo = false, $category_id, $category_nicename) {
global $wpdb, $tablecategories, $post, $querystring_start, $querystring_equal, $cache_categories;
global $wpdb, $post, $querystring_start, $querystring_equal, $cache_categories;
$cat_ID = $category_id;
$permalink_structure = get_settings('permalink_structure');
@ -123,9 +123,9 @@ function the_category_rss($type = 'rss') {
}
function get_the_category_by_ID($cat_ID) {
global $tablecategories, $cache_categories, $wpdb;
global $cache_categories, $wpdb;
if ( !$cache_categories[$cat_ID] ) {
$cat_name = $wpdb->get_var("SELECT cat_name FROM $tablecategories WHERE cat_ID = '$cat_ID'");
$cat_name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
$cache_categories[$cat_ID]->cat_name = $cat_name;
} else {
$cat_name = $cache_categories[$cat_ID]->cat_name;
@ -134,8 +134,8 @@ function get_the_category_by_ID($cat_ID) {
}
function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){
global $tablecategories, $cache_categories;
$chain = "";
global $cache_categories;
$chain = '';
$parent = $cache_categories[$id];
if ($nicename) {
$name = $parent->category_nicename;
@ -152,7 +152,7 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
}
function get_category_children($id, $before = '/', $after = '') {
global $tablecategories, $cache_categories;
global $cache_categories;
$c_cache = $cache_categories; // Can't do recursive foreach on a global, have to make a copy
$chain = '';
foreach ($c_cache as $category){
@ -184,7 +184,7 @@ function the_category_head($before='', $after='') {
}
function category_description($category = 0) {
global $cat, $wpdb, $tablecategories, $cache_categories;
global $cat, $wpdb, $cache_categories;
if (!$category) $category = $cat;
$category_description = $cache_categories[$category]->category_description;
$category_description = apply_filters('category_description', $category_description);
@ -195,7 +195,7 @@ function category_description($category = 0) {
function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc',
$optiondates = 0, $optioncount = 0, $hide_empty = 1, $optionnone=FALSE,
$selected=0, $hide=0) {
global $tablecategories, $tableposts, $tablepost2cat, $wpdb;
global $wpdb;
global $querystring_start, $querystring_equal, $querystring_separator;
if (($file == 'blah') || ($file == '')) $file = get_settings('home') . '/' . get_settings('blogfilename');
if (!$selected) $selected=$cat;
@ -203,10 +203,10 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
$query = "
SELECT cat_ID, cat_name, category_nicename,category_parent,
COUNT($tablepost2cat.post_id) AS cat_count,
COUNT($wpdb->post2cat.post_id) AS cat_count,
DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth
FROM $tablecategories LEFT JOIN $tablepost2cat ON (cat_ID = category_id)
LEFT JOIN $tableposts ON (ID = post_id)
FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (cat_ID = category_id)
LEFT JOIN $wpdb->posts ON (ID = post_id)
WHERE cat_ID > 0
";
if ($hide) {
@ -265,7 +265,7 @@ function wp_list_cats($args = '') {
}
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 = '') {
global $tablecategories, $tableposts, $tablepost2cat, $wpdb, $category_posts;
global $wpdb, $category_posts;
global $querystring_start, $querystring_equal, $querystring_separator;
// Optiondates now works
if ('' == $file) {
@ -287,7 +287,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
$query = "
SELECT cat_ID, cat_name, category_nicename, category_description, category_parent
FROM $tablecategories
FROM $wpdb->categories
WHERE cat_ID > 0 $exclusions
ORDER BY $sort_column $sort_order";
@ -295,10 +295,10 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
}
if (!count($category_posts)) {
$cat_counts = $wpdb->get_results(" SELECT cat_ID,
COUNT($tablepost2cat.post_id) AS cat_count
FROM $tablecategories
INNER JOIN $tablepost2cat ON (cat_ID = category_id)
INNER JOIN $tableposts ON (ID = post_id)
COUNT($wpdb->post2cat.post_id) AS cat_count
FROM $wpdb->categories
INNER JOIN $wpdb->post2cat ON (cat_ID = category_id)
INNER JOIN $wpdb->posts ON (ID = post_id)
WHERE post_status = 'publish' $exclusions
GROUP BY category_id");
foreach ($cat_counts as $cat_count) {
@ -311,9 +311,9 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
if (intval($optiondates) == 1) {
$cat_dates = $wpdb->get_results(" SELECT cat_ID,
DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth
FROM $tablecategories
LEFT JOIN $tablepost2cat ON (cat_ID = category_id)
LEFT JOIN $tableposts ON (ID = post_id)
FROM $wpdb->categories
LEFT JOIN $wpdb->post2cat ON (cat_ID = category_id)
LEFT JOIN $wpdb->posts ON (ID = post_id)
WHERE post_status = 'publish' $exclusions
GROUP BY category_id");
foreach ($cat_dates as $cat_date) {

View File

@ -26,8 +26,8 @@ function clean_url($url) {
}
function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $number='') {
global $id, $comment, $tablecomments, $wpdb, $comment_count_cache;
if ('' == $comment_count_cache["$id"]) $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'");
global $id, $comment, $wpdb, $comment_count_cache;
if ('' == $comment_count_cache["$id"]) $number = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1'");
else $number = $comment_count_cache["$id"];
if ($number == 0) {
$blah = $zero;
@ -56,12 +56,12 @@ function comments_popup_script($width=400, $height=400, $file='wp-comments-popup
}
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $tablecomments, $cookiehash;
global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $cookiehash;
global $querystring_start, $querystring_equal, $querystring_separator;
global $comment_count_cache, $single;
if (!$single) {
if ('' == $comment_count_cache["$id"]) {
$number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1';");
$number = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
} else {
$number = $comment_count_cache["$id"];
}

View File

@ -91,7 +91,7 @@ function get_bloginfo($show='') {
}
function wp_title($sep = '&raquo;', $display = true) {
global $wpdb, $tableposts, $tablecategories;
global $wpdb;
global $year, $monthnum, $day, $cat, $p, $name, $month, $posts, $single;
// If there's a category
@ -101,7 +101,7 @@ function wp_title($sep = '&raquo;', $display = true) {
}
}
if (!empty($category_name)) {
$title = stripslashes($wpdb->get_var("SELECT cat_name FROM $tablecategories WHERE category_nicename = '$category_name'"));
$title = stripslashes($wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE category_nicename = '$category_name'"));
}
// If there's a month
@ -136,10 +136,10 @@ function wp_title($sep = '&raquo;', $display = true) {
}
function single_post_title($prefix = '', $display = true) {
global $p, $name, $wpdb, $tableposts;
global $p, $name, $wpdb;
if (intval($p) || '' != $name) {
if (!$p) {
$p = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_name = '$name'");
$p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'");
}
$post_data = get_postdata($p);
$title = $post_data['Title'];
@ -202,7 +202,6 @@ function wp_get_archives($args = '') {
}
function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
global $tableposts;
global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb;
if ('' == $type) {
@ -243,7 +242,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
$now = current_time('mysql');
if ('monthly' == $type) {
$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);
$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);
if ($arcresults) {
$afterafter = $after;
foreach ($arcresults as $arcresult) {
@ -258,7 +257,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
}
} elseif ('daily' == $type) {
$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);
$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);
if ($arcresults) {
foreach ($arcresults as $arcresult) {
$url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
@ -269,7 +268,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
} elseif ('weekly' == $type) {
$start_of_week = get_settings('start_of_week');
$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);
$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);
$arc_w_last = '';
if ($arcresults) {
foreach ($arcresults as $arcresult) {
@ -288,7 +287,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
}
} elseif ('postbypost' == $type) {
$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);
$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);
if ($arcresults) {
foreach ($arcresults as $arcresult) {
if ($arcresult->post_date != '0000-00-00 00:00:00') {
@ -307,11 +306,11 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
}
function get_calendar($daylength = 1) {
global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $tableposts, $posts;
global $wpdb, $m, $monthnum, $year, $timedifference, $month, $month_abbrev, $weekday, $weekday_initial, $weekday_abbrev, $posts;
// Quick check. If we have no posts at all, abort!
if (!$posts) {
$gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
$gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
if (!$gotsome)
return;
}
@ -349,13 +348,13 @@ function get_calendar($daylength = 1) {
// Get the next and previous month and year with at least one post
$previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
FROM $tableposts
FROM $wpdb->posts
WHERE post_date < '$thisyear-$thismonth-01'
AND post_status = 'publish'
ORDER BY post_date DESC
LIMIT 1");
$next = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year
FROM $tableposts
FROM $wpdb->posts
WHERE post_date > '$thisyear-$thismonth-01'
AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
AND post_status = 'publish'
@ -409,7 +408,7 @@ function get_calendar($daylength = 1) {
// Get days with posts
$dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date)
FROM $tableposts WHERE MONTH(post_date) = $thismonth
FROM $wpdb->posts WHERE MONTH(post_date) = $thismonth
AND YEAR(post_date) = $thisyear
AND post_status = 'publish'
AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
@ -433,7 +432,7 @@ function get_calendar($daylength = 1) {
$ak_titles_for_day = array();
$ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH(post_date) as dom "
."FROM $tableposts "
."FROM $wpdb->posts "
."WHERE YEAR(post_date) = '$thisyear' "
."AND MONTH(post_date) = '$thismonth' "
."AND post_date < '".current_time('mysql')."' "

View File

@ -27,7 +27,7 @@ function permalink_single_rss($file = '') {
}
function get_permalink($id=false) {
global $post, $wpdb, $tableposts;
global $post, $wpdb;
global $querystring_start, $querystring_equal;
$rewritecode = array(
@ -58,7 +58,7 @@ function get_permalink($id=false) {
return get_settings('home') . '/' . get_settings('blogfilename').$querystring_start.'p'.$querystring_equal.$post->ID;
}
} else { // if an ID is given
$idpost = $wpdb->get_row("SELECT post_date, post_name FROM $tableposts WHERE ID = $id");
$idpost = $wpdb->get_row("SELECT post_date, post_name FROM $wpdb->posts WHERE ID = $id");
if ('' != get_settings('permalink_structure')) {
$unixtime = strtotime($idpost->post_date);
$rewritereplace = array(

View File

@ -275,7 +275,7 @@ function link_pages($before='<br />', $after='<br />', $next_or_number='number',
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
global $tableposts, $id, $post, $wpdb;
global $id, $post, $wpdb;
global $p, $posts, $posts_per_page, $s, $single;
global $querystring_start, $querystring_equal, $querystring_separator;
@ -299,7 +299,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
}
$limitprev--;
$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");
$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");
if ($lastpost) {
$string = '<a href="'.get_permalink($lastpost->ID).'">'.$previous;
if ($title == 'yes') {
@ -313,7 +313,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
}
function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
global $tableposts, $posts_per_page, $post, $wpdb, $single;
global $posts_per_page, $post, $wpdb, $single;
if(1 == $posts_per_page || 1 == $single) {
$current_post_date = $post->post_date;
@ -337,7 +337,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
$limitnext--;
$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");
$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");
if ($nextpost) {
$string = '<a href="'.get_permalink($nextpost->ID).'">'.$next;
if ($title=='yes') {

View File

@ -19,6 +19,21 @@ class wpdb {
var $last_query;
var $col_info;
// Our tables
var $posts;
var $users;
var $categories;
var $post2cat;
var $comments;
var $links;
var $linkcategories;
var $options;
var $optiontypes;
var $optionvalues;
var $optiongroups;
var $optiongroup_options;
var $postmeta;
// ==================================================================
// DB Constructor - connects to the server and selects a database

View File

@ -12,8 +12,8 @@ if ((empty($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
$link_cat = addslashes_gpc($link_cat);
$link_cat = intval($link_cat);
if ($link_cat != 0) {
$sql_cat = "AND $tablelinks.link_category = $link_cat";
$cat_name = $wpdb->get_var("SELECT $tablelinkcategories.cat_name FROM $tablelinkcategories WHERE $tablelinkcategories.cat_id = $link_cat");
$sql_cat = "AND $wpdb->links.link_category = $link_cat";
$cat_name = $wpdb->get_var("SELECT $wpdb->linkcategories.cat_name FROM $wpdb->linkcategories WHERE $wpdb->linkcategories.cat_id = $link_cat");
if (!empty($cat_name)) {
$cat_name = ": category $cat_name";
}
@ -27,11 +27,11 @@ if ((empty($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
</head>
<body>
<?php $sql = "SELECT $tablelinks.link_url, link_rss, $tablelinks.link_name, $tablelinks.link_category, $tablelinkcategories.cat_name
FROM $tablelinks
LEFT JOIN $tablelinkcategories on $tablelinks.link_category = $tablelinkcategories.cat_id
<?php $sql = "SELECT $wpdb->links.link_url, link_rss, $wpdb->links.link_name, $wpdb->links.link_category, $wpdb->linkcategories.cat_name
FROM $wpdb->links
LEFT JOIN $wpdb->linkcategories on $wpdb->links.link_category = $wpdb->linkcategories.cat_id
$sql_cat
ORDER BY $tablelinkcategories.cat_name, $tablelinks.link_name \n";
ORDER BY $wpdb->linkcategories.cat_name, $wpdb->links.link_name \n";
//echo("<!-- $sql -->");
$prev_cat_id = 0;
$results = $wpdb->get_results($sql);

View File

@ -72,7 +72,7 @@ case 'login':
function login() {
global $wpdb, $log, $pwd, $error, $user_ID;
global $tableusers, $pass_is_md5;
global $pass_is_md5;
$user_login = &$log;
$pwd = md5($pwd);
$password = &$pwd;
@ -86,7 +86,7 @@ case 'login':
return false;
}
$query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND user_pass = '$password'";
$query = "SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$user_login' AND user_pass = '$password'";
$login = $wpdb->get_row($query);
@ -208,7 +208,7 @@ case 'retrievepassword':
// Generate something random for a password... md5'ing current time with a rand salt
$user_pass = substr((MD5("time" . rand(1,16000))), 0, 6);
// now insert the new pass md5'd into the db
$wpdb->query("UPDATE $tableusers SET user_pass = MD5('$user_pass') WHERE user_login = '$user_login'");
$wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$user_pass') WHERE user_login = '$user_login'");
$message = "Login: $user_login\r\n";
$message .= "Password: $user_pass\r\n";
$message .= 'Login at: ' . get_settings('siteurl') . '/wp-login.php';

View File

@ -121,7 +121,7 @@ for ($i=1; $i <= $count; $i++) :
$content = addslashes(trim($content));
$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')";
$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')";
$result = $wpdb->query($sql);
$post_ID = $wpdb->insert_id;
@ -138,11 +138,11 @@ foreach ($post_categories as $post_category) :
$post_category = intval($post_category);
// Double check it's not there already
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");
$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
if (!$exists && $result) {
$wpdb->query("
INSERT INTO $tablepost2cat
INSERT INTO $wpdb->post2cat
(post_id, category_id)
VALUES
($post_ID, $post_category)

View File

@ -71,7 +71,7 @@ case 'register':
}
/* checking the login isn't already used by another user */
$result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
$result = $wpdb->get_results("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
if (count($result) >= 1) {
die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.'));
}
@ -86,7 +86,7 @@ case 'register':
$now = gmdate('Y-m-d H:i:s');
$new_users_can_blog = get_settings('new_users_can_blog');
$result = $wpdb->query("INSERT INTO $tableusers
$result = $wpdb->query("INSERT INTO $wpdb->users
(user_login, user_pass, user_nickname, user_email, user_ip, user_browser, dateYMDhour, user_level, user_idmode)
VALUES
('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_browser', '$now', '$new_users_can_blog', 'nickname')");

View File

@ -9,28 +9,26 @@ $_SERVER['REQUEST_URI'] = ( isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_U
// Change to E_ALL for development/debugging
error_reporting(E_ALL ^ E_NOTICE);
// Table names
$tableposts = $table_prefix . 'posts';
$tableusers = $table_prefix . 'users';
$tablesettings = $table_prefix . 'settings'; // only used during upgrade
$tablecategories = $table_prefix . 'categories';
$tablepost2cat = $table_prefix . 'post2cat';
$tablecomments = $table_prefix . 'comments';
$tablelinks = $table_prefix . 'links';
$tablelinkcategories = $table_prefix . 'linkcategories';
$tableoptions = $table_prefix . 'options';
$tableoptiontypes = $table_prefix . 'optiontypes';
$tableoptionvalues = $table_prefix . 'optionvalues';
$tableoptiongroups = $table_prefix . 'optiongroups';
$tableoptiongroup_options = $table_prefix . 'optiongroup_options';
$tablepostmeta = $table_prefix . 'postmeta';
define('WPINC', 'wp-includes');
require_once (ABSPATH . WPINC . '/wp-db.php');
// Table names
$wpdb->posts = $table_prefix . 'posts';
$wpdb->users = $table_prefix . 'users';
$wpdb->categories = $table_prefix . 'categories';
$wpdb->post2cat = $table_prefix . 'post2cat';
$wpdb->comments = $table_prefix . 'comments';
$wpdb->links = $table_prefix . 'links';
$wpdb->linkcategories = $table_prefix . 'linkcategories';
$wpdb->options = $table_prefix . 'options';
$wpdb->optiontypes = $table_prefix . 'optiontypes';
$wpdb->optionvalues = $table_prefix . 'optionvalues';
$wpdb->optiongroups = $table_prefix . 'optiongroups';
$wpdb->optiongroup_options = $table_prefix . 'optiongroup_options';
$wpdb->postmeta = $table_prefix . 'postmeta';
$wpdb->hide_errors();
$users = $wpdb->get_results("SELECT * FROM $tableusers");
$users = $wpdb->get_results("SELECT * FROM $wpdb->users");
if (!$users && !strstr($_SERVER['PHP_SELF'], 'install.php')) {
die("It doesn't look like you've installed WP yet. Try running <a href='wp-admin/install.php'>install.php</a>.");
}

View File

@ -28,7 +28,7 @@ if ((strlen(''.$tb_id)) && (empty($_GET['__mode'])) && (strlen(''.$tb_url))) {
if (!get_settings('use_trackback'))
trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.');
$pingstatus = $wpdb->get_var("SELECT ping_status FROM $tableposts WHERE ID = $tb_id");
$pingstatus = $wpdb->get_var("SELECT ping_status FROM $wpdb->posts WHERE ID = $tb_id");
if ('closed' == $pingstatus)
trackback_response(1, 'Sorry, trackbacks are closed for this item.');
@ -72,7 +72,7 @@ if ((strlen(''.$tb_id)) && (empty($_GET['__mode'])) && (strlen(''.$tb_url))) {
$approved = 0;
}
$result = $wpdb->query("INSERT INTO $tablecomments
$result = $wpdb->query("INSERT INTO $wpdb->comments
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved)
VALUES
('$comment_post_ID', '$author', '$email', '$tb_url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved')

View File

@ -163,7 +163,7 @@ class wp_xmlrpc_server extends IXR_Server {
/* blogger.getRecentPosts ...gets recent posts */
function blogger_getRecentPosts($args) {
global $tableposts, $wpdb;
global $wpdb;
$blog_ID = $args[1]; /* though we don't use it yet */
$user_login = $args[2];
@ -180,7 +180,7 @@ class wp_xmlrpc_server extends IXR_Server {
return $this->error;
}
$sql = "SELECT * FROM $tableposts ORDER BY post_date DESC".$limit;
$sql = "SELECT * FROM $wpdb->posts ORDER BY post_date DESC".$limit;
$result = $wpdb->get_results($sql);
if (!$result) {
@ -322,7 +322,7 @@ class wp_xmlrpc_server extends IXR_Server {
/* blogger.newPost ...creates a new post */
function blogger_newPost($args) {
global $tableposts, $wpdb;
global $wpdb;
$blog_ID = $args[1]; /* though we don't use it yet */
$user_login = $args[2];
@ -375,7 +375,7 @@ $wp_xmlrpc_server = new wp_xmlrpc_server();
*/
function wp_insert_post($postarr = array()) {
global $wpdb, $tableposts, $post_default_category;
global $wpdb, $post_default_category;
// export array as variables
extract($postarr);
@ -400,7 +400,7 @@ function wp_insert_post($postarr = array()) {
if (empty($post_date_gmt))
$post_date_gmt = get_gmt_from_date($post_date);
$sql = "INSERT INTO $tableposts
$sql = "INSERT INTO $wpdb->posts
(post_author, post_date, post_date_gmt, post_modified, post_modified_gmt, post_content, post_title, post_excerpt, post_category, post_status, post_name)
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')";
@ -416,7 +416,7 @@ function wp_insert_post($postarr = array()) {
function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
global $wpdb, $tablepost2cat;
global $wpdb;
// If $post_categories isn't already an array, make it one:
if (!is_array($post_categories)) {
if (!$post_categories) {
@ -430,7 +430,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
// First the old categories
$old_categories = $wpdb->get_col("
SELECT category_id
FROM $tablepost2cat
FROM $wpdb->post2cat
WHERE post_id = $post_ID");
if (!$old_categories) {
@ -453,7 +453,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
if ($delete_cats) {
foreach ($delete_cats as $del) {
$wpdb->query("
DELETE FROM $tablepost2cat
DELETE FROM $wpdb->post2cat
WHERE category_id = $del
AND post_id = $post_ID
");
@ -470,7 +470,7 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
if ($add_cats) {
foreach ($add_cats as $new_cat) {
$wpdb->query("
INSERT INTO $tablepost2cat (post_id, category_id)
INSERT INTO $wpdb->post2cat (post_id, category_id)
VALUES ($post_ID, $new_cat)");
logio("O","adding post/cat: $post_ID, $new_cat");
@ -480,10 +480,10 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
function wp_get_post_cats($blogid = '1', $post_ID = 0) {
global $wpdb, $tablepost2cat;
global $wpdb;
$sql = "SELECT category_id
FROM $tablepost2cat
FROM $wpdb->post2cat
WHERE post_id = $post_ID
ORDER BY category_id";