WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r3422 r4349  
    66
    77if ( 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'));
     8    wp_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-functions.php');
     12require_once(ABSPATH . WPINC . '/registration.php');
    1313
    1414auth_redirect();
     
    1818update_category_cache();
    1919
    20 get_currentuserinfo();
     20wp_get_current_user();
    2121
    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');
     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');
    2626
    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     }
     27wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
     28
     29wp_enqueue_script( 'fat' );
     30
     31$editing = false;
     32
     33if (isset($_GET['page'])) {
     34    $plugin_page = stripslashes($_GET['page']);
     35    $plugin_page = plugin_basename($plugin_page);
    4136}
    42 
    43 $xfn_js = $sack_js = $list_js = $cat_js = $dbx_js = $editing = false;
    4437
    4538require(ABSPATH . '/wp-admin/menu.php');
    4639
    4740// Handle plugin admin pages.
    48 if (isset($_GET['page'])) {
    49     $plugin_page = stripslashes($_GET['page']);
    50     $plugin_page = plugin_basename($plugin_page);
     41if (isset($plugin_page)) {
    5142    $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
    5243
    5344    if ( $page_hook ) {
     45        do_action('load-' . $page_hook);
    5446        if (! isset($_GET['noheader']))
    5547            require_once(ABSPATH . '/wp-admin/admin-header.php');
    56        
     48
    5749        do_action($page_hook);
    5850    } else {
    5951        if ( validate_file($plugin_page) ) {
    60             die(__('Invalid plugin page'));
     52            wp_die(__('Invalid plugin page'));
    6153        }
    62        
    63         if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
    64             die(sprintf(__('Cannot load %s.'), $plugin_page));
     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);
    6559
    6660        if (! isset($_GET['noheader']))
    6761            require_once(ABSPATH . '/wp-admin/admin-header.php');
    68        
    69         include(ABSPATH . "wp-content/plugins/$plugin_page");
     62
     63        include(ABSPATH . PLUGINDIR . "/$plugin_page");
    7064    }
    71    
     65
    7266    include(ABSPATH . 'wp-admin/admin-footer.php');
    7367
    7468    exit();
    7569} else if (isset($_GET['import'])) {
    76    
     70
    7771    $importer = $_GET['import'];
    7872
     73    if ( ! current_user_can('import') )
     74        wp_die(__('You are not allowed to import.'));
     75
    7976    if ( validate_file($importer) ) {
    80         die(__('Invalid importer.'));
     77        wp_die(__('Invalid importer.'));
    8178    }
    82        
     79
    8380    if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
    84         die(__('Cannot load importer.'));
    85    
     81        wp_die(__('Cannot load importer.'));
     82
    8683    include(ABSPATH . "wp-admin/import/$importer.php");
    8784
    88     $parent_file = 'import.php';
     85    $parent_file = 'edit.php';
     86    $submenu_file = 'import.php';
    8987    $title = __('Import');
    90    
     88
    9189    if (! isset($_GET['noheader']))
    9290        require_once(ABSPATH . 'wp-admin/admin-header.php');
     
    9896
    9997    call_user_func($wp_importers[$importer][2]);
    100            
     98
    10199    include(ABSPATH . 'wp-admin/admin-footer.php');
    102100
    103101    exit();
     102} else {
     103    do_action("load-$pagenow");
    104104}
    105105
Note: See TracChangeset for help on using the changeset viewer.