Make WordPress Core

Changeset 1818


Ignore:
Timestamp:
10/19/2004 03:03:06 AM (20 years ago)
Author:
rboren
Message:

Split admin-header.php into admin.php and admin-header.php. Split menu.php into menu-header.php and menu.php. Add plugin admin page support.

Location:
trunk
Files:
2 added
29 edited

Legend:

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

    r1810 r1818  
    662662}
    663663
    664 function add_options_menu($title, $access_level, $file) {
     664function get_admin_page_title() {
     665    global $title;
    665666    global $submenu;
    666    
    667     $submenu['options-general.php'][] = array($title, $access_level, $file);
     667    global $pagenow;
     668    global $plugin_page;
     669
     670    if (isset($title) && ! empty($title)) {
     671        return $title;
     672    }
     673
     674    foreach (array_keys($submenu) as $parent) {
     675        foreach ($submenu[$parent] as $submenu_array) {
     676            if (isset($submenu_array[3])) {
     677                if ($submenu_array[2] == $pagenow) {
     678                    $title = $submenu_array[3];
     679                    return $submenu_array[3];
     680                } else if (isset($plugin_page) && ($plugin_page == $submenu_array[2])) {
     681                    $title = $submenu_array[3];
     682                    return $submenu_array[3];
     683                }
     684            }
     685        }
     686    }
     687
     688    return '';
     689}
     690
     691function get_admin_page_parent() {
     692    global $parent_file;
     693    global $submenu;
     694    global $pagenow;
     695    global $plugin_page;
     696
     697    if (isset($parent_file) && ! empty($parent_file)) {
     698        return $parent_file;
     699    }
     700
     701    foreach (array_keys($submenu) as $parent) {
     702        foreach ($submenu[$parent] as $submenu_array) {
     703            if ($submenu_array[2] == $pagenow) {
     704                $parent_file = $parent;
     705                return $parent;
     706            } else if (isset($plugin_page) && ($plugin_page == $submenu_array[2])) {
     707                $parent_file = $parent;
     708                return $parent;
     709            }
     710        }
     711    }
     712
     713    $parent_file = '';
     714    return '';
     715}
     716
     717function add_options_page($page_title, $menu_title, $access_level, $file) {
     718    global $submenu;
     719
     720    $file = basename($file);
     721
     722    $submenu['options-general.php'][] = array($menu_title, $access_level, $file, $page_title);
    668723}
    669724
  • trunk/wp-admin/admin-header.php

    r1810 r1818  
    1 <?php
    2 
    3 if (strstr($_SERVER['PHP_SELF'], 'plugins/')) {
    4     $wp_admin_path = '../../wp-admin/';
    5     $wp_path = '../../';
    6 } else {
    7     $wp_admin_path = './';
    8     $wp_path = '../';
    9 }
    10 
    11 require_once($wp_path . 'wp-config.php');
    12 
    13 require_once(ABSPATH . '/wp-admin/auth.php');
    14 require(ABSPATH . '/wp-admin/admin-functions.php');
    15 
    16 $dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories");
    17 foreach ($dogs as $catt) {
    18     $cache_categories[$catt->cat_ID] = $catt;
    19 }
    20 
    21 get_currentuserinfo();
    22 
    23 $posts_per_page = get_settings('posts_per_page');
    24 $what_to_show = get_settings('what_to_show');
    25 $date_format = get_settings('date_format');
    26 $time_format = get_settings('time_format');
    27 
    28 $wpvarstoreset = array('profile','standalone','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
    29 for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    30     $wpvar = $wpvarstoreset[$i];
    31     if (!isset($$wpvar)) {
    32         if (empty($_POST["$wpvar"])) {
    33             if (empty($_GET["$wpvar"])) {
    34                 $$wpvar = '';
    35             } else {
    36                 $$wpvar = $_GET["$wpvar"];
    37             }
    38         } else {
    39             $$wpvar = $_POST["$wpvar"];
    40         }
    41     }
    42 }
    43 
    44 if ($standalone == 0) :
    45 
    46 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     1<?php get_admin_page_title(); ?>
     2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    473<html xmlns="http://www.w3.org/1999/xhtml">
    484<head>
    495<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title>
    50 <link rel="stylesheet" href="<?php echo $wp_admin_path; ?>wp-admin.css" type="text/css" />
    51 <link rel="shortcut icon" href="<?php echo $wp_path; ?>wp-images/wp-favicon.png" />
     6<link rel="stylesheet" href="wp-admin.css" type="text/css" />
     7<link rel="shortcut icon" href="../wp-images/wp-favicon.png" />
    528<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
    539
     
    12076
    12177<?php
    122 require(ABSPATH . '/wp-admin/menu.php');
    123 endif;
     78require(ABSPATH . '/wp-admin/menu-header.php');
     79
     80if ( $parent_file == 'options-general.php' ) {
     81    require(ABSPATH . '/wp-admin/options-head.php');
     82}
    12483?>
  • trunk/wp-admin/categories.php

    r1744 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Categories');
    55$parent_file = 'edit.php';
    66
    7 function add_magic_quotes($array) {
    8     foreach ($array as $k => $v) {
    9         if (is_array($v)) {
    10             $array[$k] = add_magic_quotes($v);
    11         } else {
    12             $array[$k] = addslashes($v);
    13         }
    14     }
    15     return $array;
    16 }
    17 
    18 if (!get_magic_quotes_gpc()) {
    19     $_GET    = add_magic_quotes($_GET);
    20     $_POST   = add_magic_quotes($_POST);
    21     $_COOKIE = add_magic_quotes($_COOKIE);
    22 }
    23 
    24 $wpvarstoreset = array('action','standalone','cat');
     7$wpvarstoreset = array('action','cat');
    258for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    269    $wpvar = $wpvarstoreset[$i];
     
    4225case 'addcat':
    4326
    44     $standalone = 1;
    45     require_once('admin-header.php');
    46    
    4727    if ($user_level < 3)
    4828        die (__('Cheatin&#8217; uh?'));
     
    6141
    6242case 'Delete':
    63 
    64     $standalone = 1;
    65     require_once('admin-header.php');
    6643
    6744    check_admin_referer();
     
    12097case 'editedcat':
    12198
    122     $standalone = 1;
    123     require_once('admin-header.php');
    124 
    12599    if ($user_level < 3)
    126100        die (__('Cheatin&#8217; uh?'));
     
    139113default:
    140114
    141     $standalone = 0;
    142115    require_once ('admin-header.php');
    143116    if ($user_level < 3) {
  • trunk/wp-admin/edit-comments.php

    r1746 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Edit Comments');
  • trunk/wp-admin/edit-pages.php

    r1753 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
    3 
     2require_once('admin.php');
    43$title = __('Pages');
    54$parent_file = 'edit.php';
  • trunk/wp-admin/edit.php

    r1743 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Posts');
  • trunk/wp-admin/link-add.php

    r1551 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = 'Add Link';
     
    2323}
    2424
    25 function add_magic_quotes($array) {
    26     foreach ($array as $k => $v) {
    27         if (is_array($v)) {
    28             $array[$k] = add_magic_quotes($v);
    29         } else {
    30             $array[$k] = addslashes($v);
    31         }
    32     }
    33     return $array;
    34 }
    35 if (!get_magic_quotes_gpc()) {
    36     $_GET    = add_magic_quotes($_GET);
    37     $_POST   = add_magic_quotes($_POST);
    38     $_COOKIE = add_magic_quotes($_COOKIE);
    39 }
    40 
    41 $wpvarstoreset = array('action','standalone','cat_id', 'linkurl', 'name', 'image',
     25$wpvarstoreset = array('action', 'cat_id', 'linkurl', 'name', 'image',
    4226                       'description', 'visible', 'target', 'category', 'link_id',
    4327                       'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
  • trunk/wp-admin/link-categories.php

    r1599 r1818  
    22// Links
    33// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
    4 require_once('../wp-includes/wp-l10n.php');
     4require_once('admin.php');
    55$title = __('Link Categories');
    66$this_file='link-categories.php';
    77$parent_file = 'link-manager.php';
    88
    9 $wpvarstoreset = array('action','standalone','cat', 'auto_toggle');
     9$wpvarstoreset = array('action', 'cat', 'auto_toggle');
    1010for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    1111    $wpvar = $wpvarstoreset[$i];
     
    2626  case 'addcat':
    2727  {
    28       $standalone = 1;
    29       include_once('admin-header.php');
    30 
    3128      if ($user_level < 5)
    3229          die (__("Cheatin' uh ?"));
     
    8380  case 'Delete':
    8481  {
    85     $standalone = 1;
    86     include_once('admin-header.php');
    87 
    8882    $cat_id = $_GET['cat_id'];
    8983    $cat_name=get_linkcatname($cat_id);
     
    205199  case "editedcat":
    206200  {
    207     $standalone = 1;
    208     include_once("./admin-header.php");
    209 
    210201    if ($user_level < 5)
    211202      die (__("Cheatin' uh ?"));
     
    279270  default:
    280271  {
    281     $standalone=0;
    282     include_once ("./admin-header.php");
     272    include_once ("admin-header.php");
    283273    if ($user_level < 5) {
    284274      die(__("You have do not have sufficient permissions to edit the link categories for this blog. :)"));
  • trunk/wp-admin/link-import.php

    r1599 r1818  
    33// Copyright (C) 2002 Mike Little -- mike@zed1.com
    44
    5 require_once('../wp-config.php');
    6 
     5require_once('admin.php');
    76$parent_file = 'link-manager.php';
    87$title = __('Import Blogroll');
     
    1615    case 0:
    1716    {
    18         $standalone = 0;
    1917        include_once('admin-header.php');
    2018        if ($user_level < 5)
     
    7371
    7472    case 1: {
    75                 $standalone = 0;
    7673                include_once('admin-header.php');
    7774                if ($user_level < 5)
  • trunk/wp-admin/link-manager.php

    r1768 r1818  
    33// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
    44
    5 require_once('../wp-config.php');
     5require_once('admin.php');
    66
    77$title = __('Manage Links');
     
    3838}
    3939
    40 function add_magic_quotes($array) {
    41     foreach ($array as $k => $v) {
    42         if (is_array($v)) {
    43             $array[$k] = add_magic_quotes($v);
    44         } else {
    45             $array[$k] = addslashes($v);
    46         }
    47     }
    48     return $array;
    49 }
    50 if (!get_magic_quotes_gpc()) {
    51     $_GET    = add_magic_quotes($_GET);
    52     $_POST   = add_magic_quotes($_POST);
    53     $_COOKIE = add_magic_quotes($_COOKIE);
    54 }
    55 
    56 $wpvarstoreset = array('action','standalone','cat_id', 'linkurl', 'name', 'image',
     40$wpvarstoreset = array('action','cat_id', 'linkurl', 'name', 'image',
    5741                       'description', 'visible', 'target', 'category', 'link_id',
    5842                       'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
     
    8468  case 'assign':
    8569  {
    86     $standalone = 1;
    87     include_once('admin-header.php');
    88 
    8970    check_admin_referer();
    9071
     
    11798  case 'visibility':
    11899  {
    119     $standalone = 1;
    120     include_once('admin-header.php');
    121 
    122100    check_admin_referer();
    123101
     
    157135  case 'move':
    158136  {
    159     $standalone = 1;
    160     include_once('admin-header.php');
    161 
    162137    check_admin_referer();
    163138
     
    181156  case 'Add':
    182157  {
    183     $standalone = 1;
    184     include_once('admin-header.php');
    185 
    186158    check_admin_referer();
    187159
     
    230202      }
    231203      $links_show_cat_id = $cat_id;
    232 
    233       $standalone = 1;
    234       include_once('admin-header.php');
    235204
    236205      check_admin_referer();
     
    277246  case 'Delete':
    278247  {
    279     $standalone = 1;
    280     include_once('admin-header.php');
    281 
    282248    check_admin_referer();
    283249
     
    304270  case 'linkedit':
    305271  {
    306     $standalone=0;
    307272    $xfn = true;
    308273    include_once ('admin-header.php');
     
    570535    setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
    571536    setcookie('links_show_order_' . COOKIEHASH, $links_show_order, time()+600);
    572     $standalone=0;
    573537    include_once ("./admin-header.php");
    574538    if ($user_level < 5) {
  • trunk/wp-admin/menu.php

    r1810 r1818  
    1 
    2 <ul id="adminmenu">
    31<?php
    42// This array constructs the admin menu bar.
     
    5048}
    5149
    52 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
    53 $self = preg_replace('|^.*/plugins/|i', '', $self);
    54 
    55 if (!isset($parent_file)) $parent_file = '';
    56 foreach ($menu as $item) {
    57     $class = '';
    58 
    59     // 0 = name, 1 = user_level, 2 = file
    60     if ((substr($self, -10) == substr($item[2], -10) && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
    61    
    62     if ($user_level >= $item[1]) {
    63         if (
    64 ('upload.php' == $item[2] &&
    65 get_settings('use_fileupload') &&
    66 ($user_level >= get_settings('fileupload_minlevel'))
    67              ) || 'upload.php' != $item[2])
    68                     echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
    69     }
    70 }
    71 
    7250?>
    73     <li class="last"><a href="<?php echo get_settings('siteurl')
    74      ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php printf(__('Logout (%s)'), $user_nickname) ?></a></li>
    75 </ul>
    76 
    77 <?php
    78 // Sub-menu
    79 if ( isset($submenu["$parent_file"]) ) :
    80 ?>
    81 <ul id="adminmenu2">
    82 <?php
    83 foreach ($submenu["$parent_file"] as $item) :
    84      if ($user_level < $item[1]) {
    85          continue;
    86      }
    87 
    88     if ( substr($self, -10) == substr($item[2], -10) ) $class = ' class="current"';
    89     else $class = '';
    90     echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
    91 endforeach;
    92 ?>
    93 
    94 </ul>
    95 <?php endif; ?>
  • trunk/wp-admin/moderation.php

    r1744 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Moderate comments');
    55$parent_file = 'edit.php';
    6 
    7 function add_magic_quotes($array) {
    8     foreach ($array as $k => $v) {
    9         if (is_array($v)) {
    10             $array[$k] = add_magic_quotes($v);
    11         } else {
    12             $array[$k] = addslashes($v);
    13         }
    14     }
    15     return $array;
    16 }
    17 
    18 if (!get_magic_quotes_gpc()) {
    19     $_GET    = add_magic_quotes($_GET);
    20     $_POST   = add_magic_quotes($_POST);
    21     $_COOKIE = add_magic_quotes($_COOKIE);
    22 }
    236
    247$wpvarstoreset = array('action','item_ignored','item_deleted','item_approved');
     
    4831
    4932case 'update':
    50 
    51     $standalone = 1;
    52     require_once('admin-header.php');
    5333
    5434    if ($user_level < 3) {
  • trunk/wp-admin/options-discussion.php

    r1810 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Discussion Options');
    5 include('options-head.php');
     5$parent_file = 'options-general.php';
     6
     7include('admin-header.php');
    68
    79if ($action == 'retrospam') {
  • trunk/wp-admin/options-general.php

    r1810 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('General Options');
     5$parent_file = 'options-general.php';
    56
    6 include('options-head.php');
     7include('admin-header.php');
    78?>
    89 
  • trunk/wp-admin/options-head.php

    r1810 r1818  
    11<?php
    2 
    3 $parent_file = 'options-general.php';
    4 
    5 function add_magic_quotes($array) {
    6     foreach ($array as $k => $v) {
    7         if (is_array($v)) {
    8             $array[$k] = add_magic_quotes($v);
    9         } else {
    10             $array[$k] = addslashes($v);
    11         }
    12     }
    13     return $array;
    14 }
    15 
    16 if (!get_magic_quotes_gpc()) {
    17     $_GET    = add_magic_quotes($_GET);
    18     $_POST   = add_magic_quotes($_POST);
    19     $_COOKIE = add_magic_quotes($_COOKIE);
    20 }
    212
    223$wpvarstoreset = array('action','standalone', 'option_group_id');
     
    3516    }
    3617}
    37 
    38 $standalone = 0;
    39 include_once('admin-header.php');
    4018?>
    4119
    4220<br clear="all" />
    4321
    44 <?php if (isset($updated)) : ?>
     22<?php if (isset($_GET['updated'])) : ?>
    4523<div class="updated"><p><strong><?php _e('Options saved.') ?></strong></p></div>
    4624<?php endif; ?>
  • trunk/wp-admin/options-misc.php

    r1810 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Miscellaneous Options');
    5 include('options-head.php');
     5$parent_file = 'options-general.php';
     6
     7include('admin-header.php');
     8
    69?>
    710 
  • trunk/wp-admin/options-permalink.php

    r1811 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Permalink Options');
    5 require('./options-head.php');
     5$parent_file = 'options-general.php';
     6
     7include('admin-header.php');
    68
    79$home = get_settings('home');
  • trunk/wp-admin/options-reading.php

    r1810 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Reading Options');
    5 include('options-head.php');
     5$parent_file = 'options-general.php';
     6
     7include('admin-header.php');
    68?>
    79
  • trunk/wp-admin/options-writing.php

    r1810 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Writing Options');
    5 include('./options-head.php');
     5$parent_file = 'options-general.php';
     6
     7include('admin-header.php');
    68?>
    79
  • trunk/wp-admin/options.php

    r1751 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Options');
     
    66$parent_file = 'options-general.php';
    77
    8 function add_magic_quotes($array) {
    9     foreach ($array as $k => $v) {
    10         if (is_array($v)) {
    11             $array[$k] = add_magic_quotes($v);
    12         } else {
    13             $array[$k] = addslashes($v);
    14         }
    15     }
    16     return $array;
    17 }
    18 
    19 if (!get_magic_quotes_gpc()) {
    20     $_GET    = add_magic_quotes($_GET);
    21     $_POST   = add_magic_quotes($_POST);
    22     $_COOKIE = add_magic_quotes($_COOKIE);
    23 }
    24 
    25 $wpvarstoreset = array('action','standalone');
     8$wpvarstoreset = array('action');
    269for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    2710    $wpvar = $wpvarstoreset[$i];
     
    4225
    4326case 'update':
    44     $standalone = 1;
    45     include_once('./admin-header.php');
    4627    $any_changed = 0;
    4728   
     
    9273
    9374default:
    94     $standalone = 0;
    95     include_once('./admin-header.php');
    96     if ($user_level <= 6) {
    97         die(__("You have do not have sufficient permissions to edit the options for this blog."));
    98     }
    99 ?>
    100 
    101 <?php include('options-head.php'); ?>
     75    include('admin-header.php'); ?>
    10276
    10377<div class="wrap">
  • trunk/wp-admin/plugins.php

    r1711 r1818  
    11<?php
     2require_once('admin.php');
    23
    34if ( isset($_GET['action']) ) {
    4     $standalone = 1;
    5     require_once('admin-header.php');
    6 
    75    check_admin_referer();
    86
     
    2523}
    2624
    27 require_once('../wp-includes/wp-l10n.php');
    2825$title = __('Manage Plugins');
    2926require_once('admin-header.php');
    30 
    31 if ($user_level < 9) // Must be at least level 9
    32     die (__('Sorry, you must be at least a level 8 user to modify plugins.'));
    3327
    3428// Clean up options
  • trunk/wp-admin/post.php

    r1813 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
    3 
    4 function add_magic_quotes($array) {
    5 foreach ($array as $k => $v) {
    6     if (is_array($v)) {
    7         $array[$k] = add_magic_quotes($v);
    8     } else {
    9         $array[$k] = addslashes($v);
    10     }
    11 }
    12 return $array;
    13 }
    14 
    15 if (!get_magic_quotes_gpc()) {
    16     $_GET    = add_magic_quotes($_GET);
    17     $_POST   = add_magic_quotes($_POST);
    18     $_COOKIE = add_magic_quotes($_COOKIE);
    19 }
     2require_once('admin.php');
    203
    214$wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'poststart', 'postend', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder', 'enclosure_url' );
     
    3821switch($action) {
    3922case 'post':
    40     $standalone = 1;
    4123    require_once('admin-header.php');
    4224
     
    184166    $title = __('Edit');
    185167
    186     $standalone = 0;
    187168    require_once('admin-header.php');
    188169
     
    237218case 'editpost':
    238219// die(var_dump('<pre>', $_POST));
    239     $standalone = 1;
    240     require_once('./admin-header.php');
    241 
    242220    if (!isset($blog_ID)) {
    243221        $blog_ID = 1;
     
    399377
    400378case 'delete':
    401 
    402     $standalone = 1;
    403     require_once('./admin-header.php');
    404 
    405379    check_admin_referer();
    406380
     
    429403case 'editcomment':
    430404    $title = __('Edit Comment');
    431     $standalone = 0;
    432405    $parent_file = 'edit.php';
    433406    require_once ('admin-header.php');
     
    452425case 'confirmdeletecomment':
    453426
    454 $standalone = 0;
    455427require_once('./admin-header.php');
    456428
     
    488460case 'deletecomment':
    489461
    490 $standalone = 1;
    491 require_once('./admin-header.php');
    492 
    493462check_admin_referer();
    494463
     
    521490case 'unapprovecomment':
    522491
    523 $standalone = 1;
    524492require_once('./admin-header.php');
    525493
     
    552520case 'mailapprovecomment':
    553521
    554 $standalone = 1;
    555 require_once('./admin-header.php');
    556 
    557522$comment = (int) $_GET['comment'];
    558523
     
    574539
    575540case 'approvecomment':
    576 
    577 $standalone = 1;
    578 require_once('./admin-header.php');
    579541
    580542$comment = $_GET['comment'];
     
    606568
    607569case 'editedcomment':
    608 
    609     $standalone = 1;
    610     require_once('./admin-header.php');
    611570
    612571    $comment_ID = $_POST['comment_ID'];
     
    654613
    655614default:
    656     $standalone = 0;
    657615    $title = __('Create New Post');
    658616    require_once ('./admin-header.php');
  • trunk/wp-admin/profile.php

    r1768 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = "Profile";
    55$parent_file = 'profile.php';
    66
    7 function add_magic_quotes($array) {
    8     foreach ($array as $k => $v) {
    9         if (is_array($v)) {
    10             $array[$k] = add_magic_quotes($v);
    11         } else {
    12             $array[$k] = addslashes($v);
    13         }
    14     }
    15     return $array;
    16 }
    17 
    18 if (!get_magic_quotes_gpc()) {
    19     $_GET    = add_magic_quotes($_GET);
    20     $_POST   = add_magic_quotes($_POST);
    21     $_COOKIE = add_magic_quotes($_COOKIE);
    22 }
    23 
    24 $wpvarstoreset = array('action','standalone','redirect','profile','user');
     7$wpvarstoreset = array('action','redirect','profile','user');
    258for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    269    $wpvar = $wpvarstoreset[$i];
  • trunk/wp-admin/templates.php

    r1703 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
    3 
     2require_once('admin.php');
    43$title = __('Template &amp; file editing');
    54$parent_file =  'themes.php';
    6 
    7 function add_magic_quotes($array) {
    8     foreach ($array as $k => $v) {
    9         if (is_array($v)) {
    10             $array[$k] = add_magic_quotes($v);
    11         } else {
    12             $array[$k] = addslashes($v);
    13         }
    14     }
    15     return $array;
    16 }
    175
    186function validate_file($file) {
     
    3220}
    3321
    34 if (!get_magic_quotes_gpc()) {
    35     $_GET    = add_magic_quotes($_GET);
    36     $_POST   = add_magic_quotes($_POST);
    37     $_COOKIE = add_magic_quotes($_COOKIE);
    38 }
    39 
    40 $wpvarstoreset = array('action','standalone','redirect','profile','error','warning','a','file');
     22$wpvarstoreset = array('action','redirect','profile','error','warning','a','file');
    4123for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    4224    $wpvar = $wpvarstoreset[$i];
     
    5739
    5840case 'update':
    59 
    60     $standalone = 1;
    61     require_once('./admin-header.php');
    6241
    6342    if ($user_level < 5) {
  • trunk/wp-admin/theme-editor.php

    r1703 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __("Template &amp; file editing");
    55$parent_file = 'themes.php';
    6 
    7 function add_magic_quotes($array) {
    8     foreach ($array as $k => $v) {
    9         if (is_array($v)) {
    10             $array[$k] = add_magic_quotes($v);
    11         } else {
    12             $array[$k] = addslashes($v);
    13         }
    14     }
    15     return $array;
    16 }
    176
    187function validate_file($file) {
     
    3221}
    3322
    34 if (!get_magic_quotes_gpc()) {
    35     $_GET    = add_magic_quotes($_GET);
    36     $_POST   = add_magic_quotes($_POST);
    37     $_COOKIE = add_magic_quotes($_COOKIE);
    38 }
    39 
    40 $wpvarstoreset = array('action','standalone','redirect','profile','error','warning','a','file', 'theme');
     23$wpvarstoreset = array('action','redirect','profile','error','warning','a','file', 'theme');
    4124for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    4225    $wpvar = $wpvarstoreset[$i];
     
    5740
    5841case 'update':
    59 
    60     $standalone = 1;
    61     require_once("admin-header.php");
    6242
    6343    if ($user_level < 5) {
  • trunk/wp-admin/themes.php

    r1755 r1818  
    11<?php
     2require_once('admin.php');
    23
    34if ( isset($_GET['action']) ) {
    4     $standalone = 1;
    5     require_once('admin-header.php');
    6 
    75    check_admin_referer();
    86
     
    2220 }
    2321
    24 require_once('../wp-includes/wp-l10n.php');
    2522$title = __('Manage Themes');
    2623$parent_file = 'themes.php';
    2724require_once('admin-header.php');
    28 
    29 if ($user_level < 9)
    30     die (__('Sorry, you must be at least a level 9 user to modify themes.'));
    3125?>
    32 
    3326<?php if ( ! validate_current_theme() ) : ?>
    3427<div class="updated"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>
  • trunk/wp-admin/user-edit.php

    r1520 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Edit User');
    55
    6 function add_magic_quotes($array) {
    7   foreach ($array as $k => $v) {
    8     if (is_array($v)) {
    9       $array[$k] = add_magic_quotes($v);
    10     } else {
    11       $array[$k] = addslashes($v);
    12     }
    13   }
    14   return $array;
    15 }
    16 
    17 if (!get_magic_quotes_gpc()) {
    18     $_POST   = add_magic_quotes($_POST);
    19 }
    20 
    21 $wpvarstoreset = array('action', 'standalone', 'redirect', 'profile', 'user_id');
     6$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');
    227for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    238    $wpvar = $wpvarstoreset[$i];
     
    8469case 'switchposts':
    8570
    86 $standalone = 1;
    87 require_once('admin-header.php');
    88 
    8971check_admin_referer();
    9072
     
    9577default:
    9678   
    97 $standalone = 0;
    9879include ('admin-header.php');
    9980
  • trunk/wp-admin/users.php

    r1733 r1818  
    11<?php
    2 require_once('../wp-includes/wp-l10n.php');
     2require_once('admin.php');
    33
    44$title = __('Users');
     
    2323switch ($action) {
    2424case 'adduser':
    25     $standalone = 1;
    26     require_once('admin-header.php');
    27 
    2825    check_admin_referer();
    2926
     
    10198
    10299case 'promote':
    103 
    104     $standalone = 1;
    105     require_once('admin-header.php');
    106 
    107100    check_admin_referer();
    108101
     
    135128
    136129case 'delete':
    137 
    138     $standalone = 1;
    139     require_once('admin-header.php');
    140130
    141131    check_admin_referer();
     
    177167default:
    178168   
    179     $standalone = 0;
    180169    include ('admin-header.php');
    181170    ?>
  • trunk/wp-includes/functions.php

    r1812 r1818  
    22362236}
    22372237
     2238function is_plugin_page() {
     2239    global $plugin_page;
     2240
     2241    if (isset($plugin_page)) {
     2242        return true;
     2243    }
     2244
     2245    return false;
     2246}
     2247
    22382248?>
Note: See TracChangeset for help on using the changeset viewer.