From d85d717aedbc7690e2a450e40dab8fcebd94b38c Mon Sep 17 00:00:00 2001
From: donncha
Date: Tue, 30 Oct 2007 16:49:38 +0000
Subject: Merge with WordPress 2.3.1
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1139 7be80a69-a1ef-0310-a953-fb0f7c49ff36
---
wp-admin/includes/plugin.php | 42 ------------
wp-admin/includes/post.php | 47 --------------
wp-admin/includes/schema.php | 12 ++--
wp-admin/includes/template.php | 143 +++++++++++++++--------------------------
wp-admin/includes/upgrade.php | 10 +--
wp-admin/includes/user.php | 12 ++--
6 files changed, 70 insertions(+), 196 deletions(-)
(limited to 'wp-admin/includes')
diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php
index 3c4f474..e5911bd 100644
--- a/wp-admin/includes/plugin.php
+++ b/wp-admin/includes/plugin.php
@@ -86,48 +86,6 @@ 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 3c9cc77..acd6e64 100644
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -348,8 +348,6 @@ 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 )
@@ -364,9 +362,6 @@ 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'" );
}
@@ -413,9 +408,6 @@ 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;
@@ -476,43 +468,4 @@ function _relocate_children( $old_ID, $new_ID ) {
return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
}
-function wp_edit_posts_query( $q = false ) {
- global $wpdb;
- if ( false === $q )
- $q = $_GET;
- $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 d76d5f7..de4e949 100644
--- a/wp-admin/includes/schema.php
+++ b/wp-admin/includes/schema.php
@@ -4,7 +4,7 @@
global $wp_queries;
$charset_collate = '';
-if ( $wpdb->supports_collation() ) {
+if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
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', _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_role('administrator', __('Administrator'));
+ add_role('editor', __('Editor'));
+ add_role('author', __('Author'));
+ add_role('contributor', __('Contributor'));
+ add_role('subscriber', __('Subscriber'));
// Add caps for Administrator role
$role = get_role('administrator');
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index c604d4c..ff809ec 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -41,7 +41,7 @@ function _cat_row( $category, $level, $name_override = false ) {
$default_link_cat_id = (int) get_option( 'default_link_category' );
if ( $category->term_id != $default_cat_id )
- $edit .= "| term_id ) . "' class='delete:the-list:cat-$category->term_id delete'>".__( 'Delete' )."";
+ $edit .= " | 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' )."";
else
$edit .= " | ".__( "Default" );
} else
@@ -164,31 +164,6 @@ 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'] = ' ' . __('ID') . ' ';
- 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'] = '' . __('Comments') . ' ';
- $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;
@@ -215,9 +190,9 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) {
|
|
post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?> |
- |
+ |
" . __( 'Edit' ) . ""; } ?> |
- " . __( 'Delete' ) . ""; } ?> |
+ " . __( 'Delete' ) . ""; } ?> |
comment_ID;
$class = '';
$post = get_post($comment->comment_post_ID);
$authordata = get_userdata($post->post_author);
- $comment_status = wp_get_comment_status($id);
+ $comment_status = wp_get_comment_status($comment->comment_ID);
if ( 'unapproved' == $comment_status )
$class .= ' unapproved';
if ( $alt % 2 )
$class .= ' alternate';
- echo "
| |
'; //TBODY needed for list-manipulation JS
+ echo '| |
'; //TBODY needed for list-manipulation JS
return;
}
$count = 0;
@@ -370,47 +338,43 @@ function list_meta( $meta ) {
|
-
";
-}
-
-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;
+ $r ="\n\t";
+ 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;
+ }
}
- }
- $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";
- $r .= "\n\t\t | ";
- $r .= "\n\t\t | ";
- $r .= "\n\t\t ";
- $r .= "\n\t\t";
- $r .= "";
- $r .= " | \n\t
";
- return $r;
+ $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";
+ $r .= "\n\t\t | ";
+ $r .= "\n\t\t | ";
+ $r .= "\n\t\t ";
+ $r .= "\n\t\t | ";
+ $r .= "\n\t
";
+ }
+ echo $r;
+ echo "\n\t";
}
function meta_form() {
@@ -451,11 +415,8 @@ function meta_form() {
|
-|
-
-
- |
+
check_database_version();
- if ( is_wp_error( $result ) )
- die( $result->get_error_message() );
+ 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(__('ERROR: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
}
function maybe_disable_automattic_widgets() {
diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index bd017a4..ca15057 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', __( 'ERROR: Please enter your password twice.' ));
} else {
if ((empty ( $pass1 ) && !empty ( $pass2 ) ) || (empty ( $pass2 ) && !empty ( $pass1 ) ) )
- $errors->add( 'pass', __( 'ERROR: You entered your new password only once.' ));
+ $errors->add( 'pass', __( "ERROR: you typed 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', __( 'ERROR: Please enter the same password in the two password fields.' ));
+ $errors->add( 'pass', __( 'ERROR: Please type 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', __( 'ERROR: This username is invalid. Please enter a valid username.' ));
+ $errors->add( 'user_login', __( 'ERROR: This username is invalid. Please enter a valid username.' ));
if (!$update && username_exists( $user->user_login ))
- $errors->add( 'user_login', __( 'ERROR: This username is already registered. Please choose another one.' ));
+ $errors->add( 'user_login', __( 'ERROR: This username is already registered, please choose another one.' ));
/* checking e-mail address */
if ( empty ( $user->user_email ) ) {
- $errors->add( 'user_email', __( 'ERROR: Please enter an e-mail address.' ));
+ $errors->add( 'user_email', __( "ERROR: please type an e-mail address" ));
} else
if (!is_email( $user->user_email ) ) {
- $errors->add( 'user_email', __( "ERROR: The e-mail address isn't correct." ));
+ $errors->add( 'user_email', __( "ERROR: the email address isn't correct" ));
}
if ( $errors->get_error_codes() )
--
cgit