diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-04-07 16:35:03 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-04-07 16:35:03 +0000 |
commit | f3a8fa9ea8cc3e807f066c43e6ab240c204941ee (patch) | |
tree | 1fde4a9b48e241ec81c08e986eae7bad5cf9d78e | |
parent | dde5c67ba041dc65588377808b1943fdd3b57bf6 (diff) | |
download | brdo-f3a8fa9ea8cc3e807f066c43e6ab240c204941ee.tar.gz brdo-f3a8fa9ea8cc3e807f066c43e6ab240c204941ee.tar.bz2 |
- Patch #763444 by jpmckinney: user_cookie_save() has a weird/awkward function signature.
-rw-r--r-- | modules/comment/comment.module | 2 | ||||
-rw-r--r-- | modules/contact/contact.pages.inc | 4 | ||||
-rw-r--r-- | modules/openid/openid.module | 2 | ||||
-rw-r--r-- | modules/system/system.module | 2 | ||||
-rw-r--r-- | modules/user/user.module | 17 |
5 files changed, 11 insertions, 16 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 83834b613..113275157 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -2104,7 +2104,7 @@ function comment_form_submit($form, &$form_state) { if (user_access('post comments') && (user_access('administer comments') || $node->comment == COMMENT_NODE_OPEN)) { // Save the anonymous user information to a cookie for reuse. if (!$comment->uid) { - user_cookie_save($form_state['values']); + user_cookie_save(array_intersect_key($form_state['values'], array_flip(array('name', 'mail', 'homepage')))); } comment_save($comment); diff --git a/modules/contact/contact.pages.inc b/modules/contact/contact.pages.inc index dfe511069..2ff99090a 100644 --- a/modules/contact/contact.pages.inc +++ b/modules/contact/contact.pages.inc @@ -139,7 +139,7 @@ function contact_site_form_submit($form, &$form_state) { // Save the anonymous user information to a cookie for reuse. if (!$user->uid) { - user_cookie_save($values); + user_cookie_save(array_intersect_key($values, array_flip(array('name', 'mail')))); } // Get the to and from e-mail addresses. @@ -272,7 +272,7 @@ function contact_personal_form_submit($form, &$form_state) { // Save the anonymous user information to a cookie for reuse. if (!$user->uid) { - user_cookie_save($values); + user_cookie_save(array_intersect_key($values, array_flip(array('name', 'mail')))); } // Get the to and from e-mail addresses. diff --git a/modules/openid/openid.module b/modules/openid/openid.module index 96a74415a..afb6f86c1 100644 --- a/modules/openid/openid.module +++ b/modules/openid/openid.module @@ -84,7 +84,7 @@ function openid_user_insert(&$edit, $account, $category) { function openid_user_login(&$edit, $account) { if (isset($_SESSION['openid'])) { // The user has logged in via OpenID. - user_cookie_save($_SESSION['openid']['user_login_values'], array('openid_identifier')); + user_cookie_save(array_intersect_key($_SESSION['openid']['user_login_values'], array_flip(array('openid_identifier')))); unset($_SESSION['openid']); } } diff --git a/modules/system/system.module b/modules/system/system.module index eea5e90f0..f2f06bfe7 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2721,7 +2721,7 @@ function system_admin_compact_mode() { * Valid values are 'on' and 'off'. */ function system_admin_compact_page($mode = 'off') { - user_cookie_save(array('admin_compact_mode' => ($mode == 'on')), array('admin_compact_mode')); + user_cookie_save(array('admin_compact_mode' => ($mode == 'on'))); drupal_goto(); } diff --git a/modules/user/user.module b/modules/user/user.module index 40c475d92..1441dc831 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -3494,17 +3494,12 @@ function user_login_destination() { * Saves visitor information as a cookie so it can be reused. * * @param $values - * An array of submitted form values with identifying information about the - * current user, typically $form_state['values'] from a submit handler. - * @param $fields - * An array of key values from $values to be saved into a cookie. - */ -function user_cookie_save(array $values, array $fields = array('name', 'mail', 'homepage')) { - foreach ($fields as $field) { - if (isset($values[$field])) { - // Set cookie for 365 days. - setrawcookie('Drupal.visitor.' . $field, rawurlencode($values[$field]), REQUEST_TIME + 31536000, '/'); - } + * An array of key/value pairs to be saved into a cookie. + */ +function user_cookie_save(array $values) { + foreach ($values as $field => $value) { + // Set cookie for 365 days. + setrawcookie('Drupal.visitor.' . $field, rawurlencode($value), REQUEST_TIME + 31536000, '/'); } } |