raw
mp-wp_genesis           1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * WordPress Administration Bootstrap
mp-wp_genesis 4 *
mp-wp_genesis 5 * @package WordPress
mp-wp_genesis 6 * @subpackage Administration
mp-wp_genesis 7 */
mp-wp_genesis 8
mp-wp_genesis 9 /**
mp-wp_genesis 10 * In WordPress Administration Panels
mp-wp_genesis 11 *
mp-wp_genesis 12 * @since unknown
mp-wp_genesis 13 */
mp-wp_genesis 14 define('WP_ADMIN', TRUE);
mp-wp_genesis 15
mp-wp_genesis 16 if ( defined('ABSPATH') )
mp-wp_genesis 17 require_once(ABSPATH . 'wp-load.php');
mp-wp_genesis 18 else
mp-wp_genesis 19 require_once('../wp-load.php');
mp-wp_genesis 20
mp-wp_genesis 21 if ( get_option('db_version') != $wp_db_version ) {
mp-wp_genesis 22 wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
mp-wp_genesis 23 exit;
mp-wp_genesis 24 }
mp-wp_genesis 25
mp-wp_genesis 26 require_once(ABSPATH . 'wp-admin/includes/admin.php');
mp-wp_genesis 27
mp-wp_genesis 28 auth_redirect();
mp-wp_genesis 29
mp-wp_genesis 30 nocache_headers();
mp-wp_genesis 31
mp-wp_genesis 32 update_category_cache();
mp-wp_genesis 33
mp-wp_genesis 34 $posts_per_page = get_option('posts_per_page');
mp-wp_genesis 35 $what_to_show = get_option('what_to_show');
mp-wp_genesis 36 $date_format = get_option('date_format');
mp-wp_genesis 37 $time_format = get_option('time_format');
mp-wp_genesis 38
mp-wp_genesis 39 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
mp-wp_genesis 40
mp-wp_genesis 41 $editing = false;
mp-wp_genesis 42
mp-wp_genesis 43 if (isset($_GET['page'])) {
mp-wp_genesis 44 $plugin_page = stripslashes($_GET['page']);
mp-wp_genesis 45 $plugin_page = plugin_basename($plugin_page);
mp-wp_genesis 46 }
mp-wp_genesis 47
mp-wp_genesis 48 require(ABSPATH . 'wp-admin/menu.php');
mp-wp_genesis 49
mp-wp_genesis 50 do_action('admin_init');
mp-wp_genesis 51
mp-wp_genesis 52 // Handle plugin admin pages.
mp-wp_genesis 53 if (isset($plugin_page)) {
mp-wp_genesis 54 if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) {
mp-wp_genesis 55 $page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
mp-wp_genesis 56 // backwards compatibility for plugins using add_management_page
mp-wp_genesis 57 if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) {
mp-wp_genesis 58 wp_redirect('tools.php?page=' . $plugin_page);
mp-wp_genesis 59 exit;
mp-wp_genesis 60 }
mp-wp_genesis 61 }
mp-wp_genesis 62
mp-wp_genesis 63 if ( $page_hook ) {
mp-wp_genesis 64 do_action('load-' . $page_hook);
mp-wp_genesis 65 if (! isset($_GET['noheader']))
mp-wp_genesis 66 require_once(ABSPATH . 'wp-admin/admin-header.php');
mp-wp_genesis 67
mp-wp_genesis 68 do_action($page_hook);
mp-wp_genesis 69 } else {
mp-wp_genesis 70 if ( validate_file($plugin_page) ) {
mp-wp_genesis 71 wp_die(__('Invalid plugin page'));
mp-wp_genesis 72 }
mp-wp_genesis 73
mp-wp_genesis 74 if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
mp-wp_genesis 75 wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
mp-wp_genesis 76
mp-wp_genesis 77 do_action('load-' . $plugin_page);
mp-wp_genesis 78
mp-wp_genesis 79 if (! isset($_GET['noheader']))
mp-wp_genesis 80 require_once(ABSPATH . 'wp-admin/admin-header.php');
mp-wp_genesis 81
mp-wp_genesis 82 include(WP_PLUGIN_DIR . "/$plugin_page");
mp-wp_genesis 83 }
mp-wp_genesis 84
mp-wp_genesis 85 include(ABSPATH . 'wp-admin/admin-footer.php');
mp-wp_genesis 86
mp-wp_genesis 87 exit();
mp-wp_genesis 88 } else if (isset($_GET['import'])) {
mp-wp_genesis 89
mp-wp_genesis 90 $importer = $_GET['import'];
mp-wp_genesis 91
mp-wp_genesis 92 if ( ! current_user_can('import') )
mp-wp_genesis 93 wp_die(__('You are not allowed to import.'));
mp-wp_genesis 94
mp-wp_genesis 95 if ( validate_file($importer) ) {
mp-wp_genesis 96 wp_die(__('Invalid importer.'));
mp-wp_genesis 97 }
mp-wp_genesis 98
mp-wp_genesis 99 // Allow plugins to define importers as well
mp-wp_genesis 100 if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]))
mp-wp_genesis 101 {
mp-wp_genesis 102 if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
mp-wp_genesis 103 {
mp-wp_genesis 104 wp_die(__('Cannot load importer.'));
mp-wp_genesis 105 }
mp-wp_genesis 106 include(ABSPATH . "wp-admin/import/$importer.php");
mp-wp_genesis 107 }
mp-wp_genesis 108
mp-wp_genesis 109 $parent_file = 'tools.php';
mp-wp_genesis 110 $submenu_file = 'import.php';
mp-wp_genesis 111 $title = __('Import');
mp-wp_genesis 112
mp-wp_genesis 113 if (! isset($_GET['noheader']))
mp-wp_genesis 114 require_once(ABSPATH . 'wp-admin/admin-header.php');
mp-wp_genesis 115
mp-wp_genesis 116 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
mp-wp_genesis 117
mp-wp_genesis 118 define('WP_IMPORTING', true);
mp-wp_genesis 119
mp-wp_genesis 120 call_user_func($wp_importers[$importer][2]);
mp-wp_genesis 121
mp-wp_genesis 122 include(ABSPATH . 'wp-admin/admin-footer.php');
mp-wp_genesis 123
mp-wp_genesis 124 // Make sure rules are flushed
mp-wp_genesis 125 global $wp_rewrite;
mp-wp_genesis 126 $wp_rewrite->flush_rules();
mp-wp_genesis 127
mp-wp_genesis 128 exit();
mp-wp_genesis 129 } else {
mp-wp_genesis 130 do_action("load-$pagenow");
mp-wp_genesis 131 }
mp-wp_genesis 132
mp-wp_genesis 133 if ( !empty($_REQUEST['action']) )
mp-wp_genesis 134 do_action('admin_action_' . $_REQUEST['action']);
mp-wp_genesis 135
mp-wp_genesis 136 ?>