Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.438
diff -u -9 -p -r1.438 form.inc
--- includes/form.inc	7 Mar 2010 23:14:20 -0000	1.438
+++ includes/form.inc	8 Mar 2010 22:50:53 -0000
@@ -1421,18 +1421,41 @@ function _form_builder_handle_input_elem
     if (_form_button_was_clicked($element, $form_state)) {
       $form_state['submitted'] = $form_state['submitted'] || $element['#executes_submit_callback'];
 
       // In most cases, we want to use form_set_value() to manipulate
       // the global variables. In this special case, we want to make sure that
       // the value of this element is listed in $form_variables under 'op'.
       $form_state['values'][$element['#name']] = $element['#value'];
       $form_state['clicked_button'] = $element;
 
+      if (isset($element['#redirect'])) {
+        if (isset($_GET['destination'])) {
+          // Preserve destination parameter when redirecting.
+          $query = drupal_get_destination();
+          unset($_GET['destination']);
+          if (is_array($element['#redirect'])) {
+            list($path, $options) = $element['#redirect'];
+            if (!isset($options['query'])) {
+              $options['query'] = array();
+            }
+            $options['query'] += $query;
+            $form_state['redirect'] = array($path, $options);
+          }
+          else {
+            $form_state['redirect'] = array($element['#redirect'], array('query' => $query));
+          }
+        }
+        else {
+          $form_state['redirect'] = $element['#redirect'];
+        }
+
+        drupal_redirect_form($form_state);
+      }
       if (isset($element['#validate'])) {
         $form_state['validate_handlers'] = $element['#validate'];
       }
       if (isset($element['#submit'])) {
         $form_state['submit_handlers'] = $element['#submit'];
       }
     }
   }
   // Set the element's value in $form_state['values'], but only, if its key
Index: modules/book/book.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.pages.inc,v
retrieving revision 1.24
diff -u -9 -p -r1.24 book.pages.inc
--- modules/book/book.pages.inc	9 Jan 2010 21:54:00 -0000	1.24
+++ modules/book/book.pages.inc	8 Mar 2010 22:50:53 -0000
@@ -126,34 +126,25 @@ function book_outline_form($form, &$form
     '#value' => $node->book['original_bid'] ? t('Update book outline') : t('Add to book outline'),
     '#weight' => 15,
   );
 
   $form['remove'] = array(
     '#type' => 'submit',
     '#value' => t('Remove from book outline'),
     '#access' => $node->nid != $node->book['bid'] && $node->book['bid'],
     '#weight' => 20,
-    '#submit' => array('book_remove_button_submit'),
+    '#redirect' => 'node/' . $node->nid . '/outline/remove',
   );
 
   return $form;
 }
 
 /**
- * Button submit function to redirect to removal confirm form.
- *
- * @see book_outline_form()
- */
-function book_remove_button_submit($form, &$form_state) {
-  $form_state['redirect'] = 'node/' . $form['#node']->nid . '/outline/remove';
-}
-
-/**
  * Handles book outline form submissions from the outline tab.
  *
  * @see book_outline_form()
  */
 function book_outline_form_submit($form, &$form_state) {
   $node = $form['#node'];
   $form_state['redirect'] = "node/" . $node->nid;
   $book_link = $form_state['values']['book'];
   if (!$book_link['bid']) {
Index: modules/menu/menu.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.admin.inc,v
retrieving revision 1.76
diff -u -9 -p -r1.76 menu.admin.inc
--- modules/menu/menu.admin.inc	23 Feb 2010 10:32:10 -0000	1.76
+++ modules/menu/menu.admin.inc	8 Mar 2010 22:50:53 -0000
@@ -270,19 +270,19 @@ function menu_edit_item($form, &$form_st
       '#title' => t('Path'),
       '#default_value' => $path,
       '#description' => t('The path for this menu link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')),
       '#required' => TRUE,
     );
     $form['delete'] = array(
       '#type' => 'submit',
       '#value' => t('Delete'),
       '#access' => $item['mlid'],
-      '#submit' => array('menu_item_delete_submit'),
+      '#redirect' => 'admin/structure/menu/item/' . $item['mlid'] . '/delete',
       '#weight' => 10,
     );
   }
   else {
     $form['_path'] = array(
       '#type' => 'item',
       '#title' => t('Path'),
       '#description' => l($item['link_title'], $item['href'], $item['options']),
     );
@@ -363,25 +363,18 @@ function menu_edit_item_validate($form, 
       $item['link_path'] = $parsed_link['path'];
     }
   }
   if (!trim($item['link_path']) || !drupal_valid_path($item['link_path'], TRUE)) {
     form_set_error('link_path', t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => $item['link_path'])));
   }
 }
 
 /**
- * Submit function for the delete button on the menu item editing form.
- */
-function menu_item_delete_submit($form, &$form_state) {
-  $form_state['redirect'] = 'admin/structure/menu/item/' . $form_state['values']['mlid'] . '/delete';
-}
-
-/**
  * Process menu and menu item add/edit form submissions.
  */
 function menu_edit_item_submit($form, &$form_state) {
   $item = &$form_state['values'];
 
   // The value of "hidden" is the opposite of the value
   // supplied by the "enabled" checkbox.
   $item['hidden'] = (int) !$item['enabled'];
   unset($item['enabled']);
@@ -459,32 +452,25 @@ function menu_edit_menu($form, &$form_st
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Save'),
   );
   // Only custom menus may be deleted.
   $form['delete'] = array(
     '#type' => 'submit',
     '#value' => t('Delete'),
     '#access' => $type == 'edit' && !isset($system_menus[$menu['menu_name']]),
-    '#submit' => array('menu_custom_delete_submit'),
+    '#redirect' => 'admin/structure/menu/manage/' . $menu['menu_name'] . '/delete',
   );
 
   return $form;
 }
 
 /**
- * Submit function for the 'Delete' button on the menu editing form.
- */
-function menu_custom_delete_submit($form, &$form_state) {
-  $form_state['redirect'] = 'admin/structure/menu/manage/' . $form_state['values']['menu_name'] . '/delete';
-}
-
-/**
  * Menu callback; check access and get a confirm form for deletion of a custom menu.
  */
 function menu_delete_menu_page($menu) {
   // System-defined menus may not be deleted.
   $system_menus = menu_list_system_menus();
   if (isset($system_menus[$menu['menu_name']])) {
     drupal_access_denied();
     return;
   }
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.117
diff -u -9 -p -r1.117 node.pages.inc
--- modules/node/node.pages.inc	27 Feb 2010 20:37:11 -0000	1.117
+++ modules/node/node.pages.inc	8 Mar 2010 22:50:54 -0000
@@ -254,44 +254,30 @@ function node_form($form, &$form_state, 
     '#value' => t('Preview'),
     '#weight' => 10,
     '#submit' => array('node_form_build_preview'),
   );
   if (!empty($node->nid) && node_access('delete', $node)) {
     $form['actions']['delete'] = array(
       '#type' => 'submit',
       '#value' => t('Delete'),
       '#weight' => 15,
-      '#submit' => array('node_form_delete_submit'),
+      '#redirect' => 'node/' . $node->nid . '/delete',
     );
   }
   $form['#validate'][] = 'node_form_validate';
   $form['#theme'] = array($node->type . '_node_form', 'node_form');
 
   $form['#builder_function'] = 'node_form_submit_build_node';
   field_attach_form('node', $node, $form, $form_state, $node->language);
 
   return $form;
 }
 
