Changeset 636
- Timestamp:
- 12/22/2003 02:46:40 AM (21 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form.php
r608 r636 27 27 } 28 28 if ($use_trackback) { 29 $form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="Help on trackbacks"><strong>TrackBack</strong> an <acronym title="Uniform Resource Locator">URL</acronym></a>:</label> (Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with commas.)<br />29 $form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="Help on trackbacks"><strong>TrackBack</strong> an <acronym title="Uniform Resource Locator">URL</acronym></a>:</label> (Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with spaces.)<br /> 30 30 <input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" /></p>'; 31 if ('' != $pinged) { 32 $form_trackback .= '<p>Already pinged:</p><ul>'; 33 $already_pinged = explode("\n", trim($pinged)); 34 foreach ($already_pinged as $pinged_url) { 35 $form_trackback .= "\n\t<li>$pinged_url</li>"; 36 } 37 $form_trackback .= '</ul>'; 38 } 31 39 } else { 32 40 $form_trackback = ''; … … 43 51 $form_pingback = '<input type="hidden" name="post_pingback" value="0" />'; 44 52 $form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />'; 45 $form_trackback = ''; 53 if ($use_trackback) { 54 $form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="Help on trackbacks"><strong>TrackBack</strong> an <acronym title="Uniform Resource Locator">URL</acronym></a></label> 55 (Separate multiple <acronym title="Uniform Resource Locator">URL</acronym>s with spaces.)<br /> 56 <input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" /></p>'; 57 if ('' != $pinged) { 58 $form_trackback .= '<p>Already pinged:</p><ul>'; 59 $already_pinged = explode("\n", trim($pinged)); 60 foreach ($already_pinged as $pinged_url) { 61 $form_trackback .= "\n\t<li>$pinged_url</li>"; 62 } 63 $form_trackback .= '</ul>'; 64 } 65 } else { 66 $form_trackback = ''; 67 } 46 68 break; 47 69 case "editcomment": -
trunk/wp-admin/post.php
r631 r636 63 63 $post_password = addslashes($HTTP_POST_VARS['post_password']); 64 64 $post_name = sanitize_title($post_title); 65 $trackback = $HTTP_POST_VARS['trackback_url']; 66 // Format trackbacks 67 $trackback = preg_replace('|\s+|', '\n', $trackback); 65 68 66 69 if ($user_level == 0) … … 87 90 if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) { 88 91 $postquery ="INSERT INTO $tableposts 89 (ID, post_author, post_date, post_content, post_title, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password, post_name )92 (ID, post_author, post_date, post_content, post_title, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping) 90 93 VALUES 91 ('0', '$user_ID', '$now', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name' )94 ('0', '$user_ID', '$now', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback') 92 95 "; 93 96 } else { 94 97 $postquery ="INSERT INTO $tableposts 95 (ID, post_author, post_date, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name )98 (ID, post_author, post_date, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping) 96 99 VALUES 97 ('0', '$user_ID', '$now', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name' )100 ('0', '$user_ID', '$now', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback') 98 101 "; 99 102 } … … 141 144 142 145 if ('' != $HTTP_POST_VARS['save']) $location = "post.php?action=edit&post=$post_ID"; 143 header("Location: $location"); 146 147 header("Location: $location"); 144 148 145 149 if ($post_status == 'publish') { … … 154 158 } 155 159 156 if (!empty($HTTP_POST_VARS['trackback_url'])) { 160 // Time for trackbacks 161 $to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID"); 162 $pinged = $wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID"); 163 $pinged = explode("\n", $pinged); 164 if ('' != $to_ping) { 157 165 if (strlen($excerpt) > 0) { 158 166 $the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt) ; … … 160 168 $the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content); 161 169 } 162 $excerpt = stripslashes($the_excerpt); 163 $trackback_urls = explode(',', $HTTP_POST_VARS['trackback_url']); 164 foreach($trackback_urls as $tb_url) { 165 $tb_url = trim($tb_url); 166 trackback($tb_url, stripslashes($post_title), $excerpt, $post_ID); 167 } 168 } 170 $excerpt = stripslashes($the_excerpt); 171 $to_pings = explode("\n", $to_ping); 172 foreach ($to_pings as $tb_ping) { 173 $tb_ping = trim($tb_ping); 174 if (!in_array($tb_ping, $pinged)) { 175 trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID); 176 } 177 } 178 } 179 169 180 } // end if publish 170 181 … … 196 207 $ping_status = $postdata['ping_status']; 197 208 $post_password = $postdata['post_password']; 209 $to_ping = $postdata['to_ping']; 210 $pinged = $postdata['pinged']; 198 211 199 212 include('edit-form.php'); … … 246 259 $post_password = addslashes($HTTP_POST_VARS['post_password']); 247 260 $post_name = sanitize_title($post_title); 261 $trackback = $HTTP_POST_VARS['trackback_url']; 262 // Format trackbacks 263 $trackback = preg_replace('|\s+|', '\n', $trackback); 248 264 249 265 if (($user_level > 4) && (!empty($HTTP_POST_VARS['edit_date']))) { … … 274 290 ping_status = '$ping_status', 275 291 post_password = '$post_password', 276 post_name = '$post_name' 292 post_name = '$post_name', 293 to_ping = '$trackback' 277 294 WHERE ID = $post_ID "); 278 295 … … 302 319 pingWeblogs($blog_ID); 303 320 pingBlogs($blog_ID); 304 305 if ($post_pingback) { 306 pingback($content, $post_ID); 307 } 308 309 if (!empty($HTTP_POST_VARS['trackback_url'])) { 310 $excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content); 311 $excerpt = stripslashes($excerpt); 312 $trackback_urls = explode(',', $HTTP_POST_VARS['trackback_url']); 313 foreach($trackback_urls as $tb_url) { 314 $tb_url = trim($tb_url); 315 trackback($tb_url, stripslashes($post_title), $excerpt, $post_ID); 316 } 317 } 321 } // end if moving from draft/private to published 322 if ($post_status == 'publish') { 323 // Trackback time. 324 $to_ping = trim($wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID")); 325 $pinged = trim($wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID")); 326 $pinged = explode("\n", $pinged); 327 if ('' != $to_ping) { 328 if (strlen($excerpt) > 0) { 329 $the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt) ; 330 } else { 331 $the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content); 332 } 333 $excerpt = stripslashes($the_excerpt); 334 $to_pings = explode("\n", $to_ping); 335 foreach ($to_pings as $tb_ping) { 336 $tb_ping = trim($tb_ping); 337 if (!in_array($tb_ping, $pinged)) { 338 trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID); 339 } 340 } 341 } 318 342 } // end if publish 343 319 344 320 345 $location = "Location: post.php"; … … 358 383 } 359 384 360 // pingWeblogs($blog_ID);361 385 $sendback = $HTTP_SERVER_VARS['HTTP_REFERER']; 362 386 if (strstr($sendback, 'post.php')) $sendback = $siteurl .'/wp-admin/post.php'; -
trunk/wp-admin/upgrade-072-to-080.php
r632 r636 60 60 $wpdb->show_errors(); 61 61 62 62 // Create ping status fields 63 64 $query = "ALTER TABLE $tableposts ADD `to_ping` TEXT NOT NULL"; 65 maybe_add_column($tableposts, 'to_ping', $query); 66 $query = "ALTER TABLE $tableposts ADD `pinged` TEXT NOT NULL"; 67 maybe_add_column($tableposts, 'pinged', $query); 63 68 64 69 // Create category_nicename field -
trunk/wp-includes/functions.php
r628 r636 589 589 'comment_status' => $post->comment_status, 590 590 'ping_status' => $post->ping_status, 591 'post_password' => $post->post_password 591 'post_password' => $post->post_password, 592 'to_ping' => $post->to_ping, 593 'pinged' => $post->pinged 592 594 ); 593 595 return $postdata; … … 888 890 889 891 890 // trackback - send892 // Send a Trackback 891 893 function trackback($trackback_url, $title, $excerpt, $ID) { 892 global $siteurl, $blogfilename, $blogname; 893 global $querystring_start, $querystring_equal; 894 $title = urlencode($title); 894 global $blogname, $wpdb, $tableposts; 895 $title = urlencode(stripslashes($title)); 895 896 $excerpt = urlencode(stripslashes($excerpt)); 896 $blog_name = urlencode($blogname); 897 $url = urlencode($siteurl.'/'.$blogfilename.$querystring_start.'p'.$querystring_equal.$ID); 897 $blog_name = urlencode(stripslashes($blogname)); 898 $tb_url = $trackback_url; 899 $url = urlencode(get_permalink($ID)); 898 900 $query_string = "title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt"; 899 if (strstr($trackback_url, '?')) { 900 $trackback_url .= "&".$query_string;; 901 $fp = @fopen($trackback_url, 'r'); 902 $result = @fread($fp, 4096); 903 @fclose($fp); 904 /* debug code 905 $debug_file = 'trackback.log'; 906 $fp = fopen($debug_file, 'a'); 907 fwrite($fp, "\n*****\nTrackback URL query:\n\n$trackback_url\n\nResponse:\n\n"); 908 fwrite($fp, $result); 909 fwrite($fp, "\n\n"); 910 fclose($fp); 901 $trackback_url = parse_url($trackback_url); 902 $http_request = 'POST '.$trackback_url['path']." HTTP/1.0\r\n"; 903 $http_request .= 'Host: '.$trackback_url['host']."\r\n"; 904 $http_request .= 'Content-Type: application/x-www-form-urlencoded'."\r\n"; 905 $http_request .= 'Content-Length: '.strlen($query_string)."\r\n"; 906 $http_request .= "\r\n"; 907 $http_request .= $query_string; 908 $fs = @fsockopen($trackback_url['host'], 80); 909 @fputs($fs, $http_request); 910 /* 911 $debug_file = 'trackback.log'; 912 $fp = fopen($debug_file, 'a'); 913 fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"); 914 while(!@feof($fs)) { 915 fwrite($fp, @fgets($fs, 4096)); 916 } 917 fwrite($fp, "\n\n"); 918 fclose($fp); 911 919 */ 912 } else { 913 $trackback_url = parse_url($trackback_url); 914 $http_request = 'POST '.$trackback_url['path']." HTTP/1.0\r\n"; 915 $http_request .= 'Host: '.$trackback_url['host']."\r\n"; 916 $http_request .= 'Content-Type: application/x-www-form-urlencoded'."\r\n"; 917 $http_request .= 'Content-Length: '.strlen($query_string)."\r\n"; 918 $http_request .= "\r\n"; 919 $http_request .= $query_string; 920 $fs = @fsockopen($trackback_url['host'], 80); 921 @fputs($fs, $http_request); 922 /* debug code 923 $debug_file = 'trackback.log'; 924 $fp = fopen($debug_file, 'a'); 925 fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"); 926 while(!@feof($fs)) { 927 fwrite($fp, @fgets($fs, 4096)); 928 } 929 fwrite($fp, "\n\n"); 930 fclose($fp); 931 */ 932 @fclose($fs); 933 } 920 @fclose($fs); 921 922 $wpdb->query("UPDATE $tableposts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = $ID"); 923 $wpdb->query("UPDATE $tableposts SET to_ping = REPLACE(to_ping, '$tb_url', '') WHERE ID = $ID"); 934 924 return $result; 935 925 } -
trunk/wp-trackback.php
r601 r636 42 42 $comment .= "<strong>$title</strong>\n$excerpt"; 43 43 44 $author = addslashes( $blog_name);44 $author = addslashes(stripslashes(stripslashes($blog_name))); 45 45 $email = ''; 46 46 $original_comment = $comment;
Note: See TracChangeset
for help on using the changeset viewer.