Projet

Général

Profil

Révision f76f30e1

Ajouté par Assos Assos il y a environ 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ds/ds.info
13 13
files[] = tests/ds.forms.test
14 14
configure = admin/structure/ds
15 15

  
16
; Information added by Drupal.org packaging script on 2014-10-28
17
version = "7.x-2.7"
16
; Information added by Drupal.org packaging script on 2015-04-15
17
version = "7.x-2.8"
18 18
core = "7.x"
19 19
project = "ds"
20
datestamp = "1414483431"
20
datestamp = "1429107782"
21 21

  
drupal7/sites/all/modules/ds/modules/ds_devel/ds_devel.info
5 5
dependencies[] = ds
6 6
dependencies[] = devel
7 7

  
8
; Information added by Drupal.org packaging script on 2014-10-28
9
version = "7.x-2.7"
8
; Information added by Drupal.org packaging script on 2015-04-15
9
version = "7.x-2.8"
10 10
core = "7.x"
11 11
project = "ds"
12
datestamp = "1414483431"
12
datestamp = "1429107782"
13 13

  
drupal7/sites/all/modules/ds/modules/ds_extras/ds_extras.info
5 5
dependencies[] = ds
6 6
configure = admin/structure/ds/list/extras
7 7

  
8
; Information added by Drupal.org packaging script on 2014-10-28
9
version = "7.x-2.7"
8
; Information added by Drupal.org packaging script on 2015-04-15
9
version = "7.x-2.8"
10 10
core = "7.x"
11 11
project = "ds"
12
datestamp = "1414483431"
12
datestamp = "1429107782"
13 13

  
drupal7/sites/all/modules/ds/modules/ds_extras/ds_extras.module
1027 1027
      $variables['theme_hook_suggestions'][] = $suggestion . '__' . $field_name . '__' . $variables['element']['#bundle'];
1028 1028
    }
1029 1029
  }
1030

  
1031
  // Sanitize the output of field templates
1032
  $fields = array(
1033
    'prefix',
1034
    'suffix',
1035
  );
1036

  
1037
  foreach ($fields as $field) {
1038
    if (isset($variables['ds-config'][$field])) {
1039
      $variables['ds-config'][$field] = filter_xss($variables['ds-config'][$field]);
1040
    }
1041
  }
1030 1042
}
drupal7/sites/all/modules/ds/modules/ds_format/ds_format.info
5 5
dependencies[] = ds
6 6
configure = admin/structure/ds/list/extras
7 7

  
8
; Information added by Drupal.org packaging script on 2014-10-28
9
version = "7.x-2.7"
8
; Information added by Drupal.org packaging script on 2015-04-15
9
version = "7.x-2.8"
10 10
core = "7.x"
11 11
project = "ds"
12
datestamp = "1414483431"
12
datestamp = "1429107782"
13 13

  
drupal7/sites/all/modules/ds/modules/ds_forms/ds_forms.info
4 4
package = "Display Suite"
5 5
dependencies[] = ds
6 6

  
7
; Information added by Drupal.org packaging script on 2014-10-28
8
version = "7.x-2.7"
7
; Information added by Drupal.org packaging script on 2015-04-15
8
version = "7.x-2.8"
9 9
core = "7.x"
10 10
project = "ds"
11
datestamp = "1414483431"
11
datestamp = "1429107782"
12 12

  
drupal7/sites/all/modules/ds/modules/ds_search/ds_search.info
5 5
dependencies[] = ds
6 6
configure = admin/structure/ds/list/search
7 7

  
8
; Information added by Drupal.org packaging script on 2014-10-28
9
version = "7.x-2.7"
8
; Information added by Drupal.org packaging script on 2015-04-15
9
version = "7.x-2.8"
10 10
core = "7.x"
11 11
project = "ds"
12
datestamp = "1414483431"
12
datestamp = "1429107782"
13 13

  
drupal7/sites/all/modules/ds/modules/ds_ui/ds_ui.info
4 4
package = "Display Suite"
5 5
dependencies[] = ds
6 6

  
7
; Information added by Drupal.org packaging script on 2014-10-28
8
version = "7.x-2.7"
7
; Information added by Drupal.org packaging script on 2015-04-15
8
version = "7.x-2.8"
9 9
core = "7.x"
10 10
project = "ds"
11
datestamp = "1414483431"
11
datestamp = "1429107782"
12 12

  
drupal7/sites/all/modules/ds/tests/ds_exportables_test/ds_exportables_test.info
4 4
core = 7.x
5 5
hidden = TRUE
6 6

  
7
; Information added by Drupal.org packaging script on 2014-10-28
8
version = "7.x-2.7"
7
; Information added by Drupal.org packaging script on 2015-04-15
8
version = "7.x-2.8"
9 9
core = "7.x"
10 10
project = "ds"
11
datestamp = "1414483431"
11
datestamp = "1429107782"
12 12

  
drupal7/sites/all/modules/ds/tests/ds_test.info
5 5
dependencies[] = ds_extras
6 6
hidden = TRUE
7 7

  
8
; Information added by Drupal.org packaging script on 2014-10-28
9
version = "7.x-2.7"
8
; Information added by Drupal.org packaging script on 2015-04-15
9
version = "7.x-2.8"
10 10
core = "7.x"
11 11
project = "ds"
12
datestamp = "1414483431"
12
datestamp = "1429107782"
13 13

  
drupal7/sites/all/modules/recaptcha/README.txt
27 27
       admin/config/people/captcha/recaptcha
