source: trunk/www.guidonia.net/wp/wp-admin/admin.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 4.1 KB
Line 
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 */
14if ( !defined('WP_ADMIN') )
15 define('WP_ADMIN', TRUE);
16
17if ( defined('ABSPATH') )
18 require_once(ABSPATH . 'wp-load.php');
19else
20 require_once('../wp-load.php');
21
22if ( 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
37require_once(ABSPATH . 'wp-admin/includes/admin.php');
38
39auth_redirect();
40
41nocache_headers();
42
43update_category_cache();
44
45set_screen_options();
46
47$posts_per_page = get_option('posts_per_page');
48$date_format = get_option('date_format');
49$time_format = get_option('time_format');
50
51wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
52
53wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
54wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));
55
56wp_enqueue_script( 'common' );
57wp_enqueue_script( 'jquery-color' );
58
59$editing = false;
60
61if (isset($_GET['page'])) {
62 $plugin_page = stripslashes($_GET['page']);
63 $plugin_page = plugin_basename($plugin_page);
64}
65
66require(ABSPATH . 'wp-admin/menu.php');
67
68do_action('admin_init');
69
70// Handle plugin admin pages.
71if (isset($plugin_page)) {
72 if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) {
73 $page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
74 // backwards compatibility for plugins using add_management_page
75 if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) {
76 // There could be plugin specific params on the URL, so we need the whole query string
77 if ( !empty($_SERVER[ 'QUERY_STRING' ]) )
78 $query_string = $_SERVER[ 'QUERY_STRING' ];
79 else
80 $query_string = 'page=' . $plugin_page;
81 wp_redirect( 'tools.php?' . $query_string );
82 exit;
83 }
84 }
85
86 if ( $page_hook ) {
87 do_action('load-' . $page_hook);
88 if (! isset($_GET['noheader']))
89 require_once(ABSPATH . 'wp-admin/admin-header.php');
90
91 do_action($page_hook);
92 } else {
93 if ( validate_file($plugin_page) ) {
94 wp_die(__('Invalid plugin page'));
95 }
96
97 if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
98 wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
99
100 do_action('load-' . $plugin_page);
101
102 if (! isset($_GET['noheader']))
103 require_once(ABSPATH . 'wp-admin/admin-header.php');
104
105 include(WP_PLUGIN_DIR . "/$plugin_page");
106 }
107
108 include(ABSPATH . 'wp-admin/admin-footer.php');
109
110 exit();
111} else if (isset($_GET['import'])) {
112
113 $importer = $_GET['import'];
114
115 if ( ! current_user_can('import') )
116 wp_die(__('You are not allowed to import.'));
117
118 if ( validate_file($importer) ) {
119 wp_die(__('Invalid importer.'));
120 }
121
122 // Allow plugins to define importers as well
123 if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]))
124 {
125 if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
126 {
127 wp_die(__('Cannot load importer.'));
128 }
129 include(ABSPATH . "wp-admin/import/$importer.php");
130 }
131
132 $parent_file = 'tools.php';
133 $submenu_file = 'import.php';
134 $title = __('Import');
135
136 if (! isset($_GET['noheader']))
137 require_once(ABSPATH . 'wp-admin/admin-header.php');
138
139 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
140
141 define('WP_IMPORTING', true);
142
143 call_user_func($wp_importers[$importer][2]);
144
145 include(ABSPATH . 'wp-admin/admin-footer.php');
146
147 // Make sure rules are flushed
148 global $wp_rewrite;
149 $wp_rewrite->flush_rules(false);
150
151 exit();
152} else {
153 do_action("load-$pagenow");
154}
155
156if ( !empty($_REQUEST['action']) )
157 do_action('admin_action_' . $_REQUEST['action']);
158
159?>
Note: See TracBrowser for help on using the repository browser.