summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes
diff options
context:
space:
mode:
Diffstat (limited to 'wp-admin/includes')
-rw-r--r--wp-admin/includes/plugin.php42
-rw-r--r--wp-admin/includes/post.php47
-rw-r--r--wp-admin/includes/schema.php12
-rw-r--r--wp-admin/includes/template.php152
-rw-r--r--wp-admin/includes/upgrade.php21
-rw-r--r--wp-admin/includes/upload.php7
-rw-r--r--wp-admin/includes/user.php12
7 files changed, 210 insertions, 83 deletions
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index e5911bd..3c4f474 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -86,6 +86,48 @@ function get_plugins() {
return $wp_plugins;
}
+function activate_plugin($plugin) {
+ $current = get_option('active_plugins');
+ $plugin = trim($plugin);
+
+ if ( validate_file($plugin) )
+ return new WP_Error('plugin_invalid', __('Invalid plugin.'));
+ if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
+ return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
+
+ if (!in_array($plugin, $current)) {
+ wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), 'plugins.php?error=true&plugin=' . $plugin)); // we'll override this later if the plugin can be included without fatal error
+ ob_start();
+ @include(ABSPATH . PLUGINDIR . '/' . $plugin);
+ $current[] = $plugin;
+ sort($current);
+ update_option('active_plugins', $current);
+ do_action('activate_' . $plugin);
+ ob_end_clean();
+ }
+
+ return null;
+}
+
+function deactivate_plugins($plugins) {
+ $current = get_option('active_plugins');
+
+ if(!is_array($plugins))
+ $plugins = array($plugins);
+
+ foreach($plugins as $plugin) {
+ array_splice($current, array_search( $plugin, $current), 1 ); // Array-fu!
+ do_action('deactivate_' . trim( $plugin ));
+ }
+
+ update_option('active_plugins', $current);
+}
+
+function deactivate_all_plugins() {
+ $current = get_option('active_plugins');
+ deactivate_plugins($current);
+}
+
//
// Menu
//
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php
index e27482c..b88e3b0 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -348,6 +348,8 @@ function add_meta( $post_ID ) {
if ( in_array($metakey, $protected) )
return false;
+ wp_cache_delete($post_ID, 'post_meta');
+
$result = $wpdb->query( "
INSERT INTO $wpdb->postmeta
(post_id,meta_key,meta_value )
@@ -362,6 +364,9 @@ function delete_meta( $mid ) {
global $wpdb;
$mid = (int) $mid;
+ $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+ wp_cache_delete($post_id, 'post_meta');
+
return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
}
@@ -408,6 +413,9 @@ function update_meta( $mid, $mkey, $mvalue ) {
if ( in_array($mkey, $protected) )
return false;
+ $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
+ wp_cache_delete($post_id, 'post_meta');
+
$mvalue = maybe_serialize( stripslashes( $mvalue ));
$mvalue = $wpdb->escape( $mvalue );
$mid = (int) $mid;
@@ -468,4 +476,41 @@ function _relocate_children( $old_ID, $new_ID ) {
return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
}
-?> \ No newline at end of file
+function wp_edit_posts_query( $q = '_GET' ) {
+ global $wpdb;
+ $$q['m'] = (int) $$q['m'];
+ $$q['cat'] = (int) $$q['cat'];
+ $post_stati = array( // array( adj, noun )
+ 'draft' => array(__('Draft'), _c('Drafts|manage posts header')),
+ 'future' => array(__('Scheduled'), __('Scheduled posts')),
+ 'pending' => array(__('Pending Review'), __('Pending posts')),
+ 'private' => array(__('Private'), __('Private posts')),
+ 'publish' => array(__('Published'), __('Published posts'))
+ );
+
+ $avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'");
+
+ $post_status_q = '';
+ $post_status_label = _c('Posts|manage posts header');
+ if ( isset($$q['post_status']) && in_array( $$q['post_status'], array_keys($post_stati) ) ) {
+ $post_status_label = $post_stati[$$q['post_status']][1];
+ $post_status_q = '&post_status=' . $$q['post_status'];
+ }
+
+ if ( 'pending' === $$q['post_status'] ) {
+ $order = 'ASC';
+ $orderby = 'modified';
+ } elseif ( 'draft' === $$q['post_status'] ) {
+ $order = 'DESC';
+ $orderby = 'modified';
+ } else {
+ $order = 'DESC';
+ $orderby = 'date';
+ }
+
+ wp("what_to_show=posts$post_status_q&posts_per_page=20&order=$order&orderby=$orderby");
+
+ return array($post_stati, $avail_post_stati);
+}
+
+?>
diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php
index de4e949..d76d5f7 100644
--- a/wp-admin/includes/schema.php
+++ b/wp-admin/includes/schema.php
@@ -4,7 +4,7 @@
global $wp_queries;
$charset_collate = '';
-if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
+if ( $wpdb->supports_collation() ) {
if ( ! empty($wpdb->charset) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate) )
@@ -334,11 +334,11 @@ function populate_roles_160() {
global $wp_roles;
// Add roles
- add_role('administrator', __('Administrator'));
- add_role('editor', __('Editor'));
- add_role('author', __('Author'));
- add_role('contributor', __('Contributor'));
- add_role('subscriber', __('Subscriber'));
+ add_role('administrator', _c('Administrator|User role'));
+ add_role('editor', _c('Editor|User role'));
+ add_role('author', _c('Author|User role'));
+ add_role('contributor', _c('Contributor|User role'));
+ add_role('subscriber', _c('Subscriber|User role'));
// Add caps for Administrator role
$role = get_role('administrator');
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 1cf9284..c604d4c 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -14,10 +14,6 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
if ( $categories ) {
ob_start();
foreach ( $categories as $category ) {
- if ( $category->term_id == 0 ) {
- $wpdb->query("DELETE FROM $wpdb->terms WHERE term_id = 0");
- continue;
- }
if ( $category->parent == $parent) {
echo "\t" . _cat_row( $category, $level );
if ( isset($children[$category->term_id]) )
@@ -42,9 +38,10 @@ function _cat_row( $category, $level, $name_override = false ) {
if ( current_user_can( 'manage_categories' ) ) {
$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
$default_cat_id = (int) get_option( 'default_category' );
+ $default_link_cat_id = (int) get_option( 'default_link_category' );
if ( $category->term_id != $default_cat_id )
- $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
+ $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' class='delete:the-list:cat-$category->term_id delete'>".__( 'Delete' )."</a>";
else
$edit .= "<td style='text-align:center'>".__( "Default" );
} else
@@ -111,10 +108,6 @@ function get_nested_categories( $default = 0, $parent = 0 ) {
$result = array ();
if ( is_array( $cats ) ) {
foreach ( $cats as $cat) {
- if ( $cat == 0 ) {
- $wpdb->query("DELETE FROM $wpdb->terms WHERE term_id = 0");
- continue;
- }
$result[$cat]['children'] = get_nested_categories( $default, $cat);
$result[$cat]['cat_ID'] = $cat;
$result[$cat]['checked'] = in_array( $cat, $checked_categories );
@@ -171,6 +164,31 @@ function dropdown_link_categories( $default = 0 ) {
}
}
+// define the columns to display, the syntax is 'internal name' => 'display name'
+function wp_manage_posts_columns() {
+ $posts_columns = array();
+ $posts_columns['id'] = '<div style="text-align: center">' . __('ID') . '</div>';
+ if ( 'draft' === $_GET['post_status'] )
+ $posts_columns['modified'] = __('Modified');
+ elseif ( 'pending' === $_GET['post_status'] )
+ $posts_columns['modified'] = __('Submitted');
+ else
+ $posts_columns['date'] = __('When');
+ $posts_columns['title'] = __('Title');
+ $posts_columns['categories'] = __('Categories');
+ if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
+ $posts_columns['comments'] = '<div style="text-align: center">' . __('Comments') . '</div>';
+ $posts_columns['author'] = __('Author');
+ $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+
+ // you can not edit these at the moment
+ $posts_columns['control_view'] = '';
+ $posts_columns['control_edit'] = '';
+ $posts_columns['control_delete'] = '';
+
+ return $posts_columns;
+}
+
function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
global $wpdb, $class, $post;
@@ -197,9 +215,9 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
</td>
<td><?php the_author() ?></td>
<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?></td>
- <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td>
+ <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td>
<td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td>
- <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&amp;post=$id", 'delete-page_' . $id ) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . js_escape(sprintf( __("You are about to delete the '%s' page.\n'OK' to delete, 'Cancel' to stop." ), get_the_title() ) ) . "' );\">" . __( 'Delete' ) . "</a>"; } ?></td>
+ <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&amp;post=$id", 'delete-page_' . $id ) . "' class='delete:the-list:page-$id delete'>" . __( 'Delete' ) . "</a>"; } ?></td>
</tr>
<?php
@@ -271,38 +289,45 @@ function _wp_get_comment_list( $s = false, $start, $num ) {
function _wp_comment_list_item( $id, $alt = 0 ) {
global $authordata, $comment, $wpdb;
- $id = (int) $id;
$comment =& get_comment( $id );
+ $id = (int) $comment->comment_ID;
$class = '';
$post = get_post($comment->comment_post_ID);
$authordata = get_userdata($post->post_author);
- $comment_status = wp_get_comment_status($comment->comment_ID);
+ $comment_status = wp_get_comment_status($id);
if ( 'unapproved' == $comment_status )
$class .= ' unapproved';
if ( $alt % 2 )
$class .= ' alternate';
- echo "<li id='comment-$comment->comment_ID' class='$class'>";
+ echo "<li id='comment-$id' class='$class'>";
?>
-<p><strong><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
+<p><strong class="comment-author"><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
<?php comment_text() ?>
<p><?php comment_date(__('M j, g:i A')); ?> &#8212; [
<?php
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
- echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
- echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> ';
+ echo " <a href='comment.php?action=editcomment&amp;c=$id'>" . __('Edit') . '</a>';
+ $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) );
+ echo " | <a href='$url' class='delete:the-comment-list:comment-$id'>" . __('Delete') . '</a> ';
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) {
- echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>';
- echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>';
+ $url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$id", "unapprove-comment_$id" ) );
+ echo "<span class='unapprove'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:FF3333'>" . __('Unapprove') . '</a> </span>';
+ $url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$id", "approve-comment_$id" ) );
+ echo "<span class='approve'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:FFFF33:FFFF33'>" . __('Approve') . '</a> </span>';
}
- echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> ";
+ $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) );
+ echo " | <a href='$url' class='delete:the-comment-list:comment-$id::spam=1'>" . __('Spam') . '</a> ';
}
-$post = get_post($comment->comment_post_ID, OBJECT, 'display');
-$post_title = wp_specialchars( $post->post_title, 'double' );
-$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
+if ( !is_single() ) {
+ $post = get_post($comment->comment_post_ID, OBJECT, 'display');
+ $post_title = wp_specialchars( $post->post_title, 'double' );
+ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
?>
- ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p>
+ ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a>
+<?php } ?>
+</p>
</li>
<?php
}
@@ -333,7 +358,7 @@ function list_meta( $meta ) {
global $post_ID;
// Exit if no meta
if (!$meta ) {
- echo '<tbody id="the-list"><tr style="display: none;"><td>&nbsp;</td></tr></tbody>'; //TBODY needed for list-manipulation JS
+ echo '<tbody id="the-list" class="list:meta"><tr style="display: none;"><td>&nbsp;</td></tr></tbody>'; //TBODY needed for list-manipulation JS
return;
}
$count = 0;
@@ -345,43 +370,47 @@ function list_meta( $meta ) {
<th colspan='2'><?php _e( 'Action' ) ?></th>
</tr>
</thead>
+ <tbody id='the-list' class='list:meta'>
<?php
- $r ="\n\t<tbody id='the-list'>";
- foreach ( $meta as $entry ) {
- ++ $count;
- if ( $count % 2 )
- $style = 'alternate';
- else
- $style = '';
- if ('_' == $entry['meta_key'] { 0 } )
- $style .= ' hidden';
-
- if ( is_serialized( $entry['meta_value'] ) ) {
- if ( is_serialized_string( $entry['meta_value'] ) ) {
- // this is a serialized string, so we should display it
- $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
- } else {
- // this is a serialized array/object so we should NOT display it
- --$count;
- continue;
- }
- }
+ foreach ( $meta as $entry )
+ echo _list_meta_row( $entry, $count );
+ echo "\n\t</tbody>";
+}
- $key_js = js_escape( $entry['meta_key'] );
- $entry['meta_key'] = attribute_escape($entry['meta_key']);
- $entry['meta_value'] = attribute_escape($entry['meta_value']);
- $entry['meta_id'] = (int) $entry['meta_id'];
- $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
- $r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
- $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
- $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".attribute_escape(__( 'Update' ))."' /><br />";
- $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick=\"return deleteSomething( 'meta', {$entry['meta_id']}, '";
- $r .= js_escape(sprintf( __("You are about to delete the '%s' custom field on this post.\n'OK' to delete, 'Cancel' to stop." ), $key_js ) );
- $r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' /></td>";
- $r .= "\n\t</tr>";
+function _list_meta_row( $entry, &$count ) {
+ $r = '';
+ ++ $count;
+ if ( $count % 2 )
+ $style = 'alternate';
+ else
+ $style = '';
+ if ('_' == $entry['meta_key'] { 0 } )
+ $style .= ' hidden';
+
+ if ( is_serialized( $entry['meta_value'] ) ) {
+ if ( is_serialized_string( $entry['meta_value'] ) ) {
+ // this is a serialized string, so we should display it
+ $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
+ } else {
+ // this is a serialized array/object so we should NOT display it
+ --$count;
+ return;
+ }
}
- echo $r;
- echo "\n\t</tbody>";
+
+ $key_js = js_escape( $entry['meta_key'] );
+ $entry['meta_key'] = attribute_escape($entry['meta_key']);
+ $entry['meta_value'] = attribute_escape($entry['meta_value']);
+ $entry['meta_id'] = (int) $entry['meta_id'];
+ $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
+ $r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
+ $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
+ $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']} updatemeta' /><br />";
+ $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
+ $r .= "class='delete:the-list:meta-{$entry['meta_id']} deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />";
+ $r .= "<input type='hidden' name='_ajax_nonce' value='$nonce' />";
+ $r .= "</td>\n\t</tr>";
+ return $r;
}
function meta_form() {
@@ -422,8 +451,11 @@ function meta_form() {
<td><textarea id="metavalue" name="metavalue" rows="3" cols="25" tabindex="8"></textarea></td>
</tr>
+<tr class="submit"><td colspan="3">
+ <?php wp_nonce_field( 'change_meta', '_ajax_nonce', false ); ?>
+ <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field &raquo;' ) ?>" />
+</td></tr>
</table>
-<p class="submit"><input type="submit" id="updatemetasub" name="updatemeta" tabindex="9" value="<?php _e( 'Add Custom Field &raquo;' ) ?>" /></p>
<?php
}
diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php
index 71e6399..b30daef 100644
--- a/wp-admin/includes/upgrade.php
+++ b/wp-admin/includes/upgrade.php
@@ -541,6 +541,7 @@ function upgrade_230() {
// Convert categories to terms.
$tt_ids = array();
+ $have_tags = false;
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID");
foreach ($categories as $category) {
$term_id = (int) $category->cat_ID;
@@ -587,6 +588,7 @@ function upgrade_230() {
}
if ( !empty($category->tag_count) ) {
+ $have_tags = true;
$count = (int) $category->tag_count;
$taxonomy = 'post_tag';
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
@@ -601,7 +603,11 @@ function upgrade_230() {
}
}
- $posts = $wpdb->get_results("SELECT * FROM $wpdb->post2cat");
+ $select = 'post_id, category_id';
+ if ( $have_tags )
+ $select .= ', rel_type';
+
+ $posts = $wpdb->get_results("SELECT $select FROM $wpdb->post2cat GROUP BY post_id, category_id");
foreach ( $posts as $post ) {
$post_id = (int) $post->post_id;
$term_id = (int) $post->category_id;
@@ -666,7 +672,7 @@ function upgrade_230() {
// Set default to the last category we grabbed during the upgrade loop.
update_option('default_link_category', $default_link_cat);
} else {
- $links = $wpdb->get_results("SELECT * FROM $wpdb->link2cat");
+ $links = $wpdb->get_results("SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id");
foreach ( $links as $link ) {
$link_id = (int) $link->link_id;
$term_id = (int) $link->category_id;
@@ -1010,7 +1016,6 @@ function dbDelta($queries, $execute = true) {
}
// Add the column list to the index create string
$index_string .= ' ('.$index_columns.')';
- error_log("Index string: $index_string", 0);
if(!(($aindex = array_search($index_string, $indices)) === false)) {
unset($indices[$aindex]);
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
@@ -1248,12 +1253,10 @@ function translate_level_to_role($level) {
}
function wp_check_mysql_version() {
- global $wp_version;
-
- // Make sure the server has MySQL 4.0
- $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
- if ( version_compare($mysql_version, '4.0.0', '<') )
- die(sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
+ global $wpdb;
+ $result = $wpdb->check_database_version();
+ if ( is_wp_error( $result ) )
+ die( $result->get_error_message() );
}
function maybe_disable_automattic_widgets() {
diff --git a/wp-admin/includes/upload.php b/wp-admin/includes/upload.php
index 61b0302..c66feeb 100644
--- a/wp-admin/includes/upload.php
+++ b/wp-admin/includes/upload.php
@@ -31,6 +31,9 @@ function wp_upload_display( $dims = false, $href = '' ) {
$src = wp_make_link_relative( $src_base );
$src_base = str_replace($src, '', $src_base);
+ if ( !trim($post_title) )
+ $post_title = basename($src);
+
$r = '';
if ( $href )
@@ -39,7 +42,9 @@ function wp_upload_display( $dims = false, $href = '' ) {
$r .= "\t\t\t$innerHTML";
if ( $href )
$r .= "</a>\n";
- $r .= "\t\t\t\t<span class='upload-file-size'>".size_format(filesize($filesystem_path))."</span>\n";
+ $size = @filesize($filesystem_path);
+ if ( !empty($size) )
+ $r .= "\t\t\t\t<span class='upload-file-size'>".size_format($size)."</span>\n";
$r .= "\n\t\t<div class='upload-file-data'>\n\t\t\t<p>\n";
$r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='$src' />\n";
$r .= "\t\t\t\t<input type='hidden' name='attachment-url-base-$id' id='attachment-url-base-$id' value='$src_base' />\n";
diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index ca15057..bd017a4 100644
--- a/wp-admin/includes/user.php
+++ b/wp-admin/includes/user.php
@@ -87,7 +87,7 @@ function edit_user( $user_id = 0 ) {
$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password twice.' ));
} else {
if ((empty ( $pass1 ) && !empty ( $pass2 ) ) || (empty ( $pass2 ) && !empty ( $pass1 ) ) )
- $errors->add( 'pass', __( "<strong>ERROR</strong>: you typed your new password only once." ));
+ $errors->add( 'pass', __( '<strong>ERROR</strong>: You entered your new password only once.' ));
}
/* Check for "\" in password */
@@ -96,23 +96,23 @@ function edit_user( $user_id = 0 ) {
/* checking the password has been typed twice the same */
if ( $pass1 != $pass2 )
- $errors->add( 'pass', __( '<strong>ERROR</strong>: Please type the same password in the two password fields.' ));
+ $errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in the two password fields.' ));
if (!empty ( $pass1 ))
$user->user_pass = $pass1;
if ( !$update && !validate_username( $user->user_login ) )
- $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' ));
+ $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid. Please enter a valid username.' ));
if (!$update && username_exists( $user->user_login ))
- $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered, please choose another one.' ));
+ $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ));
/* checking e-mail address */
if ( empty ( $user->user_email ) ) {
- $errors->add( 'user_email', __( "<strong>ERROR</strong>: please type an e-mail address" ));
+ $errors->add( 'user_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ));
} else
if (!is_email( $user->user_email ) ) {
- $errors->add( 'user_email', __( "<strong>ERROR</strong>: the email address isn't correct" ));
+ $errors->add( 'user_email', __( "<strong>ERROR</strong>: The e-mail address isn't correct." ));
}
if ( $errors->get_error_codes() )