[wp-cvs] wordpress/wp-admin admin-functions.php, 1.26, 1.27 admin-header.php, 1.22, 1.23 auth.php, 1.5, 1.6 categories.php, 1.29, 1.30 edit-comments.php, 1.23, 1.24 edit.php, 1.21, 1.22 import-b2.php, 1.9, 1.10 import-blogger.php, 1.11, 1.12 import-greymatter.php, 1.13, 1.14 import-livejournal.php, 1.3, 1.4 import-mt.php, 1.10, 1.11 import-rss.php, 1.3, 1.4 import-textpattern.php, 1.9, 1.10 install-helper.php, 1.1, 1.2 install.php, 1.29, 1.30 link-add.php, 1.11, 1.12 link-categories.php, 1.8, 1.9 link-import.php, 1.10, 1.11 link-manager.php, 1.24, 1.25 moderation.php, 1.9, 1.10 optionhandler.php, 1.7, 1.8 options-head.php, 1.7, 1.8 options-writing.php, 1.16, 1.17 options.php, 1.20, 1.21 post.php, 1.60, 1.61 profile.php, 1.20, 1.21 upgrade-functions.php, 1.54, 1.55 users.php, 1.26, 1.27 xmlrpc.php, 1.3, 1.4

Matthew Mullenweg saxmatt at users.sourceforge.net
Mon May 24 03:22:20 CDT 2004


Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19270/wp-admin

Modified Files:
	admin-functions.php admin-header.php auth.php categories.php 
	edit-comments.php edit.php import-b2.php import-blogger.php 
	import-greymatter.php import-livejournal.php import-mt.php 
	import-rss.php import-textpattern.php install-helper.php 
	install.php link-add.php link-categories.php link-import.php 
	link-manager.php moderation.php optionhandler.php 
	options-head.php options-writing.php options.php post.php 
	profile.php upgrade-functions.php users.php xmlrpc.php 
Log Message:
Giant commit, sorry mailing list people. Move all table names to new $wpdb versions. Works but the whole app needs thorough testing now.

