From 346f859e126e477b6a45f9f1f91fcd52c852cc86 Mon Sep 17 00:00:00 2001 From: wpmuguru Date: Tue, 12 Jan 2010 21:11:52 +0000 Subject: [PATCH] merge multisite admin - edit links,tags,cats,options, See #11644 git-svn-id: http://svn.automattic.com/wordpress/trunk@12712 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin.php | 30 ++++++++++++++++++++++++---- wp-admin/categories.php | 4 ++-- wp-admin/edit-category-form.php | 2 ++ wp-admin/edit-link-categories.php | 4 ++-- wp-admin/edit-link-category-form.php | 2 ++ wp-admin/edit-tag-form.php | 2 ++ wp-admin/edit-tags.php | 4 ++-- wp-admin/menu-header.php | 2 ++ wp-admin/options-discussion.php | 1 + wp-admin/options-general.php | 28 ++++++++++++++++++++++++++ wp-admin/options-misc.php | 4 ++-- wp-admin/options-permalink.php | 16 +++++++++++++-- wp-admin/options-writing.php | 5 ++++- wp-admin/options.php | 26 ++++++++++++++++++++++++ 14 files changed, 115 insertions(+), 15 deletions(-) diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 24e9efc3a..fa6bf2081 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -27,8 +27,23 @@ if ( get_option('db_upgraded') ) { */ do_action('after_db_upgrade'); } elseif ( get_option('db_version') != $wp_db_version ) { - wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])))); - exit; + if ( !is_multisite() ) { + wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])))); + exit; + } elseif ( apply_filters( 'do_mu_upgrade', true ) ) { + /** + * On really small MU installs run the upgrader every time, + * else run it less often to reduce load. + * + * @since 2.8.4b + */ + $c = get_blog_count(); + if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) { + require_once( ABSPATH . WPINC . '/http.php' ); + $response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) ); + do_action( 'after_mu_upgrade', $response ); + } + } } require_once(ABSPATH . 'wp-admin/includes/admin.php'); @@ -45,6 +60,7 @@ if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') ) set_screen_options(); +$posts_per_page = get_option('posts_per_page'); $date_format = get_option('date_format'); $time_format = get_option('time_format'); @@ -94,7 +110,7 @@ if (isset($plugin_page)) { wp_die(__('Invalid plugin page')); } - if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) ) + if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) ) wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); do_action('load-' . $plugin_page); @@ -102,7 +118,10 @@ if (isset($plugin_page)) { if (! isset($_GET['noheader'])) require_once(ABSPATH . 'wp-admin/admin-header.php'); - include(WP_PLUGIN_DIR . "/$plugin_page"); + if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) + include(WPMU_PLUGIN_DIR . "/$plugin_page"); + else + include(ABSPATH . PLUGINDIR . "/$plugin_page"); } include(ABSPATH . 'wp-admin/admin-footer.php'); @@ -139,6 +158,9 @@ if (isset($plugin_page)) { require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); define('WP_IMPORTING', true); + if ( is_multisite() ) { + kses_init_filters(); // Always filter imported data with kses. + } call_user_func($wp_importers[$importer][2]); diff --git a/wp-admin/categories.php b/wp-admin/categories.php index b6c6c1ff2..70fe62400 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -297,13 +297,13 @@ if ( $page_links )

- +

- +
0, 'hide_if_empty' => false, 'taxonomy' => $taxonomy, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?> diff --git a/wp-admin/edit-category-form.php b/wp-admin/edit-category-form.php index a37f82e47..09f904a52 100644 --- a/wp-admin/edit-category-form.php +++ b/wp-admin/edit-category-form.php @@ -58,11 +58,13 @@ _fill_empty_category($category); +
+ diff --git a/wp-admin/edit-link-categories.php b/wp-admin/edit-link-categories.php index 98acca864..5f9852436 100644 --- a/wp-admin/edit-link-categories.php +++ b/wp-admin/edit-link-categories.php @@ -200,13 +200,13 @@ if ( $page_links )
- +

- +
diff --git a/wp-admin/edit-link-category-form.php b/wp-admin/edit-link-category-form.php index 17db6ef6b..5495b5e7e 100644 --- a/wp-admin/edit-link-category-form.php +++ b/wp-admin/edit-link-category-form.php @@ -72,11 +72,13 @@ _fill_empty_link_category($category); +
+
diff --git a/wp-admin/edit-tag-form.php b/wp-admin/edit-tag-form.php index da8a3947c..5492200d0 100644 --- a/wp-admin/edit-tag-form.php +++ b/wp-admin/edit-tag-form.php @@ -35,11 +35,13 @@ do_action('edit_tag_form_pre', $tag); ?> +

+
diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 1e89e1b14..92465c4f8 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -300,13 +300,13 @@ else

- +

