From 9648173c70c2f897c6024b2505bc61aa01f2bed2 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Tue, 3 May 2005 07:52:11 +0000 Subject: [PATCH] Use CURL if available, possible fix for http://mosquito.wordpress.org/view.php?id=1166 git-svn-id: https://develop.svn.wordpress.org/trunk@2581 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/upgrade-schema.php | 2 ++ wp-includes/functions.php | 22 +++++++++++++++++++++- xmlrpc.php | 13 +++---------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php index 4aa48f0e0e..d8100ef0aa 100644 --- a/wp-admin/upgrade-schema.php +++ b/wp-admin/upgrade-schema.php @@ -215,6 +215,8 @@ function populate_options() { add_option('open_proxy_check', 1); add_option('rss_language', 'en'); add_option('html_type', 'text/html'); + // 1.5.1 + add_option('use_trackback', 0); // Delete unused options $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url'); diff --git a/wp-includes/functions.php b/wp-includes/functions.php index b240deabfc..1871493385 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1858,4 +1858,24 @@ function add_magic_quotes($array) { return $array; } -?> +function wp_remote_fopen( $uri ) { + if ( function_exists('curl_init') ) { + $handle = curl_init(); + curl_setopt ($handle, CURLOPT_URL, $uri); + curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1); + curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1); + $buffer = curl_exec($handle); + curl_close($handle); + return $buffer; + } else { + $fp = fopen( $uri, 'r' ); + if ( !$fp ) + return false; + $linea = ''; + while( $remote_read = fread($fp, 4096) ) + $linea .= $remote_read; + return $linea; + } +} + +?> \ No newline at end of file diff --git a/xmlrpc.php b/xmlrpc.php index 058062f595..d586e538ff 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -1162,16 +1162,9 @@ class wp_xmlrpc_server extends IXR_Server { sleep(1); // Let's check the remote site - $fp = @fopen($pagelinkedfrom, 'r'); - if (!$fp) { - // The source URI does not exist + $linea = wp_remote_fopen( $pagelinkedfrom ); + if ( !$linea ) return new IXR_Error(16, 'The source URI does not exist.'); - } - - $puntero = 4096; - while($remote_read = fread($fp, $puntero)) { - $linea .= $remote_read; - } // Work around bug in strip_tags(): $linea = str_replace('([^<]*?)|is', $linea, $matchtitle); } $pos2 = strpos($linea, $pagelinkedto);