diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/comment.module | 15 | ||||
-rw-r--r-- | modules/comment/comment.module | 15 | ||||
-rw-r--r-- | modules/path.module | 3 | ||||
-rw-r--r-- | modules/path/path.module | 3 | ||||
-rw-r--r-- | modules/taxonomy.module | 3 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 3 | ||||
-rw-r--r-- | modules/user.module | 23 | ||||
-rw-r--r-- | modules/user/user.module | 23 |
8 files changed, 36 insertions, 52 deletions
diff --git a/modules/comment.module b/modules/comment.module index 8ac68ba7c..90517617a 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -970,24 +970,24 @@ function comment_delete($cid) { _comment_update_node_statistics($comment->nid); - // Clear the cache so an anonymous user - // can see his comment being added. + // Clear the cache so an anonymous user sees that his comment was deleted. cache_clear_all(); - } + drupal_goto("node/$comment->nid"); - // Print a confirmation. + } else if ($comment->cid) { drupal_set_message(t('Do you want to delete this comment and all its replies?')); $comment->comment = check_output($comment->comment, $comment->format); $output = theme('comment', $comment); $output .= form_submit(t('Delete')); + $output = form($output); } else { drupal_set_message(t('The comment no longer exists.')); } - print theme('page', form($output)); + print theme('page', $output); } function comment_save($id, $edit) { @@ -1009,6 +1009,7 @@ function comment_admin_overview($type = 'new') { array('data' => t('Operations'), 'colspan' => '2') ); + $destination = drupal_get_destination(); $status = ($type == 'approval') ? 1 : 0; $sql = 'SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.status = '. db_escape_string($status); $sql .= tablesort_sql($header); @@ -1021,8 +1022,8 @@ function comment_admin_overview($type = 'new') { format_name($comment), ($comment->status == 0 ? t('Published') : t('Not published')), format_date($comment->timestamp, 'small'), - l(t('edit'), "admin/comment/edit/$comment->cid"), - l(t('delete'), "admin/comment/delete/$comment->cid") + l(t('edit'), "admin/comment/edit/$comment->cid", array(), $destination), + l(t('delete'), "admin/comment/delete/$comment->cid", array(), $destination) ); } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 8ac68ba7c..90517617a 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -970,24 +970,24 @@ function comment_delete($cid) { _comment_update_node_statistics($comment->nid); - // Clear the cache so an anonymous user - // can see his comment being added. + // Clear the cache so an anonymous user sees that his comment was deleted. cache_clear_all(); - } + drupal_goto("node/$comment->nid"); - // Print a confirmation. + } else if ($comment->cid) { drupal_set_message(t('Do you want to delete this comment and all its replies?')); $comment->comment = check_output($comment->comment, $comment->format); $output = theme('comment', $comment); $output .= form_submit(t('Delete')); + $output = form($output); } else { drupal_set_message(t('The comment no longer exists.')); } - print theme('page', form($output)); + print theme('page', $output); } function comment_save($id, $edit) { @@ -1009,6 +1009,7 @@ function comment_admin_overview($type = 'new') { array('data' => t('Operations'), 'colspan' => '2') ); + $destination = drupal_get_destination(); $status = ($type == 'approval') ? 1 : 0; $sql = 'SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.status = '. db_escape_string($status); $sql .= tablesort_sql($header); @@ -1021,8 +1022,8 @@ function comment_admin_overview($type = 'new') { format_name($comment), ($comment->status == 0 ? t('Published') : t('Not published')), format_date($comment->timestamp, 'small'), - l(t('edit'), "admin/comment/edit/$comment->cid"), - l(t('delete'), "admin/comment/delete/$comment->cid") + l(t('edit'), "admin/comment/edit/$comment->cid", array(), $destination), + l(t('delete'), "admin/comment/delete/$comment->cid", array(), $destination) ); } diff --git a/modules/path.module b/modules/path.module index 43b2d0ec2..86a9bea07 100644 --- a/modules/path.module +++ b/modules/path.module @@ -264,8 +264,9 @@ function path_overview() { $sql .= tablesort_sql($header); $result = pager_query($sql, 50); + $destination = drupal_get_destination(); while ($data = db_fetch_object($result)) { - $rows[] = array($data->dst, $data->src, l(t('edit'), "admin/path/edit/$data->pid"), l(t('delete'), "admin/path/delete/$data->pid")); + $rows[] = array($data->dst, $data->src, l(t('edit'), "admin/path/edit/$data->pid", array(), $destination), l(t('delete'), "admin/path/delete/$data->pid")); } if ($pager = theme('pager', NULL, 50, 0, tablesort_pager())) { diff --git a/modules/path/path.module b/modules/path/path.module index 43b2d0ec2..86a9bea07 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -264,8 +264,9 @@ function path_overview() { $sql .= tablesort_sql($header); $result = pager_query($sql, 50); + $destination = drupal_get_destination(); while ($data = db_fetch_object($result)) { - $rows[] = array($data->dst, $data->src, l(t('edit'), "admin/path/edit/$data->pid"), l(t('delete'), "admin/path/delete/$data->pid")); + $rows[] = array($data->dst, $data->src, l(t('edit'), "admin/path/edit/$data->pid", array(), $destination), l(t('delete'), "admin/path/delete/$data->pid")); } if ($pager = theme('pager', NULL, 50, 0, tablesort_pager())) { diff --git a/modules/taxonomy.module b/modules/taxonomy.module index d69f988db..75967f0f8 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -241,6 +241,9 @@ function taxonomy_form_term($edit = array()) { $form .= form_submit(t('Delete')); $form .= form_hidden('tid', $edit['tid']); } + else { + $form .= form_hidden('destination', $_GET['q']); + } return form($form); } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index d69f988db..75967f0f8 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -241,6 +241,9 @@ function taxonomy_form_term($edit = array()) { $form .= form_submit(t('Delete')); $form .= form_hidden('tid', $edit['tid']); } + else { + $form .= form_hidden('destination', $_GET['q']); + } return form($form); } diff --git a/modules/user.module b/modules/user.module index 785d72b80..7c2df79cb 100644 --- a/modules/user.module +++ b/modules/user.module @@ -483,23 +483,16 @@ function user_block($op = 'list', $delta = 0, $edit = array()) { $output = "<div class=\"user-login-block\">\n"; - // Save the referer. We record where the user came from such - // that we can redirect him after having completed the login form. - - if (empty($edit)) { - $edit['destination'] = $_GET['q']; - } // NOTE: special care needs to be taken because on pages with forms, // such as node and comment submission pages, the $edit variable // might already be set. - $output .= form_hidden('destination', $edit['destination']); $output .= form_textfield(t('Username'), 'name', $edit['name'], 15, 64); $output .= form_password(t('Password'), 'pass', $pass, 15, 64); $output .= form_submit(t('Log in')); $output .= "</div>\n"; - $output = form($output, 'post', url('user/login')); + $output = form($output, 'post', url('user/login', drupal_get_destination())); if (variable_get('user_register', 1)) { $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.'))); @@ -796,7 +789,7 @@ function user_login($edit = array(), $msg = '') { user_module_invoke('login', $edit, $user); // Redirect the user to the page he logged on from. - drupal_goto($edit['destination']); + drupal_goto(); } else { if (!$error) { @@ -811,13 +804,6 @@ function user_login($edit = array(), $msg = '') { drupal_set_message($error, 'error'); } - // Save the referrer. We record where the user came from such that we - // can redirect him after having completed the login form. - if (empty($edit)) { - $edit['destination'] = $_GET['q']; - } - $output .= form_hidden('destination', $edit['destination']); - // Display login form: if ($msg) { $output .= "<p>$msg</p>"; @@ -831,7 +817,7 @@ function user_login($edit = array(), $msg = '') { $output .= form_password(t('Password'), 'pass', $pass, 30, 64, t('Enter the password that accompanies your username.')); $output .= form_submit(t('Log in')); - return form($output, 'post', url('user/login')); + return form($output, 'post', url('user/login', drupal_get_destination())); } function user_authenticate($name, $pass) { @@ -1609,6 +1595,7 @@ function user_admin_account() { $result = pager_query($sql, 50); $status = array(t('blocked'), t('active')); + $destination = drupal_get_destination(); while ($account = db_fetch_object($result)) { $rolesresult = db_query('SELECT r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $account->uid); $roles = array(); @@ -1617,7 +1604,7 @@ function user_admin_account() { $roles[] = $role->name; } - $rows[] = array($account->uid, format_name($account), $status[$account->status], implode(',<br />', $roles), format_date($account->changed, 'small'), l(t('edit'), "user/$account->uid/edit")); + $rows[] = array($account->uid, format_name($account), $status[$account->status], implode(',<br />', $roles), format_date($account->changed, 'small'), l(t('edit'), "user/$account->uid/edit", array(), $destination)); } $pager = theme('pager', NULL, 50, 0, tablesort_pager()); diff --git a/modules/user/user.module b/modules/user/user.module index 785d72b80..7c2df79cb 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -483,23 +483,16 @@ function user_block($op = 'list', $delta = 0, $edit = array()) { $output = "<div class=\"user-login-block\">\n"; - // Save the referer. We record where the user came from such - // that we can redirect him after having completed the login form. - - if (empty($edit)) { - $edit['destination'] = $_GET['q']; - } // NOTE: special care needs to be taken because on pages with forms, // such as node and comment submission pages, the $edit variable // might already be set. - $output .= form_hidden('destination', $edit['destination']); $output .= form_textfield(t('Username'), 'name', $edit['name'], 15, 64); $output .= form_password(t('Password'), 'pass', $pass, 15, 64); $output .= form_submit(t('Log in')); $output .= "</div>\n"; - $output = form($output, 'post', url('user/login')); + $output = form($output, 'post', url('user/login', drupal_get_destination())); if (variable_get('user_register', 1)) { $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.'))); @@ -796,7 +789,7 @@ function user_login($edit = array(), $msg = '') { user_module_invoke('login', $edit, $user); // Redirect the user to the page he logged on from. - drupal_goto($edit['destination']); + drupal_goto(); } else { if (!$error) { @@ -811,13 +804,6 @@ function user_login($edit = array(), $msg = '') { drupal_set_message($error, 'error'); } - // Save the referrer. We record where the user came from such that we - // can redirect him after having completed the login form. - if (empty($edit)) { - $edit['destination'] = $_GET['q']; - } - $output .= form_hidden('destination', $edit['destination']); - // Display login form: if ($msg) { $output .= "<p>$msg</p>"; @@ -831,7 +817,7 @@ function user_login($edit = array(), $msg = '') { $output .= form_password(t('Password'), 'pass', $pass, 30, 64, t('Enter the password that accompanies your username.')); $output .= form_submit(t('Log in')); - return form($output, 'post', url('user/login')); + return form($output, 'post', url('user/login', drupal_get_destination())); } function user_authenticate($name, $pass) { @@ -1609,6 +1595,7 @@ function user_admin_account() { $result = pager_query($sql, 50); $status = array(t('blocked'), t('active')); + $destination = drupal_get_destination(); while ($account = db_fetch_object($result)) { $rolesresult = db_query('SELECT r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $account->uid); $roles = array(); @@ -1617,7 +1604,7 @@ function user_admin_account() { $roles[] = $role->name; } - $rows[] = array($account->uid, format_name($account), $status[$account->status], implode(',<br />', $roles), format_date($account->changed, 'small'), l(t('edit'), "user/$account->uid/edit")); + $rows[] = array($account->uid, format_name($account), $status[$account->status], implode(',<br />', $roles), format_date($account->changed, 'small'), l(t('edit'), "user/$account->uid/edit", array(), $destination)); } $pager = theme('pager', NULL, 50, 0, tablesort_pager()); |