Ticket #10875: wp-trackback.patch
| File wp-trackback.patch, 2.5 KB (added by Askapache, 4 years ago) |
|---|
-
wp-trackback.php
34 34 } 35 35 36 36 // trackback is done by a POST 37 $request_array = 'HTTP_POST_VARS'; 38 39 if ( !$_GET['tb_id'] ) { 37 if ( !isset($_GET['tb_id']) || !$_GET['tb_id'] ){ 40 38 $tb_id = explode('/', $_SERVER['REQUEST_URI']); 41 39 $tb_id = intval( $tb_id[ count($tb_id) - 1 ] ); 42 40 } 43 41 44 $tb_url = $_POST['url'];45 $charset = $_POST['charset'];42 $tb_url = isset($_POST['url']) ? $_POST['url'] : ''; 43 $charset = isset($_POST['charset']) ? strtoupper( trim($_POST['charset']) ) : 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS'; 46 44 47 // These three are stripslashed here so that they can be properly escaped after mb_convert_encoding()48 $title = stripslashes($_POST['title']);49 $excerpt = stripslashes($_POST['excerpt']);50 $blog_name = stripslashes($_POST['blog_name']);51 52 if ($charset)53 $charset = strtoupper( trim($charset) );54 else55 $charset = 'ASCII, UTF-8, ISO-8859-1, JIS, EUC-JP, SJIS';56 57 45 // No valid uses for UTF-7 58 46 if ( false !== strpos($charset, 'UTF-7') ) 59 47 die; 60 48 49 // These three are stripslashed here so that they can be properly escaped after mb_convert_encoding() 50 $title = isset($_POST['title']) ? stripslashes($_POST['title']) : ''; 51 $excerpt = isset($_POST['excerpt']) ? stripslashes($_POST['excerpt']) : ''; 52 $blog_name = isset($_POST['blog_name']) ? stripslashes($_POST['blog_name']) : ''; 53 54 55 61 56 if ( function_exists('mb_convert_encoding') ) { // For international trackbacks 62 57 $title = mb_convert_encoding($title, get_option('blog_charset'), $charset); 63 58 $excerpt = mb_convert_encoding($excerpt, get_option('blog_charset'), $charset); … … 72 67 if ( is_single() || is_page() ) 73 68 $tb_id = $posts[0]->ID; 74 69 75 if ( !i ntval( $tb_id ) )70 if ( !isset($tb_id) || !intval( $tb_id ) ) 76 71 trackback_response(1, 'I really need an ID for this to work.'); 77 72 78 73 if (empty($title) && empty($tb_url) && empty($blog_name)) { … … 82 77 } 83 78 84 79 if ( !empty($tb_url) && !empty($title) ) { 85 header('Content-Type: text/xml; charset=' . get_option('blog_charset') );86 80 87 81 if ( !pings_open($tb_id) ) 88 82 trackback_response(1, 'Sorry, trackbacks are closed for this item.'); 89 83 90 84 $title = wp_html_excerpt( $title, 250 ).'...'; 91 85 $excerpt = wp_html_excerpt( $excerpt, 252 ).'...'; 92 86 93 $comment_post_ID = (int)$tb_id;87 $comment_post_ID = $tb_id; 94 88 $comment_author = $blog_name; 95 89 $comment_author_email = ''; 96 90 $comment_author_url = $tb_url;