Changeset 1812
- Timestamp:
- 10/18/2004 12:09:20 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r1801 r1812 133 133 <input name="referredby" type="hidden" id="referredby" value="<?php echo htmlspecialchars($_SERVER['HTTP_REFERER']); ?>" /> 134 134 </p> 135 136 <?php echo $form_enclosure; ?>137 138 135 <?php 139 136 if ('' != $pinged) { -
trunk/wp-admin/post.php
r1806 r1812 167 167 if ($post_pingback) 168 168 pingback($content, $post_ID); 169 do_enclose( $content, $post_ID ); 169 170 do_trackbacks($post_ID); 170 171 do_action('publish_post', $post_ID); … … 321 322 header ('Location: ' . $location); // Send user on their way while we keep working 322 323 323 $now = current_time('mysql');324 $now_gmt = current_time('mysql', 1);324 $now = current_time('mysql'); 325 $now_gmt = current_time('mysql', 1); 325 326 326 327 $result = $wpdb->query(" … … 339 340 post_modified = '$now', 340 341 post_modified_gmt = '$now_gmt', 341 342 post_parent = '$post_parent' 342 343 WHERE ID = $post_ID "); 343 344 … … 373 374 } 374 375 375 // Enclosures376 $enclosures = split( " ", $enclosure_url );377 if( is_array( $enclosures ) ) {378 while( list( $key, $url ) = each( $enclosures ) ) {379 if( $url != '' ) {380 // READ INFO FROM REMOTE HOST381 $file = str_replace( "http://", "", $url );382 $host = substr( $file, 0, strpos( $file, "/" ) );383 $file = substr( $file, strpos( $file, "/" ) );384 $headers = "HEAD $file HTTP/1.1\r\nHOST: $host\r\n\r\n";385 $port = 80;386 $timeout = 3;387 $fp = fsockopen($host, $port, $errno, $errstr, $timeout);388 if( $fp ) {389 fputs($fp, $headers );390 $response = '';391 while (!feof($fp))392 $response .= fgets($fp, 2048);393 } else {394 $response = '';395 }396 if( $response != '' ) {397 $len = substr( $response, strpos( $response, "Content-Length:" ) + 16 );398 $len = substr( $len, 0, strpos( $len, "\n" ) );399 $type = substr( $response, strpos( $response, "Content-Type:" ) + 14 );400 $type = substr( $type, 0, strpos( $type, "\n" ) + 1 );401 $meta_value = "$url\n$len\n$type\n";402 $query = "INSERT INTO `".$wpdb->postmeta."` ( `meta_id` , `post_id` , `meta_key` , `meta_value` )403 VALUES ( NULL, '$post_ID', 'enclosure' , '".$meta_value."')";404 $wpdb->query( $query );405 }406 }407 }408 }409 410 376 if ($prev_status != 'publish' && $post_status == 'publish') 411 377 do_action('private_to_published', $post_ID); … … 414 380 do_action('publish_post', $post_ID); 415 381 do_trackbacks($post_ID); 382 do_enclose( $content, $post_ID ); 416 383 if ( get_option('default_pingback_flag') ) 417 384 pingback($content, $post_ID); -
trunk/wp-admin/upgrade.php
r1803 r1812 1 l<?php1 <?php 2 2 $_wp_installing = 1; 3 3 if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. Double check that you updated wp-config-sample.php with the proper database connection information and renamed it to wp-config.php."); -
trunk/wp-includes/functions.php
r1802 r1812 758 758 } 759 759 760 function pingback($content, $post_ID) {760 function do_enclose( $content, $post_ID ) { 761 761 global $wp_version, $wpdb; 762 762 include_once (ABSPATH . WPINC . '/class-IXR.php'); … … 804 804 endforeach; 805 805 806 foreach ($post_links as $url){ 807 if( $url != '' && in_array($url, $pung) == false ) { 808 set_time_limit( 60 ); 809 $file = str_replace( "http://", "", $url ); 810 $host = substr( $file, 0, strpos( $file, "/" ) ); 811 $file = substr( $file, strpos( $file, "/" ) ); 812 $headers = "HEAD $file HTTP/1.1\r\nHOST: $host\r\n\r\n"; 813 $port = 80; 814 $timeout = 3; 815 $fp = fsockopen($host, $port, $err_num, $err_msg, $timeout); 816 if( $fp ) { 817 fputs($fp, $headers ); 818 $response = ''; 819 while (!feof($fp)) 820 $response .= fgets($fp, 2048); 821 fclose( $fp ); 822 } else { 823 $response = ''; 824 } 825 if( $response != '' ) { 826 $len = substr( $response, strpos( $response, "Content-Length:" ) + 16 ); 827 $len = substr( $len, 0, strpos( $len, "\n" ) ); 828 $type = substr( $response, strpos( $response, "Content-Type:" ) + 14 ); 829 $type = substr( $type, 0, strpos( $type, "\n" ) + 1 ); 830 $allowed_types = array( "video", "audio", "image" ); 831 if( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) { 832 $meta_value = "$url\n$len\n$type\n"; 833 $query = "INSERT INTO `".$wpdb->postmeta."` ( `meta_id` , `post_id` , `meta_key` , `meta_value` ) 834 VALUES ( NULL, '$post_ID', 'enclosure' , '".$meta_value."')"; 835 $wpdb->query( $query ); 836 add_ping( $post_ID, $url ); 837 } 838 } 839 } 840 } 841 } 842 843 function pingback($content, $post_ID) { 844 global $wp_version, $wpdb; 845 include_once (ABSPATH . WPINC . '/class-IXR.php'); 846 847 // original code by Mort (http://mort.mine.nu:8080) 848 $log = debug_fopen(ABSPATH . '/pingback.log', 'a'); 849 $post_links = array(); 850 debug_fwrite($log, 'BEGIN '.date('YmdHis', time())."\n"); 851 852 $pung = get_pung($post_ID); 853 854 // Variables 855 $ltrs = '\w'; 856 $gunk = '/#~:.?+=&%@!\-'; 857 $punc = '.:?\-'; 858 $any = $ltrs . $gunk . $punc; 859 860 // Step 1 861 // Parsing the post, external links (if any) are stored in the $post_links array 862 // This regexp comes straight from phpfreaks.com 863 // http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php 864 preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp); 865 866 // Debug 867 debug_fwrite($log, 'Post contents:'); 868 debug_fwrite($log, $content."\n"); 869 870 // Step 2. 871 // Walking thru the links array 872 // first we get rid of links pointing to sites, not to specific files 873 // Example: 874 // http://dummy-weblog.org 875 // http://dummy-weblog.org/ 876 // http://dummy-weblog.org/post.php 877 // We don't wanna ping first and second types, even if they have a valid <link/> 878 879 foreach($post_links_temp[0] as $link_test) : 880 if ( !in_array($link_test, $pung) ) : // If we haven't pung it already 881 $test = parse_url($link_test); 882 if (isset($test['query'])) 883 $post_links[] = $link_test; 884 elseif(($test['path'] != '/') && ($test['path'] != '')) 885 $post_links[] = $link_test; 886 endif; 887 endforeach; 888 806 889 foreach ($post_links as $pagelinkedto){ 807 890 debug_fwrite($log, "Processing -- $pagelinkedto\n"); … … 809 892 810 893 if ($pingback_server_url) { 894 set_time_limit( 60 ); 811 895 // Now, the RPC call 812 896 debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
Note: See TracChangeset
for help on using the changeset viewer.