summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-02-10 05:25:57 +0000
committerDries Buytaert <dries@buytaert.net>2006-02-10 05:25:57 +0000
commit583d5a4ee95a583184f39497a44062599ad6e1d7 (patch)
treecdefa73496e1140b7856f4a2fe869b5962b08eac
parent91152ba7af96b8f7125cc54a268f0056435908a1 (diff)
downloadbrdo-583d5a4ee95a583184f39497a44062599ad6e1d7.tar.gz
brdo-583d5a4ee95a583184f39497a44062599ad6e1d7.tar.bz2
- Patch #48622 by adrian: remove drupal_goto from _submit functions.
-rw-r--r--includes/common.inc2
-rw-r--r--includes/form.inc23
-rw-r--r--includes/menu.inc4
-rw-r--r--misc/drupal.css15
-rw-r--r--modules/aggregator.module1
-rw-r--r--modules/aggregator/aggregator.module1
-rw-r--r--modules/block.module6
-rw-r--r--modules/block/block.module6
-rw-r--r--modules/comment.module2
-rw-r--r--modules/comment/comment.module2
-rw-r--r--modules/contact.module6
-rw-r--r--modules/contact/contact.module6
-rw-r--r--modules/node.module17
-rw-r--r--modules/node/node.module17
-rw-r--r--modules/path.module4
-rw-r--r--modules/path/path.module4
-rw-r--r--modules/search.module2
-rw-r--r--modules/search/search.module2
-rw-r--r--modules/system.module7
-rw-r--r--modules/system/system.module7
-rw-r--r--modules/user.module18
-rw-r--r--modules/user/user.module18
22 files changed, 85 insertions, 85 deletions
diff --git a/includes/common.inc b/includes/common.inc
index aead0a2d7..52088a12f 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1193,7 +1193,7 @@ function drupal_to_js($var) {
}
return '[ '. implode(', ', $output) .' ]';
}
- // Fall through
+ // Fall through
case 'object':
$output = array();
foreach ($var as $k => $v) {
diff --git a/includes/form.inc b/includes/form.inc
index 66159313f..fa2fdef49 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -103,11 +103,24 @@ function drupal_get_form($form_id, &$form, $callback = NULL) {
}
$form = _form_builder($form_id, $form);
-
+ $goto = $_GET['q'];
if (!empty($_POST['edit']) && (($_POST['edit']['form_id'] == $form_id) || ($_POST['edit']['form_id'] == $callback))) {
drupal_validate_form($form_id, $form, $callback);
if ($form_submitted && !form_get_errors()) {
- drupal_submit_form($form_id, $form, $callback);
+ $redirect = drupal_submit_form($form_id, $form, $callback);
+ if (!is_null($redirect)) {
+ $goto = $redirect;
+ }
+ else if ($form['#redirect']) {
+ $goto = $form['#redirect'];
+ }
+
+ if (is_array($goto)) {
+ call_user_func_array('drupal_goto', $redirect);
+ }
+ else {
+ drupal_goto(drupal_get_path_alias($goto));
+ }
}
}
@@ -136,14 +149,18 @@ function drupal_validate_form($form_id, &$form, $callback = NULL) {
function drupal_submit_form($form_id, $form, $callback = NULL) {
global $form_values;
+ $goto = null;
unset($GLOBALS['form_values']['submit'], $GLOBALS['form_values']['form_id']);
if (isset($form['#submit'])) {
foreach ($form['#submit'] as $function => $args) {
if (function_exists($function)) {
- call_user_func_array($function, $args);
+ // Since we can only redirect to one page, only the last redirect will work
+ $redirect = call_user_func_array($function, $args);
+ $goto = (!is_null($redirect)) ? $redirect : $goto;
}
}
}
+ return $goto;
}
function _form_validate($elements, $form_id = NULL) {
diff --git a/includes/menu.inc b/includes/menu.inc
index 5c961cca4..d224dc824 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -998,8 +998,8 @@ function _menu_sort($a, $b) {
elseif ($a['weight'] > $b['weight']) {
return 1;
}
- elseif (isset($a['title']) && isset($b['title']) && ($a['title'] < $b['title'])) {
- return -1;
+ elseif (isset($a['title']) && isset($b['title'])) {
+ return strnatcasecmp($a['title'], $b['title']);
}
else {
return 1;
diff --git a/misc/drupal.css b/misc/drupal.css
index e7f2baa74..9b21676cd 100644
--- a/misc/drupal.css
+++ b/misc/drupal.css
@@ -291,7 +291,20 @@ tr.odd .form-item, tr.even .form-item {
#forum td.posts, #forum td.topics, #forum td.replies, #forum td.pager {
text-align: center;
}
-
+.forum-topic-navigation {
+ padding: 1em 0 0 3em;
+ border-top: 1px solid #888;
+ border-bottom: 1px solid #888;
+ text-align: center;
+ padding: 0.5em;
+}
+.forum-topic-navigation .topic-previous {
+ margin-right: 4em;
+ text-align: right;
+}
+.forum-topic-navigation .topic-next {
+ text-align: left;
+}
.locale-untranslated {
font-style: normal;
text-decoration: line-through;
diff --git a/modules/aggregator.module b/modules/aggregator.module
index bed247589..0556c4104 100644
--- a/modules/aggregator.module
+++ b/modules/aggregator.module
@@ -1013,7 +1013,6 @@ function aggregator_page_list_submit($form_id, $form) {
}
}
drupal_set_message(t('The categories have been saved.'));
- drupal_goto($_GET['q']);
}
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index bed247589..0556c4104 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -1013,7 +1013,6 @@ function aggregator_page_list_submit($form_id, $form) {
}
}
drupal_set_message(t('The categories have been saved.'));
- drupal_goto($_GET['q']);
}
diff --git a/modules/block.module b/modules/block.module
index a39a9fdf2..449c46910 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -406,7 +406,7 @@ function block_admin_configure_submit($form_id, $form_values) {
module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values);
drupal_set_message(t('The block configuration has been saved.'));
cache_clear_all();
- drupal_goto('admin/block');
+ return 'admin/block';
}
}
@@ -430,7 +430,7 @@ function block_box_add_submit($form_id, $form_values) {
if (!form_get_errors()) {
if (block_box_save($form_values)) {
drupal_set_message(t('The block has been created.'));
- drupal_goto('admin/block');
+ return 'admin/block';
}
}
}
@@ -453,7 +453,7 @@ function block_box_delete_confirm_submit($form_id, $form_values) {
db_query('DELETE FROM {boxes} WHERE bid = %d', $form_values['bid']);
drupal_set_message(t('The block %name has been removed.', array('%name' => theme('placeholder', $form_values['info']))));
cache_clear_all();
- drupal_goto('admin/block');
+ return 'admin/block';
};
function block_box_form($edit = array()) {
diff --git a/modules/block/block.module b/modules/block/block.module
index a39a9fdf2..449c46910 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -406,7 +406,7 @@ function block_admin_configure_submit($form_id, $form_values) {
module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values);
drupal_set_message(t('The block configuration has been saved.'));
cache_clear_all();
- drupal_goto('admin/block');
+ return 'admin/block';
}
}
@@ -430,7 +430,7 @@ function block_box_add_submit($form_id, $form_values) {
if (!form_get_errors()) {
if (block_box_save($form_values)) {
drupal_set_message(t('The block has been created.'));
- drupal_goto('admin/block');
+ return 'admin/block';
}
}
}
@@ -453,7 +453,7 @@ function block_box_delete_confirm_submit($form_id, $form_values) {
db_query('DELETE FROM {boxes} WHERE bid = %d', $form_values['bid']);
drupal_set_message(t('The block %name has been removed.', array('%name' => theme('placeholder', $form_values['info']))));
cache_clear_all();
- drupal_goto('admin/block');
+ return 'admin/block';
};
function block_box_form($edit = array()) {
diff --git a/modules/comment.module b/modules/comment.module
index d34f0fcd9..13fedb752 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1413,7 +1413,7 @@ function _comment_form_submit($form_values) {
function comment_form_submit($form_id, $form_values) {
$form_values = _comment_form_submit($form_values);
if ($cid = comment_save($form_values)) {
- drupal_goto('node/'. $form_values['nid'], NULL, "comment-$cid");
+ return array('node/'. $form_values['nid'], NULL, "comment-$cid");
}
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index d34f0fcd9..13fedb752 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1413,7 +1413,7 @@ function _comment_form_submit($form_values) {
function comment_form_submit($form_id, $form_values) {
$form_values = _comment_form_submit($form_values);
if ($cid = comment_save($form_values)) {
- drupal_goto('node/'. $form_values['nid'], NULL, "comment-$cid");
+ return array('node/'. $form_values['nid'], NULL, "comment-$cid");
}
}
diff --git a/modules/contact.module b/modules/contact.module
index 75ace56c4..00bbc10d0 100644
--- a/modules/contact.module
+++ b/modules/contact.module
@@ -199,7 +199,7 @@ function contact_mail_user_submit($form_id, $edit) {
drupal_set_message(t('The message has been sent.'));
// Jump to the user's profile page:
- drupal_goto("user/$account->uid");
+ return "user/$account->uid";
}
function contact_admin_edit($cid = NULL) {
@@ -285,7 +285,7 @@ function contact_admin_edit_submit($form_id, $form_values) {
db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid=%d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']);
}
drupal_set_message(t('Category %category has been updated.', array('%category' => theme('placeholder', $edit['category']))));
- drupal_goto('admin/contact');
+ return 'admin/contact';
}
function contact_admin_delete($cid) {
@@ -453,5 +453,5 @@ function contact_mail_page_submit($form_id, $edit) {
drupal_set_message(t('Your message has been sent.'));
// Jump to contact page:
- drupal_goto('contact');
+ return 'contact';
}
diff --git a/modules/contact/contact.module b/modules/contact/contact.module
index 75ace56c4..00bbc10d0 100644
--- a/modules/contact/contact.module
+++ b/modules/contact/contact.module
@@ -199,7 +199,7 @@ function contact_mail_user_submit($form_id, $edit) {
drupal_set_message(t('The message has been sent.'));
// Jump to the user's profile page:
- drupal_goto("user/$account->uid");
+ return "user/$account->uid";
}
function contact_admin_edit($cid = NULL) {
@@ -285,7 +285,7 @@ function contact_admin_edit_submit($form_id, $form_values) {
db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid=%d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']);
}
drupal_set_message(t('Category %category has been updated.', array('%category' => theme('placeholder', $edit['category']))));
- drupal_goto('admin/contact');
+ return 'admin/contact';
}
function contact_admin_delete($cid) {
@@ -453,5 +453,5 @@ function contact_mail_page_submit($form_id, $edit) {
drupal_set_message(t('Your message has been sent.'));
// Jump to contact page:
- drupal_goto('contact');
+ return 'contact';
}
diff --git a/modules/node.module b/modules/node.module
index 4b5dfbc0c..4cf89859d 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1093,7 +1093,7 @@ function node_filter_form_submit() {
return;
}
if ($op != '') {
- drupal_goto('admin/node');
+ return 'admin/node';
}
}
@@ -1111,7 +1111,7 @@ function node_admin_nodes_submit($form_id, $edit) {
}
}
drupal_set_message(t('The update has been performed.'));
- drupal_goto('admin/node');
+ return 'admin/node';
}
}
@@ -1227,7 +1227,7 @@ function node_multiple_delete_confirm_submit($form_id, $edit) {
}
drupal_set_message(t('The items have been deleted.'));
}
- drupal_goto('admin/node');
+ return 'admin/node';
}
/**
@@ -1865,14 +1865,8 @@ function node_form_submit($form_id, $edit) {
drupal_set_message(t('Your %post was created.', array ('%post' => node_get_name($node))));
}
}
-
- if ($node->nid) {
- if (node_access('view', $node)) {
- drupal_goto('node/'. $node->nid);
- }
- else {
- drupal_goto();
- }
+ if ($node->nid && node_access('view', $node)) {
+ return 'node/'. $node->nid;
}
}
@@ -1901,7 +1895,6 @@ function node_delete_confirm() {
function node_delete_confirm_submit($form_id, $form_values) {
if ($form_values['confirm']) {
node_delete($form_values['nid']);
- drupal_goto();
}
}
diff --git a/modules/node/node.module b/modules/node/node.module
index 4b5dfbc0c..4cf89859d 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1093,7 +1093,7 @@ function node_filter_form_submit() {
return;
}
if ($op != '') {
- drupal_goto('admin/node');
+ return 'admin/node';
}
}
@@ -1111,7 +1111,7 @@ function node_admin_nodes_submit($form_id, $edit) {
}
}
drupal_set_message(t('The update has been performed.'));
- drupal_goto('admin/node');
+ return 'admin/node';
}
}
@@ -1227,7 +1227,7 @@ function node_multiple_delete_confirm_submit($form_id, $edit) {
}
drupal_set_message(t('The items have been deleted.'));
}
- drupal_goto('admin/node');
+ return 'admin/node';
}
/**
@@ -1865,14 +1865,8 @@ function node_form_submit($form_id, $edit) {
drupal_set_message(t('Your %post was created.', array ('%post' => node_get_name($node))));
}
}
-
- if ($node->nid) {
- if (node_access('view', $node)) {
- drupal_goto('node/'. $node->nid);
- }
- else {
- drupal_goto();
- }
+ if ($node->nid && node_access('view', $node)) {
+ return 'node/'. $node->nid;
}
}
@@ -1901,7 +1895,6 @@ function node_delete_confirm() {
function node_delete_confirm_submit($form_id, $form_values) {
if ($form_values['confirm']) {
node_delete($form_values['nid']);
- drupal_goto();
}
}
diff --git a/modules/path.module b/modules/path.module
index 816fd1c1e..004f647d6 100644
--- a/modules/path.module
+++ b/modules/path.module
@@ -117,7 +117,7 @@ function path_admin_delete_confirm($pid) {
function path_admin_delete_confirm_submit($form_id, $form_values) {
if ($form_values['confirm']) {
path_admin_delete($form_values['pid']);
- drupal_goto('admin/path');
+ return 'admin/path';
}
}
@@ -342,7 +342,7 @@ function path_form_submit() {
path_set_alias($src, $dst, $pid);
drupal_set_message(t('The alias has been saved.'));
- drupal_goto('admin/path');
+ return 'admin/path';
}
}
diff --git a/modules/path/path.module b/modules/path/path.module
index 816fd1c1e..004f647d6 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -117,7 +117,7 @@ function path_admin_delete_confirm($pid) {
function path_admin_delete_confirm_submit($form_id, $form_values) {
if ($form_values['confirm']) {
path_admin_delete($form_values['pid']);
- drupal_goto('admin/path');
+ return 'admin/path';
}
}
@@ -342,7 +342,7 @@ function path_form_submit() {
path_set_alias($src, $dst, $pid);
drupal_set_message(t('The alias has been saved.'));
- drupal_goto('admin/path');
+ return 'admin/path';
}
}
diff --git a/modules/search.module b/modules/search.module
index a51a83f01..18d1f9cf9 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -245,7 +245,7 @@ function search_wipe_confirm_submit($form_id, &$form) {
if ($form['confirm']) {
search_wipe();
drupal_set_message(t('The index will be rebuilt.'));
- drupal_goto('admin/settings/search');
+ return 'admin/settings/search';
}
}
diff --git a/modules/search/search.module b/modules/search/search.module
index a51a83f01..18d1f9cf9 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -245,7 +245,7 @@ function search_wipe_confirm_submit($form_id, &$form) {
if ($form['confirm']) {
search_wipe();
drupal_set_message(t('The index will be rebuilt.'));
- drupal_goto('admin/settings/search');
+ return 'admin/settings/search';
}
}
diff --git a/modules/system.module b/modules/system.module
index e90d59a1d..e5559180a 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -55,7 +55,7 @@ function system_perm() {
*/
function system_elements() {
// Top level form
- $type['form'] = array('#method' => 'post', '#action' => request_uri());
+ $type['form'] = array('#method' => 'post', '#action' => request_uri(), '#redirect' => '');
// Inputs
$type['checkbox'] = array('#input' => TRUE, '#return_value' => 1);
@@ -787,7 +787,6 @@ function system_settings_form_submit($form_id, $values) {
drupal_set_message(t('The configuration options have been saved.'));
}
menu_rebuild();
- drupal_goto($_GET['q']);
}
/**
@@ -887,7 +886,7 @@ function system_themes_submit($form_id, $values) {
menu_rebuild();
drupal_set_message(t('The configuration options have been saved.'));
- drupal_goto('admin/themes');
+ return 'admin/themes';
}
/**
@@ -1021,7 +1020,7 @@ function system_modules_submit($form_id, $edit) {
}
drupal_set_message(t('The configuration options have been saved.'));
- drupal_goto('admin/modules');
+ return 'admin/modules';
}
diff --git a/modules/system/system.module b/modules/system/system.module
index e90d59a1d..e5559180a 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -55,7 +55,7 @@ function system_perm() {
*/
function system_elements() {
// Top level form
- $type['form'] = array('#method' => 'post', '#action' => request_uri());
+ $type['form'] = array('#method' => 'post', '#action' => request_uri(), '#redirect' => '');
// Inputs
$type['checkbox'] = array('#input' => TRUE, '#return_value' => 1);
@@ -787,7 +787,6 @@ function system_settings_form_submit($form_id, $values) {
drupal_set_message(t('The configuration options have been saved.'));
}
menu_rebuild();
- drupal_goto($_GET['q']);
}
/**
@@ -887,7 +886,7 @@ function system_themes_submit($form_id, $values) {
menu_rebuild();
drupal_set_message(t('The configuration options have been saved.'));
- drupal_goto('admin/themes');
+ return 'admin/themes';
}
/**
@@ -1021,7 +1020,7 @@ function system_modules_submit($form_id, $edit) {
}
drupal_set_message(t('The configuration options have been saved.'));
- drupal_goto('admin/modules');
+ return 'admin/modules';
}
diff --git a/modules/user.module b/modules/user.module
index 86e63e43e..388f33169 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -895,9 +895,6 @@ function user_login_submit($form_id, $form_values) {
db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $user->uid);
user_module_invoke('login', $form_values, $user);
-
- // Redirect the user to the page he logged on from.
- drupal_goto();
}
}
@@ -1012,7 +1009,7 @@ function user_pass_submit($form_id, $form_values) {
watchdog('user', t('Error mailing password reset instructions to %name at %email.', array('%name' => theme('placeholder', $account->name), '%email' => theme('placeholder', $account->mail))), WATCHDOG_ERROR);
drupal_set_message(t('Unable to send mail. Please contact the site admin.'));
}
- drupal_goto('user');
+ return 'user';
}
function theme_user_pass($form) {
@@ -1135,7 +1132,7 @@ function user_register_submit($form_id, $form_values) {
if (!$admin && array_intersect(array_keys($form_values), array('uid', 'roles', 'init', 'session', 'status'))) {
watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING);
- drupal_goto('user/register');
+ return 'user/register';
}
$account = user_save('', array_merge($form_values, array('pass' => $pass, 'init' => $mail, 'status' => ($admin || variable_get('user_register', 1) == 1))));
@@ -1153,13 +1150,13 @@ function user_register_submit($form_id, $form_values) {
include_once './includes/install.inc';
drupal_set_installed_schema_version('system', max(drupal_get_schema_versions('system')));
- drupal_goto('user/1/edit');
+ return 'user/1/edit';
}
else {
if ($admin) {
drupal_set_message(t('Created a new user account. No e-mail has been sent.'));
- drupal_goto('admin/user');
+ return 'admin/user';
}
else if ($account->status) {
// Create new user account, no administrator approval required.
@@ -1168,7 +1165,6 @@ function user_register_submit($form_id, $form_values) {
user_mail($mail, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
drupal_set_message(t('Your password and further instructions have been sent to your e-mail address.'));
- drupal_goto();
}
else {
// Create new user account, administrator approval required.
@@ -1179,7 +1175,6 @@ function user_register_submit($form_id, $form_values) {
user_mail(variable_get('site_mail', ini_get('sendmail_from')), $subject, t("%u has applied for an account.\n\n%uri", array('%u' => $account->name, '%uri' => url("user/$account->uid/edit", NULL, NULL, TRUE))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
drupal_set_message(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.<br />In the meantime, your password and further instructions have been sent to your e-mail address.'));
- drupal_goto();
}
}
}
@@ -1328,7 +1323,7 @@ function user_edit_submit($form_id, $form_values) {
// Delete that user's menu cache.
cache_clear_all('menu:'. $account->uid, TRUE);
drupal_set_message(t('The changes have been saved.'));
- drupal_goto('user/'. $account->uid);
+ return 'user/'. $account->uid;
}
function user_view($uid = 0) {
@@ -1497,7 +1492,7 @@ function user_admin_access_delete($aid = 0) {
function user_admin_access_delete_confirm_submit($form_id, $edit) {
db_query('DELETE FROM {access} WHERE aid = %d', $edit['aid']);
drupal_set_message(t('The access rule has been deleted.'));
- drupal_goto('admin/access/rules');
+ return 'admin/access/rules';
}
/**
@@ -1705,7 +1700,6 @@ function user_admin_perm_submit($form_id, $edit) {
// Clear the cached pages and menus:
menu_rebuild();
- drupal_goto($_GET['q']);
}
/**
diff --git a/modules/user/user.module b/modules/user/user.module
index 86e63e43e..388f33169 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -895,9 +895,6 @@ function user_login_submit($form_id, $form_values) {
db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $user->uid);
user_module_invoke('login', $form_values, $user);
-
- // Redirect the user to the page he logged on from.
- drupal_goto();
}
}
@@ -1012,7 +1009,7 @@ function user_pass_submit($form_id, $form_values) {
watchdog('user', t('Error mailing password reset instructions to %name at %email.', array('%name' => theme('placeholder', $account->name), '%email' => theme('placeholder', $account->mail))), WATCHDOG_ERROR);
drupal_set_message(t('Unable to send mail. Please contact the site admin.'));
}
- drupal_goto('user');
+ return 'user';
}
function theme_user_pass($form) {
@@ -1135,7 +1132,7 @@ function user_register_submit($form_id, $form_values) {
if (!$admin && array_intersect(array_keys($form_values), array('uid', 'roles', 'init', 'session', 'status'))) {
watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING);
- drupal_goto('user/register');
+ return 'user/register';
}
$account = user_save('', array_merge($form_values, array('pass' => $pass, 'init' => $mail, 'status' => ($admin || variable_get('user_register', 1) == 1))));
@@ -1153,13 +1150,13 @@ function user_register_submit($form_id, $form_values) {
include_once './includes/install.inc';
drupal_set_installed_schema_version('system', max(drupal_get_schema_versions('system')));
- drupal_goto('user/1/edit');
+ return 'user/1/edit';
}
else {
if ($admin) {
drupal_set_message(t('Created a new user account. No e-mail has been sent.'));
- drupal_goto('admin/user');
+ return 'admin/user';
}
else if ($account->status) {
// Create new user account, no administrator approval required.
@@ -1168,7 +1165,6 @@ function user_register_submit($form_id, $form_values) {
user_mail($mail, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
drupal_set_message(t('Your password and further instructions have been sent to your e-mail address.'));
- drupal_goto();
}
else {
// Create new user account, administrator approval required.
@@ -1179,7 +1175,6 @@ function user_register_submit($form_id, $form_values) {
user_mail(variable_get('site_mail', ini_get('sendmail_from')), $subject, t("%u has applied for an account.\n\n%uri", array('%u' => $account->name, '%uri' => url("user/$account->uid/edit", NULL, NULL, TRUE))), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
drupal_set_message(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.<br />In the meantime, your password and further instructions have been sent to your e-mail address.'));
- drupal_goto();
}
}
}
@@ -1328,7 +1323,7 @@ function user_edit_submit($form_id, $form_values) {
// Delete that user's menu cache.
cache_clear_all('menu:'. $account->uid, TRUE);
drupal_set_message(t('The changes have been saved.'));
- drupal_goto('user/'. $account->uid);
+ return 'user/'. $account->uid;
}
function user_view($uid = 0) {
@@ -1497,7 +1492,7 @@ function user_admin_access_delete($aid = 0) {
function user_admin_access_delete_confirm_submit($form_id, $edit) {
db_query('DELETE FROM {access} WHERE aid = %d', $edit['aid']);
drupal_set_message(t('The access rule has been deleted.'));
- drupal_goto('admin/access/rules');
+ return 'admin/access/rules';
}
/**
@@ -1705,7 +1700,6 @@ function user_admin_perm_submit($form_id, $edit) {
// Clear the cached pages and menus:
menu_rebuild();
- drupal_goto($_GET['q']);
}
/**