Nonces for dashboard controls.

git-svn-id: http://core.svn.wordpress.org/trunk@22930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-30 00:01:02 +00:00
parent 27d943786b
commit 24b82f2c3b
1 changed files with 2 additions and 0 deletions

View File

@ -131,6 +131,7 @@ function wp_dashboard_setup() {
}
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'] );
ob_start(); // hack - but the same hack wp-admin/widgets.php uses
wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
ob_end_clean();
@ -182,6 +183,7 @@ function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_
function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
echo '<form action="" method="post" class="dashboard-widget-control-form">';
wp_dashboard_trigger_widget_control( $meta_box['id'] );
wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'] );
echo '<input type="hidden" name="widget_id" value="' . esc_attr($meta_box['id']) . '" />';
submit_button( __('Submit') );
echo '</form>';