- +
diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index f7379e6af..d6f72cc96 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -15,8 +15,10 @@ */ $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']); $self = preg_replace('|^.*/plugins/|i', '', $self); +$self = preg_replace('|^.*/mu-plugins/|i', '', $self); global $menu, $submenu, $parent_file; //For when admin-header is included from within a function. +$parent_file = apply_filters("parent_file", $parent_file); // For plugins to move submenu tabs around. get_admin_page_parent(); diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php index 8093d1593..77ee6b67f 100644 --- a/wp-admin/options-discussion.php +++ b/wp-admin/options-discussion.php @@ -52,6 +52,7 @@ include('admin-header.php');
diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index c6e473477..db3ab315b 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -70,6 +70,7 @@ include('./admin-header.php'); + " /> @@ -97,6 +98,13 @@ include('./admin-header.php'); + + + + + The new address will not become active until confirmed.') ?> + + + + + + + + + + diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index 73575a4e8..8dcdd4e48 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.php @@ -25,7 +25,7 @@ include('admin-header.php');
- +

@@ -65,7 +65,7 @@ include('admin-header.php');
- +

diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index c86743649..9583f6a29 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -82,6 +82,9 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { $permalink_structure = $_POST['permalink_structure']; if (! empty($permalink_structure) ) $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']); + if ( is_multisite() && !is_subdomain_install() && $permalink_structure != '' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { + $permalink_structure = '/blog' . $permalink_structure; + } $wp_rewrite->set_permalink_structure($permalink_structure); } @@ -89,6 +92,9 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { $category_base = $_POST['category_base']; if (! empty($category_base) ) $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']); + if ( is_miltisite() && !is_subdomain_install() && $category_base != '' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { + $category_base = '/blog' . $category_base; + } $wp_rewrite->set_category_base($category_base); } @@ -96,6 +102,9 @@ if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { $tag_base = $_POST['tag_base']; if (! empty($tag_base) ) $tag_base = preg_replace('#/+#', '/', '/' . $_POST['tag_base']); + if ( is_multisite() && !is_subdomain_install() && $tag_base != '' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { + $tag_base = '/blog' . $tag_base; + } $wp_rewrite->set_tag_base($tag_base); } } @@ -194,6 +203,7 @@ $structures = array( + domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $permalink_structure = str_replace( "/blog", "", $permalink_structure ); }?> @@ -209,11 +219,11 @@ $structures = array( - + - +
domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $category_base = str_replace( "/blog", "", $category_base ); }?>
domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $tag_base = str_replace( "/blog", "", $tag_base ); }?>
@@ -224,6 +234,7 @@ $structures = array(

+ @@ -251,6 +262,7 @@ $structures = array( +
diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index a8979f4e1..88567e4fb 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -81,6 +81,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category +

%s, %s, %s.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?>

@@ -112,7 +113,8 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor - + +

@@ -126,6 +128,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_categor

Update Services because of your blog’s privacy settings.'), 'options-privacy.php'); ?>

+ diff --git a/wp-admin/options.php b/wp-admin/options.php index 11d6ee058..01f3b6f3d 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -38,6 +38,20 @@ $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); if ( !current_user_can('manage_options') ) wp_die(__('Cheatin’ uh?')); +if ( is_multisite() && is_super_admin() && $_GET[ 'adminhash' ] ) { + $new_admin_details = get_option( 'adminhash' ); + if( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && $new_admin_details[ 'newemail' ] != '' ) { + update_option( "admin_email", $new_admin_details[ 'newemail' ] ); + delete_option( "adminhash" ); + delete_option( "new_admin_email" ); + wp_redirect( get_option( "siteurl" ) . "/wp-admin/options-general.php?updated=true" ); + exit; + } else { + wp_redirect( get_option( "siteurl" ) . "/wp-admin/options-general.php?updated=false" ); + exit; + } +} + switch($action) { case 'update': @@ -55,6 +69,8 @@ case 'update': if ( 'options' == $option_page ) { $options = explode(',', stripslashes( $_POST[ 'page_options' ] )); + if ( !is_super_admin() ) + wp_die( __( 'Not allowed here' ) ); } else { $options = $whitelist_options[ $option_page ]; } @@ -90,6 +106,9 @@ case 'update': break; default: + if ( !is_super_admin() ) + wp_die( __( 'Not admin' ) ); + include('admin-header.php'); ?>
@@ -99,6 +118,11 @@ default: + +

+ +

+ get_results("SELECT * FROM $wpdb->options ORDER BY option_name"); @@ -106,6 +130,8 @@ $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name foreach ( (array) $options as $option) : $disabled = ''; $option->option_name = esc_attr($option->option_name); + if( $option->option_name == '' ) + continue; if ( is_serialized($option->option_value) ) { if ( is_serialized_string($option->option_value) ) { // this is a serialized string, so we should display it