Make WordPress Core


Ignore:
Timestamp:
05/24/2004 08:22:18 AM (21 years ago)
Author:
saxmatt
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import-greymatter.php

    r1190 r1355  
    8888        $user_joindate=addslashes($user_joindate);
    8989
    90         $loginthere = $wpdb->get_var("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
     90        $loginthere = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
    9191        if ($loginthere) {
    9292            echo "<li>user <i>$user_login</i>... <b>Already exists</b></li>";
     
    9494        }
    9595
    96         $query = "INSERT INTO $tableusers (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
     96        $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
    9797        $result = mysql_query($query);
    9898        if ($result==false) {
     
    140140            $post_author=trim(addslashes($postinfo[1]));
    141141            // we'll check the author is registered, or if it's a deleted author
    142             $sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
     142            $sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
    143143            $result = mysql_query($sql);
    144144            if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2
     
    153153                $user_url=addslashes("");
    154154                $user_joindate=addslashes($user_joindate);
    155                 $query = "INSERT INTO $tableusers (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')";
     155                $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')";
    156156                $result = mysql_query($query);
    157157                if ($result==false) {
     
    161161            }
    162162
    163             $sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
     163            $sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
    164164            $result = mysql_query($sql);
    165165            $myrow = mysql_fetch_array($result);
     
    188188            $post_karma=$postinfo[12];
    189189
    190             $query = "INSERT INTO $tableposts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')";
     190            $query = "INSERT INTO $wpdb->posts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')";
    191191            $result = mysql_query($query) or die(mysql_error());
    192192
     
    194194                die ("Error in posting...");
    195195           
    196             $sql2 = "SELECT * FROM $tableposts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
     196            $sql2 = "SELECT * FROM $wpdb->posts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
    197197            $result2 = mysql_query($sql2);
    198198            $myrow2 = mysql_fetch_array($result2);
     
    200200
    201201            // Grab a default category.
    202             $post_category = $wpdb->get_var("SELECT cat_ID FROM $tablecategories LIMIT 1");
     202            $post_category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
    203203
    204204            // Update the post2cat table.
    205             $exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");
     205            $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
    206206             
    207207            if (!$exists) {
    208208              $wpdb->query("
    209                     INSERT INTO $tablepost2cat
     209                    INSERT INTO $wpdb->post2cat
    210210                    (post_id, category_id)
    211211                    VALUES
     
    237237                    $comment_content=addslashes($commentinfo[12]);
    238238
    239                     $sql3 = "INSERT INTO $tablecomments (comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content) VALUES ('$comment_post_ID','$comment_author','$comment_author_email','$comment_author_url','$comment_author_IP','$comment_date','$comment_content')";
     239                    $sql3 = "INSERT INTO $wpdb->comments (comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content) VALUES ('$comment_post_ID','$comment_author','$comment_author_email','$comment_author_url','$comment_author_IP','$comment_date','$comment_content')";
    240240                    $result3 = mysql_query($sql3);
    241241                    if (!$result3)
Note: See TracChangeset for help on using the changeset viewer.