Make WordPress Core


Ignore:
Timestamp:
07/05/2005 08:47:22 PM (21 years ago)
Author:
ryan
Message:

Use wpdb->escape instead of addslashes to prepare DB bound data.

File:
1 edited

Legend:

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

    r2687 r2699  
    207207        // We want the excerpt
    208208        preg_match("|-----\nEXCERPT:(.*)|s", $post, $excerpt);
    209         $excerpt = addslashes(trim($excerpt[1]));
     209        $excerpt = $wpdb->escape(trim($excerpt[1]));
    210210        $post = preg_replace("|(-----\nEXCERPT:.*)|s", '', $post);
    211211       
    … …  
    219219        preg_match("|-----\nBODY:(.*)|s", $post, $body);
    220220        $body = trim($body[1]);
    221         $post_content = addslashes($body . $extended);
     221        $post_content = $wpdb->escape($body . $extended);
    222222        $post = preg_replace("|(-----\nBODY:.*)|s", '', $post);
    223223       
    … …  
    236236                break;
    237237            case 'TITLE':
    238                 $post_title = addslashes($value);
     238                $post_title = $wpdb->escape($value);
    239239                                echo '<i>'.stripslashes($post_title).'</i>... ';
    240240                                $post_name = sanitize_title($post_title);
    … …  
    265265                break;
    266266            case 'PRIMARY CATEGORY':
    267                                 $post_categories[] = addslashes($value);
     267                                $post_categories[] = $wpdb->escape($value);
    268268                break;
    269269            case 'CATEGORY':   
    270                                 $post_categories[] = addslashes($value);
     270                                $post_categories[] = $wpdb->escape($value);
    271271                break;
    272272                        case 'DATE':
    … …  
    324324                        // Author
    325325                        preg_match("|AUTHOR:(.*)|", $comment, $comment_author);
    326                         $comment_author = addslashes(trim($comment_author[1]));
     326                        $comment_author = $wpdb->escape(trim($comment_author[1]));
    327327                        $comment = preg_replace('|(\n?AUTHOR:.*)|', '', $comment);
    328328
    329329                        preg_match("|EMAIL:(.*)|", $comment, $comment_email);
    330                         $comment_email = addslashes(trim($comment_email[1]));
     330                        $comment_email = $wpdb->escape(trim($comment_email[1]));
    331331                        $comment = preg_replace('|(\n?EMAIL:.*)|', '', $comment);
    332332
    … …  
    336336
    337337                        preg_match("|URL:(.*)|", $comment, $comment_url);
    338                         $comment_url = addslashes(trim($comment_url[1]));
     338                        $comment_url = $wpdb->escape(trim($comment_url[1]));
    339339                        $comment = preg_replace('|(\n?URL:.*)|', '', $comment);
    340340
    … …  
    344344                        $comment = preg_replace('|(\n?DATE:.*)|', '', $comment);
    345345
    346                         $comment_content = addslashes(trim($comment));
     346                        $comment_content = $wpdb->escape(trim($comment));
    347347                        $comment_content = str_replace('-----', '', $comment_content);
    348348
    … …  
    365365                        // 'Author'
    366366                        preg_match("|BLOG NAME:(.*)|", $ping, $comment_author);
    367                         $comment_author = addslashes(trim($comment_author[1]));
     367                        $comment_author = $wpdb->escape(trim($comment_author[1]));
    368368                        $ping = preg_replace('|(\n?BLOG NAME:.*)|', '', $ping);
    369369
    … …  
    375375
    376376                        preg_match("|URL:(.*)|", $ping, $comment_url);
    377                         $comment_url = addslashes(trim($comment_url[1]));
     377                        $comment_url = $wpdb->escape(trim($comment_url[1]));
    378378                        $ping = preg_replace('|(\n?URL:.*)|', '', $ping);
    379379
    … …  
    384384     
    385385                        preg_match("|TITLE:(.*)|", $ping, $ping_title);
    386                         $ping_title = addslashes(trim($ping_title[1]));
     386                        $ping_title = $wpdb->escape(trim($ping_title[1]));
    387387                        $ping = preg_replace('|(\n?TITLE:.*)|', '', $ping);
    388388
    389                         $comment_content = addslashes(trim($ping));
     389                        $comment_content = $wpdb->escape(trim($ping));
    390390                        $comment_content = str_replace('-----', '', $comment_content);
    391391                       
Note: See TracChangeset for help on using the changeset viewer.