Index: link-add.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/link-add.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** link-add.php	28 Apr 2004 05:34:50 -0000	1.11
--- link-add.php	24 May 2004 08:22:17 -0000	1.12
***************
*** 7,13 ****
  
  function category_dropdown($fieldname, $selected = 0) {
!     global $wpdb, $tablelinkcategories;
  
!     $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
      echo '        <select name="'.$fieldname.'" size="1">'."\n";
      foreach ($results as $row) {
--- 7,13 ----
  
  function category_dropdown($fieldname, $selected = 0) {
!     global $wpdb;
  
!     $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) {

Index: auth.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/auth.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** auth.php	19 May 2004 07:05:40 -0000	1.5
--- auth.php	24 May 2004 08:22:16 -0000	1.6
***************
*** 6,10 ****
  function veriflog() {
  	global $cookiehash;
! 	global $tableusers, $wpdb;
  
  	if (!empty($_COOKIE['wordpressuser_' . $cookiehash])) {
--- 6,10 ----
  function veriflog() {
  	global $cookiehash;
! 	global $wpdb;
  
  	if (!empty($_COOKIE['wordpressuser_' . $cookiehash])) {
***************
*** 20,24 ****
  		return false;
  
! 	$login = $wpdb->get_row("SELECT user_login, user_pass FROM $tableusers WHERE user_login = '$user_login'");
  
  	if (!$login) {
--- 20,24 ----
  		return false;
  
! 	$login = $wpdb->get_row("SELECT user_login, user_pass FROM $wpdb->users WHERE user_login = '$user_login'");
  
  	if (!$login) {

Index: optionhandler.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/optionhandler.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** optionhandler.php	3 Jan 2004 03:19:56 -0000	1.7
--- optionhandler.php	24 May 2004 08:22:17 -0000	1.8
***************
*** 10,14 ****
  function get_option_widget($option_result, $editable, $between)
  {
!     global $wpdb, $tableoptionvalues;
      $disabled = $editable ? '' : 'disabled';
  
--- 10,14 ----
  function get_option_widget($option_result, $editable, $between)
  {
!     global $wpdb;
      $disabled = $editable ? '' : 'disabled';
  
***************
*** 48,52 ****
  
              $select = $wpdb->get_results("SELECT optionvalue, optionvalue_desc "
!                                          ."FROM $tableoptionvalues "
                                           ."WHERE option_id = $option_result->option_id "
                                           ."ORDER BY optionvalue_seq");
--- 48,52 ----
  
              $select = $wpdb->get_results("SELECT optionvalue, optionvalue_desc "
!                                          ."FROM $wpdb->optionvalues "
                                           ."WHERE option_id = $option_result->option_id "
                                           ."ORDER BY optionvalue_seq");
***************
*** 67,71 ****
          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");
              if (!$sql) {
                  return $option_result->option_name . $editable;
--- 67,71 ----
          case 7: // SQL select
              // first get the sql to run
!             $sql = $wpdb->get_var("SELECT optionvalue FROM $wpdb->optionvalues WHERE option_id = $option_result->option_id");
              if (!$sql) {
                  return $option_result->option_name . $editable;
***************
*** 101,110 ****
  
  function validate_option($option, $name, $val) {
!     global $wpdb, $tableoptionvalues;
      $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");
              if ($range) {
                  if (($val < $range->optionvalue_min) || ($val > $range->optionvalue_max)) {
--- 101,110 ----
  
  function validate_option($option, $name, $val) {
!     global $wpdb;
      $msg = '';
      switch ($option->option_type) {
          case 6: // range
              // get range
!             $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)) {

Index: options-head.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-head.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** options-head.php	14 May 2004 06:21:24 -0000	1.7
--- options-head.php	24 May 2004 08:22:17 -0000	1.8
***************
*** 7,11 ****
  //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");
  foreach ($option_groups as $option_group) {
  	if ($option_group->group_id == $option_group_id) {
--- 7,11 ----
  //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 $wpdb->optiongroups ORDER BY group_id");
  foreach ($option_groups as $option_group) {
  	if ($option_group->group_id == $option_group_id) {

Index: import-greymatter.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/import-greymatter.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** import-greymatter.php	27 Apr 2004 23:17:16 -0000	1.13
--- import-greymatter.php	24 May 2004 08:22:17 -0000	1.14
***************
*** 88,92 ****
  		$user_joindate=addslashes($user_joindate);
  
! 		$loginthere = $wpdb->get_var("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
  		if ($loginthere) {
  			echo "<li>user <i>$user_login</i>... <b>Already exists</b></li>";
--- 88,92 ----
  		$user_joindate=addslashes($user_joindate);
  
! 		$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>";
***************
*** 94,98 ****
  		}
  
! 		$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')";
  		$result = mysql_query($query);
  		if ($result==false) {
--- 94,98 ----
  		}
  
! 		$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) {
***************
*** 140,144 ****
  			$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'";
  			$result = mysql_query($sql);
  			if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2
--- 140,144 ----
  			$post_author=trim(addslashes($postinfo[1]));
  			// we'll check the author is registered, or if it's a deleted 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
***************
*** 153,157 ****
  				$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')";
  				$result = mysql_query($query);
  				if ($result==false) {
--- 153,157 ----
  				$user_url=addslashes("");
  				$user_joindate=addslashes($user_joindate);
! 				$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) {
***************
*** 161,165 ****
  			}
  
! 			$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
  			$result = mysql_query($sql);
  			$myrow = mysql_fetch_array($result);
--- 161,165 ----
  			}
  
! 			$sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
  			$result = mysql_query($sql);
  			$myrow = mysql_fetch_array($result);
***************
*** 188,192 ****
  			$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')";
  			$result = mysql_query($query) or die(mysql_error());
  
--- 188,192 ----
  			$post_karma=$postinfo[12];
  
! 			$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());
  
***************
*** 194,198 ****
  				die ("Error in posting...");
  			
! 			$sql2 = "SELECT * FROM $tableposts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
  			$result2 = mysql_query($sql2);
  			$myrow2 = mysql_fetch_array($result2);
--- 194,198 ----
  				die ("Error in posting...");
  			
! 			$sql2 = "SELECT * FROM $wpdb->posts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
  			$result2 = mysql_query($sql2);
  			$myrow2 = mysql_fetch_array($result2);
***************
*** 200,211 ****
  
  			// Grab a default category.
! 			$post_category = $wpdb->get_var("SELECT cat_ID FROM $tablecategories LIMIT 1");
  
  			// Update the post2cat table.
! 			$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");
  			  
  			if (!$exists) {
  			  $wpdb->query("
! 					INSERT INTO $tablepost2cat
  					(post_id, category_id)
  					VALUES
--- 200,211 ----
  
  			// Grab a default category.
! 			$post_category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
  
  			// Update the post2cat table.
! 			$exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
  			  
  			if (!$exists) {
  			  $wpdb->query("
! 					INSERT INTO $wpdb->post2cat
  					(post_id, category_id)
  					VALUES
***************
*** 237,241 ****
  					$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')";
  					$result3 = mysql_query($sql3);
  					if (!$result3)
--- 237,241 ----
  					$comment_content=addslashes($commentinfo[12]);
  
! 					$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)

Index: link-categories.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/link-categories.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** link-categories.php	25 Apr 2004 23:49:45 -0000	1.8
--- link-categories.php	24 May 2004 08:22:17 -0000	1.9
***************
*** 72,76 ****
            $list_limit = -1;
  
!       $wpdb->query("INSERT INTO $tablelinkcategories (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" .
--- 72,76 ----
            $list_limit = -1;
  
!       $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" .
***************
*** 96,101 ****
        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'");
  
      header('Location: link-categories.php');
--- 96,101 ----
        die (__("Cheatin' uh ?"));
  
!     $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');
***************
*** 108,112 ****
      $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");
      if ($row) {
          if ($row->list_limit == -1) {
--- 108,112 ----
      $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 $wpdb->linkcategories WHERE cat_id=$cat_id");
      if ($row) {
          if ($row->list_limit == -1) {
***************
*** 264,268 ****
          $list_limit = -1;
  
!     $wpdb->query("UPDATE $tablelinkcategories set
              cat_name='$cat_name',
              auto_toggle='$auto_toggle',
--- 264,268 ----
          $list_limit = -1;
  
!     $wpdb->query("UPDATE $wpdb->linkcategories set
              cat_name='$cat_name',
              auto_toggle='$auto_toggle',
***************
*** 325,329 ****
  $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");
  $i = 1;
  foreach ($results as $row) {
--- 325,329 ----
  $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 $wpdb->linkcategories ORDER BY cat_id");
  $i = 1;
  foreach ($results as $row) {

Index: categories.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/categories.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** categories.php	23 May 2004 17:24:36 -0000	1.29
--- categories.php	24 May 2004 08:22:16 -0000	1.30
***************
*** 52,56 ****
      $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')");
      
      header('Location: categories.php?message=1#addcat');
--- 52,56 ----
      $cat = intval($_POST['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');
***************
*** 68,72 ****
      $cat_name = get_catname($cat_ID);
      $cat_name = addslashes($cat_name);
!     $category = $wpdb->get_row("SELECT * FROM $tablecategories WHERE cat_ID = '$cat_ID'");
      $cat_parent = $category->category_parent;
  
--- 68,72 ----
      $cat_name = get_catname($cat_ID);
      $cat_name = addslashes($cat_name);
!     $category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
      $cat_parent = $category->category_parent;
  
***************
*** 77,83 ****
          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'");
  
      header('Location: categories.php?message=2');
--- 77,83 ----
          die (__('Cheatin&#8217; uh?'));
  
!     $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');
***************
*** 89,93 ****
      require_once ('admin-header.php');
      $cat_ID = intval($_GET['cat_ID']);
!     $category = $wpdb->get_row("SELECT * FROM $tablecategories WHERE cat_ID = '$cat_ID'");
      $cat_name = stripslashes($category->cat_name);
      ?>
--- 89,93 ----
      require_once ('admin-header.php');
      $cat_ID = intval($_GET['cat_ID']);
!     $category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$cat_ID'");
      $cat_name = stripslashes($category->cat_name);
      ?>
***************
*** 130,134 ****
      $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'");
      
      header('Location: categories.php?message=3');
--- 130,134 ----
      $category_description = $wpdb->escape(stripslashes($_POST['category_description']));
  
!     $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');

Index: edit-comments.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/edit-comments.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** edit-comments.php	14 May 2004 06:19:46 -0000	1.23
--- edit-comments.php	24 May 2004 08:22:17 -0000	1.24
***************
*** 46,53 ****
  	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"));
  		if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {
! 			$wpdb->query("DELETE FROM $tablecomments WHERE comment_ID = $comment");
  			++$i;
  		}
--- 46,53 ----
  	foreach ($delete_comments as $comment) { // Check the permissions on each
  		$comment = intval($comment);
! 		$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 $wpdb->comments WHERE comment_ID = $comment");
  			++$i;
  		}
***************
*** 58,62 ****
  if (isset($_GET['s'])) {
  	$s = $wpdb->escape($_GET['s']);
! 	$comments = $wpdb->get_results("SELECT * FROM $tablecomments  WHERE
  		comment_author LIKE '%$s%' OR
  		comment_author_email LIKE '%$s%' OR
--- 58,62 ----
  if (isset($_GET['s'])) {
  	$s = $wpdb->escape($_GET['s']);
! 	$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments  WHERE
  		comment_author LIKE '%$s%' OR
  		comment_author_email LIKE '%$s%' OR
***************
*** 66,70 ****
  		ORDER BY comment_date DESC");
  } else {
! 	$comments = $wpdb->get_results("SELECT * FROM $tablecomments ORDER BY comment_date DESC LIMIT 20");
  }
  if ('view' == $mode) {
--- 66,70 ----
  		ORDER BY comment_date DESC");
  } else {
! 	$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments ORDER BY comment_date DESC LIMIT 20");
  }
  if ('view' == $mode) {
***************
*** 72,76 ****
  		echo '<ol>';
  		foreach ($comments as $comment) {
! 		$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $tableposts WHERE ID = $comment->comment_post_ID"));
  			$comment_status = wp_get_comment_status($comment->comment_ID);
  			if ('unapproved' == $comment_status) {
--- 72,76 ----
  		echo '<ol>';
  		foreach ($comments as $comment) {
! 		$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) {
***************
*** 90,94 ****
  			} // 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 = ('' == $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>
--- 90,94 ----
  			} // end if any comments to show
  			// Get post title
! 			$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>
***************
*** 120,124 ****
    </tr>';
  		foreach ($comments as $comment) {
! 		$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $tableposts WHERE ID = $comment->comment_post_ID"));
  		$bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee';
  ?>
--- 120,124 ----
    </tr>';
  		foreach ($comments as $comment) {
! 		$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
  		$bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee';
  ?>

Index: options.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** options.php	14 May 2004 08:38:34 -0000	1.20
--- options.php	24 May 2004 08:22:17 -0000	1.21
***************
*** 64,68 ****
  	}
  
!     $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)");
  //	die(var_dump($options));
  
--- 64,68 ----
  	}
  
!     $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));
  
***************
*** 84,88 ****
  				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'";
  					$result = $wpdb->query($query);
  					//if( in_array($option->option_name, $nonbools)) die('boo'.$query);
--- 84,88 ----
  				if( in_array($option->option_name, $nonbools) && $new_val == 0 ) $new_value = 'closed';
                  if ($new_val !== $old_val) {
! 					$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);
***************
*** 131,135 ****
  <?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");
      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");
--- 131,135 ----
  <?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 $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");
***************
*** 160,169 ****
  //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");
  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
  WHERE group_id = $option_group_id
  ORDER BY seq
--- 160,169 ----
  //Now display all the options for the selected group.
  if ('all' == $_GET['option_group_id']) :
! $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 
! $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

Index: upgrade-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/upgrade-functions.php,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** upgrade-functions.php	20 May 2004 11:44:05 -0000	1.54
--- upgrade-functions.php	24 May 2004 08:22:17 -0000	1.55
***************
*** 76,103 ****
  
  function upgrade_071() {
! 	global $tableposts;
! 	maybe_add_column($tableposts, 'post_status', "ALTER TABLE $tableposts ADD `post_status` ENUM('publish','draft','private') NOT NULL");
! 	maybe_add_column($tableposts, 'comment_status', "ALTER TABLE $tableposts ADD `comment_status` ENUM('open','closed') NOT NULL");
! 	maybe_add_column($tableposts, 'ping_status', "ALTER TABLE $tableposts ADD `ping_status` ENUM('open','closed') NOT NULL");
! 	maybe_add_column($tableposts, 'post_password', "ALTER TABLE $tableposts ADD post_password varchar(20) NOT NULL");
  }
  
  function upgrade_072() {
[...1387 lines suppressed...]
*** 829,837 ****
  
  	// Forward-thinking
! 	$wpdb->query("ALTER TABLE `$tableposts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL");
! 	maybe_add_column($tableposts, 'post_parent', "ALTER TABLE `$tableposts` ADD `post_parent` INT NOT NULL ;");
  
  
! 	$wpdb->query("ALTER TABLE `$tablecomments` CHANGE `comment_author_url` `comment_author_url` VARCHAR( 200 ) NOT NULL");
  }
  
--- 828,836 ----
  
  	// Forward-thinking
! 	$wpdb->query("ALTER TABLE `$wpdb->posts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL");
! 	maybe_add_column($wpdb->posts, 'post_parent', "ALTER TABLE `$wpdb->posts` ADD `post_parent` INT NOT NULL ;");
  
  
! 	$wpdb->query("ALTER TABLE `$wpdb->comments` CHANGE `comment_author_url` `comment_author_url` VARCHAR( 200 ) NOT NULL");
  }
  

Index: options-writing.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-writing.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** options-writing.php	8 May 2004 01:15:01 -0000	1.16
--- options-writing.php	24 May 2004 08:22:17 -0000	1.17
***************
*** 108,112 ****
          		<td><select name="default_category" id="default_category">
  <?php
! $categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY cat_name");
  foreach ($categories as $category) :
  if ($category->cat_ID == get_settings('default_category')) $selected = " selected='selected'";
--- 108,112 ----
          		<td><select name="default_category" id="default_category">
  <?php
! $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'";

Index: install-helper.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/install-helper.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** install-helper.php	11 Dec 2003 00:22:35 -0000	1.1
--- install-helper.php	24 May 2004 08:22:17 -0000	1.2
***************
*** 132,146 ****
  
  //check_column('wp_links', 'link_description', 'mediumtext'); 
! //if (check_column($tablecomments, 'comment_author', 'tinytext'))
  //    echo "ok\n";
  $error_count = 0;
! $tablename = $tablelinks;
  // check the column
! if (!check_column($tablelinks, 'link_description', 'varchar(255)'))
  {
!     $ddl = "ALTER TABLE $tablelinks MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
      $q = $wpdb->query($ddl);
  }
! if (check_column($tablelinks, 'link_description', 'varchar(255)')) {
      $res .= $tablename . ' - ok <br />';
  } else {
--- 132,146 ----
  
  //check_column('wp_links', 'link_description', 'mediumtext'); 
! //if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
  //    echo "ok\n";
  $error_count = 0;
! $tablename = $wpdb->links;
  // check the column
! if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
  {
!     $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
      $q = $wpdb->query($ddl);
  }
! if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
      $res .= $tablename . ' - ok <br />';
  } else {

Index: import-b2.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/import-b2.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** import-b2.php	22 Apr 2004 00:40:15 -0000	1.9
--- import-b2.php	24 May 2004 08:22:17 -0000	1.10
***************
*** 83,95 ****
  
  while ($row = mysql_fetch_row($result)) {
!     if ($row[0] == $tablelinks)
          $got_links = true;
!     if ($row[0] == $tablelinkcategories)
          $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 ( " .
             " cat_id int(11) NOT NULL auto_increment, " .
             " cat_name tinytext NOT NULL, ".
--- 83,95 ----
  
  while ($row = mysql_fetch_row($result)) {
!     if ($row[0] == $wpdb->links)
          $got_links = true;
!     if ($row[0] == $wpdb->linkcategories)
          $got_cats = true;
      //print "Table: $row[0]<br />\n";
  }
  if (!$got_cats) {
!     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, ".
***************
*** 97,112 ****
             " PRIMARY KEY (cat_id) ".
             ") ";
!     $result = mysql_query($sql) or print ("Can't create the table '$tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
      if ($result != false) {
!         echo "<p>Table '$tablelinkcategories' created OK</p>\n";
          $got_cats = true;
      }
  } else {
!     echo "<p>Found table '$tablelinkcategories', 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 ( " .
             " link_id int(11) NOT NULL auto_increment,           " .
             " link_url varchar(255) NOT NULL default '',         " .
--- 97,112 ----
             " PRIMARY KEY (cat_id) ".
             ") ";
!     $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 '$wpdb->linkcategories' created OK</p>\n";
          $got_cats = true;
      }
  } else {
!     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 '$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 '',         " .
***************
*** 124,140 ****
             " 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', '');");
  
      if ($result != false) {
!         echo "<p>Table '$tablelinks' created OK</p>\n";
          $got_links = true;
      }
  } else {
!     echo "<p>Found table '$tablelinks', 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";
      $q = @mysql_query($query);
      if ($q != false) {
--- 124,140 ----
             " PRIMARY KEY (link_id)                              " .
             ") ";
!     $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 '$wpdb->links' created OK</p>\n";
          $got_links = true;
      }
  } else {
!     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 $wpdb->links LIMIT 1";
      $q = @mysql_query($query);
      if ($q != false) {
***************
*** 143,152 ****
          }
      } else {
!         $query = "ALTER TABLE $tablelinks 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";
      $q = @mysql_query($query);
      if ($q != false) {
--- 143,152 ----
          }
      } else {
!         $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 $wpdb->links LIMIT 1";
      $q = @mysql_query($query);
      if ($q != false) {
***************
*** 155,159 ****
          }
      } else {
!         $query = "ALTER TABLE $tablelinks 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";
--- 155,159 ----
          }
      } else {
!         $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";
***************
*** 164,169 ****
  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());
      if ($result != false) {
          if ($row = mysql_fetch_object($result)) {
--- 164,169 ----
  if ($got_links && $got_cats) {
      echo "<p>Looking for category 1...</p>\n";
!     $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)) {
***************
*** 172,176 ****
          } else {
              echo "<p>Gonna insert category 1...</p>\n";
!             $sql = "INSERT INTO $tablelinkcategories (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) {
--- 172,176 ----
          } else {
              echo "<p>Gonna insert category 1...</p>\n";
!             $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) {
***************
*** 197,204 ****
  <?php
  
! $query = "ALTER TABLE $tableposts 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,
  ADD comment_status ENUM('open','closed') NOT NULL,
  ADD ping_status ENUM('open','closed') NOT NULL,
--- 197,204 ----
  <?php
  
! $query = "ALTER TABLE $wpdb->posts ADD COLUMN post_excerpt text NOT NULL;";
  $q = $wpdb->query($query);
  // 0.71 mods
! $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,
***************
*** 210,214 ****
  
  <?php
! $query = "ALTER TABLE $tableposts DROP INDEX ID";
  
  $q = $wpdb->query($query);
--- 210,214 ----
  
  <?php
! $query = "ALTER TABLE $wpdb->posts DROP INDEX ID";
  
  $q = $wpdb->query($query);
***************
*** 218,232 ****
  <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";
  $q = $wpdb->query($query);
  flush();
--- 218,226 ----
  <p>One down, two to go...</p>
  
  
  <p>So far so good.</p>
  <?php
  
! $query="ALTER TABLE $wpdb->posts DROP post_karma";
  $q = $wpdb->query($query);
  flush();
***************
*** 237,241 ****
  <?php
  
! $query = "ALTER TABLE $tableusers DROP INDEX ID";
  
  $q = $wpdb->query($query);
--- 231,235 ----
  <?php
  
! $query = "ALTER TABLE $wpdb->users DROP INDEX ID";
  
  $q = $wpdb->query($query);

Index: admin-header.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/admin-header.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** admin-header.php	22 May 2004 08:45:36 -0000	1.22
--- admin-header.php	24 May 2004 08:22:16 -0000	1.23
***************
*** 15,19 ****
  timer_start();
  
! $dogs = $wpdb->get_results("SELECT * FROM $tablecategories WHERE 1=1");
  foreach ($dogs as $catt) {
      $cache_categories[$catt->cat_ID] = $catt;
--- 15,19 ----
  timer_start();
  
! $dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE 1=1");
  foreach ($dogs as $catt) {
      $cache_categories[$catt->cat_ID] = $catt;

Index: import-blogger.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/import-blogger.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** import-blogger.php	16 May 2004 05:04:09 -0000	1.11
--- import-blogger.php	24 May 2004 08:22:17 -0000	1.12
***************
*** 64,68 ****
  			$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'");
  			if (!$user) { // seems s/he's not, so let's register
  				$user_ip = '127.0.0.1';
--- 64,68 ----
  			$post_author = trim(addslashes($postinfo[1]));
  			// we'll check the author is registered already
! 			$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';
***************
*** 77,81 ****
  				$user_joindate = addslashes($user_joindate);
  				$result = $wpdb->query("
! 				INSERT INTO $tableusers (
  					user_login,
  					user_pass,
--- 77,81 ----
  				$user_joindate = addslashes($user_joindate);
  				$result = $wpdb->query("
! 				INSERT INTO $wpdb->users (
  					user_login,
  					user_pass,
***************
*** 106,110 ****
  			}
  
! 			$post_author_ID = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$post_author'");
  
  			$post_date = explode(' ', $post_date);
--- 106,110 ----
  			}
  
! 			$post_author_ID = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$post_author'");
  
  			$post_date = explode(' ', $post_date);
***************
*** 129,133 ****
  			
  			// 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);
  			if ($dupcheck[0]['ID']) {
  				print "<br />\nSkipping duplicate post, ID = '" . $dupcheck[0]['ID'] . "'<br />\n";
--- 129,133 ----
  			
  			// Quick-n-dirty check for dups:
! 			$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";
***************
*** 138,142 ****
  
  			$result = $wpdb->query("
! 			INSERT INTO $tableposts 
  				(post_author,post_date,post_content,post_title,post_category)
  			VALUES 
--- 138,142 ----
  
  			$result = $wpdb->query("
! 			INSERT INTO $wpdb->posts 
  				(post_author,post_date,post_content,post_title,post_category)
  			VALUES 
***************
*** 152,156 ****
  	/* 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\"");
  
  	upgrade_all();
--- 152,156 ----
  	/* 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 $wpdb->posts WHERE post_date=\"0000-00-00 00:00:00\"");
  
  	upgrade_all();

Index: link-manager.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/link-manager.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** link-manager.php	23 May 2004 17:24:38 -0000	1.24
--- link-manager.php	24 May 2004 08:22:17 -0000	1.25
***************
*** 21,27 ****
  
  function category_dropdown($fieldname, $selected = 0) {
! 	global $wpdb, $tablelinkcategories;
  	
! 	$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
  	echo "\n<select name='$fieldname' size='1'>";
  	foreach ($results as $row) {
--- 21,27 ----
  
  function category_dropdown($fieldname, $selected = 0) {
! 	global $wpdb;
  	
! 	$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) {
***************
*** 100,104 ****
      }
      $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)");
      foreach ($results as $row) {
        if (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed
--- 100,104 ----
      }
      $all_links = join(',', $linkcheck);
!     $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
***************
*** 109,113 ****
      // 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)");
  
      header('Location: ' . $this_file);
--- 109,113 ----
      // should now have an array of links we can change
      $all_links = join(',', $ids_to_change);
!     $q = $wpdb->query("update $wpdb->links SET link_owner='$newowner' WHERE link_id IN ($all_links)");
  
      header('Location: ' . $this_file);
***************
*** 131,135 ****
      }
      $all_links = join(',', $linkcheck);
!     $results = $wpdb->get_results("SELECT link_id, link_visible FROM $tablelinks WHERE link_id in ($all_links)");
      foreach ($results as $row) {
          if ($row->link_visible == 'Y') { // ok to proceed
--- 131,135 ----
      }
      $all_links = join(',', $linkcheck);
!     $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
***************
*** 143,152 ****
      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)");
      }
  
      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)");
      }
  
--- 143,152 ----
      if (count($ids_to_turnoff)) {
          $all_linksoff = join(',', $ids_to_turnoff);
!         $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 $wpdb->links SET link_visible='Y' WHERE link_id IN ($all_linkson)");
      }
  
***************
*** 172,176 ****
      $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)");
  
      header('Location: ' . $this_file);
--- 172,176 ----
      $all_links = join(',', $linkcheck);
      // should now have an array of links we can change
!     $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
  
      header('Location: ' . $this_file);
***************
*** 204,210 ****
      // 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("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) " .
        " VALUES('" . addslashes($link_url) . "','"
             . addslashes($link_name) . "', '"
--- 204,210 ----
      // need to make the others invisible before we add this new one.
      if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
!       $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
      }
!     $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) . "', '"
***************
*** 254,261 ****
        // 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 $tablelinks 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,
--- 254,261 ----
        // need to make the others invisible before we update this one.
        if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
!         $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category");
        }
  
!       $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,
***************
*** 284,288 ****
        die (__("Cheatin' uh ?"));
  
!     $wpdb->query("DELETE FROM $tablelinks WHERE link_id = $link_id");
  
      if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
--- 284,288 ----
        die (__("Cheatin' uh ?"));
  
!     $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = $link_id");
  
      if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
***************
*** 309,313 ****
  
      $row = $wpdb->get_row("SELECT * 
! 	FROM $tablelinks 
  	WHERE link_id = $link_id");
  
--- 309,313 ----
  
      $row = $wpdb->get_row("SELECT * 
! 	FROM $wpdb->links 
  	WHERE link_id = $link_id");
  
***************
*** 618,622 ****
          <td>
  <?php
!     $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
      echo "        <select name=\"cat_id\">\n";
      echo "          <option value=\"All\"";
--- 618,622 ----
          <td>
  <?php
!     $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\"";
***************
*** 676,684 ****
  <?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 ";
  
      if (isset($cat_id) && ($cat_id != 'All')) {
--- 676,684 ----
  <?php
      $sql = "SELECT link_url, link_name, link_image, link_description, link_visible,
!             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')) {
***************
*** 748,752 ****
            <?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");
      echo "          <select name=\"newowner\" size=\"1\">\n";
      foreach ($results as $row) {
--- 748,752 ----
            <?php _e('Assign ownership to:'); echo ' ' . gethelp_link($this_file,'assign_ownership'); ?>
  <?php
!     $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) {

Index: users.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/users.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** users.php	18 May 2004 03:58:05 -0000	1.26
--- users.php	24 May 2004 08:22:17 -0000	1.27
***************
*** 56,60 ****
  
  	/* checking the login isn't already used by another user */
! 	$loginthere = $wpdb->get_var("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
      if ($loginthere) {
  		die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.'));
--- 56,60 ----
  
  	/* checking the login isn't already used by another user */
! 	$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.'));
***************
*** 79,83 ****
  	$new_users_can_blog = get_settings('new_users_can_blog');
  
! 	$result = $wpdb->query("INSERT INTO $tableusers 
  		(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 
--- 79,83 ----
  	$new_users_can_blog = get_settings('new_users_can_blog');
  
! 	$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 
***************
*** 123,130 ****
  	if ('up' == $prom) {
  		$new_level = $usertopromote_level + 1;
! 		$sql="UPDATE $tableusers 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";
  	}
  	$result = $wpdb->query($sql);
--- 123,130 ----
  	if ('up' == $prom) {
  		$new_level = $usertopromote_level + 1;
! 		$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 $wpdb->users SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
  	}
  	$result = $wpdb->query($sql);
***************
*** 153,174 ****
  		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");
  	if ($post_ids) {
  		$post_ids = implode(',', $post_ids);
  		
  		// Delete comments, *backs
! 		$wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID IN ($post_ids)");
  		// Clean cats
! 		$wpdb->query("DELETE FROM $tablepost2cat WHERE post_id IN ($post_ids)");
  		// Clean post_meta
! 		$wpdb->query("DELETE FROM $tablepostmeta WHERE post_id IN ($post_ids)");
  		// Clean links
! 		$wpdb->query("DELETE FROM $tablelinks WHERE link_owner = $id");
  		// Delete posts
! 		$wpdb->query("DELETE FROM $tableposts WHERE post_author = $id");
  	}
  
  	// FINALLY, delete user
! 	$wpdb->query("DELETE FROM $tableusers WHERE ID = $id");
  	header('Location: users.php?deleted=true');
  
--- 153,174 ----
  		die(__('Can&#8217;t delete a user whose level is higher than yours.'));
  
! 	$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 $wpdb->comments WHERE comment_post_ID IN ($post_ids)");
  		// Clean cats
! 		$wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id IN ($post_ids)");
  		// Clean post_meta
! 		$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id IN ($post_ids)");
  		// Clean links
! 		$wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
  		// Delete posts
! 		$wpdb->query("DELETE FROM $wpdb->posts WHERE post_author = $id");
  	}
  
  	// FINALLY, delete user
! 	$wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
  	header('Location: users.php?deleted=true');
  
***************
*** 196,200 ****
  	</tr>
  	<?php
! 	$users = $wpdb->get_results("SELECT ID FROM $tableusers WHERE user_level > 0 ORDER BY ID");
  	$style = '';
  	foreach ($users as $user) {
--- 196,200 ----
  	</tr>
  	<?php
! 	$users = $wpdb->get_results("SELECT ID FROM $wpdb->users WHERE user_level > 0 ORDER BY ID");
  	$style = '';
  	foreach ($users as $user) {
***************
*** 209,213 ****
  		$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'");
  		if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_data->ID' title='" . __('View posts') . "'>$numposts</a>";
  		echo "
--- 209,213 ----
  		$short_url =  substr($short_url, 0, 32).'...';
  		$style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
! 		$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 "
***************
*** 234,238 ****
  
  <?php
! 	$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level = 0 ORDER BY ID");
  	if ($users) {
  ?>
--- 234,238 ----
  
  <?php
! 	$users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level = 0 ORDER BY ID");
  	if ($users) {
  ?>

Index: import-textpattern.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/import-textpattern.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** import-textpattern.php	22 Apr 2004 00:40:26 -0000	1.9
--- import-textpattern.php	24 May 2004 08:22:17 -0000	1.10
***************
*** 72,77 ****
  <?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);
  
  // Create post_name field
--- 72,77 ----
  <?php
  // For people running this on .72
! $query = "ALTER TABLE `$wpdb->posts` ADD `post_name` VARCHAR(200) NOT NULL";
! maybe_add_column($wpdb->posts, 'post_name', $query);
  
  // Create post_name field
***************
*** 80,85 ****
  
  // 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");
  
  $posts = mysql_query('SELECT * FROM textpattern', $connection);
--- 80,85 ----
  
  // For now we're going to give everything the same author and same category
! $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);
***************
*** 102,106 ****
  	$post_name = sanitize_title($title);
  
! 	$wpdb->query("INSERT INTO $tableposts
  		(post_author, post_date, post_content, post_title, post_category, post_name, post_status)
  		VALUES
--- 102,106 ----
  	$post_name = sanitize_title($title);
  
! 	$wpdb->query("INSERT INTO $wpdb->posts
  		(post_author, post_date, post_content, post_title, post_category, post_name, post_status)
  		VALUES
***************
*** 108,112 ****
  
  	// Get wordpress post id
! 	$wp_post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
  	
  	// Now let's insert comments if there are any for the TP post
--- 108,112 ----
  
  	// Get wordpress post id
! 	$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
***************
*** 118,122 ****
  			// 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
  				(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content)
  				VALUES
--- 118,122 ----
  			// 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 $wpdb->comments
  				(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content)
  				VALUES

Index: xmlrpc.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/xmlrpc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** xmlrpc.php	23 May 2004 16:42:23 -0000	1.3
--- xmlrpc.php	24 May 2004 08:22:17 -0000	1.4
***************
*** 164,168 ****
  	function blogger_getRecentPosts($args) {
  
! 	  global $tableposts, $wpdb;
  
  	  $blog_ID    = $args[1]; /* though we don't use it yet */
--- 164,168 ----
  	function blogger_getRecentPosts($args) {
  
! 	  global $wpdb;
  
  	  $blog_ID    = $args[1]; /* though we don't use it yet */
***************
*** 181,185 ****
  	  }
  
! 	  $sql = "SELECT * FROM $tableposts ORDER BY post_date DESC".$limit;
  	  $result = $wpdb->get_results($sql);
  
--- 181,185 ----
  	  }
  
! 	  $sql = "SELECT * FROM $wpdb->posts ORDER BY post_date DESC".$limit;
  	  $result = $wpdb->get_results($sql);
  
***************
*** 323,327 ****
  	function blogger_newPost($args) {
  
! 	  global $tableposts, $wpdb;
  
  	  $blog_ID    = $args[1]; /* though we don't use it yet */
--- 323,327 ----
  	function blogger_newPost($args) {
  
! 	  global $wpdb;
  
  	  $blog_ID    = $args[1]; /* though we don't use it yet */
***************
*** 376,380 ****
  
  function wp_insert_post($postarr = array()) {
! 	global $wpdb, $tableposts, $post_default_category;
  	
  	// export array as variables
--- 376,380 ----
  
  function wp_insert_post($postarr = array()) {
! 	global $wpdb, $post_default_category;
  	
  	// export array as variables
***************
*** 401,405 ****
  		$post_date_gmt = get_gmt_from_date($post_date);
  	
! 	$sql = "INSERT INTO $tableposts 
  		(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')";
--- 401,405 ----
  		$post_date_gmt = get_gmt_from_date($post_date);
  	
! 	$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')";
***************
*** 417,421 ****
  
  function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
! 	global $wpdb, $tablepost2cat;
  	// If $post_categories isn't already an array, make it one:
  	if (!is_array($post_categories)) {
--- 417,421 ----
  
  function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array()) {
! 	global $wpdb;
  	// If $post_categories isn't already an array, make it one:
  	if (!is_array($post_categories)) {
***************
*** 431,435 ****
  	$old_categories = $wpdb->get_col("
  		SELECT category_id 
! 		FROM $tablepost2cat 
  		WHERE post_id = $post_ID");
  	
--- 431,435 ----
  	$old_categories = $wpdb->get_col("
  		SELECT category_id 
! 		FROM $wpdb->post2cat 
  		WHERE post_id = $post_ID");
  	
***************
*** 454,458 ****
  		foreach ($delete_cats as $del) {
  			$wpdb->query("
! 				DELETE FROM $tablepost2cat 
  				WHERE category_id = $del 
  					AND post_id = $post_ID 
--- 454,458 ----
  		foreach ($delete_cats as $del) {
  			$wpdb->query("
! 				DELETE FROM $wpdb->post2cat 
  				WHERE category_id = $del 
  					AND post_id = $post_ID 
***************
*** 471,475 ****
  		foreach ($add_cats as $new_cat) {
  			$wpdb->query("
! 				INSERT INTO $tablepost2cat (post_id, category_id) 
  				VALUES ($post_ID, $new_cat)");
  
--- 471,475 ----
  		foreach ($add_cats as $new_cat) {
  			$wpdb->query("
! 				INSERT INTO $wpdb->post2cat (post_id, category_id) 
  				VALUES ($post_ID, $new_cat)");
  
***************
*** 481,488 ****
  
  function wp_get_post_cats($blogid = '1', $post_ID = 0) {
! 	global $wpdb, $tablepost2cat;
  	
  	$sql = "SELECT category_id 
! 		FROM $tablepost2cat 
  		WHERE post_id = $post_ID 
  		ORDER BY category_id";
--- 481,488 ----
  
  function wp_get_post_cats($blogid = '1', $post_ID = 0) {
! 	global $wpdb;
  	
  	$sql = "SELECT category_id 
! 		FROM $wpdb->post2cat 
  		WHERE post_id = $post_ID 
  		ORDER BY category_id";

Index: import-mt.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/import-mt.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** import-mt.php	17 May 2004 04:40:23 -0000	1.10
--- import-mt.php	24 May 2004 08:22:17 -0000	1.11
***************
*** 72,77 ****
  
  function users_form($n) {
! 	global $wpdb, $tableusers, $testing;
! 	$users = $wpdb->get_results("SELECT * FROM $tableusers ORDER BY ID");
  	?><select name="userselect[<?php echo $n; ?>]">
  	<option value="#NONE#">- Select -</option>
--- 72,77 ----
  
  function users_form($n) {
! 	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>
***************
*** 148,170 ****
  	//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
  	$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
  		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'");
  				$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]'");
  			}
  		} 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
  	}
  	return $user_id;
--- 148,170 ----
  	//function to check the authorname and do the mapping
  	function checkauthor($author) {
! 	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 $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 $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 $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 $wpdb->users WHERE user_login = '$newauthornames[$key]'");//use that key to get the value of the author's name from $newauthornames
  	}
  	return $user_id;
***************
*** 273,301 ****
  
  	// 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'")) {
  		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 (
  			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'");
  		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'");
  			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'");
  			}
  			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");
  
  			 if (!$exists) { 
  				$wpdb->query("
! 				INSERT INTO $tablepost2cat
  				(post_id, category_id)
  				VALUES
--- 273,301 ----
  
  	// Let's check to see if it's in already
! 	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 $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 $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 $wpdb->categories WHERE cat_name = '$post_category'");
  			if (!$cat_id && '' != trim($post_category)) {
  				$cat_nicename = sanitize_title($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 $wpdb->post2cat WHERE post_id = $post_id AND category_id = $cat_id");
  
  			 if (!$exists) { 
  				$wpdb->query("
! 				INSERT INTO $wpdb->post2cat
  				(post_id, category_id)
  				VALUES
***************
*** 305,310 ****
  		} // 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) ");
  		}
  		echo " Post imported successfully...";
--- 305,310 ----
  		} // end category loop
  		} else {
! 			$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...";
***************
*** 339,344 ****
  
  			// 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)
  				VALUES
  				($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')");
--- 339,344 ----
  
  			// Check if it's already there
! 			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')");
***************
*** 384,389 ****
        
  			// 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)
  				VALUES
  				($post_id, '$comment_author', '$comment_email', '$comment_url', '$comment_ip', '$comment_date', '$comment_content', '1')");
--- 384,389 ----
        
  			// Check if it's already there
! 			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')");

Index: moderation.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/moderation.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** moderation.php	7 May 2004 23:56:29 -0000	1.9
--- moderation.php	24 May 2004 08:22:17 -0000	1.10
***************
*** 135,139 ****
  <div class="wrap">
  <?php
! $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_approved = '0'");
  
  if ($comments) {
--- 135,139 ----
  <div class="wrap">
  <?php
! $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '0'");
  
  if ($comments) {
***************
*** 148,152 ****
      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'");
  	
  	echo "\n\t<li id='comment-$comment->comment_ID'>"; 
--- 148,152 ----
      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 $wpdb->posts WHERE ID='$comment->comment_post_ID'");
  	
  	echo "\n\t<li id='comment-$comment->comment_ID'>"; 

Index: install.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/install.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** install.php	18 May 2004 20:05:31 -0000	1.29
--- install.php	24 May 2004 08:22:17 -0000	1.30
***************
*** 51,55 ****
  
  $wpdb->hide_errors();
! $installed = $wpdb->get_results("SELECT * FROM $tableusers");
  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();
--- 51,55 ----
  
  $wpdb->hide_errors();
! $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();
***************
*** 89,101 ****
  
  while ($row = mysql_fetch_row($result)) {
!     if ($row[0] == $tablelinks)
          $got_links = true;
!     if ($row[0] == $tablelinkcategories)
          $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 ( " .
             " cat_id int(11) NOT NULL auto_increment, " .
             " cat_name tinytext NOT NULL, ".
--- 89,101 ----
  
  while ($row = mysql_fetch_row($result)) {
!     if ($row[0] == $wpdb->links)
          $got_links = true;
!     if ($row[0] == $wpdb->linkcategories)
          $got_cats = true;
      //print "Table: $row[0]<br />\n";
  }
  if (!$got_cats) {
!     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, ".
***************
*** 113,128 ****
             " PRIMARY KEY (cat_id) ".
             ") ";
!     $result = mysql_query($sql) or print ("Can't create the table '$tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
      if ($result != false) {
!         echo "<p>Table '$tablelinkcategories' created OK</p>\n";
          $got_cats = true;
      }
  } else {
!     echo "<p>Found table '$tablelinkcategories', 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 ( " .
             " link_id int(11) NOT NULL auto_increment,           " .
             " link_url varchar(255) NOT NULL default '',         " .
--- 113,128 ----
             " PRIMARY KEY (cat_id) ".
             ") ";
!     $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 '$wpdb->linkcategories' created OK</p>\n";
          $got_cats = true;
      }
  } else {
!     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 '$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 '',         " .
***************
*** 140,157 ****
             " 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', '', '');");
  
  
      if ($result != false) {
!         echo "<p>Table '$tablelinks' created OK</p>\n";
          $got_links = true;
      }
  } else {
!     echo "<p>Found table '$tablelinks', don't need to create it...</p>\n";
          $got_links = true;
  }
--- 140,157 ----
             " PRIMARY KEY (link_id)                              " .
             ") ";
!     $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 '$wpdb->links' created OK</p>\n";
          $got_links = true;
      }
  } else {
!     echo "<p>Found table '$wpdb->links', don't need to create it...</p>\n";
          $got_links = true;
  }
***************
*** 159,164 ****
  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());
      if ($result != false) {
          if ($row = mysql_fetch_object($result)) {
--- 159,164 ----
  if ($got_links && $got_cats) {
      echo "<p>Looking for category 1...</p>\n";
!     $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)) {
***************
*** 167,171 ****
          } else {
              echo "<p>Gonna insert category 1...</p>\n";
!             $sql = "INSERT INTO $tablelinkcategories (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) {
--- 167,171 ----
          } else {
              echo "<p>Gonna insert category 1...</p>\n";
!             $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) {
***************
*** 194,201 ****
  #       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 = "CREATE TABLE $tableposts (
    ID int(10) unsigned NOT NULL auto_increment,
    post_author int(4) NOT NULL default '0',
--- 194,201 ----
  #       just remove the // in this file
  
! // $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 $wpdb->posts (
    ID int(10) unsigned NOT NULL auto_increment,
    post_author int(4) NOT NULL default '0',
***************
*** 233,237 ****
  $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')";
  
  $q = $wpdb->query($query);
--- 233,237 ----
  $now = date('Y-m-d H:i:s');
  $now_gmt = gmdate('Y-m-d H:i:s');
! $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);
***************
*** 241,249 ****
  
  <?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 = "
! CREATE TABLE $tablecategories (
    cat_ID int(4) NOT NULL auto_increment,
    cat_name varchar(55) NOT NULL default '',
--- 241,249 ----
  
  <?php
! // $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 $wpdb->categories (
    cat_ID int(4) NOT NULL auto_increment,
    cat_name varchar(55) NOT NULL default '',
***************
*** 254,261 ****
  $q = $wpdb->query($query);
  
! $query = "INSERT INTO $tablecategories (cat_ID, cat_name) VALUES ('0', 'General')";
  $q = $wpdb->query($query);
  
! $query = "UPDATE $tableposts SET post_category = 1";
  $result = $wpdb->query($query);
  ?>
--- 254,261 ----
  $q = $wpdb->query($query);
  
! $query = "INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'General')";
  $q = $wpdb->query($query);
  
! $query = "UPDATE $wpdb->posts SET post_category = 1";
  $result = $wpdb->query($query);
  ?>
***************
*** 264,272 ****
  
  <?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 = "
! CREATE TABLE $tablecomments (
    comment_ID int(11) unsigned NOT NULL auto_increment,
    comment_post_ID int(11) NOT NULL default '0',
--- 264,272 ----
  
  <?php
! // $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 $wpdb->comments (
    comment_ID int(11) unsigned NOT NULL auto_increment,
    comment_post_ID int(11) NOT NULL default '0',
***************
*** 294,298 ****
  <?php
  $query = "
! 	CREATE TABLE $tablepostmeta (
  	  meta_id int(11) NOT NULL auto_increment,
  	  post_id int(11) NOT NULL default 0,
--- 294,298 ----
  <?php
  $query = "
! 	CREATE TABLE $wpdb->postmeta (
  	  meta_id int(11) NOT NULL auto_increment,
  	  post_id int(11) NOT NULL default 0,
***************
*** 313,321 ****
  
  <?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 = "
! CREATE TABLE $tableoptions (
    option_id int(11) NOT NULL auto_increment,
    blog_id int(11) NOT NULL default 0,
--- 313,321 ----
  
  <?php
! // $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 $wpdb->options (
    option_id int(11) NOT NULL auto_increment,
    blog_id int(11) NOT NULL default 0,
***************
*** 337,341 ****
  
  $query = "
! CREATE TABLE $tableoptiontypes (
    optiontype_id int(11) NOT NULL auto_increment,
    optiontype_name varchar(64) NOT NULL,
--- 337,341 ----
  
  $query = "
! CREATE TABLE $wpdb->optiontypes (
    optiontype_id int(11) NOT NULL auto_increment,
    optiontype_name varchar(64) NOT NULL,
***************
*** 350,354 ****
  
  $query = "
! CREATE TABLE $tableoptiongroups (
    group_id int(11) NOT NULL auto_increment,
    group_name varchar(64) not null,
--- 350,354 ----
  
  $query = "
! CREATE TABLE $wpdb->optiongroups (
    group_id int(11) NOT NULL auto_increment,
    group_name varchar(64) not null,
***************
*** 361,369 ****
  
  
! // $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 = "
! CREATE TABLE $tableoptiongroup_options (
    group_id int(11) NOT NULL,
    option_id int(11) NOT NULL,
--- 361,369 ----
  
  
! // $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 $wpdb->optiongroup_options (
    group_id int(11) NOT NULL,
    option_id int(11) NOT NULL,
***************
*** 375,383 ****
  
  
! // $query = "DROP TABLE IF EXISTS $tableoptionvalues";
! // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableoptionvalues\" in the database.");
  
  $query = "
! CREATE TABLE $tableoptionvalues (
    option_id int(11) NOT NULL,
    optionvalue tinytext,
--- 375,383 ----
  
  
! // $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 $wpdb->optionvalues (
    option_id int(11) NOT NULL,
    optionvalue tinytext,
***************
*** 399,541 ****
  
  $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')",
  
  //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 at 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)",
  // 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)",
  //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)",
  //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)",
  // 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 at 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)",
  // 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)",
  
  //'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 $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 $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 $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 $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 $tab