-/**
- * Button submit function: handle the 'Delete' button on the node form.
- */
-function node_form_delete_submit($form, &$form_state) {
-  $destination = array();
-  if (isset($_GET['destination'])) {
-    $destination = drupal_get_destination();
-    unset($_GET['destination']);
-  }
-  $node = $form['#node'];
-  $form_state['redirect'] = array('node/' . $node->nid . '/delete', array('query' => $destination));
-}
-
-
 function node_form_build_preview($form, &$form_state) {
   $node = node_form_submit_build_node($form, $form_state);
   $form_state['node_preview'] = node_preview($node);
 }
 
 /**
  * Present a node submission form.
  *
  * @ingroup themeable
Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.42
diff -u -9 -p -r1.42 path.admin.inc
--- modules/path/path.admin.inc	3 Mar 2010 19:46:25 -0000	1.42
+++ modules/path/path.admin.inc	8 Mar 2010 22:50:54 -0000
@@ -132,38 +132,26 @@ function path_admin_form($form, &$form_s
   );
   if ($path['pid']) {
     $form['pid'] = array(
       '#type' => 'hidden',
       '#value' => $path['pid'],
     );
     $form['actions']['delete'] = array(
       '#type' => 'submit',
       '#value' => t('Delete'),
-      '#submit' => array('path_admin_form_delete_submit'),
+      '#redirect' => 'admin/config/search/path/delete/' . $path['pid'],
     );
   }
 
   return $form;
 }
 
 /**
- * Submit function for the 'Delete' button on the URL alias editing form.
- */
-function path_admin_form_delete_submit($form, &$form_state) {
-  $destination = array();
-  if (isset($_GET['destination'])) {
-    $destination = drupal_get_destination();
-    unset($_GET['destination']);
-  }
-  $form_state['redirect'] = array('admin/config/search/path/delete/' . $form_state['values']['pid'], array('query' => $destination));
-}
-
-/**
  * Verify that a URL alias is valid
  */
 function path_admin_form_validate($form, &$form_state) {
   $source = &$form_state['values']['source'];
   $source = drupal_get_normal_path($source);
   $alias = $form_state['values']['alias'];
   $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0;
   // Language is only set if locale module is enabled, otherwise save for all languages.
   $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : LANGUAGE_NONE;
@@ -244,28 +232,21 @@ function path_admin_filter_form($form, &
   $form['basic']['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Filter'),
     '#submit' => array('path_admin_filter_form_submit_filter'),
     );
   if ($keys) {
     $form['basic']['reset'] = array(
       '#type' => 'submit',
       '#value' => t('Reset'),
-      '#submit' => array('path_admin_filter_form_submit_reset'),
+      '#redirect' => 'admin/config/search/path/list',
     );
   }
   return $form;
 }
 
 /**
  * Process filter form submission when the Filter button is pressed.
  */
 function path_admin_filter_form_submit_filter($form, &$form_state) {
   $form_state['redirect'] = 'admin/config/search/path/list/' . trim($form_state['values']['filter']);
 }
