Notice fixes from DD32. see #7509
git-svn-id: http://svn.automattic.com/wordpress/trunk@9699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
705ca7cd48
commit
9861eb1a85
|
@ -25,7 +25,7 @@ if ( !current_user_can('upload_files') )
|
|||
wp_die(__('You do not have permission to upload files.'));
|
||||
|
||||
// just fetch the detail form for that attachment
|
||||
if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
|
||||
if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
|
||||
if ( 2 == $_REQUEST['fetch'] ) {
|
||||
add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
|
||||
echo get_media_item($id, array( 'send' => false, 'delete' => false ));
|
||||
|
|
|
@ -343,12 +343,7 @@ require_once ('admin-header.php');
|
|||
<div class="wrap">
|
||||
<h2><?php echo wp_specialchars( $title ); ?></h2>
|
||||
|
||||
<?php
|
||||
$link_added = ( isset($_GET['added']) && '' != $_POST['link_name'] ) ?
|
||||
'<div id="message" class="updated fade"><p>' . __('Link added.') . '</p></div>' : '';
|
||||
?>
|
||||
|
||||
<?php if ( isset( $_GET['added'] ) && '' != $_POST['link_name']) : ?>
|
||||
<?php if ( isset( $_GET['added'] ) ) : ?>
|
||||
<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ function edit_link( $link_id = '' ) {
|
|||
$_POST['link_name'] = wp_specialchars( $_POST['link_name'] );
|
||||
$_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
|
||||
$_POST['link_rss'] = clean_url($_POST['link_rss']);
|
||||
if ( 'N' != $_POST['link_visible'] )
|
||||
if ( !isset($_POST['link_visible']) || 'N' != $_POST['link_visible'] )
|
||||
$_POST['link_visible'] = 'Y';
|
||||
|
||||
if ( !empty( $link_id ) ) {
|
||||
|
@ -176,7 +176,7 @@ function wp_insert_link( $linkdata, $wp_error = false ) {
|
|||
$link_rel = '';
|
||||
|
||||
// Make sure we set a valid category
|
||||
if ( 0 == count( $link_category ) || !is_array( $link_category ) ) {
|
||||
if ( ! isset( $link_category ) ||0 == count( $link_category ) || !is_array( $link_category ) ) {
|
||||
$link_category = array( get_option( 'default_link_category' ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -177,11 +177,13 @@ function wp_dashboard_right_now() {
|
|||
echo "\n\t".'<tr class="first">';
|
||||
|
||||
// Posts
|
||||
$num = number_format_i18n( $num_posts->publish );
|
||||
$num = isset($num_posts->publish) ? number_format_i18n( $num_posts->publish ) : 0;
|
||||
if ( current_user_can( 'edit_posts' ) )
|
||||
$num = "<a href='edit.php'>$num</a>";
|
||||
echo '<td class="first b b-posts">'.$num.'</td>';
|
||||
echo '<td class="t posts">' . __ngettext( 'Post', 'Posts', $num_posts->publish ) . '</td>';
|
||||
$text = "<a href='edit.php'>$num</a>";
|
||||
else
|
||||
$text = $num;
|
||||
echo '<td class="first b b-posts">' . $text . '</td>';
|
||||
echo '<td class="t posts">' . __ngettext( 'Post', 'Posts', $num ) . '</td>';
|
||||
/* TODO: Show status breakdown on hover
|
||||
if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds. Don't show if !current_user_can
|
||||
$post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
|
||||
|
|
|
@ -224,6 +224,9 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
|
|||
// You may define your own function and pass the name in $overrides['upload_error_handler']
|
||||
$upload_error_handler = 'wp_handle_upload_error';
|
||||
|
||||
// You may define your own function and pass the name in $overrides['unique_filename_callback']
|
||||
$unique_filename_callback = null;
|
||||
|
||||
// $_POST['action'] must be set and its value must equal $overrides['action'] or this:
|
||||
$action = 'wp_handle_upload';
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
|
|||
), $post_data );
|
||||
|
||||
// Save the data
|
||||
$id = wp_insert_attachment($attachment, $file, $post_parent);
|
||||
$id = wp_insert_attachment($attachment, $file, $post_id);
|
||||
if ( !is_wp_error($id) ) {
|
||||
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
|
||||
}
|
||||
|
@ -989,10 +989,8 @@ function get_media_items( $post_id, $errors ) {
|
|||
$attachments[$attachment->ID] = $attachment;
|
||||
}
|
||||
|
||||
if ( empty($attachments) )
|
||||
return '';
|
||||
|
||||
foreach ( $attachments as $id => $attachment )
|
||||
$output = '';
|
||||
foreach ( (array) $attachments as $id => $attachment )
|
||||
if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
|
||||
$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>";
|
||||
|
||||
|
@ -1039,6 +1037,7 @@ function get_media_item( $attachment_id, $args = null ) {
|
|||
$tags = attribute_escape(join(', ', $tags));
|
||||
}
|
||||
|
||||
$type = '';
|
||||
if ( isset($post_mime_types) ) {
|
||||
$keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
|
||||
$type = array_shift($keys);
|
||||
|
|
|
@ -153,6 +153,7 @@ function edit_post( $post_data = null ) {
|
|||
if ( is_wp_error($post_data) )
|
||||
wp_die( $post_data->get_error_message() );
|
||||
|
||||
if ( isset($post_data['visibility']) ) {
|
||||
switch ( $post_data['visibility'] ) {
|
||||
case 'public' :
|
||||
unset( $post_data['post_password'] );
|
||||
|
@ -166,6 +167,7 @@ function edit_post( $post_data = null ) {
|
|||
unset( $post_data['sticky'] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Meta Stuff
|
||||
if ( isset($post_data['meta']) && $post_data['meta'] ) {
|
||||
|
@ -337,6 +339,7 @@ function get_default_post_to_edit() {
|
|||
$post->post_name = '';
|
||||
$post->post_author = '';
|
||||
$post->post_date = '';
|
||||
$post->post_password = '';
|
||||
$post->post_status = 'draft';
|
||||
$post->post_type = 'post';
|
||||
$post->to_ping = '';
|
||||
|
@ -456,6 +459,7 @@ function wp_write_post() {
|
|||
if ( is_wp_error($translated) )
|
||||
return $translated;
|
||||
|
||||
if ( isset($_POST['visibility']) ) {
|
||||
switch ( $_POST['visibility'] ) {
|
||||
case 'public' :
|
||||
$_POST['post_password'] = '';
|
||||
|
@ -469,6 +473,7 @@ function wp_write_post() {
|
|||
unset( $_POST['sticky'] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the post.
|
||||
$post_ID = wp_insert_post( $_POST );
|
||||
|
|
|
@ -22,12 +22,12 @@ if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
|
|||
wp_die(__('You can’t create users.'));
|
||||
|
||||
$user_id = add_user();
|
||||
$update = 'add';
|
||||
if ( is_wp_error( $user_id ) )
|
||||
|
||||
if ( is_wp_error( $user_id ) ) {
|
||||
$add_user_errors = $user_id;
|
||||
else {
|
||||
} else {
|
||||
$new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
|
||||
$redirect = add_query_arg( array('usersearch' => urlencode($new_user_login), 'update' => $update), $redirect );
|
||||
$redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add';
|
||||
wp_redirect( $redirect . '#user-' . $user_id );
|
||||
die();
|
||||
}
|
||||
|
@ -78,6 +78,15 @@ if ( ! empty($messages) ) {
|
|||
?>
|
||||
<form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate">
|
||||
<?php wp_nonce_field('add-user') ?>
|
||||
<?php
|
||||
//Load up the passed data, else set to a default.
|
||||
foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
|
||||
'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) {
|
||||
$var = "new_user_$var";
|
||||
if ( ! isset($$var) )
|
||||
$$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
|
||||
}
|
||||
?>
|
||||
<table class="form-table">
|
||||
<tr class="form-field form-required">
|
||||
<th scope="row"><label for="user_login"><?php _e('Username (required)') ?></label><input name="action" type="hidden" id="action" value="adduser" /></th>
|
||||
|
@ -114,7 +123,7 @@ if ( ! empty($messages) ) {
|
|||
<td><select name="role" id="role">
|
||||
<?php
|
||||
if ( !$new_user_role )
|
||||
$new_user_role = $current_role ? $current_role : get_option('default_role');
|
||||
$new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
|
||||
wp_dropdown_roles($new_user_role);
|
||||
?>
|
||||
</select>
|
||||
|
@ -122,7 +131,6 @@ if ( ! empty($messages) ) {
|
|||
</tr>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<?php echo $referer; ?>
|
||||
<input name="adduser" type="submit" id="addusersub" class="button" value="<?php _e('Add User') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
|
|
|
@ -265,15 +265,22 @@ function sanitize_bookmark($bookmark, $context = 'display') {
|
|||
'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated',
|
||||
'link_rel', 'link_notes', 'link_rss', );
|
||||
|
||||
$do_object = false;
|
||||
if ( is_object($bookmark) )
|
||||
if ( is_object($bookmark) ) {
|
||||
$do_object = true;
|
||||
$link_id = $bookmark->link_id;
|
||||
} else {
|
||||
$do_object = false;
|
||||
$link_id = $bookmark['link_id'];
|
||||
}
|
||||
|
||||
foreach ( $fields as $field ) {
|
||||
if ( $do_object )
|
||||
$bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context);
|
||||
else
|
||||
$bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $bookmark['link_id'], $context);
|
||||
if ( $do_object ) {
|
||||
if ( isset($bookmark->$field) )
|
||||
$bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context);
|
||||
} else {
|
||||
if ( isset($bookmark[$field]) )
|
||||
$bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context);
|
||||
}
|
||||
}
|
||||
|
||||
return $bookmark;
|
||||
|
|
|
@ -1677,6 +1677,7 @@ function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
|
|||
if ( empty($tags) )
|
||||
$tags = array();
|
||||
$tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
|
||||
$tags = array_map('trim', $tags); //Trim whitespace from around the tags.
|
||||
wp_set_object_terms($post_id, $tags, 'post_tag', $append);
|
||||
}
|
||||
|
||||
|
@ -2158,8 +2159,10 @@ function &get_pages($args = '') {
|
|||
|
||||
$pages = $wpdb->get_results($query);
|
||||
|
||||
if ( empty($pages) )
|
||||
return apply_filters('get_pages', array(), $r);
|
||||
if ( empty($pages) ) {
|
||||
$page = apply_filters('get_pages', array(), $r);
|
||||
return $pages;
|
||||
}
|
||||
|
||||
// Update cache.
|
||||
update_page_cache($pages);
|
||||
|
@ -2261,7 +2264,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
|
|||
extract($object, EXTR_SKIP);
|
||||
|
||||
// Make sure we set a valid category
|
||||
if (0 == count($post_category) || !is_array($post_category)) {
|
||||
if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category)) {
|
||||
$post_category = array(get_option('default_category'));
|
||||
}
|
||||
|
||||
|
@ -2272,10 +2275,12 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
|
|||
$post_status = 'inherit';
|
||||
|
||||
// Are we updating or creating?
|
||||
$update = false;
|
||||
if ( !empty($ID) ) {
|
||||
$update = true;
|
||||
$post_ID = (int) $ID;
|
||||
} else {
|
||||
$update = false;
|
||||
$post_ID = 0;
|
||||
}
|
||||
|
||||
// Create a valid post name.
|
||||
|
@ -3241,8 +3246,8 @@ function _wp_post_revision_fields( $post = null, $autosave = false ) {
|
|||
$return['post_status'] = 'inherit';
|
||||
$return['post_type'] = 'revision';
|
||||
$return['post_name'] = $autosave ? "$post[ID]-autosave" : "$post[ID]-revision";
|
||||
$return['post_date'] = $post['post_modified'];
|
||||
$return['post_date_gmt'] = $post['post_modified_gmt'];
|
||||
$return['post_date'] = isset($post['post_modified']) ? $post['post_modified'] : '';
|
||||
$return['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : '';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
|
|
@ -164,6 +164,15 @@ function wp_insert_user($userdata) {
|
|||
if ( empty($use_ssl) )
|
||||
$use_ssl = 0;
|
||||
|
||||
if ( empty($jabber) )
|
||||
$jabber = '';
|
||||
|
||||
if ( empty($aim) )
|
||||
$aim = '';
|
||||
|
||||
if ( empty($yim) )
|
||||
$yim = '';
|
||||
|
||||
if ( empty($user_registered) )
|
||||
$user_registered = gmdate('Y-m-d H:i:s');
|
||||
|
||||
|
|
|
@ -459,7 +459,7 @@ function fetch_rss ($url) {
|
|||
// setup headers
|
||||
if ( $cache_status == 'STALE' ) {
|
||||
$rss = $cache->get( $url );
|
||||
if ( $rss->etag and $rss->last_modified ) {
|
||||
if ( isset($rss->etag) and $rss->last_modified ) {
|
||||
$request_headers['If-None-Match'] = $rss->etag;
|
||||
$request_headers['If-Last-Modified'] = $rss->last_modified;
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ function _response_to_rss ($resp) {
|
|||
$rss = new MagpieRSS( $resp->results );
|
||||
|
||||
// if RSS parsed successfully
|
||||
if ( $rss && !$rss->ERROR) {
|
||||
if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) {
|
||||
|
||||
// find Etag, and Last-Modified
|
||||
foreach( (array) $resp->headers as $h) {
|
||||
|
|
|
@ -294,16 +294,19 @@ case 'retrievepassword' :
|
|||
}
|
||||
}
|
||||
|
||||
if ( 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
|
||||
if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
|
||||
|
||||
do_action('lost_password');
|
||||
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);
|
||||
|
||||
$user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
|
||||
|
||||
?>
|
||||
|
||||
<form name="lostpasswordform" id="lostpasswordform" action="<?php echo site_url('wp-login.php?action=lostpassword', 'login_post') ?>" method="post">
|
||||
<p>
|
||||
<label><?php _e('Username or E-mail:') ?><br />
|
||||
<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>
|
||||
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
|
||||
</p>
|
||||
<?php do_action('lostpassword_form'); ?>
|
||||
<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Get New Password'); ?>" tabindex="100" /></p>
|
||||
|
|
Loading…
Reference in New Issue