28 28

  
29 29
3. Register for a public and private reCAPTCHA key at:
30
       https://www.google.com/recaptcha/whyrecaptcha
30
       https://www.google.com/recaptcha/admin/create
31 31

  
32 32
4. Input the keys into the reCAPTCHA settings. The rest of
33 33
   the settings should be fine as their defaults.
drupal7/sites/all/modules/recaptcha/recaptcha.admin.inc
32 32
    '#description' => t('The private key given to you when you <a href="@url" target="_blank">register for reCAPTCHA</a>.', array('@url' => url(recaptcha_get_signup_url($_SERVER['SERVER_NAME'], variable_get('site_name', ''))))),
33 33
    '#required' => TRUE,
34 34
  );
35
  $form['recaptcha_server_status_check_interval'] = array(
36
    '#type' => 'textfield',
37
    '#title' => t('Captcha server check interval'),
38
    '#default_value' => variable_get('recaptcha_server_status_check_interval', 5),
39
    '#description' => t('Number of minutes to cache reCAPTCHA server status.'),
40
    '#size' => 10,
41
  );
35 42
  $form['recaptcha_ajax_api'] = array(
36 43
    '#type' => 'checkbox',
37 44
    '#title' => t('AJAX API'),
drupal7/sites/all/modules/recaptcha/recaptcha.info
1 1
name = reCAPTCHA
2
description = "Uses the reCAPTCHA web service to improve the CAPTCHA system."
3
dependencies[] = captcha
4
package = "Spam control"
2
description = Uses the reCAPTCHA web service to improve the CAPTCHA system.
5 3
core = 7.x
4
package = Spam control
5
dependencies[] = captcha
6
files[] = tests/recaptcha_base.test
7
files[] = tests/recaptcha_ui.test
8
files[] = tests/recaptcha_server_status.test
6 9
configure = admin/config/people/captcha/recaptcha
7 10

  
8
files[] = recaptcha.admin.inc
9
files[] = recaptcha.module
10
files[] = recaptcha.install
11

  
12
; Information added by Drupal.org packaging script on 2014-02-06
13
version = "7.x-1.11"
11
; Information added by Drupal.org packaging script on 2015-04-09
12
version = "7.x-1.12"
14 13
core = "7.x"
15 14
project = "recaptcha"
16
datestamp = "1391701492"
15
datestamp = "1428593287"
17 16

  
drupal7/sites/all/modules/recaptcha/recaptcha.install
15 15
    ->execute();
16 16
  cache_clear_all('variables', 'cache');
17 17
}
18

  
19
/**
20
 * @todo The next time there is an update hook, that hook should run:
21
 * variable_del('recaptcha_secure_connection');
22
 * This removes a variable no longer in use due to https://drupal.org/node/1827922
23
 */
drupal7/sites/all/modules/recaptcha/recaptcha.module
63 63
/**
64 64
 * Implements hook_captcha().
65 65
 */