-
-/**
- * Process filter form submission when the Reset button is pressed.
- */
-function path_admin_filter_form_submit_reset($form, &$form_state) {
-  $form_state['redirect'] = 'admin/config/search/path/list';
-}
Index: modules/search/search.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.admin.inc,v
retrieving revision 1.14
diff -u -9 -p -r1.14 search.admin.inc
--- modules/search/search.admin.inc	30 Jan 2010 07:59:25 -0000	1.14
+++ modules/search/search.admin.inc	8 Mar 2010 22:50:54 -0000
@@ -65,19 +65,23 @@ function search_admin_settings($form) {
       $total += $status['total'];
     }
   }
 
   $count = format_plural($remaining, 'There is 1 item left to index.', 'There are @count items left to index.');
   $percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%';
   $status = '<p><strong>' . t('%percentage of the site has been indexed.', array('%percentage' => $percentage)) . ' ' . $count . '</strong></p>';
   $form['status'] = array('#type' => 'fieldset', '#title' => t('Indexing status'));
   $form['status']['status'] = array('#markup' => $status);
-  $form['status']['wipe'] = array('#type' => 'submit', '#value' => t('Re-index site'), '#submit' => array('search_admin_reindex_submit'));
+  $form['status']['wipe'] = array(
+    '#type' => 'submit',
+    '#value' => t('Re-index site'),
+    '#redirect' => 'admin/config/search/settings/reindex',
+  );
 
   $items = drupal_map_assoc(array(10, 20, 50, 100, 200, 500));
 
   // Indexing throttle:
   $form['indexing_throttle'] = array(
     '#type' => 'fieldset',
     '#title' => t('Indexing throttle')
   );
   $form['indexing_throttle']['search_cron_limit'] = array(
@@ -151,17 +155,9 @@ function search_admin_settings_submit($f
   }
   else {
     $new_modules = array_filter($form_state['values']['search_active_modules']);
   }
   if (array_diff($current_modules, $new_modules)) {
     drupal_set_message(t('The active search modules have been changed.'));
     variable_set('menu_rebuild_needed', TRUE);
   }
 }
-
-/**
- * Submit callback.
- */
-function search_admin_reindex_submit($form, &$form_state) {
-  // send the user to the confirmation page
-  $form_state['redirect'] = 'admin/config/search/settings/reindex';
-}
Index: modules/user/user.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v
retrieving revision 1.68
diff -u -9 -p -r1.68 user.pages.inc
--- modules/user/user.pages.inc	28 Feb 2010 20:10:34 -0000	1.68
+++ modules/user/user.pages.inc	8 Mar 2010 22:50:54 -0000
@@ -255,19 +255,19 @@ function user_profile_form($form, &$form
     '#type' => 'submit',
     '#value' => t('Save'),
     '#weight' => 30,
   );
   if ($category == 'account') {
     $form['cancel'] = array(
       '#type' => 'submit',
       '#value' => t('Cancel account'),
       '#weight' => 31,
-      '#submit' => array('user_edit_cancel_submit'),
+      '#redirect' => 'user/' . $account->uid . '/cancel',
       '#access' => $account->uid > 1 && (($account->uid == $user->uid && user_access('cancel account')) || user_access('administer users')),
     );
   }
 
   $form['#validate'][] = 'user_profile_form_validate';
   // Add the final user profile form submit handler.
   $form['#submit'][] = 'user_profile_form_submit';
 
   return $form;
@@ -302,35 +302,21 @@ function user_profile_form_submit($form,
     unset($_SESSION['pass_reset_'. $account->uid]);
   }
   // Clear the page cache because pages can contain usernames and/or profile information:
   cache_clear_all();
 
   drupal_set_message(t('The changes have been saved.'));
 }
 
 /**
- * Submit function for the 'Cancel account' button on the user edit form.
- */
-function user_edit_cancel_submit($form, &$form_state) {
-  $destination = array();
-  if (isset($_GET['destination'])) {
-    $destination = drupal_get_destination();
-    unset($_GET['destination']);
-  }
-  // Note: We redirect from user/uid/edit to user/uid/cancel to make the tabs disappear.
-  $form_state['redirect'] = array("user/" . $form['#user']->uid . "/cancel", array('query' => $destination));
-}
-
-/**
  * Form builder; confirm form for cancelling user account.
  *
  * @ingroup forms
- * @see user_edit_cancel_submit()
  */
 function user_cancel_confirm_form($form, &$form_state, $account) {
   global $user;
 
   $form['_account'] = array('#type' => 'value', '#value' => $account);
 
   // Display account cancellation method selection, if allowed.
   $default_method = variable_get('user_cancel_method', 'user_cancel_block');
   $admin_access = user_access('administer users');
