WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin.php

    r4349 r3422  
    66
    77if ( get_option('db_version') != $wp_db_version )
    8     wp_die(sprintf(__("Your database is out-of-date.  Please <a href='%s'>upgrade</a>."), get_option('siteurl') . '/wp-admin/upgrade.php'));
     8    die (sprintf(__("Your database is out-of-date.  Please <a href='%s'>upgrade</a>."), get_option('siteurl') . '/wp-admin/upgrade.php'));
    99   
    1010require_once(ABSPATH . 'wp-admin/admin-functions.php');
    1111require_once(ABSPATH . 'wp-admin/admin-db.php');
    12 require_once(ABSPATH . WPINC . '/registration.php');
     12require_once(ABSPATH . WPINC . '/registration-functions.php');
    1313
    1414auth_redirect();
     
    1818update_category_cache();
    1919
    20 wp_get_current_user();
     20get_currentuserinfo();
    2121
    22 $posts_per_page = get_option('posts_per_page');
    23 $what_to_show = get_option('what_to_show');
    24 $date_format = get_option('date_format');
    25 $time_format = get_option('time_format');
     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');
    2626
    27 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
     27$wpvarstoreset = array('profile','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
     28for ($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}
    2842
    29 wp_enqueue_script( 'fat' );
    30 
    31 $editing = false;
    32 
    33 if (isset($_GET['page'])) {
    34     $plugin_page = stripslashes($_GET['page']);
    35     $plugin_page = plugin_basename($plugin_page);
    36 }
     43$xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;
    3744
    3845require(ABSPATH . '/wp-admin/menu.php');
    3946
    4047// Handle plugin admin pages.
    41 if (isset($plugin_page)) {
     48if (isset($_GET['page'])) {
     49    $plugin_page = stripslashes($_GET['page']);
     50    $plugin_page = plugin_basename($plugin_page);
    4251    $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
    4352
    4453    if ( $page_hook ) {
    45         do_action('load-' . $page_hook);
    4654        if (! isset($_GET['noheader']))
    4755            require_once(ABSPATH . '/wp-admin/admin-header.php');
    48 
     56       
    4957        do_action($page_hook);
    5058    } else {
    5159        if ( validate_file($plugin_page) ) {
    52             wp_die(__('Invalid plugin page'));
     60            die(__('Invalid plugin page'));
    5361        }
    54 
    55         if (! file_exists(ABSPATH . PLUGINDIR . "/$plugin_page"))
    56             wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
    57 
    58         do_action('load-' . $plugin_page);
     62       
     63        if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
     64            die(sprintf(__('Cannot load %s.'), $plugin_page));
    5965
    6066        if (! isset($_GET['noheader']))
    6167            require_once(ABSPATH . '/wp-admin/admin-header.php');
    62 
    63         include(ABSPATH . PLUGINDIR . "/$plugin_page");
     68       
     69        include(ABSPATH . "wp-content/plugins/$plugin_page");
    6470    }
    65 
     71   
    6672    include(ABSPATH . 'wp-admin/admin-footer.php');
    6773
    6874    exit();
    6975} else if (isset($_GET['import'])) {
    70 
     76   
    7177    $importer = $_GET['import'];
    7278
    73     if ( ! current_user_can('import') )
    74         wp_die(__('You are not allowed to import.'));
    75 
    7679    if ( validate_file($importer) ) {
    77         wp_die(__('Invalid importer.'));
     80        die(__('Invalid importer.'));
    7881    }
    79 
     82       
    8083    if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
    81         wp_die(__('Cannot load importer.'));
    82 
     84        die(__('Cannot load importer.'));
     85   
    8386    include(ABSPATH . "wp-admin/import/$importer.php");
    8487
    85     $parent_file = 'edit.php';
    86     $submenu_file = 'import.php';
     88    $parent_file = 'import.php';
    8789    $title = __('Import');
    88 
     90   
    8991    if (! isset($_GET['noheader']))
    9092        require_once(ABSPATH . 'wp-admin/admin-header.php');
     
    9698
    9799    call_user_func($wp_importers[$importer][2]);
    98 
     100           
    99101    include(ABSPATH . 'wp-admin/admin-footer.php');
    100102
    101103    exit();
    102 } else {
    103     do_action("load-$pagenow");
    104104}
    105105
Note: See TracChangeset for help on using the changeset viewer.