updated drupal core to 7.43
This commit is contained in:
@@ -5,8 +5,8 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.39"
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
project = "drupal"
|
||||
datestamp = "1440020197"
|
||||
datestamp = "1456343506"
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php if ($user_picture): ?>
|
||||
<div class="user-picture">
|
||||
<div class="<?php print $classes; ?>">
|
||||
<?php print $user_picture; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
@@ -123,8 +123,8 @@ function hook_user_cancel($edit, $account, $method) {
|
||||
* description is NOT used for the radio button, but instead should provide
|
||||
* additional explanation to the user seeking to cancel their account.
|
||||
* - access: (optional) A boolean value indicating whether the user can access
|
||||
* a method. If #access is defined, the method cannot be configured as default
|
||||
* method.
|
||||
* a method. If access is defined, the method cannot be configured as the
|
||||
* default method.
|
||||
*
|
||||
* @param $methods
|
||||
* An array containing user account cancellation methods, keyed by method id.
|
||||
@@ -183,7 +183,23 @@ function hook_user_operations() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of user setting or profile information categories.
|
||||
* Define a list of user settings or profile information categories.
|
||||
*
|
||||
* There are two steps to using hook_user_categories():
|
||||
* - Create the category with hook_user_categories().
|
||||
* - Display that category on the form ID of "user_profile_form" with
|
||||
* hook_form_FORM_ID_alter().
|
||||
*
|
||||
* Step one builds out the category but it won't be visible on your form until
|
||||
* you explicitly tell it to do so.
|
||||
*
|
||||
* The function in step two should contain the following code in order to
|
||||
* display your new category:
|
||||
* @code
|
||||
* if ($form['#user_category'] == 'mycategory') {
|
||||
* // Return your form here.
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* @return
|
||||
* An array of associative arrays. Each inner array has elements:
|
||||
|
@@ -9,8 +9,8 @@ required = TRUE
|
||||
configure = admin/config/people
|
||||
stylesheets[all][] = user.css
|
||||
|
||||
; Information added by Drupal.org packaging script on 2015-08-19
|
||||
version = "7.39"
|
||||
; Information added by Drupal.org packaging script on 2016-02-24
|
||||
version = "7.43"
|
||||
project = "drupal"
|
||||
datestamp = "1440020197"
|
||||
datestamp = "1456343506"
|
||||
|
||||
|
@@ -93,6 +93,8 @@ Drupal.behaviors.password = {
|
||||
* Returns the estimated strength and the relevant output message.
|
||||
*/
|
||||
Drupal.evaluatePasswordStrength = function (password, translate) {
|
||||
password = $.trim(password);
|
||||
|
||||
var weaknesses = 0, strength = 100, msg = [];
|
||||
|
||||
var hasLowercase = /[a-z]+/.test(password);
|
||||
|
@@ -958,6 +958,8 @@ function user_search_access() {
|
||||
*/
|
||||
function user_search_execute($keys = NULL, $conditions = NULL) {
|
||||
$find = array();
|
||||
// Escape for LIKE matching.
|
||||
$keys = db_like($keys);
|
||||
// Replace wildcards with MySQL/PostgreSQL wildcards.
|
||||
$keys = preg_replace('!\*+!', '%', $keys);
|
||||
$query = db_select('users')->extend('PagerDefault');
|
||||
@@ -967,13 +969,13 @@ function user_search_execute($keys = NULL, $conditions = NULL) {
|
||||
// and they don't need to be restricted to only active users.
|
||||
$query->fields('users', array('mail'));
|
||||
$query->condition(db_or()->
|
||||
condition('name', '%' . db_like($keys) . '%', 'LIKE')->
|
||||
condition('mail', '%' . db_like($keys) . '%', 'LIKE'));
|
||||
condition('name', '%' . $keys . '%', 'LIKE')->
|
||||
condition('mail', '%' . $keys . '%', 'LIKE'));
|
||||
}
|
||||
else {
|
||||
// Regular users can only search via usernames, and we do not show them
|
||||
// blocked accounts.
|
||||
$query->condition('name', '%' . db_like($keys) . '%', 'LIKE')
|
||||
$query->condition('name', '%' . $keys . '%', 'LIKE')
|
||||
->condition('status', 1);
|
||||
}
|
||||
$uids = $query
|
||||
@@ -1306,10 +1308,12 @@ function user_user_presave(&$edit, $account, $category) {
|
||||
elseif (!empty($edit['picture_delete'])) {
|
||||
$edit['picture'] = NULL;
|
||||
}
|
||||
// Prepare user roles.
|
||||
if (isset($edit['roles'])) {
|
||||
$edit['roles'] = array_filter($edit['roles']);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter out roles with empty values to avoid granting extra roles when
|
||||
// processing custom form submissions.
|
||||
if (isset($edit['roles'])) {
|
||||
$edit['roles'] = array_filter($edit['roles']);
|
||||
}
|
||||
|
||||
// Move account cancellation information into $user->data.
|
||||
@@ -1911,13 +1915,13 @@ function user_menu_link_alter(&$link) {
|
||||
// for authenticated users. Authenticated users should see "My account", but
|
||||
// anonymous users should not see it at all. Therefore, invoke
|
||||
// user_translated_menu_link_alter() to conditionally hide the link.
|
||||
if ($link['link_path'] == 'user' && $link['module'] == 'system') {
|
||||
if ($link['link_path'] == 'user' && isset($link['module']) && $link['module'] == 'system') {
|
||||
$link['options']['alter'] = TRUE;
|
||||
}
|
||||
|
||||
// Force the Logout link to appear on the top-level of 'user-menu' menu by
|
||||
// default (i.e., unless it has been customized).
|
||||
if ($link['link_path'] == 'user/logout' && $link['module'] == 'system' && empty($link['customized'])) {
|
||||
if ($link['link_path'] == 'user/logout' && isset($link['module']) && $link['module'] == 'system' && empty($link['customized'])) {
|
||||
$link['plid'] = 0;
|
||||
}
|
||||
}
|
||||
@@ -2225,7 +2229,11 @@ function user_login_final_validate($form, &$form_state) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
form_set_error('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => url('user/password', array('query' => array('name' => $form_state['values']['name']))))));
|
||||
// Use $form_state['input']['name'] here to guarantee that we send
|
||||
// exactly what the user typed in. $form_state['values']['name'] may have
|
||||
// been modified by validation handlers that ran earlier than this one.
|
||||
$query = isset($form_state['input']['name']) ? array('name' => $form_state['input']['name']) : array();
|
||||
form_set_error('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => url('user/password', array('query' => $query)))));
|
||||
watchdog('user', 'Login attempt failed for %user.', array('%user' => $form_state['values']['name']));
|
||||
}
|
||||
}
|
||||
@@ -2348,26 +2356,14 @@ function user_external_login_register($name, $module) {
|
||||
* following properties:
|
||||
* - uid: The user ID number.
|
||||
* - login: The UNIX timestamp of the user's last login.
|
||||
* @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, $account->uid), $url_options);
|
||||
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2379,10 +2375,6 @@ function user_pass_reset_url($account, $options = array()) {
|
||||
* - uid: The user ID number.
|
||||
* - pass: The hashed user password string.
|
||||
* - login: The UNIX timestamp of the user's last login.
|
||||
* @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
|
||||
@@ -2391,17 +2383,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, $account->uid), $url_options);
|
||||
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid), array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2512,7 +2496,9 @@ function user_cancel($edit, $uid, $method) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Last batch processing step for cancelling a user account.
|
||||
* Implements callback_batch_operation().
|
||||
*
|
||||
* Last step for cancelling a user account.
|
||||
*
|
||||
* Since batch and session API require a valid user account, the actual
|
||||
* cancellation of a user account needs to happen last.
|
||||
@@ -2560,6 +2546,8 @@ function _user_cancel($edit, $account, $method) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements callback_batch_finished().
|
||||
*
|
||||
* Finished batch processing callback for cancelling a user account.
|
||||
*
|
||||
* @see user_cancel()
|
||||
@@ -2887,7 +2875,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('language' => $language, '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;
|
||||
@@ -2914,8 +2902,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']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3063,6 +3051,11 @@ function user_role_delete($role) {
|
||||
$role = user_role_load_by_name($role);
|
||||
}
|
||||
|
||||
// If this is the administrator role, delete the user_admin_role variable.
|
||||
if ($role->rid == variable_get('user_admin_role')) {
|
||||
variable_del('user_admin_role');
|
||||
}
|
||||
|
||||
db_delete('role')
|
||||
->condition('rid', $role->rid)
|
||||
->execute();
|
||||
@@ -3678,12 +3671,7 @@ function user_form_process_password_confirm($element) {
|
||||
);
|
||||
|
||||
$element['#attached']['js'][] = drupal_get_path('module', 'user') . '/user.js';
|
||||
// Ensure settings are only added once per page.
|
||||
static $already_added = FALSE;
|
||||
if (!$already_added) {
|
||||
$already_added = TRUE;
|
||||
$element['#attached']['js'][] = array('data' => $js_settings, 'type' => 'setting');
|
||||
}
|
||||
$element['#attached']['js'][] = array('data' => $js_settings, 'type' => 'setting');
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
@@ -105,10 +105,10 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
|
||||
$reset_link_account = user_load($uid);
|
||||
if (!empty($reset_link_account)) {
|
||||
drupal_set_message(t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href="!logout">logout</a> and try using the link again.',
|
||||
array('%other_user' => $user->name, '%resetting_user' => $reset_link_account->name, '!logout' => url('user/logout'))));
|
||||
array('%other_user' => $user->name, '%resetting_user' => $reset_link_account->name, '!logout' => url('user/logout'))), 'warning');
|
||||
} else {
|
||||
// Invalid one-time link specifies an unknown user.
|
||||
drupal_set_message(t('The one-time login link you clicked is invalid.'));
|
||||
drupal_set_message(t('The one-time login link you clicked is invalid.'), 'error');
|
||||
}
|
||||
}
|
||||
drupal_goto();
|
||||
@@ -123,7 +123,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
|
||||
if ($timestamp <= $current && $account = reset($users)) {
|
||||
// No time out for first time login.
|
||||
if ($account->login && $current - $timestamp > $timeout) {
|
||||
drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));
|
||||
drupal_set_message(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'error');
|
||||
drupal_goto('user/password');
|
||||
}
|
||||
elseif ($account->uid && $timestamp >= $account->login && $timestamp <= $current && $hashed_pass == user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid)) {
|
||||
@@ -151,7 +151,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a
|
||||
}
|
||||
}
|
||||
else {
|
||||
drupal_set_message(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'));
|
||||
drupal_set_message(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'error');
|
||||
drupal_goto('user/password');
|
||||
}
|
||||
}
|
||||
@@ -533,7 +533,7 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') {
|
||||
batch_process('');
|
||||
}
|
||||
else {
|
||||
drupal_set_message(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'));
|
||||
drupal_set_message(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'error');
|
||||
drupal_goto("user/$account->uid/cancel");
|
||||
}
|
||||
}
|
||||
|
@@ -2095,12 +2095,16 @@ class UserRoleAdminTestCase extends DrupalWebTestCase {
|
||||
$this->assertFalse(user_role_load_by_name($old_name), 'The role can no longer be retrieved from the database using its old name.');
|
||||
$this->assertTrue(is_object(user_role_load_by_name($role_name)), 'The role can be retrieved from the database using its new name.');
|
||||
|
||||
// Test deleting a role.
|
||||
// Test deleting the default administrator role.
|
||||
$role_name = 'administrator';
|
||||
$role = user_role_load_by_name($role_name);
|
||||
$this->drupalPost("admin/people/permissions/roles/edit/{$role->rid}", NULL, t('Delete role'));
|
||||
$this->drupalPost(NULL, NULL, t('Delete'));
|
||||
$this->assertText(t('The role has been deleted.'), 'The role has been deleted');
|
||||
$this->assertNoLinkByHref("admin/people/permissions/roles/edit/{$role->rid}", 'Role edit link removed.');
|
||||
$this->assertFalse(user_role_load_by_name($role_name), 'A deleted role can no longer be loaded.');
|
||||
// Make sure this role is no longer configured as the administrator role.
|
||||
$this->assertNull(variable_get('user_admin_role'), 'The administrator role is no longer configured as the administrator role.');
|
||||
|
||||
// Make sure that the system-defined roles cannot be edited via the user
|
||||
// interface.
|
||||
@@ -2145,26 +2149,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.
|
||||
*/
|
||||
@@ -2215,39 +2199,6 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
|
||||
$output = token_replace($input, array('user' => $account), array('language' => $language, 'sanitize' => FALSE));
|
||||
$this->assertEqual($output, $expected, format_string('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.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2279,6 +2230,20 @@ class UserUserSearchTestCase extends DrupalWebTestCase {
|
||||
$this->drupalPost('search/user/', $edit, t('Search'));
|
||||
$this->assertText($keys);
|
||||
|
||||
// Verify that wildcard search works.
|
||||
$keys = $user1->name;
|
||||
$keys = substr($keys, 0, 2) . '*' . substr($keys, 4, 2);
|
||||
$edit = array('keys' => $keys);
|
||||
$this->drupalPost('search/user/', $edit, t('Search'));
|
||||
$this->assertText($user1->name, 'Search for username wildcard resulted in user name on page for administrative user.');
|
||||
|
||||
// Verify that wildcard search works for email.
|
||||
$keys = $user1->mail;
|
||||
$keys = substr($keys, 0, 2) . '*' . substr($keys, 4, 2);
|
||||
$edit = array('keys' => $keys);
|
||||
$this->drupalPost('search/user/', $edit, t('Search'));
|
||||
$this->assertText($user1->name, 'Search for email wildcard resulted in user name on page for administrative user.');
|
||||
|
||||
// Create a blocked user.
|
||||
$blocked_user = $this->drupalCreateUser();
|
||||
$edit = array('status' => 0);
|
||||
|
Reference in New Issue
Block a user