updated core to 7.58, security update
This commit is contained in:
@@ -6,8 +6,8 @@ core = 7.x
|
||||
files[] = contact.test
|
||||
configure = admin/structure/contact
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-11-19
|
||||
version = "7.34"
|
||||
; Information added by Drupal.org packaging script on 2018-03-28
|
||||
version = "7.58"
|
||||
project = "drupal"
|
||||
datestamp = "1416429488"
|
||||
datestamp = "1522264019"
|
||||
|
||||
|
||||
@@ -234,7 +234,14 @@ function contact_form_user_profile_form_alter(&$form, &$form_state) {
|
||||
* Implements hook_user_presave().
|
||||
*/
|
||||
function contact_user_presave(&$edit, $account, $category) {
|
||||
$edit['data']['contact'] = isset($edit['contact']) ? $edit['contact'] : variable_get('contact_default_status', 1);
|
||||
if (isset($edit['contact'])) {
|
||||
// Set new value.
|
||||
$edit['data']['contact'] = $edit['contact'];
|
||||
}
|
||||
elseif (!isset($account->data['contact'])) {
|
||||
// Use default if none has been set.
|
||||
$edit['data']['contact'] = variable_get('contact_default_status', 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -134,7 +134,7 @@ function contact_site_form_submit($form, &$form_state) {
|
||||
global $user, $language;
|
||||
|
||||
$values = $form_state['values'];
|
||||
$values['sender'] = $user;
|
||||
$values['sender'] = clone $user;
|
||||
$values['sender']->name = $values['name'];
|
||||
$values['sender']->mail = $values['mail'];
|
||||
$values['category'] = contact_load($values['cid']);
|
||||
@@ -270,7 +270,7 @@ function contact_personal_form_submit($form, &$form_state) {
|
||||
global $user, $language;
|
||||
|
||||
$values = $form_state['values'];
|
||||
$values['sender'] = $user;
|
||||
$values['sender'] = clone $user;
|
||||
$values['sender']->name = $values['name'];
|
||||
$values['sender']->mail = $values['mail'];
|
||||
|
||||
|
||||
@@ -346,6 +346,28 @@ class ContactPersonalTestCase extends DrupalWebTestCase {
|
||||
$this->drupalGet('user/' . $this->contact_user->uid . '/contact');
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Test that users can disable their contact form.
|
||||
$this->drupalLogin($this->contact_user);
|
||||
$edit = array('contact' => FALSE);
|
||||
$this->drupalPost('user/' . $this->contact_user->uid . '/edit', $edit, 'Save');
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('user/' . $this->contact_user->uid . '/contact');
|
||||
$this->assertResponse(403);
|
||||
|
||||
// Test that user's contact status stays disabled when saving.
|
||||
$contact_user_temp = user_load($this->contact_user->uid, TRUE);
|
||||
user_save($contact_user_temp);
|
||||
$this->drupalGet('user/' . $this->contact_user->uid . '/contact');
|
||||
$this->assertResponse(403);
|
||||
|
||||
// Test that users can enable their contact form.
|
||||
$this->drupalLogin($this->contact_user);
|
||||
$edit = array('contact' => TRUE);
|
||||
$this->drupalPost('user/' . $this->contact_user->uid . '/edit', $edit, 'Save');
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('user/' . $this->contact_user->uid . '/contact');
|
||||
$this->assertResponse(200);
|
||||
|
||||
// Revoke the personal contact permission for the anonymous user.
|
||||
user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access user contact forms'));
|
||||
$this->drupalGet('user/' . $this->contact_user->uid . '/contact');
|
||||
|
||||
Reference in New Issue
Block a user