From b764af371770e70b33d47365a695c084b6762e80 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 26 Jul 2006 22:56:56 +0000 Subject: [PATCH] Menu and plugin tweaks. git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4051 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-functions.php | 23 ++++++++++++++++------- wp-admin/admin.php | 12 +++++++++--- wp-content/plugins/wp-db-backup.php | 7 +++++-- xmlrpc.php | 4 +++- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 60ede19a67..6b9be7541b 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -361,7 +361,7 @@ function edit_user($user_id = 0) { if (isset ($_POST['pass2'])) $pass2 = $_POST['pass2']; - if (isset ($_POST['role'])) { + if (isset ($_POST['role']) && current_user_can('edit_users')) { if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users')) $user->role = $_POST['role']; } @@ -1214,6 +1214,7 @@ function user_can_access_admin_page() { global $pagenow; global $menu; global $submenu; + global $plugin_page; $parent = get_admin_page_parent(); @@ -1229,15 +1230,23 @@ function user_can_access_admin_page() { } if (isset ($submenu[$parent])) { - foreach ($submenu[$parent] as $submenu_array) { - if ($submenu_array[2] == $pagenow) { - if (!current_user_can($submenu_array[1])) { - return false; - } else { - return true; + if ( isset($plugin_page) ) { + foreach ($submenu[$parent] as $submenu_array) { + if ( $submenu_array[2] == $plugin_page ) { + if (!current_user_can($submenu_array[1])) + return false; } } } + + foreach ($submenu[$parent] as $submenu_array) { + if ($submenu_array[2] == $pagenow) { + if (!current_user_can($submenu_array[1])) + return false; + else + return true; + } + } } return true; diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 29726d0fa8..756cc48062 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -42,12 +42,15 @@ for ($i=0; $iescape( $pagelinkedfrom ); $original_title = $title; - $comment_post_ID = $post_ID; + $comment_post_ID = (int) $post_ID; $comment_author = $title; + $this->escape($comment_author); $comment_author_url = $pagelinkedfrom; $comment_content = $context; + $this->escape($comment_content); $comment_type = 'pingback'; $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type');