Wordpress 2.0.11
[autoinstalls/wordpress.git] / wp-admin / admin.php
1 <?php
2 if ( defined('ABSPATH') )
3         require_once( ABSPATH . 'wp-config.php');
4 else
5     require_once('../wp-config.php');
6
7 if ( get_option('db_version') != $wp_db_version )
8         die (sprintf(__("Your database is out-of-date.  Please <a href='%s'>upgrade</a>."), get_option('siteurl') . '/wp-admin/upgrade.php'));
9     
10 require_once(ABSPATH . 'wp-admin/admin-functions.php');
11 require_once(ABSPATH . 'wp-admin/admin-db.php');
12 require_once(ABSPATH . WPINC . '/registration-functions.php');
13
14 auth_redirect();
15
16 nocache_headers();
17
18 update_category_cache();
19
20 wp_get_current_user();
21
22 $posts_per_page = get_settings('posts_per_page');
23 $what_to_show = get_settings('what_to_show');
24 $date_format = get_settings('date_format');
25 $time_format = get_settings('time_format');
26
27 $wpvarstoreset = array('profile','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
28 for ($i=0; $i<count($wpvarstoreset); $i += 1) {
29     $wpvar = $wpvarstoreset[$i];
30     if (!isset($$wpvar)) {
31         if (empty($_POST["$wpvar"])) {
32             if (empty($_GET["$wpvar"])) {
33                 $$wpvar = '';
34             } else {
35                 $$wpvar = $_GET["$wpvar"];
36             }
37         } else {
38             $$wpvar = $_POST["$wpvar"];
39         }
40     }
41 }
42
43 $xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;
44
45 if (isset($_GET['page'])) {
46         $plugin_page = stripslashes($_GET['page']);
47         $plugin_page = plugin_basename($plugin_page);
48 }
49
50 require(ABSPATH . '/wp-admin/menu.php');
51
52 // Handle plugin admin pages.
53 if (isset($plugin_page)) {
54         $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
55
56         if ( $page_hook ) {
57                 if (! isset($_GET['noheader']))
58                         require_once(ABSPATH . '/wp-admin/admin-header.php');
59                 
60                 do_action($page_hook);
61         } else {
62                 if ( validate_file($plugin_page) ) {
63                         die(__('Invalid plugin page'));
64                 }
65                 
66                 if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
67                         die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
68
69                 if (! isset($_GET['noheader']))
70                         require_once(ABSPATH . '/wp-admin/admin-header.php');
71                 
72                 include(ABSPATH . "wp-content/plugins/$plugin_page");
73         }
74         
75         include(ABSPATH . 'wp-admin/admin-footer.php');
76
77         exit();
78 } else if (isset($_GET['import'])) {
79         
80         $importer = $_GET['import'];
81
82         if ( ! current_user_can('import') )
83                 wp_die(__('You are not allowed to import.'));
84
85         if ( validate_file($importer) ) {
86                 die(__('Invalid importer.'));
87         }
88                 
89         if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
90                 die(__('Cannot load importer.'));
91         
92         include(ABSPATH . "wp-admin/import/$importer.php");
93
94         $parent_file = 'import.php';
95         $title = __('Import');
96         
97         if (! isset($_GET['noheader']))
98                 require_once(ABSPATH . 'wp-admin/admin-header.php');
99
100         require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
101
102         define('WP_IMPORTING', true);
103         kses_init_filters();  // Always filter imported data with kses.
104
105         call_user_func($wp_importers[$importer][2]);
106                         
107         include(ABSPATH . 'wp-admin/admin-footer.php');
108
109         exit();
110 }
111
112 ?>