Make WordPress Core


Ignore:
Timestamp:
06/18/2004 12:22:09 AM (22 years ago)
Author:
rboren
Message:

stripslashes() elimination. Remove extra slashes during upgrade. Bugs 0000059 and 0000018

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r1428 r1435  
    167167    global $wpdb, $cache_userdata;
    168168    if ( empty($cache_userdata[$userid]) ) {
    169         $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = '$userid'");
    170         $user->user_nickname = stripslashes($user->user_nickname);
    171         $user->user_firstname = stripslashes($user->user_firstname);
    172         $user->user_lastname = stripslashes($user->user_lastname);
    173         $user->user_description = stripslashes($user->user_description);
    174         $cache_userdata[$userid] = $user;
    175     } else {
    176         $user = $cache_userdata[$userid];
    177     }
    178     return $user;
     169        $cache_userdata[$userid] =
     170            $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = '$userid'");
     171    }
     172
     173    return $cache_userdata[$userid];
    179174}
    180175
     
    316311            if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
    317312            if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
    318             $all_options->{$option->option_name} = stripslashes($option->option_value);
     313            $all_options->{$option->option_name} = $option->option_value;
    319314        }
    320315    }
     
    324319function update_option($option_name, $newvalue) {
    325320    global $wpdb, $cache_settings;
    326     $newvalue = stripslashes($newvalue);
     321    $newvalue = $newvalue;
    327322    $newvalue = trim($newvalue); // I can't think of any situation we wouldn't want to trim
    328323    $newvalue = $wpdb->escape($newvalue);
     
    517512function trackback($trackback_url, $title, $excerpt, $ID) {
    518513    global $wpdb;
    519     $title = urlencode(stripslashes($title));
    520     $excerpt = urlencode(stripslashes($excerpt));
    521     $blog_name = urlencode(stripslashes(get_settings('blogname')));
     514    $title = urlencode($title);
     515    $excerpt = urlencode($excerpt);
     516    $blog_name = urlencode(get_settings('blogname'));
    522517    $tb_url = $trackback_url;
    523518    $url = urlencode(get_permalink($ID));
     
    933928    $comment_author_domain = gethostbyaddr($comment->comment_author_IP);
    934929
    935     $blogname = stripslashes(get_settings('blogname'));
     930    $blogname = get_settings('blogname');
    936931   
    937932    if ('comment' == $comment_type) {
    938         $notify_message  = "New comment on your post #$comment->comment_post_ID \"".stripslashes($post->post_title)."\"\r\n\r\n";
     933        $notify_message  = "New comment on your post #$comment->comment_post_ID \"".$post->post_title."\"\r\n\r\n";
    939934        $notify_message .= "Author : $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n";
    940935        $notify_message .= "E-mail : $comment->comment_author_email\r\n";
    941936        $notify_message .= "URI    : $comment->comment_author_url\r\n";
    942937        $notify_message .= "Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=$comment->comment_author_IP\r\n";
    943         $notify_message .= "Comment:\r\n".stripslashes($comment->comment_content)."\r\n\r\n";
     938        $notify_message .= "Comment:\r\n".$comment->comment_content."\r\n\r\n";
    944939        $notify_message .= "You can see all comments on this post here: \r\n";
    945         $subject = '[' . $blogname . '] Comment: "' .stripslashes($post->post_title).'"';
     940        $subject = '[' . $blogname . '] Comment: "' .$post->post_title.'"';
    946941    } elseif ('trackback' == $comment_type) {
    947         $notify_message  = "New trackback on your post #$comment_post_ID \"".stripslashes($post->post_title)."\"\r\n\r\n";
     942        $notify_message  = "New trackback on your post #$comment_post_ID \"".$post->post_title."\"\r\n\r\n";
    948943        $notify_message .= "Website: $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n";
    949944        $notify_message .= "URI    : $comment->comment_author_url\r\n";
    950         $notify_message .= "Excerpt: \n".stripslashes($comment->comment_content)."\r\n\r\n";
     945        $notify_message .= "Excerpt: \n".$comment->comment_content."\r\n\r\n";
    951946        $notify_message .= "You can see all trackbacks on this post here: \r\n";
    952         $subject = '[' . $blogname . '] Trackback: "' .stripslashes($post->post_title).'"';
     947        $subject = '[' . $blogname . '] Trackback: "' .$post->post_title.'"';
    953948    } elseif ('pingback' == $comment_type) {
    954         $notify_message  = "New pingback on your post #$comment_post_ID \"".stripslashes($post->post_title)."\"\r\n\r\n";
     949        $notify_message  = "New pingback on your post #$comment_post_ID \"".$post->post_title."\"\r\n\r\n";
    955950        $notify_message .= "Website: $comment->comment_author\r\n";
    956951        $notify_message .= "URI    : $comment->comment_author_url\r\n";
    957952        $notify_message .= "Excerpt: \n[...] $original_context [...]\r\n\r\n";
    958953        $notify_message .= "You can see all pingbacks on this post here: \r\n";
    959         $subject = '[' . $blogname . '] Pingback: "' .stripslashes($post->post_title).'"';
     954        $subject = '[' . $blogname . '] Pingback: "' .$post->post_title.'"';
    960955    }
    961956    $notify_message .= get_permalink($comment->comment_post_ID) . '#comments';
     
    964959        $from = "From: \"$blogname\" <wordpress@" . $_SERVER['SERVER_NAME'] . '>';
    965960    } else {
    966         $from = 'From: "' . stripslashes($comment->comment_author) . "\" <$comment->comment_author_email>";
     961        $from = 'From: "' . $comment->comment_author . "\" <$comment->comment_author_email>";
    967962    }
    968963
     
    992987    $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
    993988
    994     $notify_message  = "A new comment on the post #$comment->comment_post_ID \"".stripslashes($post->post_title)."\" is waiting for your approval\r\n\r\n";
     989    $notify_message  = "A new comment on the post #$comment->comment_post_ID \"".$post->post_title."\" is waiting for your approval\r\n\r\n";
    995990    $notify_message .= "Author : $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n";
    996991    $notify_message .= "E-mail : $comment->comment_author_email\r\n";
    997992    $notify_message .= "URL    : $comment->comment_author_url\r\n";
    998993    $notify_message .= "Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput=$comment->comment_author_IP\r\n";
    999     $notify_message .= "Comment:\r\n".stripslashes($comment->comment_content)."\r\n\r\n";
     994    $notify_message .= "Comment:\r\n".$comment->comment_content."\r\n\r\n";
    1000995    $notify_message .= "To approve this comment, visit: " . get_settings('siteurl') . "/wp-admin/post.php?action=mailapprovecomment&p=".$comment->comment_post_ID."&comment=$comment_id\r\n";
    1001996    $notify_message .= "To delete this comment, visit: " . get_settings('siteurl') . "/wp-admin/post.php?action=confirmdeletecomment&p=".$comment->comment_post_ID."&comment=$comment_id\r\n";
     
    1003998    $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n";
    1004999
    1005     $subject = '[' . stripslashes(get_settings('blogname')) . '] Please approve: "' .stripslashes($post->post_title).'"';
     1000    $subject = '[' . get_settings('blogname') . '] Please approve: "' .$post->post_title.'"';
    10061001    $admin_email = get_settings("admin_email");
    10071002    $from  = "From: $admin_email";
Note: See TracChangeset for help on using the changeset viewer.