WordPress.org

Make WordPress Core

Changeset 2560


Ignore:
Timestamp:
04/20/2005 09:07:19 PM (17 years ago)
Author:
matt
Message:

Don't enclose different things multiple times - http://mosquito.wordpress.org/view.php?id=1197

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r2551 r2560  
    811811
    812812    foreach ($post_links as $url) :
    813         if ( $url != '' && in_array($url, $pung) == false ) {
     813        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%')") ) {
    814814            if ( $headers = wp_get_http_headers( $url) ) {
    815                 $len  = $headers['content-length'];
    816                 $type = $headers['content-type'];
     815                $len  = (int) $headers['content-length'];
     816                $type = addslashes( $headers['content-type'] );
    817817                $allowed_types = array( 'video', 'audio' );
    818818                if( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
    819819                    $meta_value = "$url\n$len\n$type\n";
    820                     $wpdb->query( "INSERT INTO `".$wpdb->postmeta."` ( `post_id` , `meta_key` , `meta_value` )
    821                     VALUES ( '$post_ID', 'enclosure' , '".$meta_value."')" );
     820                    $wpdb->query( "INSERT INTO `$wpdb->postmeta` ( `post_id` , `meta_key` , `meta_value` )
     821                    VALUES ( '$post_ID', 'enclosure' , '$meta_value')" );
    822822                }
    823823            }
Note: See TracChangeset for help on using the changeset viewer.