Changeset 5031

Show
Ignore:
Timestamp:
03/12/07 21:28:43 (1 year ago)
Author:
ryan
Message:

Quote values heading to DB. Cast some ints.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.0/wp-includes/functions-post.php

    r4602 r5031  
    513513    if ($add_cats) { 
    514514        foreach ($add_cats as $new_cat) { 
    515             $wpdb->query(" 
    516                 INSERT INTO $wpdb->post2cat (post_id, category_id)  
    517                 VALUES ($post_ID, $new_cat)"); 
    518         } 
    519     } 
    520      
     515            $new_cat = (int) $new_cat; 
     516            if ( !empty($new_cat) ) 
     517                $wpdb->query(" 
     518                    INSERT INTO $wpdb->post2cat (post_id, category_id)  
     519                    VALUES ('$post_ID', '$new_cat')"); 
     520        } 
     521    } 
     522 
    521523    // Update category counts. 
    522524    $all_affected_cats = array_unique(array_merge($post_categories, $old_categories));