66
function recaptcha_captcha() {
67
  $args = func_get_args();
68
  $op = array_shift($args);
66
function recaptcha_captcha($op, $captcha_type = '') {
69 67
  switch ($op) {
70 68
    case 'list':
71 69
      return array('reCAPTCHA');
72 70

  
73 71
    case 'generate':
74
      $captcha_type = array_shift($args);
75 72
      $captcha = array();
76 73
      if ($captcha_type == 'reCAPTCHA') {
77 74
        // Retrieve configuration variables.
......
82 79

  
83 80
        // Test if reCAPTCHA can be used, falling back to Math if it is not
84 81
        // configured, the library won't load, or the server is down.
85
        if (!$recaptcha_public_key || !_recaptcha_load_library() || !_recaptcha_test_recaptcha_server()) {
86
          return captcha_captcha('generate', 'Math', $args);
82
        if (!$recaptcha_public_key || !_recaptcha_load_library() || !_recaptcha_server_is_up()) {
83
          return captcha_captcha('generate', 'Math');
87 84
        }
88 85

  
89 86
        if ($recaptcha_ajax_api) {
......
169 166
}
170 167

  
171 168
/**
172
 * @return boolean
173
 *   Whether or not the reCAPTCHA server is up.
169
 * @return bool
170
 *   TRUE if the reCAPTCHA server is up, FALSE otherwise.
174 171
 */
175 172
function _recaptcha_test_recaptcha_server() {
176
  $fs = @fsockopen(RECAPTCHA_VERIFY_SERVER, 80, $errno, $errstr, 10);
177
  if ($fs) {
178
    fclose($fs);
173
  $response = drupal_http_request('https://' . RECAPTCHA_VERIFY_SERVER);
174
  if (empty($response->error)) {
179 175
    return TRUE;
180 176
  }
181 177
  else {
182
    drupal_set_message(t('Unable to connect with the reCAPTCHA server (@server): @errno: @errstr', array(
178
    watchdog('reCAPTCHA', 'Unable to connect with the reCAPTCHA server (@server): @errno: @errstr', array(
183 179
      '@server' => RECAPTCHA_VERIFY_SERVER,
184
      '@errno' => $errno,
185
      '@errstr' => $errstr,
186
    )), 'error');
180
      '@errno' => $response->code,
181
      '@errstr' => $response->error,
182
    ), WATCHDOG_ERROR);
187 183
    return FALSE;
188 184
  }
189 185
}
190 186

  
187
/**
188
 * Return the cached output of _recaptcha_test_recaptcha_server().
189
 *
190
 * @return bool
191
 *   TRUE if the reCAPTCHA server was up last time it was checked, FALSE
192
 *   otherwise.
193
 */
194
function _recaptcha_server_is_up() {
195
  static $server_status;
196
  // Use static cache value, if available.
197
  if (isset($server_status)) {
198
    return $server_status;
199
  }
200
  // Check if the status is cached already.
201
  $status_cache = cache_get('recaptcha_server_status');
202
  if ($status_cache !== FALSE) {
203
    $server_status = (bool) $status_cache;
204
    return $server_status;
205
  }
206
  // Status is not cached. Check if server is up.
207
  $server_status = _recaptcha_test_recaptcha_server();
208

  
209
  // Set to 5 minutes, if interval is not set.
210
  $cache_period = variable_get('recaptcha_server_status_check_interval', 5);
211
  // Save it as integer as cache_get returns FALSE, if not found.
212
  cache_set('recaptcha_server_status', (int) $server_status, 'cache', time() + ($cache_period * 60));
213
  return $server_status;
214
}
215

  
191 216
/**
192 217
 * CAPTCHA Callback; Validates the reCAPTCHA code.
193 218
 */
......
195 220
  global $user;
196 221
  $recaptcha_private_key = variable_get('recaptcha_private_key', FALSE);
197 222
  $ip_address = ip_address();
198
  if ($recaptcha_private_key && $ip_address && $response === 'reCAPTCHA' && !empty($_POST['recaptcha_challenge_field']) && !empty($_POST['recaptcha_response_field']) && _recaptcha_test_recaptcha_server()) {
223
  if ($recaptcha_private_key && $ip_address && $response === 'reCAPTCHA' && !empty($_POST['recaptcha_challenge_field']) && !empty($_POST['recaptcha_response_field']) && _recaptcha_server_is_up()) {
199 224
    $resp = recaptcha_check_answer(
200 225
      $recaptcha_private_key,
201 226
      $ip_address,
drupal7/sites/all/modules/recaptcha/recaptcha_mailhide.info
5 5

  
6 6
files[] = recaptcha_mailhide.module
7 7

  
8
; Information added by Drupal.org packaging script on 2014-02-06
9
version = "7.x-1.11"
8
; Information added by Drupal.org packaging script on 2015-04-09
9
version = "7.x-1.12"
10 10
core = "7.x"
11 11
project = "recaptcha"
12
datestamp = "1391701492"
12
datestamp = "1428593287"
13 13

  
drupal7/sites/all/modules/recaptcha/tests/recaptcha_base.test
1
<?php
2

  
3
/**
4
 * @file
5
 * Contains ReCaptcha.
6
 */
7

  
8
/**
9
 * Test cases for ReCaptcha module UI.
10
 */
11
abstract class ReCaptchaBaseTestCase extends DrupalWebTestCase {
12

  
13
  /**
14
   * User with various administrative permissions.
15
   * @var object Drupal user
16
   */
17
  protected $admin_user;
18

  
19
  /**
20
   * Normal visitor with limited permissions
21
   * @var object Drupal user;
22
   */
23
  protected $normal_user;
24

  
25
  /**
26
   * Drupal path of the (general) CAPTCHA admin page
27
   */
28
  const RECAPTCHA_ADMIN_PATH = 'admin/config/people/captcha/recaptcha';
29

  
30
  /**
31
   * Set up some required modules and users.
32
   */
33
  function setUp() {
34
    parent::setUp('recaptcha');
35

  
36
    // Create a normal user.
37
    $permissions = array(
38
      'access comments',
39
      'post comments',
40
      'skip comment approval',
41
      'access content',
42
      'create page content',
43
      'edit own page content',
44
    );
45
    $this->normal_user = $this->drupalCreateUser($permissions);
46

  
47
    // Create an admin user.
48
    $permissions[] = 'administer CAPTCHA settings';
49
    $permissions[] = 'skip CAPTCHA';
50
    $permissions[] = 'administer permissions';
51
    $permissions[] = 'administer content types';
52
    $permissions[] = 'administer recaptcha';
53
    $this->admin_user = $this->drupalCreateUser($permissions);
54
  }
55

  
56
}
drupal7/sites/all/modules/recaptcha/tests/recaptcha_server_status.test
1
<?php
2

  
3
/**
4
 * @file
5
 * Contains ReCaptcha.
6
 */
7

  
8
/**
9
 * Test cases for ReCaptcha module UI.
10
 */
11
class ReCaptchaServerStatusTestCase extends ReCaptchaBaseTestCase {
12

  
13
  /**
14
   * Drupal path of the (general) CAPTCHA admin page
15
   */
16
  const RECAPTCHA_ADMIN_PATH = 'admin/config/people/captcha/recaptcha';
17

  
18
  public static function getInfo() {
19
    return array(
20
      'name' => 'ReCaptcha server status cache test',
21
      'group' => 'reCAPTCHA',
22
      'description' => 'Tests reCaptcha admin UI'
23
    );
24
  }
25

  
26
  public function setup() {
27
    parent::setUp();
28
    include_once drupal_get_path('module', 'recaptcha') . '/recaptcha-php-1.11/recaptchalib.php';
29
  }
30

  
31
  public function testServerStatusCache() {
32
    // No cache before status check.
33
    $status_cache = cache_get('recaptcha_server_status');
34
    $this->assertFalse($status_cache);
35

  
36
    // Call status check to set Cache.
37
    _recaptcha_server_is_up();
38

  
39
    $status_cache = cache_get('recaptcha_server_status');
40
    $this->assertNotNull($status_cache);
41
  }
42

  
43
}
drupal7/sites/all/modules/recaptcha/tests/recaptcha_ui.test
1
<?php
2

  
3
/**
4
 * @file
5
 * Contains ReCaptcha.
6
 */
7

  
8
/**
9
 * Test cases for ReCaptcha module UI.
10
 */
11
class ReCaptchaAdminUITestCase extends ReCaptchaBaseTestCase {
12

  
13
  /**
14
   * Drupal path of the (general) CAPTCHA admin page
15
   */
16
  const RECAPTCHA_ADMIN_PATH = 'admin/config/people/captcha/recaptcha';
17

  
18
  public static function getInfo() {
19
    return array(
20
      'name' => 'ReCaptcha admin UI test',
21
      'group' => 'reCAPTCHA',
22
      'description' => 'Tests reCaptcha admin UI'
23
    );
24
  }
25

  
26
  /**
27
   * Test access to the admin pages.
28
   */
29
  function testAdminAccess() {
30
    $this->drupalLogin($this->normal_user);
31
    $this->drupalGet(self::RECAPTCHA_ADMIN_PATH);
32
    file_put_contents('tmp.simpletest.html', $this->drupalGetContent());
33
    $this->assertText(t('Access denied'), 'Normal users should not be able to access the CAPTCHA admin pages', 'CAPTCHA');
34
    $this->assertResponse(403);
35

  
36
    $this->drupalLogin($this->admin_user);
37
    $this->drupalGet(self::RECAPTCHA_ADMIN_PATH);
38
    $this->assertResponse(200);
39
    $this->assertField('recaptcha_server_status_check_interval');
40

  
41

  
42
    // Update the interval and make sure it get saved properly.
43
    $edit = array(
44
      'recaptcha_server_status_check_interval' => 20,
45
      'recaptcha_public_key' => '6LekT84SAAAAAE0AqDpG5IrtKoyr7OOiE82MtXgJ',
46
      'recaptcha_private_key' => '6LekT84SAAAAAE0AqDpG5IrtKoyr7OOiE81MtXgJ',
47
    );
48
    $this->drupalPost(NULL, $edit, t('Save configuration'));
49
    $this->assertText(t('The configuration options have been saved.'));
50
    $this->assertFieldByName('recaptcha_server_status_check_interval', 20);
51
  }
52

  
53
}

Formats disponibles : Unified diff