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.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-10-19 03:03:06 +00:00
parent c591d809f7
commit 04786f267d
31 changed files with 254 additions and 445 deletions

View File

@ -661,10 +661,65 @@ function user_can_access_admin_page() {
return true;
}
function add_options_menu($title, $access_level, $file) {
function get_admin_page_title() {
global $title;
global $submenu;
global $pagenow;
global $plugin_page;
if (isset($title) && ! empty($title)) {
return $title;
}
foreach (array_keys($submenu) as $parent) {
foreach ($submenu[$parent] as $submenu_array) {
if (isset($submenu_array[3])) {
if ($submenu_array[2] == $pagenow) {
$title = $submenu_array[3];
return $submenu_array[3];
} else if (isset($plugin_page) && ($plugin_page == $submenu_array[2])) {
$title = $submenu_array[3];
return $submenu_array[3];
}
}
}
}
return '';
}
function get_admin_page_parent() {
global $parent_file;
global $submenu;
global $pagenow;
global $plugin_page;
if (isset($parent_file) && ! empty($parent_file)) {
return $parent_file;
}
foreach (array_keys($submenu) as $parent) {
foreach ($submenu[$parent] as $submenu_array) {
if ($submenu_array[2] == $pagenow) {
$parent_file = $parent;
return $parent;
} else if (isset($plugin_page) && ($plugin_page == $submenu_array[2])) {
$parent_file = $parent;
return $parent;
}
}
}
$parent_file = '';
return '';
}
function add_options_page($page_title, $menu_title, $access_level, $file) {
global $submenu;
$submenu['options-general.php'][] = array($title, $access_level, $file);
$file = basename($file);
$submenu['options-general.php'][] = array($menu_title, $access_level, $file, $page_title);
}
?>

View File

@ -1,54 +1,10 @@
<?php
if (strstr($_SERVER['PHP_SELF'], 'plugins/')) {
$wp_admin_path = '../../wp-admin/';
$wp_path = '../../';
} else {
$wp_admin_path = './';
$wp_path = '../';
}
require_once($wp_path . 'wp-config.php');
require_once(ABSPATH . '/wp-admin/auth.php');
require(ABSPATH . '/wp-admin/admin-functions.php');
$dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories");
foreach ($dogs as $catt) {
$cache_categories[$catt->cat_ID] = $catt;
}
get_currentuserinfo();
$posts_per_page = get_settings('posts_per_page');
$what_to_show = get_settings('what_to_show');
$date_format = get_settings('date_format');
$time_format = get_settings('time_format');
$wpvarstoreset = array('profile','standalone','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
if ($standalone == 0) :
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php get_admin_page_title(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title>
<link rel="stylesheet" href="<?php echo $wp_admin_path; ?>wp-admin.css" type="text/css" />
<link rel="shortcut icon" href="<?php echo $wp_path; ?>wp-images/wp-favicon.png" />
<link rel="stylesheet" href="wp-admin.css" type="text/css" />
<link rel="shortcut icon" href="../wp-images/wp-favicon.png" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
<?php if (isset($xfn)) : ?>
@ -119,6 +75,9 @@ window.onload = blurry;
</div>
<?php
require(ABSPATH . '/wp-admin/menu.php');
endif;
require(ABSPATH . '/wp-admin/menu-header.php');
if ( $parent_file == 'options-general.php' ) {
require(ABSPATH . '/wp-admin/options-head.php');
}
?>

71
wp-admin/admin.php Normal file
View File

@ -0,0 +1,71 @@
<?php
require_once('../wp-config.php');
require_once(ABSPATH . 'wp-includes/wp-l10n.php');
require_once(ABSPATH . 'wp-admin/auth.php');
require(ABSPATH . 'wp-admin/admin-functions.php');
$dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories");
foreach ($dogs as $catt) {
$cache_categories[$catt->cat_ID] = $catt;
}
get_currentuserinfo();
$posts_per_page = get_settings('posts_per_page');
$what_to_show = get_settings('what_to_show');
$date_format = get_settings('date_format');
$time_format = get_settings('time_format');
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('profile','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
require(ABSPATH . '/wp-admin/menu.php');
// Handle plugin admin pages.
if (isset($_GET['page'])) {
$plugin_page = basename($_GET['page']);
if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page")) {
die(sprintf(__('Cannot load %s.'), $plugin_page));
}
if (! isset($_GET['noheader'])) {
require_once(ABSPATH . '/wp-admin/admin-header.php');
}
include(ABSPATH . "wp-content/plugins/$plugin_page");
include(ABSPATH . 'wp-admin/admin-footer.php');
}
?>

View File

@ -1,27 +1,10 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Categories');
$parent_file = 'edit.php';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone','cat');
$wpvarstoreset = array('action','cat');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@ -41,9 +24,6 @@ switch($action) {
case 'addcat':
$standalone = 1;
require_once('admin-header.php');
if ($user_level < 3)
die (__('Cheatin&#8217; uh?'));
@ -61,9 +41,6 @@ break;
case 'Delete':
$standalone = 1;
require_once('admin-header.php');
check_admin_referer();
$cat_ID = intval($_GET["cat_ID"]);
@ -119,9 +96,6 @@ break;
case 'editedcat':
$standalone = 1;
require_once('admin-header.php');
if ($user_level < 3)
die (__('Cheatin&#8217; uh?'));
@ -138,7 +112,6 @@ break;
default:
$standalone = 0;
require_once ('admin-header.php');
if ($user_level < 3) {
die(sprintf(__("You have no right to edit the categories for this blog.<br />Ask for a promotion to your <a href='mailto:%s'>blog admin</a>. :)"), get_settings('admin_email')));

View File

@ -1,5 +1,5 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Edit Comments');
$parent_file = 'edit.php';

View File

@ -1,6 +1,5 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Pages');
$parent_file = 'edit.php';
require_once('admin-header.php');

View File

@ -1,5 +1,5 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Posts');
$parent_file = 'edit.php';

View File

@ -1,5 +1,5 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = 'Add Link';
$this_file = 'link-manager.php';
@ -22,23 +22,7 @@ function category_dropdown($fieldname, $selected = 0) {
echo " </select>\n";
}
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone','cat_id', 'linkurl', 'name', 'image',
$wpvarstoreset = array('action', 'cat_id', 'linkurl', 'name', 'image',
'description', 'visible', 'target', 'category', 'link_id',
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
'notes', 'linkcheck[]');

View File

@ -1,12 +1,12 @@
<?php
// Links
// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Link Categories');
$this_file='link-categories.php';
$parent_file = 'link-manager.php';
$wpvarstoreset = array('action','standalone','cat', 'auto_toggle');
$wpvarstoreset = array('action', 'cat', 'auto_toggle');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@ -25,9 +25,6 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
switch ($action) {
case 'addcat':
{
$standalone = 1;
include_once('admin-header.php');
if ($user_level < 5)
die (__("Cheatin' uh ?"));
@ -82,9 +79,6 @@ switch ($action) {
} // end addcat
case 'Delete':
{
$standalone = 1;
include_once('admin-header.php');
$cat_id = $_GET['cat_id'];
$cat_name=get_linkcatname($cat_id);
@ -204,9 +198,6 @@ switch ($action) {
} // end Edit
case "editedcat":
{
$standalone = 1;
include_once("./admin-header.php");
if ($user_level < 5)
die (__("Cheatin' uh ?"));
@ -278,8 +269,7 @@ switch ($action) {
} // end editcat
default:
{
$standalone=0;
include_once ("./admin-header.php");
include_once ("admin-header.php");
if ($user_level < 5) {
die(__("You have do not have sufficient permissions to edit the link categories for this blog. :)"));
}

View File

@ -2,8 +2,7 @@
// Links
// Copyright (C) 2002 Mike Little -- mike@zed1.com
require_once('../wp-config.php');
require_once('admin.php');
$parent_file = 'link-manager.php';
$title = __('Import Blogroll');
$this_file = 'link-import.php';
@ -15,7 +14,6 @@ if (!$step) $step = 0;
switch ($step) {
case 0:
{
$standalone = 0;
include_once('admin-header.php');
if ($user_level < 5)
die (__("Cheatin&#8217; uh?"));
@ -72,7 +70,6 @@ switch ($step) {
} // end case 0
case 1: {
$standalone = 0;
include_once('admin-header.php');
if ($user_level < 5)
die (__("Cheatin' uh ?"));

View File

@ -2,7 +2,7 @@
// Links
// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
require_once('../wp-config.php');
require_once('admin.php');
$title = __('Manage Links');
$this_file = $parent_file = 'link-manager.php';
@ -37,23 +37,7 @@ function category_dropdown($fieldname, $selected = 0) {
echo "\n</select>\n";
}
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone','cat_id', 'linkurl', 'name', 'image',
$wpvarstoreset = array('action','cat_id', 'linkurl', 'name', 'image',
'description', 'visible', 'target', 'category', 'link_id',
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
'notes', 'linkcheck[]');
@ -83,9 +67,6 @@ if ('' != $_POST['move']) $action = 'move';
switch ($action) {
case 'assign':
{
$standalone = 1;
include_once('admin-header.php');
check_admin_referer();
// check the current user's level first.
@ -116,9 +97,6 @@ switch ($action) {
}
case 'visibility':
{
$standalone = 1;
include_once('admin-header.php');
check_admin_referer();
// check the current user's level first.
@ -156,9 +134,6 @@ switch ($action) {
}
case 'move':
{
$standalone = 1;
include_once('admin-header.php');
check_admin_referer();
// check the current user's level first.
@ -180,9 +155,6 @@ switch ($action) {
case 'Add':
{
$standalone = 1;
include_once('admin-header.php');
check_admin_referer();
$link_url = $_POST['linkurl'];
@ -230,9 +202,6 @@ switch ($action) {
}
$links_show_cat_id = $cat_id;
$standalone = 1;
include_once('admin-header.php');
check_admin_referer();
$link_id = $_POST['link_id'];
@ -276,9 +245,6 @@ switch ($action) {
case 'Delete':
{
$standalone = 1;
include_once('admin-header.php');
check_admin_referer();
$link_id = (int) $_GET['link_id'];
@ -303,7 +269,6 @@ switch ($action) {
case 'linkedit':
{
$standalone=0;
$xfn = true;
include_once ('admin-header.php');
if ($user_level < 5) {
@ -569,7 +534,6 @@ switch ($action) {
setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
setcookie('links_show_order_' . COOKIEHASH, $links_show_order, time()+600);
$standalone=0;
include_once ("./admin-header.php");
if ($user_level < 5) {
die(__("You do not have sufficient permissions to edit the links for this blog."));

51
wp-admin/menu-header.php Normal file
View File

@ -0,0 +1,51 @@
<ul id="adminmenu">
<?php
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
$self = preg_replace('|^.*/plugins/|i', '', $self);
get_admin_page_parent();
foreach ($menu as $item) {
$class = '';
// 0 = name, 1 = user_level, 2 = file
if ((substr($self, -10) == substr($item[2], -10) && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
if ($user_level >= $item[1]) {
if (
('upload.php' == $item[2] &&
get_settings('use_fileupload') &&
($user_level >= get_settings('fileupload_minlevel'))
) || 'upload.php' != $item[2])
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
}
}
?>
<li class="last"><a href="<?php echo get_settings('siteurl')
?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php printf(__('Logout (%s)'), $user_nickname) ?></a></li>
</ul>
<?php
// Sub-menu
if ( isset($submenu["$parent_file"]) ) :
?>
<ul id="adminmenu2">
<?php
foreach ($submenu["$parent_file"] as $item) :
if ($user_level < $item[1]) {
continue;
}
if ( (substr($self, -10) == substr($item[2], -10)) || (isset($plugin_page) && $plugin_page == $item[2]) ) $class = ' class="current"';
else $class = '';
if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}"))
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
else
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
endforeach;
?>
</ul>
<?php endif; ?>

View File

@ -1,5 +1,3 @@
<ul id="adminmenu">
<?php
// This array constructs the admin menu bar.
//
@ -49,47 +47,4 @@ if (! user_can_access_admin_page()) {
die( __('You have do not have sufficient permissions to access this page.') );
}
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
$self = preg_replace('|^.*/plugins/|i', '', $self);
if (!isset($parent_file)) $parent_file = '';
foreach ($menu as $item) {
$class = '';
// 0 = name, 1 = user_level, 2 = file
if ((substr($self, -10) == substr($item[2], -10) && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
if ($user_level >= $item[1]) {
if (
('upload.php' == $item[2] &&
get_settings('use_fileupload') &&
($user_level >= get_settings('fileupload_minlevel'))
) || 'upload.php' != $item[2])
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
}
}
?>
<li class="last"><a href="<?php echo get_settings('siteurl')
?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php printf(__('Logout (%s)'), $user_nickname) ?></a></li>
</ul>
<?php
// Sub-menu
if ( isset($submenu["$parent_file"]) ) :
?>
<ul id="adminmenu2">
<?php
foreach ($submenu["$parent_file"] as $item) :
if ($user_level < $item[1]) {
continue;
}
if ( substr($self, -10) == substr($item[2], -10) ) $class = ' class="current"';
else $class = '';
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
endforeach;
?>
</ul>
<?php endif; ?>

View File

@ -1,26 +1,9 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Moderate comments');
$parent_file = 'edit.php';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','item_ignored','item_deleted','item_approved');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
@ -48,9 +31,6 @@ switch($action) {
case 'update':
$standalone = 1;
require_once('admin-header.php');
if ($user_level < 3) {
die(__('<p>Your level is not high enough to moderate comments.</p>'));
}

View File

@ -1,8 +1,10 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Discussion Options');
include('options-head.php');
$parent_file = 'options-general.php';
include('admin-header.php');
if ($action == 'retrospam') {
if ( $_GET['move'] == 'true' ) {

View File

@ -1,9 +1,10 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('General Options');
$parent_file = 'options-general.php';
include('options-head.php');
include('admin-header.php');
?>
<div class="wrap">

View File

@ -1,24 +1,5 @@
<?php
$parent_file = 'options-general.php';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone', 'option_group_id');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
@ -34,13 +15,10 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
}
}
}
$standalone = 0;
include_once('admin-header.php');
?>
<br clear="all" />
<?php if (isset($updated)) : ?>
<?php if (isset($_GET['updated'])) : ?>
<div class="updated"><p><strong><?php _e('Options saved.') ?></strong></p></div>
<?php endif; ?>

View File

@ -1,8 +1,11 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Miscellaneous Options');
include('options-head.php');
$parent_file = 'options-general.php';
include('admin-header.php');
?>
<div class="wrap">

View File

@ -1,8 +1,10 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Permalink Options');
require('./options-head.php');
$parent_file = 'options-general.php';
include('admin-header.php');
$home = get_settings('home');
if ( $home != '' && $home != get_settings('siteurl') ) {

View File

@ -1,8 +1,10 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Reading Options');
include('options-head.php');
$parent_file = 'options-general.php';
include('admin-header.php');
?>
<div class="wrap">

View File

@ -1,8 +1,10 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Writing Options');
include('./options-head.php');
$parent_file = 'options-general.php';
include('admin-header.php');
?>
<div class="wrap">

View File

@ -1,28 +1,11 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Options');
$this_file = 'options.php';
$parent_file = 'options-general.php';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone');
$wpvarstoreset = array('action');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@ -41,8 +24,6 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
switch($action) {
case 'update':
$standalone = 1;
include_once('./admin-header.php');
$any_changed = 0;
if (!$_POST['page_options']) {
@ -91,14 +72,7 @@ case 'update':
break;
default:
$standalone = 0;
include_once('./admin-header.php');
if ($user_level <= 6) {
die(__("You have do not have sufficient permissions to edit the options for this blog."));
}
?>
<?php include('options-head.php'); ?>
include('admin-header.php'); ?>
<div class="wrap">
<h2>All options</h2>

View File

@ -1,9 +1,7 @@
<?php
require_once('admin.php');
if ( isset($_GET['action']) ) {
$standalone = 1;
require_once('admin-header.php');
check_admin_referer();
if ('activate' == $_GET['action']) {
@ -24,13 +22,9 @@ if ( isset($_GET['action']) ) {
}
}
require_once('../wp-includes/wp-l10n.php');
$title = __('Manage Plugins');
require_once('admin-header.php');
if ($user_level < 9) // Must be at least level 9
die (__('Sorry, you must be at least a level 8 user to modify plugins.'));
// Clean up options
// If any plugins don't exist, axe 'em

View File

@ -1,22 +1,5 @@
<?php
require_once('../wp-includes/wp-l10n.php');
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
require_once('admin.php');
$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' );
@ -37,7 +20,6 @@ if (!isset($$wpvar)) {
switch($action) {
case 'post':
$standalone = 1;
require_once('admin-header.php');
if (!user_can_create_draft($user_ID)) {
@ -183,7 +165,6 @@ case 'post':
case 'edit':
$title = __('Edit');
$standalone = 0;
require_once('admin-header.php');
$post = $post_ID = $p = (int) $_GET['post'];
@ -236,9 +217,6 @@ echo $content;
case 'editpost':
// die(var_dump('<pre>', $_POST));
$standalone = 1;
require_once('./admin-header.php');
if (!isset($blog_ID)) {
$blog_ID = 1;
}
@ -398,10 +376,6 @@ case 'editpost':
break;
case 'delete':
$standalone = 1;
require_once('./admin-header.php');
check_admin_referer();
$post_id = intval($_GET['post']);
@ -428,7 +402,6 @@ case 'delete':
case 'editcomment':
$title = __('Edit Comment');
$standalone = 0;
$parent_file = 'edit.php';
require_once ('admin-header.php');
@ -451,7 +424,6 @@ case 'editcomment':
case 'confirmdeletecomment':
$standalone = 0;
require_once('./admin-header.php');
$comment = $_GET['comment'];
@ -487,9 +459,6 @@ break;
case 'deletecomment':
$standalone = 1;
require_once('./admin-header.php');
check_admin_referer();
$comment = $_GET['comment'];
@ -520,7 +489,6 @@ break;
case 'unapprovecomment':
$standalone = 1;
require_once('./admin-header.php');
check_admin_referer();
@ -551,9 +519,6 @@ break;
case 'mailapprovecomment':
$standalone = 1;
require_once('./admin-header.php');
$comment = (int) $_GET['comment'];
$commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
@ -574,9 +539,6 @@ break;
case 'approvecomment':
$standalone = 1;
require_once('./admin-header.php');
$comment = $_GET['comment'];
$p = $_GET['p'];
if (isset($_GET['noredir'])) {
@ -606,9 +568,6 @@ break;
case 'editedcomment':
$standalone = 1;
require_once('./admin-header.php');
$comment_ID = $_POST['comment_ID'];
$comment_post_ID = $_POST['comment_post_ID'];
$newcomment_author = $_POST['newcomment_author'];
@ -653,7 +612,6 @@ case 'editedcomment':
break;
default:
$standalone = 0;
$title = __('Create New Post');
require_once ('./admin-header.php');

View File

@ -1,27 +1,10 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = "Profile";
$parent_file = 'profile.php';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone','redirect','profile','user');
$wpvarstoreset = array('action','redirect','profile','user');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {

View File

@ -1,20 +1,8 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Template &amp; file editing');
$parent_file = 'themes.php';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
function validate_file($file) {
if ('..' == substr($file,0,2))
die (__('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
@ -31,13 +19,7 @@ function validate_file($file) {
return $file;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone','redirect','profile','error','warning','a','file');
$wpvarstoreset = array('action','redirect','profile','error','warning','a','file');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@ -57,9 +39,6 @@ switch($action) {
case 'update':
$standalone = 1;
require_once('./admin-header.php');
if ($user_level < 5) {
die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>'));
}

View File

@ -1,20 +1,9 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __("Template &amp; file editing");
$parent_file = 'themes.php';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
function validate_file($file) {
if ('..' == substr($file,0,2))
die (__('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
@ -31,13 +20,7 @@ function validate_file($file) {
return $file;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone','redirect','profile','error','warning','a','file', 'theme');
$wpvarstoreset = array('action','redirect','profile','error','warning','a','file', 'theme');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@ -57,9 +40,6 @@ switch($action) {
case 'update':
$standalone = 1;
require_once("admin-header.php");
if ($user_level < 5) {
die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>'));
}

View File

@ -1,9 +1,7 @@
<?php
require_once('admin.php');
if ( isset($_GET['action']) ) {
$standalone = 1;
require_once('admin-header.php');
check_admin_referer();
if ('activate' == $_GET['action']) {
@ -21,15 +19,10 @@ if ( isset($_GET['action']) ) {
}
}
require_once('../wp-includes/wp-l10n.php');
$title = __('Manage Themes');
$parent_file = 'themes.php';
require_once('admin-header.php');
if ($user_level < 9)
die (__('Sorry, you must be at least a level 9 user to modify themes.'));
?>
<?php if ( ! validate_current_theme() ) : ?>
<div class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
<?php elseif ( isset($activated) ) : ?>

View File

@ -1,24 +1,9 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Edit User');
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$_POST = add_magic_quotes($_POST);
}
$wpvarstoreset = array('action', 'standalone', 'redirect', 'profile', 'user_id');
$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
@ -83,9 +68,6 @@ break;
case 'switchposts':
$standalone = 1;
require_once('admin-header.php');
check_admin_referer();
/* TODO: Switch all posts from one user to another user */
@ -94,7 +76,6 @@ break;
default:
$standalone = 0;
include ('admin-header.php');
$edituser = get_userdata($user_id);

View File

@ -1,5 +1,5 @@
<?php
require_once('../wp-includes/wp-l10n.php');
require_once('admin.php');
$title = __('Users');
$parent_file = 'users.php';
@ -22,9 +22,6 @@ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
switch ($action) {
case 'adduser':
$standalone = 1;
require_once('admin-header.php');
check_admin_referer();
function filter($value) {
@ -100,10 +97,6 @@ case 'adduser':
break;
case 'promote':
$standalone = 1;
require_once('admin-header.php');
check_admin_referer();
if (empty($_GET['prom'])) {
@ -135,9 +128,6 @@ break;
case 'delete':
$standalone = 1;
require_once('admin-header.php');
check_admin_referer();
$id = intval($_GET['id']);
@ -176,7 +166,6 @@ break;
default:
$standalone = 0;
include ('admin-header.php');
?>

View File

@ -2235,4 +2235,14 @@ function wp_login($username, $password, $already_md5 = false) {
}
}
function is_plugin_page() {
global $plugin_page;
if (isset($plugin_page)) {
return true;
}
return false;
}
?>