Wordpress 2.0.2
[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 get_currentuserinfo();
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 require(ABSPATH . '/wp-admin/menu.php');
46
47 // Handle plugin admin pages.
48 if (isset($_GET['page'])) {
49         $plugin_page = stripslashes($_GET['page']);
50         $plugin_page = plugin_basename($plugin_page);
51         $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
52
53         if ( $page_hook ) {
54                 if (! isset($_GET['noheader']))
55                         require_once(ABSPATH . '/wp-admin/admin-header.php');
56                 
57                 do_action($page_hook);
58         } else {
59                 if ( validate_file($plugin_page) ) {
60                         die(__('Invalid plugin page'));
61                 }
62                 
63                 if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
64                         die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
65
66                 if (! isset($_GET['noheader']))
67                         require_once(ABSPATH . '/wp-admin/admin-header.php');
68                 
69                 include(ABSPATH . "wp-content/plugins/$plugin_page");
70         }
71         
72         include(ABSPATH . 'wp-admin/admin-footer.php');
73
74         exit();
75 } else if (isset($_GET['import'])) {
76         
77         $importer = $_GET['import'];
78
79         if ( validate_file($importer) ) {
80                 die(__('Invalid importer.'));
81         }
82                 
83         if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
84                 die(__('Cannot load importer.'));
85         
86         include(ABSPATH . "wp-admin/import/$importer.php");
87
88         $parent_file = 'import.php';
89         $title = __('Import');
90         
91         if (! isset($_GET['noheader']))
92                 require_once(ABSPATH . 'wp-admin/admin-header.php');
93
94         require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
95
96         define('WP_IMPORTING', true);
97         kses_init_filters();  // Always filter imported data with kses.
98
99         call_user_func($wp_importers[$importer][2]);
100                         
101         include(ABSPATH . 'wp-admin/admin-footer.php');
102
103         exit();
104 }
105
106 ?>