From baffa2ef1564b49d3ed978ab79cdcf05ccc13368 Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 20 Apr 2005 21:07:19 +0000 Subject: [PATCH] Don't enclose different things multiple times - http://mosquito.wordpress.org/view.php?id=1197 git-svn-id: http://svn.automattic.com/wordpress/trunk@2560 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 2fe04162fc..c15e9cc518 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -810,15 +810,15 @@ function do_enclose( $content, $post_ID ) { endforeach; foreach ($post_links as $url) : - if ( $url != '' && in_array($url, $pung) == false ) { + if ( $url != '' && !$wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE post_id = '$post_ID' AND meta_key = 'enclosure' AND meta_value LIKE ('$url%')") ) { if ( $headers = wp_get_http_headers( $url) ) { - $len = $headers['content-length']; - $type = $headers['content-type']; + $len = (int) $headers['content-length']; + $type = addslashes( $headers['content-type'] ); $allowed_types = array( 'video', 'audio' ); if( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) { $meta_value = "$url\n$len\n$type\n"; - $wpdb->query( "INSERT INTO `".$wpdb->postmeta."` ( `post_id` , `meta_key` , `meta_value` ) - VALUES ( '$post_ID', 'enclosure' , '".$meta_value."')" ); + $wpdb->query( "INSERT INTO `$wpdb->postmeta` ( `post_id` , `meta_key` , `meta_value` ) + VALUES ( '$post_ID', 'enclosure' , '$meta_value')" ); } } }