Make WordPress Core

Changeset 11010


Ignore:
Timestamp:
04/20/2009 11:14:37 AM (15 years ago)
Author:
azaozz
Message:

Press This notice fixes, props DD32, fixes #9593

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/press-this.php

    r10856 r11010  
    1111header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    1212
    13 if ( ! current_user_can('edit_posts') ) wp_die( __( 'Cheatin’ uh?' ) );
     13if ( ! current_user_can('edit_posts') )
     14    wp_die( __( 'Cheatin’ uh?' ) );
    1415
    1516/**
     
    4243    // define some basic variables
    4344    $quick['post_status'] = 'draft'; // set as draft first
    44     $quick['post_category'] = $_REQUEST['post_category'];
    45     $quick['tax_input'] = $_REQUEST['tax_input'];
    46     $quick['post_title'] = $_REQUEST['title'];
     45    $quick['post_category'] = isset($_REQUEST['post_category']) ? $_REQUEST['post_category'] : null;
     46    $quick['tax_input'] = isset($_REQUEST['tax_input']) ? $_REQUEST['tax_input'] : '';
     47    $quick['post_title'] = isset($_REQUEST['title']) ? $_REQUEST['title'] : '';
    4748    $quick['post_content'] = '';
    4849
    4950    // insert the post with nothing in it, to get an ID
    5051    $post_ID = wp_insert_post($quick, true);
    51     $content = $_REQUEST['content'];
    52 
    53     if( $_REQUEST['photo_src'] && current_user_can('upload_files') )
     52    $content = isset($_REQUEST['content']) ? $_REQUEST['content'] : '';
     53
     54    $upload = false;
     55    if( !empty($_REQUEST['photo_src']) && current_user_can('upload_files') )
    5456        foreach( (array) $_REQUEST['photo_src'] as $key => $image)
    5557            // see if files exist in content - we don't want to upload non-used selected files.
    5658            if( strpos($_REQUEST['content'], $image) !== false ) {
    57                 $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]);
     59                $desc = isset($_REQUEST['photo_description'][$key]) ? $_REQUEST['photo_description'][$key] : '';
     60                $upload = media_sideload_image($image, $post_ID, $desc);
    5861               
    5962                // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes
     
    8083
    8184// For submitted posts.
    82 if ( 'post' == $_REQUEST['action'] ) {
     85if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) {
    8386    check_admin_referer('press-this');
    8487    $post_ID = press_it();
    8588    $posted =  $post_ID;
     89} else {
     90    $post_ID = 0;
    8691}
    8792
    8893// Set Variables
    89 $title = wp_specialchars(aposfix(stripslashes($_GET['t'])));
    90 $selection = trim( aposfix( stripslashes($_GET['s']) ) );
     94$title = isset($_GET['t']) ? wp_specialchars(aposfix(stripslashes($_GET['t']))) : '';
     95$selection = isset($_GET['s']) ? trim( aposfix( stripslashes($_GET['s']) ) ) : '';
    9196if ( ! empty($selection) ) {
    9297    $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
    9398    $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>';
    9499}
    95 $url = clean_url($_GET['u']);
    96 $image = $_GET['i'];
    97 
    98 if($_REQUEST['ajax']) {
     100$url = isset($_GET['u']) ? clean_url($_GET['u']) : '';
     101$image = isset($_GET['i']) ? $_GET['i'] : '';
     102
     103if ( !empty($_REQUEST['ajax']) ) {
    99104switch ($_REQUEST['ajax']) {
    100105    case 'video': ?>
     
    468473                    <div id="categories-all" class="ui-tabs-panel">
    469474                        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
    470                             <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
     475                            <?php wp_category_checklist($post_ID, false) ?>
    471476                        </ul>
    472477                    </div>
Note: See TracChangeset for help on using the changeset viewer.