Make WordPress Core

Ticket #7105: press-this-5-6-08-3am.diff

File press-this-5-6-08-3am.diff, 2.8 KB (added by noel, 18 years ago)

fixes urldecode encode issue

  • wp-admin/press-this.php

     
    8989}
    9090
    9191// Ajax Requests
    92 $url = $_REQUEST['url'];
    93 $selection = $_REQUEST['selection'];
     92$title = wp_specialchars(stripslashes($_GET['t']));
     93$selection = trim(wp_specialchars(str_replace("\n", ' ',stripslashes($_GET['s']))));
     94$url = $_GET['u'];
    9495
    9596if($_REQUEST['ajax'] == 'video') { ?>
    9697        <h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2>
    … …  
    101102}
    102103
    103104if($_REQUEST['ajax'] == 'photo_images') {
     105$url = urldecode($url);
     106$url = str_replace(' ', '%20', $url);
     107
    104108        function get_images_from_uri($uri) {
    105109                $content = wp_remote_fopen($uri);
    106110                $host = parse_url($uri);
    … …  
    164168                                url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
    165169                                cache : false,
    166170                                async : false,
    167                                 data: "ajax=photo_images&url=<?php echo $url?>",
     171                                data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
    168172                        dataType : "script"
    169173                        }).responseText);
    170174
    … …  
    221225                </div>
    222226<?php die; }
    223227
    224 // Clean up the data being passed in
    225 $title = wp_specialchars(stripslashes($_GET['t']));
    226 $selection = trim(wp_specialchars(str_replace("\n", ' ',stripslashes($_GET['s']))));
    227 $url = clean_url($_GET['u']);
    228228?>
    229229<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    230230<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
    … …  
    355355                                jQuery('body').addClass('video_split');
    356356                       
    357357                               
    358                                 jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', selection: '<?php echo attribute_escape($selection); ?>'}, function() {
     358                                jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
    359359                                       
    360360                                        <?php
    361361                                        if ( preg_match("/youtube\.com\/watch/i", $url) ) {
    … …  
    387387                                set_editor('<a href="<?php echo $url; ?>"><?php echo $title; ?></a>');
    388388                               
    389389                                jQuery('#extra_fields').show();
    390                                 jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&url='.attribute_escape($url); ?>');
     390                                jQuery('#extra_fields').load('<?php echo clean_url($_SERVER['PHP_SELF']).'/?ajax=photo&u='.attribute_escape($url); ?>');
    391391                                jQuery('#extra_fields').prepend('<h2><img src="images/loading.gif" alt="" /> Loading...</h2>');
    392392                                jQuery.ajax({
    393393                                        type: "GET",
    394394                                        cache : false,
    395395                                        url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
    396                                         data: "ajax=photo_js&url=<?php echo $url?>",
     396                                        data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
    397397                                        dataType : "script",
    398398                                        success : function() {
    399399                                        }