Make WordPress Core

Changeset 9699


Ignore:
Timestamp:
11/14/2008 11:01:16 PM (16 years ago)
Author:
ryan
Message:

Notice fixes from DD32. see #7509

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/async-upload.php

    r8998 r9699  
    2626
    2727// just fetch the detail form for that attachment
    28 if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
     28if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
    2929    if ( 2 == $_REQUEST['fetch'] ) {
    3030        add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
  • trunk/wp-admin/edit-link-form.php

    r9637 r9699  
    344344<h2><?php echo wp_specialchars( $title ); ?></h2>
    345345
    346 <?php
    347 $link_added = ( isset($_GET['added']) && '' != $_POST['link_name'] ) ?
    348     '<div id="message" class="updated fade"><p>' . __('Link added.') . '</p></div>' : '';
    349 ?>
    350 
    351 <?php if ( isset( $_GET['added'] ) && '' != $_POST['link_name']) : ?>
     346<?php if ( isset( $_GET['added'] ) ) : ?>
    352347<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
    353348<?php endif; ?>
  • trunk/wp-admin/includes/bookmark.php

    r9659 r9699  
    3535    $_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
    3636    $_POST['link_rss'] = clean_url($_POST['link_rss']);
    37     if ( 'N' != $_POST['link_visible'] )
     37    if ( !isset($_POST['link_visible']) || 'N' != $_POST['link_visible'] )
    3838        $_POST['link_visible'] = 'Y';
    3939
     
    177177
    178178    // Make sure we set a valid category
    179     if ( 0 == count( $link_category ) || !is_array( $link_category ) ) {
     179    if ( ! isset( $link_category ) ||0 == count( $link_category ) || !is_array( $link_category ) ) {
    180180        $link_category = array( get_option( 'default_link_category' ) );
    181181    }
  • trunk/wp-admin/includes/dashboard.php

    r9694 r9699  
    178178
    179179    // Posts
    180     $num = number_format_i18n( $num_posts->publish );
     180    $num = isset($num_posts->publish) ? number_format_i18n( $num_posts->publish ) : 0;
    181181    if ( current_user_can( 'edit_posts' ) )
    182         $num = "<a href='edit.php'>$num</a>";
    183     echo '<td class="first b b-posts">'.$num.'</td>';
    184     echo '<td class="t posts">' . __ngettext( 'Post', 'Posts', $num_posts->publish ) . '</td>';
     182        $text = "<a href='edit.php'>$num</a>";
     183    else
     184        $text = $num;
     185    echo '<td class="first b b-posts">' . $text . '</td>';
     186    echo '<td class="t posts">' . __ngettext( 'Post', 'Posts', $num ) . '</td>';
    185187    /* TODO: Show status breakdown on hover
    186188    if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
  • trunk/wp-admin/includes/file.php

    r9664 r9699  
    224224    // You may define your own function and pass the name in $overrides['upload_error_handler']
    225225    $upload_error_handler = 'wp_handle_upload_error';
     226
     227    // You may define your own function and pass the name in $overrides['unique_filename_callback']
     228    $unique_filename_callback = null;
    226229
    227230    // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
  • trunk/wp-admin/includes/media.php

    r9676 r9699  
    210210
    211211    // Save the data
    212     $id = wp_insert_attachment($attachment, $file, $post_parent);
     212    $id = wp_insert_attachment($attachment, $file, $post_id);
    213213    if ( !is_wp_error($id) ) {
    214214        wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
     
    990990    }
    991991
    992     if ( empty($attachments) )
    993         return '';
    994 
    995     foreach ( $attachments as $id => $attachment )
     992    $output = '';
     993    foreach ( (array) $attachments as $id => $attachment )
    996994        if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
    997995            $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>";
     
    10401038    }
    10411039
     1040    $type = '';
    10421041    if ( isset($post_mime_types) ) {
    10431042        $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
  • trunk/wp-admin/includes/post.php

    r9651 r9699  
    154154        wp_die( $post_data->get_error_message() );
    155155
    156     switch ( $post_data['visibility'] ) {
    157         case 'public' :
    158             unset( $post_data['post_password'] );
    159             break;
    160         case 'password' :
    161             unset( $post_data['sticky'] );
    162             break;
    163         case 'private' :
    164             $post_data['post_status'] = 'private';
    165             $post_data['post_password'] = '';
    166             unset( $post_data['sticky'] );
    167             break;
     156    if ( isset($post_data['visibility']) ) {
     157        switch ( $post_data['visibility'] ) {
     158            case 'public' :
     159                unset( $post_data['post_password'] );
     160                break;
     161            case 'password' :
     162                unset( $post_data['sticky'] );
     163                break;
     164            case 'private' :
     165                $post_data['post_status'] = 'private';
     166                $post_data['post_password'] = '';
     167                unset( $post_data['sticky'] );
     168                break;
     169        }
    168170    }
    169171
     
    338340    $post->post_author = '';
    339341    $post->post_date = '';
     342    $post->post_password = '';
    340343    $post->post_status = 'draft';
    341344    $post->post_type = 'post';
     
    457460        return $translated;
    458461
    459     switch ( $_POST['visibility'] ) {
    460         case 'public' :
    461             $_POST['post_password'] = '';
    462             break;
    463         case 'password' :
    464             unset( $_POST['sticky'] );
    465             break;
    466         case 'private' :
    467             $_POST['post_status'] = 'private';
    468             $_POST['post_password'] = '';
    469             unset( $_POST['sticky'] );
    470             break;
     462    if ( isset($_POST['visibility']) ) {
     463        switch ( $_POST['visibility'] ) {
     464            case 'public' :
     465                $_POST['post_password'] = '';
     466                break;
     467            case 'password' :
     468                unset( $_POST['sticky'] );
     469                break;
     470            case 'private' :
     471                $_POST['post_status'] = 'private';
     472                $_POST['post_password'] = '';
     473                unset( $_POST['sticky'] );
     474                break;
     475        }
    471476    }
    472477
  • trunk/wp-admin/user-new.php

    r9631 r9699  
    2323
    2424    $user_id = add_user();
    25     $update = 'add';
    26     if ( is_wp_error( $user_id ) )
     25
     26    if ( is_wp_error( $user_id ) ) {
    2727        $add_user_errors = $user_id;
    28     else {
     28    } else {
    2929        $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
    30         $redirect = add_query_arg( array('usersearch' => urlencode($new_user_login), 'update' => $update), $redirect );
     30        $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add';
    3131        wp_redirect( $redirect . '#user-' . $user_id );
    3232        die();
     
    7979<form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate">
    8080<?php wp_nonce_field('add-user') ?>
     81<?php
     82//Load up the passed data, else set to a default.
     83foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
     84                'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) {
     85    $var = "new_user_$var";
     86    if ( ! isset($$var) )
     87        $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
     88}
     89?>
    8190<table class="form-table">
    8291    <tr class="form-field form-required">
     
    115124            <?php
    116125            if ( !$new_user_role )
    117                 $new_user_role = $current_role ? $current_role : get_option('default_role');
     126                $new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
    118127            wp_dropdown_roles($new_user_role);
    119128            ?>
     
    123132</table>
    124133<p class="submit">
    125     <?php echo $referer; ?>
    126134    <input name="adduser" type="submit" id="addusersub" class="button" value="<?php _e('Add User') ?>" />
    127135</p>
  • trunk/wp-includes/bookmark.php

    r8758 r9699  
    266266        'link_rel', 'link_notes', 'link_rss', );
    267267
    268     $do_object = false;
    269     if ( is_object($bookmark) )
     268    if ( is_object($bookmark) ) {
    270269        $do_object = true;
     270        $link_id = $bookmark->link_id;
     271    } else {
     272        $do_object = false;
     273        $link_id = $bookmark['link_id'];
     274    }
    271275
    272276    foreach ( $fields as $field ) {
    273         if ( $do_object )
    274             $bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context);
    275         else
    276             $bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $bookmark['link_id'], $context);
     277        if ( $do_object ) {
     278            if ( isset($bookmark->$field) )
     279                $bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context);
     280        } else {
     281            if ( isset($bookmark[$field]) )
     282                $bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context);
     283        }
    277284    }
    278285
  • trunk/wp-includes/post.php

    r9596 r9699  
    16781678        $tags = array();
    16791679    $tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
     1680    $tags = array_map('trim', $tags); //Trim whitespace from around the tags.
    16801681    wp_set_object_terms($post_id, $tags, 'post_tag', $append);
    16811682}
     
    21592160    $pages = $wpdb->get_results($query);
    21602161
    2161     if ( empty($pages) )
    2162         return apply_filters('get_pages', array(), $r);
     2162    if ( empty($pages) ) {
     2163        $page = apply_filters('get_pages', array(), $r);
     2164        return $pages;
     2165    }
    21632166
    21642167    // Update cache.
     
    22622265
    22632266    // Make sure we set a valid category
    2264     if (0 == count($post_category) || !is_array($post_category)) {
     2267    if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category)) {
    22652268        $post_category = array(get_option('default_category'));
    22662269    }
     
    22732276
    22742277    // Are we updating or creating?
    2275     $update = false;
    22762278    if ( !empty($ID) ) {
    22772279        $update = true;
    22782280        $post_ID = (int) $ID;
     2281    } else {
     2282        $update = false;
     2283        $post_ID = 0;
    22792284    }
    22802285
     
    32423247    $return['post_type']     = 'revision';
    32433248    $return['post_name']     = $autosave ? "$post[ID]-autosave" : "$post[ID]-revision";
    3244     $return['post_date']     = $post['post_modified'];
    3245     $return['post_date_gmt'] = $post['post_modified_gmt'];
     3249    $return['post_date']     = isset($post['post_modified']) ? $post['post_modified'] : '';
     3250    $return['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : '';
    32463251
    32473252    return $return;
  • trunk/wp-includes/registration.php

    r9217 r9699  
    165165        $use_ssl = 0;
    166166
     167    if ( empty($jabber) )
     168        $jabber = '';
     169
     170    if ( empty($aim) )
     171        $aim = '';
     172
     173    if ( empty($yim) )
     174        $yim = '';
     175
    167176    if ( empty($user_registered) )
    168177        $user_registered = gmdate('Y-m-d H:i:s');
  • trunk/wp-includes/rss.php

    r9554 r9699  
    460460        if ( $cache_status == 'STALE' ) {
    461461            $rss = $cache->get( $url );
    462             if ( $rss->etag and $rss->last_modified ) {
     462            if ( isset($rss->etag) and $rss->last_modified ) {
    463463                $request_headers['If-None-Match'] = $rss->etag;
    464464                $request_headers['If-Last-Modified'] = $rss->last_modified;
     
    565565
    566566    // if RSS parsed successfully
    567     if ( $rss && !$rss->ERROR) {
     567    if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) {
    568568
    569569        // find Etag, and Last-Modified
  • trunk/wp-login.php

    r9025 r9699  
    295295    }
    296296
    297     if ( 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
     297    if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
    298298
    299299    do_action('lost_password');
    300300    login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '</p>', $errors);
     301
     302    $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
     303
    301304?>
    302305
     
    304307    <p>
    305308        <label><?php _e('Username or E-mail:') ?><br />
    306         <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($_POST['user_login'])); ?>" size="20" tabindex="10" /></label>
     309        <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
    307310    </p>
    308311<?php do_action('lostpassword_form'); ?>
Note: See TracChangeset for help on using the changeset viewer.