X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/699231ae09f7057a4d0000cdf32e50a3df6a04ca..refs/tags/wordpress-3.5.2:/wp-admin/admin.php?page=%7B%24submenu_items%5B0%5D%5B2%5D%7D diff --git a/wp-admin/admin.php b/wp-admin/admin.php index a759d452..bd2e5406 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -7,20 +7,32 @@ */ /** - * In WordPress Administration Panels + * In WordPress Administration Screens * - * @since unknown + * @since 2.3.2 */ -if ( !defined('WP_ADMIN') ) - define('WP_ADMIN', TRUE); +if ( ! defined('WP_ADMIN') ) + define('WP_ADMIN', true); + +if ( ! defined('WP_NETWORK_ADMIN') ) + define('WP_NETWORK_ADMIN', false); + +if ( ! defined('WP_USER_ADMIN') ) + define('WP_USER_ADMIN', false); + +if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) { + define('WP_BLOG_ADMIN', true); +} if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') ) define('WP_LOAD_IMPORTERS', true); require_once(dirname(dirname(__FILE__)) . '/wp-load.php'); +nocache_headers(); + if ( get_option('db_upgraded') ) { - $wp_rewrite->flush_rules(); + flush_rewrite_rules(); update_option( 'db_upgraded', false ); /** @@ -29,7 +41,7 @@ if ( get_option('db_upgraded') ) { * @since 2.8 */ do_action('after_db_upgrade'); -} elseif ( get_option('db_version') != $wp_db_version ) { +} elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) { if ( !is_multisite() ) { wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])))); exit; @@ -41,6 +53,7 @@ if ( get_option('db_upgraded') ) { * @since 2.8.4b */ $c = get_blog_count(); + // If 50 or fewer sites, run every time. Else, run "about ten percent" of the time. Shh, don't check that math. 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' ) ); @@ -55,10 +68,6 @@ require_once(ABSPATH . 'wp-admin/includes/admin.php'); auth_redirect(); -nocache_headers(); - -update_category_cache(); - // Schedule trash collection if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') ) wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); @@ -71,7 +80,6 @@ $time_format = get_option('time_format'); wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'text', 'trackback', 'pingback')); wp_enqueue_script( 'common' ); -wp_enqueue_script( 'jquery-color' ); $editing = false; @@ -80,20 +88,25 @@ if ( isset($_GET['page']) ) { $plugin_page = plugin_basename($plugin_page); } -if ( isset($_GET['post_type']) ) - $typenow = sanitize_key($_GET['post_type']); +if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) + $typenow = $_REQUEST['post_type']; else $typenow = ''; -if ( isset($_GET['taxonomy']) ) - $taxnow = sanitize_key($_GET['taxonomy']); +if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) + $taxnow = $_REQUEST['taxonomy']; else $taxnow = ''; -require(ABSPATH . 'wp-admin/menu.php'); +if ( WP_NETWORK_ADMIN ) + require(ABSPATH . 'wp-admin/network/menu.php'); +elseif ( WP_USER_ADMIN ) + require(ABSPATH . 'wp-admin/user/menu.php'); +else + require(ABSPATH . 'wp-admin/menu.php'); if ( current_user_can( 'manage_options' ) ) - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) ); + @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); do_action('admin_init'); @@ -111,7 +124,7 @@ if ( isset($plugin_page) ) { $query_string = $_SERVER[ 'QUERY_STRING' ]; else $query_string = 'page=' . $plugin_page; - wp_redirect( 'tools.php?' . $query_string ); + wp_redirect( admin_url('tools.php?' . $query_string) ); exit; } } @@ -140,7 +153,6 @@ if ( isset($plugin_page) ) { if ( validate_file($plugin_page) ) wp_die(__('Invalid 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))); @@ -152,7 +164,7 @@ if ( isset($plugin_page) ) { if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) include(WPMU_PLUGIN_DIR . "/$plugin_page"); else - include(ABSPATH . PLUGINDIR . "/$plugin_page"); + include(WP_PLUGIN_DIR . "/$plugin_page"); } include(ABSPATH . 'wp-admin/admin-footer.php'); @@ -165,16 +177,18 @@ if ( isset($plugin_page) ) { if ( ! current_user_can('import') ) wp_die(__('You are not allowed to import.')); - if ( validate_file($importer) ) + if ( validate_file($importer) ) { wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); + exit; + } - // Allow plugins to define importers as well - if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) { - if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) - wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); - include(ABSPATH . "wp-admin/import/$importer.php"); + if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) { + wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); + exit; } + do_action( 'load-importer-' . $importer ); + $parent_file = 'tools.php'; $submenu_file = 'import.php'; $title = __('Import'); @@ -186,23 +200,33 @@ if ( isset($plugin_page) ) { define('WP_IMPORTING', true); - if ( is_multisite() ) - kses_init_filters(); // Always filter imported data with kses. + if ( apply_filters( 'force_filtered_html_on_import', false ) ) + kses_init_filters(); // Always filter imported data with kses on multisite. call_user_func($wp_importers[$importer][2]); include(ABSPATH . 'wp-admin/admin-footer.php'); // Make sure rules are flushed - global $wp_rewrite; - $wp_rewrite->flush_rules(false); + flush_rewrite_rules(false); exit(); } else { do_action("load-$pagenow"); + // Backwards compatibility with old load-page-new.php, load-page.php, + // and load-categories.php actions. + if ( $typenow == 'page' ) { + if ( $pagenow == 'post-new.php' ) + do_action( 'load-page-new.php' ); + elseif ( $pagenow == 'post.php' ) + do_action( 'load-page.php' ); + } elseif ( $pagenow == 'edit-tags.php' ) { + if ( $taxnow == 'category' ) + do_action( 'load-categories.php' ); + elseif ( $taxnow == 'link_category' ) + do_action( 'load-edit-link-categories.php' ); + } } if ( !empty($_REQUEST['action']) ) do_action('admin_action_' . $_REQUEST['action']); - -?>