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/post.php

    r1352 r1355  
    109109
    110110    if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) {
    111     $postquery ="INSERT INTO $tableposts
     111    $postquery ="INSERT INTO $wpdb->posts
    112112            (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_lat, post_lon, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt)
    113113            VALUES
     
    115115            ";
    116116    } else {
    117     $postquery ="INSERT INTO $tableposts
     117    $postquery ="INSERT INTO $wpdb->posts
    118118            (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt,  post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt)
    119119            VALUES
     
    124124    $result = $wpdb->query($postquery);
    125125
    126     $post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
     126    $post_ID = $wpdb->get_var("SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1");
    127127
    128128    if (!empty($_POST['mode'])) {
     
    152152    foreach ($post_categories as $post_category) {
    153153        // Double check it's not there already
    154         $exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");
     154        $exists = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post_ID AND category_id = $post_category");
    155155
    156156         if (!$exists && $result) {
    157157            $wpdb->query("
    158             INSERT INTO $tablepost2cat
     158            INSERT INTO $wpdb->post2cat
    159159            (post_id, category_id)
    160160            VALUES
     
    182182
    183183        // Time for trackbacks
    184         $to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID");
    185         $pinged = $wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID");
     184        $to_ping = $wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_ID");
     185        $pinged = $wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_ID");
    186186        $pinged = explode("\n", $pinged);
    187187        if ('' != $to_ping) {
     
    214214    $post = $post_ID = $p = (int) $_GET['post'];
    215215    if ($user_level > 0) {
    216         $postdata = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = '$post_ID'");
     216        $postdata = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
    217217        $authordata = get_userdata($postdata->post_author);
    218218        if ($user_level < $authordata->user_level)
     
    236236        include('edit-form-advanced.php');
    237237
    238         $post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = '$post_ID'");
     238        $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
    239239        ?>
    240240<div id='preview' class='wrap'>
     
    344344
    345345    $result = $wpdb->query("
    346         UPDATE $tableposts SET
     346        UPDATE $wpdb->posts SET
    347347            post_content = '$content',
    348348            post_excerpt = '$excerpt',
     
    365365    // Now it's category time!
    366366    // First the old categories
    367     $old_categories = $wpdb->get_col("SELECT category_id FROM $tablepost2cat WHERE post_id = $post_ID");
     367    $old_categories = $wpdb->get_col("SELECT category_id FROM $wpdb->post2cat WHERE post_id = $post_ID");
    368368   
    369369    // Delete any?
    370370    foreach ($old_categories as $old_cat) {
    371371        if (!in_array($old_cat, $post_categories)) // If a category was there before but isn't now
    372             $wpdb->query("DELETE FROM $tablepost2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1");
     372            $wpdb->query("DELETE FROM $wpdb->post2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1");
    373373    }
    374374   
     
    376376    foreach ($post_categories as $new_cat) {
    377377        if (!in_array($new_cat, $old_categories))
    378             $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_ID, $new_cat)");
     378            $wpdb->query("INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES ($post_ID, $new_cat)");
    379379    }
    380380   
     
    393393        do_action('publish_post', $post_ID);
    394394        // Trackback time.
    395         $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID"));
    396         $pinged = trim($wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID"));
     395        $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $wpdb->posts WHERE ID = $post_ID"));
     396        $pinged = trim($wpdb->get_var("SELECT pinged FROM $wpdb->posts WHERE ID = $post_ID"));
    397397        $pinged = explode("\n", $pinged);
    398398        if ('' != $to_ping) {
     
    450450
    451451    // send geoURL ping to "erase" from their DB
    452     $query = "SELECT post_lat from $tableposts WHERE ID=$post_id";
     452    $query = "SELECT post_lat from $wpdb->posts WHERE ID=$post_id";
    453453    $rows = $wpdb->query($query);
    454454    $myrow = $rows[0];
     
    458458    }
    459459
    460     $result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post_id");
     460    $result = $wpdb->query("DELETE FROM $wpdb->posts WHERE ID=$post_id");
    461461    if (!$result)
    462462        die(__('Error in deleting...'));
    463463
    464     $result = $wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID=$post_id");
    465 
    466     $categories = $wpdb->query("DELETE FROM $tablepost2cat WHERE post_id = $post_id");
     464    $result = $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID=$post_id");
     465
     466    $categories = $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $post_id");
    467467
    468468    if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
     
    695695
    696696    $result = $wpdb->query("
    697         UPDATE $tablecomments SET
     697        UPDATE $wpdb->comments SET
    698698            comment_content = '$content',
    699699            comment_author = '$newcomment_author',
     
    717717        $action = 'post';
    718718        get_currentuserinfo();
    719         $drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID");
     719        $drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID");
    720720        if ($drafts) {
    721721            ?>
Note: See TracChangeset for help on using the changeset viewer.