update to 7.22

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy
2013-05-24 13:03:57 +02:00
parent d5097a4bc6
commit 5658794f17
265 changed files with 5551 additions and 8808 deletions

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by drupal.org packaging script on 2013-03-07
version = "7.21"
; Information added by drupal.org packaging script on 2013-04-03
version = "7.22"
project = "drupal"
datestamp = "1362616996"
datestamp = "1365027012"

View File

@@ -5,6 +5,21 @@
* Admin page callback file for the user module.
*/
/**
* Page callback: Generates the appropriate user administration form.
*
* This function generates the user registration, multiple user cancellation,
* or filtered user list admin form, depending on the argument and the POST
* form values.
*
* @param string $callback_arg
* (optional) Indicates which form to build. Defaults to '', which will
* trigger the user filter form. If the POST value 'op' is present, this
* function uses that value as the callback argument.
*
* @return string
* A renderable form array for the respective request.
*/
function user_admin($callback_arg = '') {
$op = isset($_POST['op']) ? $_POST['op'] : $callback_arg;

View File

@@ -214,9 +214,11 @@ function hook_user_categories() {
* to have their data serialized on save.
*
* @param $edit
* The array of form values submitted by the user.
* The array of form values submitted by the user. Assign values to this
* array to save changes in the database.
* @param $account
* The user object on which the operation is performed.
* The user object on which the operation is performed. Values assigned in
* this object will not be saved in the database.
* @param $category
* The active category of user information being edited.
*

View File

@@ -9,8 +9,8 @@ required = TRUE
configure = admin/config/people
stylesheets[all][] = user.css
; Information added by drupal.org packaging script on 2013-03-07
version = "7.21"
; Information added by drupal.org packaging script on 2013-04-03
version = "7.22"
project = "drupal"
datestamp = "1362616996"
datestamp = "1365027012"

View File

@@ -1517,15 +1517,33 @@ function theme_user_list($variables) {
return theme('item_list', array('items' => $items, 'title' => $title));
}
/**
* Determines if the current user is anonymous.
*
* @return bool
* TRUE if the user is anonymous, FALSE if the user is authenticated.
*/
function user_is_anonymous() {
// Menu administrators can see items for anonymous when administering.
return !$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']);
}
/**
* Determines if the current user is logged in.
*
* @return bool
* TRUE if the user is logged in, FALSE if the user is anonymous.
*/
function user_is_logged_in() {
return (bool) $GLOBALS['user']->uid;
}
/**
* Determines if the current user has access to the user registration page.
*
* @return bool
* TRUE if the user is not already logged in and can register for an account.
*/
function user_register_access() {
return user_is_anonymous() && variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
}
@@ -2289,26 +2307,14 @@ function user_external_login_register($name, $module) {
*
* @param object $account
* An object containing the user account.
* @param array $options
* (optional) A keyed array of settings. Supported options are:
* - langcode: A language code to be used when generating locale-sensitive
* urls. If langcode is NULL the users preferred language is used.
*
* @return
* A unique URL that provides a one-time log in for the user, from which
* they can change their password.
*/
function user_pass_reset_url($account, $options = array()) {
function user_pass_reset_url($account) {
$timestamp = REQUEST_TIME;
$url_options = array('absolute' => TRUE);
if (isset($options['langcode'])) {
$languages = language_list();
$url_options['language'] = $languages[$options['langcode']];
}
else {
$url_options['language'] = user_preferred_language($account);
}
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
}
/**
@@ -2320,10 +2326,6 @@ function user_pass_reset_url($account, $options = array()) {
* - uid: The user uid number.
* - pass: The hashed user password string.
* - login: The user login name.
* @param array $options
* (optional) A keyed array of settings. Supported options are:
* - langcode: A language code to be used when generating locale-sensitive
* urls. If langcode is NULL the users preferred language is used.
*
* @return
* A unique URL that may be used to confirm the cancellation of the user
@@ -2332,17 +2334,9 @@ function user_pass_reset_url($account, $options = array()) {
* @see user_mail_tokens()
* @see user_cancel_confirm()
*/
function user_cancel_url($account, $options = array()) {
function user_cancel_url($account) {
$timestamp = REQUEST_TIME;
$url_options = array('absolute' => TRUE);
if (isset($options['langcode'])) {
$languages = language_list();
$url_options['language'] = $languages[$options['langcode']];
}
else {
$url_options['language'] = user_preferred_language($account);
}
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
}
/**
@@ -2791,7 +2785,7 @@ Your account on [site:name] has been canceled.
if ($replace) {
// We do not sanitize the token replacement, since the output of this
// replacement is intended for an e-mail message, not a web browser.
return token_replace($text, $variables, array('langcode' => $langcode, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
return token_replace($text, $variables, array('language' => $language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
}
return $text;
@@ -2818,8 +2812,8 @@ Your account on [site:name] has been canceled.
*/
function user_mail_tokens(&$replacements, $data, $options) {
if (isset($data['user'])) {
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user'], $options);
$replacements['[user:cancel-url]'] = user_cancel_url($data['user'], $options);
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user']);
$replacements['[user:cancel-url]'] = user_cancel_url($data['user']);
}
}
@@ -3377,7 +3371,7 @@ function user_filters() {
$options = array();
foreach (module_implements('permission') as $module) {
$function = $module . '_permission';
if ($permissions = $function('permission')) {
if ($permissions = $function()) {
asort($permissions);
foreach ($permissions as $permission => $description) {
$options[t('@module module', array('@module' => $module))][$permission] = t($permission);

File diff suppressed because it is too large Load Diff

View File

@@ -128,12 +128,12 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
elseif ($account->uid && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login)) {
// First stage is a confirmation form, then login
if ($action == 'login') {
watchdog('user', 'User %name used one-time login link at time %timestamp.', array('%name' => $account->name, '%timestamp' => $timestamp));
// Set the new user.
$user = $account;
// user_login_finalize() also updates the login timestamp of the
// user, which invalidates further use of the one-time login link.
user_login_finalize();
watchdog('user', 'User %name used one-time login link at time %timestamp.', array('%name' => $account->name, '%timestamp' => $timestamp));
drupal_set_message(t('You have just used your one-time login link. It is no longer necessary to use this link to log in. Please change your password.'));
// Let the user's password be changed without the current password check.
$token = drupal_hash_base64(drupal_random_bytes(55));

View File

@@ -2046,26 +2046,6 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
);
}
public function setUp() {
parent::setUp('locale');
$account = $this->drupalCreateUser(array('access administration pages', 'administer languages'));
$this->drupalLogin($account);
// Add language.
$edit = array('langcode' => 'de');
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
// Enable URL language detection and selection.
$edit = array('language[enabled][locale-url]' => 1);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
// Reset static caching.
drupal_static_reset('language_list');
drupal_static_reset('locale_url_outbound_alter');
drupal_static_reset('locale_language_url_rewrite_url');
}
/**
* Creates a user, then tests the tokens generated from it.
*/
@@ -2116,39 +2096,6 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
$output = token_replace($input, array('user' => $account), array('language' => $language, 'sanitize' => FALSE));
$this->assertEqual($output, $expected, t('Unsanitized user token %token replaced.', array('%token' => $input)));
}
$languages = language_list();
// Generate login and cancel link.
$tests = array();
$tests['[user:one-time-login-url]'] = user_pass_reset_url($account);
$tests['[user:cancel-url]'] = user_cancel_url($account);
// Generate tokens with interface language.
$link = url('user', array('absolute' => TRUE));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('user' => $account), array('langcode' => $language->language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
$this->assertTrue(strpos($output, $link) === 0, 'Generated URL is in interface language.');
}
// Generate tokens with the user's preferred language.
$edit['language'] = 'de';
$account = user_save($account, $edit);
$link = url('user', array('language' => $languages[$account->language], 'absolute' => TRUE));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('user' => $account), array('callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
$this->assertTrue(strpos($output, $link) === 0, "Generated URL is in the user's preferred language.");
}
// Generate tokens with one specific language.
$link = url('user', array('language' => $languages['de'], 'absolute' => TRUE));
foreach ($tests as $input => $expected) {
foreach (array($user1, $user2) as $account) {
$output = token_replace($input, array('user' => $account), array('langcode' => 'de', 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
$this->assertTrue(strpos($output, $link) === 0, "Generated URL in in the requested language.");
}
}
}
}

File diff suppressed because it is too large Load Diff