136
|
1 |
<?php |
|
2 |
/** |
|
3 |
* WordPress Administration Bootstrap |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
|
|
9 |
/** |
|
10 |
* In WordPress Administration Panels |
|
11 |
* |
|
12 |
* @since unknown |
|
13 |
*/ |
|
14 |
if ( !defined('WP_ADMIN') ) |
|
15 |
define('WP_ADMIN', TRUE); |
|
16 |
|
|
17 |
if ( defined('ABSPATH') ) |
|
18 |
require_once(ABSPATH . 'wp-load.php'); |
|
19 |
else |
|
20 |
require_once('../wp-load.php'); |
|
21 |
|
|
22 |
if ( get_option('db_upgraded') ) { |
|
23 |
$wp_rewrite->flush_rules(); |
|
24 |
update_option( 'db_upgraded', false ); |
|
25 |
|
|
26 |
/** |
|
27 |
* Runs on the next page load after successful upgrade |
|
28 |
* |
|
29 |
* @since 2.8 |
|
30 |
*/ |
|
31 |
do_action('after_db_upgrade'); |
|
32 |
} elseif ( get_option('db_version') != $wp_db_version ) { |
|
33 |
wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])))); |
|
34 |
exit; |
|
35 |
} |
|
36 |
|
|
37 |
require_once(ABSPATH . 'wp-admin/includes/admin.php'); |
|
38 |
|
|
39 |
auth_redirect(); |
|
40 |
|
|
41 |
nocache_headers(); |
|
42 |
|
|
43 |
update_category_cache(); |
|
44 |
|
|
45 |
// Schedule trash collection |
|
46 |
if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') ) |
|
47 |
wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); |
|
48 |
|
|
49 |
set_screen_options(); |
|
50 |
|
|
51 |
$posts_per_page = get_option('posts_per_page'); |
|
52 |
$date_format = get_option('date_format'); |
|
53 |
$time_format = get_option('time_format'); |
|
54 |
|
|
55 |
wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'text', 'trackback', 'pingback')); |
|
56 |
|
|
57 |
wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7')); |
|
58 |
wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF')); |
|
59 |
|
|
60 |
wp_enqueue_script( 'common' ); |
|
61 |
wp_enqueue_script( 'jquery-color' ); |
|
62 |
|
|
63 |
$editing = false; |
|
64 |
|
|
65 |
if (isset($_GET['page'])) { |
|
66 |
$plugin_page = stripslashes($_GET['page']); |
|
67 |
$plugin_page = plugin_basename($plugin_page); |
|
68 |
} |
|
69 |
|
|
70 |
require(ABSPATH . 'wp-admin/menu.php'); |
|
71 |
|
|
72 |
do_action('admin_init'); |
|
73 |
|
|
74 |
// Handle plugin admin pages. |
|
75 |
if (isset($plugin_page)) { |
|
76 |
if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) { |
|
77 |
$page_hook = get_plugin_page_hook($plugin_page, $plugin_page); |
|
78 |
// backwards compatibility for plugins using add_management_page |
|
79 |
if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) { |
|
80 |
// There could be plugin specific params on the URL, so we need the whole query string |
|
81 |
if ( !empty($_SERVER[ 'QUERY_STRING' ]) ) |
|
82 |
$query_string = $_SERVER[ 'QUERY_STRING' ]; |
|
83 |
else |
|
84 |
$query_string = 'page=' . $plugin_page; |
|
85 |
wp_redirect( 'tools.php?' . $query_string ); |
|
86 |
exit; |
|
87 |
} |
|
88 |
} |
|
89 |
|
|
90 |
if ( $page_hook ) { |
|
91 |
do_action('load-' . $page_hook); |
|
92 |
if (! isset($_GET['noheader'])) |
|
93 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
94 |
|
|
95 |
do_action($page_hook); |
|
96 |
} else { |
|
97 |
if ( validate_file($plugin_page) ) { |
|
98 |
wp_die(__('Invalid plugin page')); |
|
99 |
} |
|
100 |
|
|
101 |
if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) ) |
|
102 |
wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); |
|
103 |
|
|
104 |
do_action('load-' . $plugin_page); |
|
105 |
|
|
106 |
if (! isset($_GET['noheader'])) |
|
107 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
108 |
|
|
109 |
include(WP_PLUGIN_DIR . "/$plugin_page"); |
|
110 |
} |
|
111 |
|
|
112 |
include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
113 |
|
|
114 |
exit(); |
|
115 |
} else if (isset($_GET['import'])) { |
|
116 |
|
|
117 |
$importer = $_GET['import']; |
|
118 |
|
|
119 |
if ( ! current_user_can('import') ) |
|
120 |
wp_die(__('You are not allowed to import.')); |
|
121 |
|
|
122 |
if ( validate_file($importer) ) { |
|
123 |
wp_die(__('Invalid importer.')); |
|
124 |
} |
|
125 |
|
|
126 |
// Allow plugins to define importers as well |
|
127 |
if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) |
|
128 |
{ |
|
129 |
if (! file_exists(ABSPATH . "wp-admin/import/$importer.php")) |
|
130 |
{ |
|
131 |
wp_die(__('Cannot load importer.')); |
|
132 |
} |
|
133 |
include(ABSPATH . "wp-admin/import/$importer.php"); |
|
134 |
} |
|
135 |
|
|
136 |
$parent_file = 'tools.php'; |
|
137 |
$submenu_file = 'import.php'; |
|
138 |
$title = __('Import'); |
|
139 |
|
|
140 |
if (! isset($_GET['noheader'])) |
|
141 |
require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
142 |
|
|
143 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
144 |
|
|
145 |
define('WP_IMPORTING', true); |
|
146 |
|
|
147 |
call_user_func($wp_importers[$importer][2]); |
|
148 |
|
|
149 |
include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
150 |
|
|
151 |
// Make sure rules are flushed |
|
152 |
global $wp_rewrite; |
|
153 |
$wp_rewrite->flush_rules(false); |
|
154 |
|
|
155 |
exit(); |
|
156 |
} else { |
|
157 |
do_action("load-$pagenow"); |
|
158 |
} |
|
159 |
|
|
160 |
if ( !empty($_REQUEST['action']) ) |
|
161 |
do_action('admin_action_' . $_REQUEST['action']); |
|
162 |
|
|
163 |
?> |