diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 0f9111bae7..dd4d40ccea 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -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; - - $submenu['options-general.php'][] = array($title, $access_level, $file); + 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; + + $file = basename($file); + + $submenu['options-general.php'][] = array($menu_title, $access_level, $file, $page_title); } ?> \ No newline at end of file diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index a3c9a64797..8c573a8253 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -1,54 +1,10 @@ -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 + + <?php bloginfo('name') ?> › <?php echo $title; ?> — WordPress - - + + @@ -119,6 +75,9 @@ window.onload = blurry; \ No newline at end of file diff --git a/wp-admin/admin.php b/wp-admin/admin.php new file mode 100644 index 0000000000..e903425c4c --- /dev/null +++ b/wp-admin/admin.php @@ -0,0 +1,71 @@ +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 \ No newline at end of file diff --git a/wp-admin/categories.php b/wp-admin/categories.php index 04f7cfdb40..235ba2008d 100644 --- a/wp-admin/categories.php +++ b/wp-admin/categories.php @@ -1,27 +1,10 @@ $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; $iAsk for a promotion to your blog admin. :)"), get_settings('admin_email'))); diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 6d074bef6c..21aed3465c 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -1,5 +1,5 @@ \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[]'); diff --git a/wp-admin/link-categories.php b/wp-admin/link-categories.php index 6a2972331e..00a7e82cd3 100644 --- a/wp-admin/link-categories.php +++ b/wp-admin/link-categories.php @@ -1,12 +1,12 @@ \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.")); diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php new file mode 100644 index 0000000000..7c1696e73f --- /dev/null +++ b/wp-admin/menu-header.php @@ -0,0 +1,51 @@ +
    += $item[1]) { + if ( +('upload.php' == $item[2] && +get_settings('use_fileupload') && +($user_level >= get_settings('fileupload_minlevel')) + ) || 'upload.php' != $item[2]) + echo "\n\t
  • {$item[0]}
  • "; + } +} + +?> +
  • +
+ + + + \ No newline at end of file diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 9b02ddf11e..b03bf86b0b 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -1,5 +1,3 @@ - -
    = $item[1]) { - if ( -('upload.php' == $item[2] && -get_settings('use_fileupload') && -($user_level >= get_settings('fileupload_minlevel')) - ) || 'upload.php' != $item[2]) - echo "\n\t
  • {$item[0]}
  • "; - } -} - -?> -
  • -
- - - - \ No newline at end of file +?> \ No newline at end of file diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php index 7555f1c0fc..a35ec17fa3 100644 --- a/wp-admin/moderation.php +++ b/wp-admin/moderation.php @@ -1,26 +1,9 @@ $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; $iYour level is not high enough to moderate comments.

')); } diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php index 837fa44915..dd87e9b586 100644 --- a/wp-admin/options-discussion.php +++ b/wp-admin/options-discussion.php @@ -1,8 +1,10 @@
diff --git a/wp-admin/options-head.php b/wp-admin/options-head.php index 032ea2cef3..7fc54d6e71 100644 --- a/wp-admin/options-head.php +++ b/wp-admin/options-head.php @@ -1,24 +1,5 @@ $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
- +

\ No newline at end of file diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index c5e0f59cca..212665cc64 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.php @@ -1,8 +1,11 @@
diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index 4ed1612916..ca783138a3 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -1,8 +1,10 @@
diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index d4901a9be3..51af061724 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -1,8 +1,10 @@
diff --git a/wp-admin/options.php b/wp-admin/options.php index 610e54c857..5174f2fe95 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -1,28 +1,11 @@ $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 - - + include('admin-header.php'); ?>

All options

diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index 958f361ad6..acfc6a9f84 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -1,9 +1,7 @@ $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('
', $_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. Go back!'), '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');
 
diff --git a/wp-admin/profile.php b/wp-admin/profile.php
index 4084ae4398..b27cfd737b 100644
--- a/wp-admin/profile.php
+++ b/wp-admin/profile.php
@@ -1,27 +1,10 @@
  $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 $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’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; $iYou have do not have sufficient permissions to edit templates for this blog.

')); } diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php index d7eebb0db1..8df1f805fe 100644 --- a/wp-admin/theme-editor.php +++ b/wp-admin/theme-editor.php @@ -1,20 +1,9 @@ $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’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; $iYou have do not have sufficient permissions to edit templates for this blog.

')); } diff --git a/wp-admin/themes.php b/wp-admin/themes.php index ec605fa5d4..a486920cc7 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -1,9 +1,7 @@ -

diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 1166621f9f..3524e44541 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -1,24 +1,9 @@ $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 diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 8a73e7772d..b1add00d47 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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; +} + ?>