Projet

Général

Profil

Révision be58a50c

Ajouté par Assos Assos il y a environ 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc
659 659
        */
660 660
      $credentials_pass = (boolean)($ldap_user);
661 661
    }
662
    elseif ($ldap_server->bind_method == LDAP_SERVERS_BIND_METHOD_USER) {
663
       /**
664
        * With user bind method, the only way we can reach this part of the
665
        * code is when the pw has already been checked and $ldap_user could be
666
        * loaded, so we're good to go.
667
        */
668
      $credentials_pass = true;
669
    }
662 670
    else {
663 671
      $credentials_pass = ($ldap_server->bind($ldap_user['dn'], $password, FALSE) == LDAP_SUCCESS);
664 672
    }
drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.info
14 14
files[] = ldap_authentication.admin.inc
15 15
files[] = tests/ldap_authentication.test
16 16

  
17
; Information added by Drupal.org packaging script on 2017-02-15
18
version = "7.x-2.0-beta12"
17
; Information added by Drupal.org packaging script on 2017-03-18
18
version = "7.x-2.0"
19 19
core = "7.x"
20 20
project = "ldap"
21
datestamp = "1487199794"
21
datestamp = "1489858388"
22 22

  
drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.module
212 212
      );
213 213
    }
214 214
  }
215
  return TRUE;
215
  return $result;
216 216
}
217 217

  
218 218
/**
......
335 335
  $auth_conf = ldap_authentication_get_valid_conf();
336 336
  // Hide user/password form if ldap authentication is required and deny access
337 337
  // to users without ldap authorizations is enabled
338
  if ($user->uid == 1 || $auth_conf || (current_path() == 'user/password' && $auth_conf->authenticationMode != LDAP_AUTHENTICATION_EXCLUSIVE)) {
338
  if ($user->uid == 1 || !$auth_conf || (current_path() == 'user/password' && $auth_conf->authenticationMode != LDAP_AUTHENTICATION_EXCLUSIVE)) {
339 339
    return TRUE;
340 340
   // always show at user/passwordurl. otherwise user 1 will not be able to reset password.
341 341
  }
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization.info
17 17
files[] = tests/Og2Tests.test
18 18
configure = admin/config/people/ldap/authorization
19 19

  
20
; Information added by Drupal.org packaging script on 2017-02-15
21
version = "7.x-2.0-beta12"
20
; Information added by Drupal.org packaging script on 2017-03-18
21
version = "7.x-2.0"
22 22
core = "7.x"
23 23
project = "ldap"
24
datestamp = "1487199794"
24
datestamp = "1489858388"
25 25

  
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_drupal_role/ldap_authorization_drupal_role.info
9 9
files[] = ldap_authorization_drupal_role.module
10 10
files[] = ldap_authorization_drupal_role.inc
11 11

  
12
; Information added by Drupal.org packaging script on 2017-02-15
13
version = "7.x-2.0-beta12"
12
; Information added by Drupal.org packaging script on 2017-03-18
13
version = "7.x-2.0"
14 14
core = "7.x"
15 15
project = "ldap"
16
datestamp = "1487199794"
16
datestamp = "1489858388"
17 17

  
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.info
13 13

  
14 14
core = "7.x"
15 15

  
16
; Information added by Drupal.org packaging script on 2017-02-15
17
version = "7.x-2.0-beta12"
16
; Information added by Drupal.org packaging script on 2017-03-18
17
version = "7.x-2.0"
18 18
core = "7.x"
19 19
project = "ldap"
20
datestamp = "1487199794"
20
datestamp = "1489858388"
21 21

  
drupal7/sites/all/modules/ldap/ldap_authorization/ldap_authorization_og/ldap_authorization_og.module
141 141
/**
142 142
 * Generic function to convert between query values and organic groups structures and attributes
143 143
 *
144
 * @param mixed $value signifies query value e.g. 'bakers', 7 etc.
145
 * @param mixed $value_type signifies query type e.g. 'group_name', 'gid', etc.
146
 * @param string $return signifying return type. e.g.  'object', 'label', 'name', 'gid'
144
 * @param mixed $entity_type signifies query value e.g. 'bakers', 7 etc.
145
 * @param mixed $group_name signifies query type e.g. 'group_name', 'gid', etc.
146
 *
147 147
 * @return mixed organic group object, gid, label, etc.
148 148
 */
149 149
function ldap_authorization_og2_get_group_from_name($entity_type, $group_name) {
drupal7/sites/all/modules/ldap/ldap_feeds/FeedsLdapEntryParser.inc
44 44
          }
45 45
        }
46 46
        else {
47
          $parsed_item[$source] = ' ';
47
          $parsed_item[$source] = '';
48 48
        }
49 49
      }
50 50
      $parsed_items[] = $parsed_item;
drupal7/sites/all/modules/ldap/ldap_feeds/ldap_feeds.info
12 12
core = 7.x
13 13
php = 5.2
14 14

  
15
; Information added by Drupal.org packaging script on 2017-02-15
16
version = "7.x-2.0-beta12"
15
; Information added by Drupal.org packaging script on 2017-03-18
16
version = "7.x-2.0"
17 17
core = "7.x"
18 18
project = "ldap"
19
datestamp = "1487199794"
19
datestamp = "1489858388"
20 20

  
drupal7/sites/all/modules/ldap/ldap_help/ldap_help.info
5 5

  
6 6
dependencies[] = ldap_servers
7 7
dependencies[] = ldap_test
8
; Information added by Drupal.org packaging script on 2017-02-15
9
version = "7.x-2.0-beta12"
8
; Information added by Drupal.org packaging script on 2017-03-18
9
version = "7.x-2.0"
10 10
core = "7.x"
11 11
project = "ldap"
12
datestamp = "1487199794"
12
datestamp = "1489858388"
13 13

  
drupal7/sites/all/modules/ldap/ldap_query/ldap_query.admin.inc
105 105
   // }
106 106
  }
107 107
  else {
108
    form_set_error($server->errorName(), $server->errorMsg());
109
    $server->clearError();
108
    form_set_error($query->errorName(), $query->errorMsg());
109
    $query->clearError();
110 110
  }
111 111
  ldap_query_cache_clear();
112 112
}
drupal7/sites/all/modules/ldap/ldap_query/ldap_query.info
17 17

  
18 18
configure = admin/config/people/ldap/query
19 19

  
20
; Information added by Drupal.org packaging script on 2017-02-15
21
version = "7.x-2.0-beta12"
20
; Information added by Drupal.org packaging script on 2017-03-18
21
version = "7.x-2.0"
22 22
core = "7.x"
23 23
project = "ldap"
24
datestamp = "1487199794"
24
datestamp = "1489858388"
25 25

  
drupal7/sites/all/modules/ldap/ldap_servers/LdapServer.class.php
327 327
      return LDAP_CONNECT_ERROR;
328 328
    }
329 329

  
330
    if ($anon_bind !== FALSE && $userdn === NULL && $pass === NULL && $this->bind_method == LDAP_SERVERS_BIND_METHOD_ANON) {
330
    if ($anon_bind === FALSE && $userdn === NULL && $pass === NULL && $this->bind_method == LDAP_SERVERS_BIND_METHOD_ANON) {
331 331
      $anon_bind = TRUE;
332 332
    }
333 333
    if ($anon_bind === TRUE) {
......
463 463
      return FALSE;
464 464
    }
465 465

  
466
    if (!empty($attributes['unicodePwd']) && ($this->ldap_type == 'ad')) {
467
      $attributes['unicodePwd'] = ldap_servers_convert_password_for_active_directory_unicodePwd($attributes['unicodePwd']);
468
    }
469

  
466 470
    $result = @ldap_add($this->connection, $dn, $attributes);
467 471
    if (!$result) {
468 472
      $error = "LDAP Server ldap_add(%dn) Error Server ID = %sid, LDAP Err No: %ldap_errno LDAP Err Message: %ldap_err2str ";
469 473
      $tokens = array('%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection)));
470
      debug(t($error, $tokens));
474
      //debug(t($error, $tokens));
471 475
      watchdog('ldap_server', $error, $tokens, WATCHDOG_ERROR);
472 476
    }
473 477

  
......
549 553
        $old_attributes =  $entries[0];
550 554
      }
551 555
    }
556

  
557
    if (!empty($attributes['unicodePwd']) && ($this->ldap_type == 'ad')) {
558
      $attributes['unicodePwd'] = ldap_servers_convert_password_for_active_directory_unicodePwd($attributes['unicodePwd']);
559
    }
560

  
552 561
    $attributes = $this->removeUnchangedAttributes($attributes, $old_attributes);
553 562

  
554 563
    foreach ($attributes as $key => $cur_val) {
......
1139 1148
        && isset($ldap_entry[$this->unique_persistent_attr][0])
1140 1149
        && is_scalar($ldap_entry[$this->unique_persistent_attr][0])
1141 1150
        ) {
1142
      $puid = $ldap_entry[$this->unique_persistent_attr][0];
1151
      if (is_array($ldap_entry[$this->unique_persistent_attr])) {
1152
        $puid = $ldap_entry[$this->unique_persistent_attr][0];
1153
      }
1154
      else {
1155
        $puid = $ldap_entry[$this->unique_persistent_attr];
1156
      }
1143 1157
      return ($this->unique_persistent_attr_binary) ? ldap_servers_binary($puid) : $puid;
1144 1158
    }
1145 1159
    else {
drupal7/sites/all/modules/ldap/ldap_servers/LdapServerAdmin.class.php
691 691
          'size' => 'small',
692 692
          'not null' => FALSE,
693 693
          'default' => 0,
694
          'boolean' => FALSE,
694 695
        ),
695 696
      ),
696 697

  
......
877 878
        'form' => array(
878 879
          'fieldset' => 'users',
879 880
          '#type' => 'checkbox',
880
          '#title' => t('Does PUID hold a binary value?'),
881
          '#description' => t(''),
881
          '#title' => t('Does the <em>Persistent and Unique User ID
882
            Attribute</em> hold a binary value?'),
883
          '#description' => t('You need to set this if you are using a binary
884
             attribute such as objectSid in ActiveDirectory for the PUID.<br>
885
             If you don\'t want this consider switching to another attribute,
886
             such as samaccountname.'),
882 887
        ),
883 888
        'schema' => array(
884 889
          'type' => 'int',
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.drush.inc
1
<?php
2

  
3
/**
4
 * @file
5
 *   LDAP module drush integration.
6
 */
7

  
8
/**
9
 * Implements hook_drush_command().
10
 *
11
 * @return
12
 *   An associative array describing your command(s).
13
 *
14
 * @see drush_parse_command()
15
 */
16
function ldap_servers_drush_command() {
17
  $items['ldap-servers-set-password'] = array(
18
    'description' => 'Set the password of an otherwise already configured LDAP server.',
19
    'aliases' => array('lssp'),
20
    'arguments' => array(
21
      'ldap_sid' => 'The configured LDAP server ID.'
22
    ),
23
    'options' => array(
24
      'password' => 'The password to set for the server.'
25
    ),
26
    'examples' => array(
27
      'drush lssp LDAP_SERVER_ID --password="PASSWORD"' => 'Sets the password for LDAP_SERVER_ID. Replace LDAP_SERVER_ID with the "Machine name for this configuration." of
28
        the server found at /admin/config/people/ldap/servers, and replace PASSWORD with your password.',
29
    ),
30
  );
31
  return $items;
32
}
33

  
34
/**
35
 * Callback for the ldap-servers-set-password command.
36
 *
37
 * @param string $ldap_sid The server ID for which to set the password.
38
 * @option string --password Used to provide the password via an option in the Drush command.
39
 *
40
 * @return
41
 *   Error or success message.
42
 */
43
function drush_ldap_servers_set_password($ldap_sid = NULL) {
44
  // Check for the argument.
45
  if (!isset($ldap_sid)) {
46
    return drush_set_error(t('The server ID was not included as an argument. Use the "Machine name for this server configuration." found on the edit screen for that server.'));
47
  }
48
  // Instantiate the server configuration with the provided sid.
49
  ldap_servers_module_load_include('php', 'ldap_servers', 'LdapServerAdmin.class');
50
  $ldap_server = new LdapServerAdmin($ldap_sid);
51
  if (isset($ldap_server)) {
52
    // Retrieves the password from the --password option set in the drush command.
53
    $ldap_server->bindpw = drush_get_option('password');
54
    if (!isset($ldap_server->bindpw)) {
55
      return drupal_set_message(dt('No password was provided for @ldap_sid. A password has not been set.', array('@ldap_sid' => $ldap_sid)));
56
    }
57
    // Save the server configuration with the password.
58
    $ldap_server->save('edit');
59
    // Notify of success.
60
    return drupal_set_message(dt('Password for @ldap_sid has been set.', array('@ldap_sid' => $ldap_sid)));
61
  }
62
  // Provided server ID does not match any of the existing server IDs.
63
  return drush_set_error(dt('@ldap_sid does not match the server ID of any configured servers.  Use the "Machine name for this server configuration." found on the edit screen for that server.',
64
    array('@ldap_sid' => $ldap_sid)));
65
}
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.encryption.inc
173 173
        $key = substr($key, 0, $key_length);
174 174
        // Determine the algorithm IV.
175 175
        $ivsize = mcrypt_enc_get_iv_size($td);
176
        // Split apart IV and text.
177
        $iv = substr($cipher_txt, 0, $ivsize);
178
        $cipher_txt = substr($cipher_txt, $ivsize);
179
        // If the IV exists, decrypt the text.
180
        if ($iv) {
181
          mcrypt_generic_init($td, $key, $iv);
182
          $clear_txt = mdecrypt_generic($td, $cipher_txt);
183
          mcrypt_generic_deinit($td);
176
        // Process if the decoded cipher text is sufficient.
177
        if (strlen($cipher_txt) > $ivsize) {
178
          // Split apart IV and text.
179
          $iv = substr($cipher_txt, 0, $ivsize);
180
          $cipher_txt = substr($cipher_txt, $ivsize);
181
          // If the IV exists, decrypt the text.
182
          if ($iv) {
183
            mcrypt_generic_init($td, $key, $iv);
184
            $clear_txt = mdecrypt_generic($td, $cipher_txt);
185
            mcrypt_generic_deinit($td);
186
          }
184 187
        }
185 188
        // Close the module.
186 189
        mcrypt_module_close($td);
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.functions.inc
47 47
  return $status;
48 48
}
49 49

  
50
/**
51
 * Converts a password to the format that Active Directory supports (for the 
52
 * purpose of changing or setting).  Note that AD needs the field to be called
53
 * unicodePwd (as opposed to userPassword)
54
 * 
55
 * @param string $password
56
 *    The password that is being formatted for Active Directory unicodePwd field
57
 * @return string
58
 *    $password surrounded with quotes and in UTF-16LE encoding
59
 */
60
function ldap_servers_convert_password_for_active_directory_unicodePwd($password) {
61
  // This function can be called with $attributes['unicodePwd'] as an array.
62
  if (!is_array($password)) {
63
    return mb_convert_encoding("\"{$password}\"", "UTF-16LE");
64
  }
65
  else {
66
    // Presumably there is no use case for there being more than one password in
67
    // the $attributes array, hence it will be at index 0 and we return in kind.
68
    return array(mb_convert_encoding("\"{$password[0]}\"", "UTF-16LE"));
69
  }
70
}
71

  
50 72
/**
51 73
 *
52 74
 *  this attempts to find bad dns, but should only be used as warnings
......
226 248
        if ($is_scalar) {
227 249
            $values = array($values);
228 250
        }
251
        if ($values === NULL) {
252
          return NULL;
253
        }
229 254

  
230 255
       foreach ($values as $key => $val) {
231 256
            // Escaping of filter meta characters
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.info
17 17
files[] = tests/ldap_servers.test
18 18
configure = admin/config/people/ldap/servers
19 19

  
20
; Information added by Drupal.org packaging script on 2017-02-15
21
version = "7.x-2.0-beta12"
20
; Information added by Drupal.org packaging script on 2017-03-18
21
version = "7.x-2.0"
22 22
core = "7.x"
23 23
project = "ldap"
24
datestamp = "1487199794"
24
datestamp = "1489858388"
25 25

  
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.install
84 84
        try {
85 85
          $connect_result = $server->connect();
86 86
          if ($connect_result == LDAP_SUCCESS) {
87
            $bind_result = $server->bind();
87
            if ($server->bind_method == LDAP_SERVERS_BIND_METHOD_USER) {
88
              // Check bind anonymously if set to bind via user credentials.
89
              // The user has already logged in and so their is no dn or password
90
              // to check since LDAP doesn't store passwords.
91
              $bind_result = $server->bind(NULL, NULL, TRUE);
92
            } else {
93
              $bind_result = $server->bind();
94
            }
88 95
            if ($bind_result == LDAP_SUCCESS) {
89 96
              $requirements[$server_req_key]['value'] = $t('Connection: Success, Bind: Success', $server_tokens);
90 97
              $requirements[$server_req_key]['severity'] = REQUIREMENT_OK;
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.module
320 320
      if (!isset($attributes[$ldap_server->mail_attr])) {
321 321
        $attributes[$ldap_server->mail_attr] = ldap_servers_set_attribute_map();
322 322
      }
323
      if (!isset($attributes[$ldap_server->picture_attr])) {
323
      if ($ldap_server->picture_attr && !isset($attributes[$ldap_server->picture_attr])) {
324 324
        $attributes[$ldap_server->picture_attr] = ldap_servers_set_attribute_map();
325 325
      }
326 326
      if ($ldap_server->unique_persistent_attr && !isset($attributes[$ldap_server->unique_persistent_attr])) {
327 327
        $attributes[$ldap_server->unique_persistent_attr] = ldap_servers_set_attribute_map();
328 328
      }
329
      if ($ldap_server->groupUserMembershipsAttr && !isset($attributes[$ldap_server->groupUserMembershipsAttr])) {
330
        $attributes[$ldap_server->groupUserMembershipsAttr] = ldap_servers_set_attribute_map();
331
      }
329 332
      if ($ldap_server->user_dn_expression) {
330 333
        ldap_servers_token_extract_attributes($attributes, $ldap_server->user_dn_expression, TRUE);
331 334
      }
drupal7/sites/all/modules/ldap/ldap_servers/ldap_servers.test_form.inc
277 277
    $group_dn = $values['grp_test_grp_dn'];
278 278

  
279 279
    $result = @ldap_read($ldap_server->connection, $group_dn, 'objectClass=*');
280
    $group_entry = ldap_get_entries($ldap_server->connection, $result);
280
    if (is_array($result)) {
281
      $group_entry = ldap_get_entries($ldap_server->connection, $result);
282
    }
281 283
    $user = isset($values['testing_drupal_username']) ? $values['testing_drupal_username'] : NULL;
282 284

  
283 285
    foreach (array(FALSE, TRUE) as $nested) { //FALSE
......
347 349
    $form_state['ldap_server_test_data']['ldap_user'] = $ldap_user;
348 350
  }
349 351

  
350
  if ( isset($group_entry) ) {
352
  if (isset($group_entry) ) {
351 353
    $form_state['ldap_server_test_data']['group_entry'] = $group_entry;
352 354
  }
353 355
  
drupal7/sites/all/modules/ldap/ldap_sso/ldap_sso.info
6 6
core = 7.x
7 7
configure = admin/config/people/ldap/authentication
8 8

  
9
; Information added by Drupal.org packaging script on 2017-02-15
10
version = "7.x-2.0-beta12"
9
; Information added by Drupal.org packaging script on 2017-03-18
10
version = "7.x-2.0"
11 11
core = "7.x"
12 12
project = "ldap"
13
datestamp = "1487199794"
13
datestamp = "1489858388"
14 14

  
drupal7/sites/all/modules/ldap/ldap_test/ldap_test.info
18 18
files[] = LdapTestFunctions.class.php
19 19
files[] = LdapUserTestCase.class.php
20 20

  
21
; Information added by Drupal.org packaging script on 2017-02-15
22
version = "7.x-2.0-beta12"
21
; Information added by Drupal.org packaging script on 2017-03-18
22
version = "7.x-2.0"
23 23
core = "7.x"
24 24
project = "ldap"
25
datestamp = "1487199794"
25
datestamp = "1489858388"
26 26

  
drupal7/sites/all/modules/ldap/ldap_user/LdapUserConf.class.php
509 509
    if (is_scalar($account)) {
510 510
      $username = $account;
511 511
      $account = new stdClass();
512
      $acount->name = $username;
512
      $account->name = $username;
513 513
    }
514 514

  
515 515
    list($account, $user_entity) = ldap_user_load_user_acct_and_entity($account->name);
......
867 867
    // determine server that is associated with user
868 868

  
869 869
    $boolean_result = FALSE;
870
    $language = ($account->language) ? $account->language : LANGUAGE_NONE;
871
    if (isset($account->ldap_user_prov_entries[$language][0])) {
872
      foreach ($account->ldap_user_prov_entries[$language] as $i => $field_instance) {
870
    if (isset($account->ldap_user_prov_entries[LANGUAGE_NONE][0])) {
871
      foreach ($account->ldap_user_prov_entries[LANGUAGE_NONE] as $i => $field_instance) {
873 872
        $parts = explode('|', $field_instance['value']);
874 873
        if (count($parts) == 2) {
875 874

  
drupal7/sites/all/modules/ldap/ldap_user/LdapUserConfAdmin.class.php
998 998

  
999 999
    );
1000 1000

  
1001
    $values['orphanedDrupalAcctBehaviorDescription'] = '<ul>' .
1002
       '<li style="color: red">' . t('This is a new feature as of 11/7/2012!
1003
        It is highly recommended to use the "Perform no action,
1004
        but email list of orphaned accounts" for some time before using the
1005
        "Disable the account" options.') . '</li>' .
1006

  
1007
      '<li>' . t('These actions will only occur if the query to server is successful
1008
      and does not return a user entry.  If the ldap server is down or otherwise
1009
      cannot be connected to, no actions
1010
      will be performed.') . '</li>' .
1011

  
1012
      '<li>' .
1013
      t('When initially using this option, its best to simply check email and
1014
        delete the accounts by hand.  When you are happy with the
1015
      behavior, switch to one of the automated options.') . '</li>' .
1016

  
1017
      '</ul>';
1001
    $values['orphanedDrupalAcctBehaviorDescription'] = t('It is highly recommended to use the "Perform no action, but email list of orphaned accounts" for some time before considering switching to "Disable the account" options.');
1018 1002

  
1019 1003

  
1020 1004
    $values['manualAccountConflictOptions'] =  array(
drupal7/sites/all/modules/ldap/ldap_user/ldap_user.info
23 23
stylesheets[all][] = ldap_user.css
24 24
configure = admin/config/people/ldap/user
25 25

  
26
; Information added by Drupal.org packaging script on 2017-02-15
27
version = "7.x-2.0-beta12"
26
; Information added by Drupal.org packaging script on 2017-03-18
27
version = "7.x-2.0"
28 28
core = "7.x"
29 29
project = "ldap"
30
datestamp = "1487199794"
30
datestamp = "1489858388"
31 31

  
drupal7/sites/all/modules/ldap/ldap_user/ldap_user.module
228 228
      case 'all':
229 229
        $attributes[$ldap_server->user_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->user_attr]); // array($ldap_server->user_attr, 0, NULL);
230 230
        $attributes[$ldap_server->mail_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->mail_attr]);
231
        $attributes[$ldap_server->picture_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->picture_attr]);
232
        $attributes[$ldap_server->unique_persistent_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->unique_persistent_attr]);
231
        if ($ldap_server->picture_attr) {
232
          $attributes[$ldap_server->picture_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->picture_attr]);
233
        }
234
        if ($ldap_server->unique_persistent_attr) {
235
          $attributes[$ldap_server->unique_persistent_attr] = ldap_servers_set_attribute_map(@$attributes[$ldap_server->unique_persistent_attr]);
236
        }
233 237
        if ($ldap_server->mail_template) {
234 238
          ldap_servers_token_extract_attributes($attributes,  $ldap_server->mail_template);
235 239
        }
......
491 495
  array_unshift($form['#validate'], 'ldap_user_grab_password_validate');
492 496
}
493 497

  
498
/**
499
* Implements hook_form_FORM_ID_alter(). for user-pass-reset form. Useful for
500
* sites where this is the form ID for a user to intially set their password
501
* (user clicks an emailed registration link, is prompted to set their password).
502
*/
503
function ldap_user_form_user_pass_reset_alter(&$form, &$form_state) {
504
  array_unshift($form['#validate'], 'ldap_user_grab_password_validate');
505
}
506

  
494 507
/**
495 508
 * store password from logon forms in ldap_user_ldap_provision_pwd static variable
496 509
 * for use in provisioning to ldap
......
763 776
 *   and protect unencrypted user password from other modules
764 777
 *
765 778
 *   @param enum string $action 'get' | 'set'
766
 *   @param string | FALE $value as user entered password
779
 *   @param string | FALSE $value as user entered password
767 780
 */
768

  
769

  
770 781
function ldap_user_ldap_provision_pwd($action, $value = NULL, $reset = FALSE) {
771 782

  
772 783
  //$calling_function = FALSE;
drupal7/sites/all/modules/ldap/ldap_views/ldap_views.info
21 21
files[] = handlers/ldap_views_handler_filter_attribute.inc
22 22
files[] = handlers/ldap_views_handler_sort.inc
23 23
files[] = handlers/ldap_views_handler_sort_attribute.inc
24
; Information added by Drupal.org packaging script on 2017-02-15
25
version = "7.x-2.0-beta12"
24
; Information added by Drupal.org packaging script on 2017-03-18
25
version = "7.x-2.0"
26 26
core = "7.x"
27 27
project = "ldap"
28
datestamp = "1487199794"
28
datestamp = "1489858388"
29 29

  
drupal7/sites/all/modules/recaptcha/README.txt
6 6
more information on what reCAPTCHA is, please visit:
7 7
    https://www.google.com/recaptcha
8 8

  
9
This version of the module uses the new Google No CAPTCHA reCAPTCHA API.
9 10

  
10 11
DEPENDENCIES
11 12
------------
12 13

  
13
* reCAPTCHA depends on the CAPTCHA module.
14
* reCAPTCHA module depends on the CAPTCHA module.
14 15
  https://drupal.org/project/captcha
15
* Some people have found that they also need to use jQuery Update module.
16
  https://drupal.org/project/jquery_update
17 16

  
18 17

  
19 18
CONFIGURATION
......
26 25
   administration page available at:
27 26
       admin/config/people/captcha/recaptcha
28 27

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

  
32
4. Input the keys into the reCAPTCHA settings. The rest of
33
   the settings should be fine as their defaults.
31
4. Input the site and private keys into the reCAPTCHA settings.
34 32

  
35 33
5. Visit the Captcha administration page and set where you
36 34
   want the reCAPTCHA form to be presented:
37 35
       admin/config/people/captcha
38 36

  
37
KNOWN ISSUES
38
------------
39 39

  
40
MAILHIDE INPUT FORMAT
41
---------------------
42

  
43
The reCAPTCHA module also comes with an input format to
44
protect email addresses. This, of course, is optional to
45
use and is only there if you want it. The following is how
46
you use that input filter:
47

  
48
1. Enable the reCAPTCHA Mailhide module:
49
       admin/modules
50

  
51
2. Head over to your text format settings:
52
       admin/config/content/formats
53

  
54
3. Edit your default input format and add the reCAPTCHA
55
   Mailhide filter.
56

  
57
4. Click on the Configure tab and put in a public and
58
   private Mailhide key obtained from:
59
       https://www.google.com/recaptcha/mailhide/apikey
60

  
61
5. Use the Rearrange tab to rearrange the weight of the
62
   filter depending on what filters already exist.  Make
63
   sure it is before the URL Filter.
64

  
65
Note: You will require the installation of the mcrypt
66
      PHP module in your web server for Mailhide to work:
67
         http://php.net/manual/en/ref.mcrypt.php
68

  
69

  
70
MULTI-DOMAIN SUPPORT
71
--------------------
72

  
73
Since reCAPTCHA uses API keys that are unique to each
74
domain, if you're using a multi-domain system using the
75
same database, the reCAPTCHA module won't work when
76
querying the reCAPTCHA web service.  If you put the
77
following into your sites/mysite/settings.php file for
78
each domain, it will override the API key values and make
79
it so multi-domain systems are capable.
80

  
81
  $conf = array(
82
    'recaptcha_public_key' =>  'my other public key',
83
    'recaptcha_private_key' =>  'my other private key',
84
  );
85

  
86

  
87
CUSTOM RECAPTCHA THEME
88
----------------------
89

  
90
You can create a custom reCAPTCHA theme widget by setting
91
the theme of the reCAPTCHA form to "custom" in the
92
reCAPTCHA administration page.  This will output a custom
93
form that is themeable through the theme function:
94
  theme_recaptcha_custom_widget().
95

  
96
If you don't implement this function, it is still quite
97
easily customizable through manipulating the CSS.
98

  
99
For more information on this, visit:
100
https://developers.google.com/recaptcha/docs/customization
40
- The PHP setting 'arg_separator.output' set by Drupal core causes conflicts
41
  with the Google reCAPTCHA library. This setting is and was never used by
42
  Drupal core, but still exist in "settings.php" and need to be removed.
43
    
44
  See https://www.drupal.org/node/2476237 for more information.
101 45

  
46
- cURL requests fail because of outdated root certificate. The reCAPTCHA module
47
  may not able to connect to Google servers and fails to verify the answer.
48
  
49
  See https://www.drupal.org/node/2481341 for more information.
102 50

  
103 51
THANK YOU
104 52
---------
drupal7/sites/all/modules/recaptcha/recaptcha-php-1.11/LICENSE
1
Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
2
AUTHORS:
3
  Mike Crawford
4
  Ben Maurer
5

  
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
of this software and associated documentation files (the "Software"), to deal
8
in the Software without restriction, including without limitation the rights
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
copies of the Software, and to permit persons to whom the Software is
11
furnished to do so, subject to the following conditions:
12

  
13
The above copyright notice and this permission notice shall be included in
14
all copies or substantial portions of the Software.
15

  
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
THE SOFTWARE.
drupal7/sites/all/modules/recaptcha/recaptcha-php-1.11/README
1
reCAPTCHA README
2
================
3

  
4
The reCAPTCHA PHP Lirary helps you use the reCAPTCHA API. Documentation
5
for this library can be found at
6

  
7
	http://recaptcha.net/plugins/php
drupal7/sites/all/modules/recaptcha/recaptcha-php-1.11/example-captcha.php
1
<html>
2
  <body>
3
    <form action="" method="post">
4
<?php
5

  
6
require_once('recaptchalib.php');
7

  
8
// Get a key from https://www.google.com/recaptcha/admin/create
9
$publickey = "";
10
$privatekey = "";
11

  
12
# the response from reCAPTCHA
13
$resp = null;
14
# the error code from reCAPTCHA, if any
15
$error = null;
16

  
17
# was there a reCAPTCHA response?
18
if ($_POST["recaptcha_response_field"]) {
19
        $resp = recaptcha_check_answer ($privatekey,
20
                                        $_SERVER["REMOTE_ADDR"],
21
                                        $_POST["recaptcha_challenge_field"],
22
                                        $_POST["recaptcha_response_field"]);
23

  
24
        if ($resp->is_valid) {
25
                echo "You got it!";
26
        } else {
27
                # set the error code so that we can display it
28
                $error = $resp->error;
29
        }
30
}
31
echo recaptcha_get_html($publickey, $error);
32
?>
33
    <br/>
34
    <input type="submit" value="submit" />
35
    </form>
36
  </body>
37
</html>
drupal7/sites/all/modules/recaptcha/recaptcha-php-1.11/example-mailhide.php
1
<html><body>
2
<?
3
require_once ("recaptchalib.php");
4

  
5
// get a key at http://www.google.com/recaptcha/mailhide/apikey
6
$mailhide_pubkey = '';
7
$mailhide_privkey = '';
8

  
9
?>
10

  
11
The Mailhide version of example@example.com is
12
<? echo recaptcha_mailhide_html ($mailhide_pubkey, $mailhide_privkey, "example@example.com"); ?>. <br>
13

  
14
The url for the email is:
15
<? echo recaptcha_mailhide_url ($mailhide_pubkey, $mailhide_privkey, "example@example.com"); ?> <br>
16

  
17
</body></html>
drupal7/sites/all/modules/recaptcha/recaptcha-php-1.11/recaptchalib.php
1
<?php
2
/*
3
 * This is a PHP library that handles calling reCAPTCHA.
4
 *    - Documentation and latest version
5
 *          http://recaptcha.net/plugins/php/
6
 *    - Get a reCAPTCHA API Key
7
 *          https://www.google.com/recaptcha/admin/create
8
 *    - Discussion group
9
 *          http://groups.google.com/group/recaptcha
10
 *
11
 * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
12
 * AUTHORS:
13
 *   Mike Crawford
14
 *   Ben Maurer
15
 *
16
 * Permission is hereby granted, free of charge, to any person obtaining a copy
17
 * of this software and associated documentation files (the "Software"), to deal
18
 * in the Software without restriction, including without limitation the rights
19
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
 * copies of the Software, and to permit persons to whom the Software is
21
 * furnished to do so, subject to the following conditions:
22
 *
23
 * The above copyright notice and this permission notice shall be included in
24
 * all copies or substantial portions of the Software.
25
 *
26
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
32
 * THE SOFTWARE.
33
 */
34

  
35
/**
36
 * The reCAPTCHA server URL's
37
 */
38
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
39
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
40
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
41

  
42
/**
43
 * Encodes the given data into a query string format
44
 * @param $data - array of string elements to be encoded
45
 * @return string - encoded request
46
 */
47
function _recaptcha_qsencode ($data) {
48
        $req = "";
49
        foreach ( $data as $key => $value )
50
                $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
51

  
52
        // Cut the last '&'
53
        $req=substr($req,0,strlen($req)-1);
54
        return $req;
55
}
56

  
57

  
58

  
59
/**
60
 * Submits an HTTP POST to a reCAPTCHA server
61
 * @param string $host
62
 * @param string $path
63
 * @param array $data
64
 * @param int port
65
 * @return array response
66
 */
67
function _recaptcha_http_post($host, $path, $data, $port = 80) {
68

  
69
        $req = _recaptcha_qsencode ($data);
70

  
71
        $http_request  = "POST $path HTTP/1.0\r\n";
72
        $http_request .= "Host: $host\r\n";
73
        $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
74
        $http_request .= "Content-Length: " . strlen($req) . "\r\n";
75
        $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
76
        $http_request .= "\r\n";
77
        $http_request .= $req;
78

  
79
        $response = '';
80
        if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
81
                die ('Could not open socket');
82
        }
83

  
84
        fwrite($fs, $http_request);
85

  
86
        while ( !feof($fs) )
87
                $response .= fgets($fs, 1160); // One TCP-IP packet
88
        fclose($fs);
89
        $response = explode("\r\n\r\n", $response, 2);
90

  
91
        return $response;
92
}
93

  
94

  
95

  
96
/**
97
 * Gets the challenge HTML (javascript and non-javascript version).
98
 * This is called from the browser, and the resulting reCAPTCHA HTML widget
99
 * is embedded within the HTML form it was called from.
100
 * @param string $pubkey A public key for reCAPTCHA
101
 * @param string $error The error given by reCAPTCHA (optional, default is null)
102
 * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
103

  
104
 * @return string - The HTML to be embedded in the user's form.
105
 */
106
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
107
{
108
	if ($pubkey == null || $pubkey == '') {
109
		die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
110
	}
111
	
112
	if ($use_ssl) {
113
                $server = RECAPTCHA_API_SECURE_SERVER;
114
        } else {
115
                $server = RECAPTCHA_API_SERVER;
116
        }
117

  
118
        $errorpart = "";
119
        if ($error) {
120
           $errorpart = "&amp;error=" . $error;
121
        }
122
        return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
123

  
124
	<noscript>
125
  		<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
126
  		<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
127
  		<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
128
	</noscript>';
129
}
130

  
131

  
132

  
133

  
134
/**
135
 * A ReCaptchaResponse is returned from recaptcha_check_answer()
136
 */
137
class ReCaptchaResponse {
138
        var $is_valid;
139
        var $error;
140
}
141

  
142

  
143
/**
144
  * Calls an HTTP POST function to verify if the user's guess was correct
145
  * @param string $privkey
146
  * @param string $remoteip
147
  * @param string $challenge
148
  * @param string $response
149
  * @param array $extra_params an array of extra variables to post to the server
150
  * @return ReCaptchaResponse
151
  */
152
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
153
{
154
	if ($privkey == null || $privkey == '') {
155
		die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
156
	}
157

  
158
	if ($remoteip == null || $remoteip == '') {
159
		die ("For security reasons, you must pass the remote ip to reCAPTCHA");
160
	}
161

  
162
	
163
	
164
        //discard spam submissions
165
        if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
166
                $recaptcha_response = new ReCaptchaResponse();
167
                $recaptcha_response->is_valid = false;
168
                $recaptcha_response->error = 'incorrect-captcha-sol';
169
                return $recaptcha_response;
170
        }
171

  
172
        $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
173
                                          array (
174
                                                 'privatekey' => $privkey,
175
                                                 'remoteip' => $remoteip,
176
                                                 'challenge' => $challenge,
177
                                                 'response' => $response
178
                                                 ) + $extra_params
179
                                          );
180

  
181
        $answers = explode ("\n", $response [1]);
182
        $recaptcha_response = new ReCaptchaResponse();
183

  
184
        if (trim ($answers [0]) == 'true') {
185
                $recaptcha_response->is_valid = true;
186
        }
187
        else {
188
                $recaptcha_response->is_valid = false;
189
                $recaptcha_response->error = $answers [1];
190
        }
191
        return $recaptcha_response;
192

  
193
}
194

  
195
/**
196
 * gets a URL where the user can sign up for reCAPTCHA. If your application
197
 * has a configuration page where you enter a key, you should provide a link
198
 * using this function.
199
 * @param string $domain The domain where the page is hosted
200
 * @param string $appname The name of your application
201
 */
202
function recaptcha_get_signup_url ($domain = null, $appname = null) {
203
	return "https://www.google.com/recaptcha/admin/create?" .  _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
204
}
205

  
206
function _recaptcha_aes_pad($val) {
207
	$block_size = 16;
208
	$numpad = $block_size - (strlen ($val) % $block_size);
209
	return str_pad($val, strlen ($val) + $numpad, chr($numpad));
210
}
211

  
212
/* Mailhide related code */
213

  
214
function _recaptcha_aes_encrypt($val,$ky) {
215
	if (! function_exists ("mcrypt_encrypt")) {
216
		die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
217
	}
218
	$mode=MCRYPT_MODE_CBC;   
219
	$enc=MCRYPT_RIJNDAEL_128;
220
	$val=_recaptcha_aes_pad($val);
221
	return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
222
}
223

  
224

  
225
function _recaptcha_mailhide_urlbase64 ($x) {
226
	return strtr(base64_encode ($x), '+/', '-_');
227
}
228

  
229
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
230
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
231
	if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
232
		die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
233
		     "you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
234
	}
235
	
236

  
237
	$ky = pack('H*', $privkey);
238
	$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
239
	
240
	return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
241
}
242

  
243
/**
244
 * gets the parts of the email to expose to the user.
245
 * eg, given johndoe@example,com return ["john", "example.com"].
246
 * the email is then displayed as john...@example.com
247
 */
248
function _recaptcha_mailhide_email_parts ($email) {
249
	$arr = preg_split("/@/", $email );
250

  
251
	if (strlen ($arr[0]) <= 4) {
252
		$arr[0] = substr ($arr[0], 0, 1);
253
	} else if (strlen ($arr[0]) <= 6) {
254
		$arr[0] = substr ($arr[0], 0, 3);
255
	} else {
256
		$arr[0] = substr ($arr[0], 0, 4);
257
	}
258
	return $arr;
259
}
260

  
261
/**
262
 * Gets html to display an email address given a public an private key.
263
 * to get a key, go to:
264
 *
265
 * http://www.google.com/recaptcha/mailhide/apikey
266
 */
267
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
268
	$emailparts = _recaptcha_mailhide_email_parts ($email);
269
	$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
270
	
271
	return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
272
		"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
273

  
274
}
275

  
276

  
277
?>
drupal7/sites/all/modules/recaptcha/recaptcha-php/CONTRIBUTING.md
1
Want to contribute? Great! First, read this page (including the small print at the end).
2

  
3
### Before you contribute
4
Before we can use your code, you must sign the
5
[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
6
(CLA), which you can do online. The CLA is necessary mainly because you own the
7
copyright to your changes, even after your contribution becomes part of our
8
codebase, so we need your permission to use and distribute your code. We also
9
need to be sure of various other things—for instance that you'll tell us if you
10
know that your code infringes on other people's patents. You don't have to sign
11
the CLA until after you've submitted your code for review and a member has
12
approved it, but you must do it before we can put your code into our codebase.
13
Before you start working on a larger contribution, you should get in touch with
14
us first through the issue tracker with your idea so that we can help out and
15
possibly guide you. Coordinating up front makes it much easier to avoid
16
frustration later on.
17

  
18
### Code reviews
19
All submissions, including submissions by project members, require review. We
20
use Github pull requests for this purpose.
21

  
22
### The small print
23
Contributions made by corporations are covered by a different agreement than
24
the one above, the Software Grant and Corporate Contributor License Agreement.
drupal7/sites/all/modules/recaptcha/recaptcha-php/LICENSE
1
Copyright 2014, Google Inc.
2
All rights reserved.
3

  
4
Redistribution and use in source and binary forms, with or without
5
modification, are permitted provided that the following conditions are
6
met:
7

  
8
    * Redistributions of source code must retain the above copyright
9
notice, this list of conditions and the following disclaimer.
10
    * Redistributions in binary form must reproduce the above
11
copyright notice, this list of conditions and the following disclaimer
12
in the documentation and/or other materials provided with the
13
distribution.
14
    * Neither the name of Google Inc. nor the names of its
15
contributors may be used to endorse or promote products derived from
16
this software without specific prior written permission.
17

  
18
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29

  
drupal7/sites/all/modules/recaptcha/recaptcha-php/README.md
1
# reCAPTCHA PHP client library
2

  
3
[![Build Status](https://travis-ci.org/google/recaptcha.svg)](https://travis-ci.org/google/recaptcha)
4
[![Latest Stable Version](https://poser.pugx.org/google/recaptcha/v/stable.svg)](https://packagist.org/packages/google/recaptcha)
5
[![Total Downloads](https://poser.pugx.org/google/recaptcha/downloads.svg)](https://packagist.org/packages/google/recaptcha)
6

  
7
* Project page: http://www.google.com/recaptcha/
8
* Repository: https://github.com/google/recaptcha
9
* Version: 1.1.2
10
* License: BSD, see [LICENSE](LICENSE)
11

  
12
## Description
13

  
14
reCAPTCHA is a free CAPTCHA service that protect websites from spam and abuse.
15
This is Google authored code that provides plugins for third-party integration
16
with reCAPTCHA.
17

  
18
## Installation
19

  
20
### Composer (Recommended)
21

  
22
[Composer](https://getcomposer.org/) is a widely used dependency manager for PHP
23
packages. This reCAPTCHA client is available on Packagist as
24
[`google/recaptcha`](https://packagist.org/packages/google/recaptcha) and can be
25
installed either by running the `composer require` command or adding the library
26
to your `composer.json`. To enable Composer for you project, refer to the
27
project's [Getting Started](https://getcomposer.org/doc/00-intro.md)
28
documentation.
29

  
30
To add this dependency using the command, run the following from within your
31
project directory:
32
```
33
composer require google/recaptcha "~1.1"
34
```
35

  
36
Alternatively, add the dependency directly to your `composer.json` file:
37
```json
38
"require": {
39
    "google/recaptcha": "~1.1"
40
}
41
```
42

  
43
### Direct download (no Composer)
44

  
45
If you wish to install the library manually (i.e. without Composer), then you
46
can use the links on the main project page to either clone the repo or download
47
the [ZIP file](https://github.com/google/recaptcha/archive/master.zip). For
48
convenience, an autoloader script is provided in `src/autoload.php` which you
49
can require into your script instead of Composer's `vendor/autoload.php`. For
50
example:
51

  
52
```php
53
require('/path/to/recaptcha/src/autoload.php');
54
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
55
```
56

  
57
The classes in the project are structured according to the
58
[PSR-4](http://www.php-fig.org/psr/psr-4/) standard, so you may of course also
59
use your own autoloader or require the needed files directly in your code.
60

  
61
### Development install
62

  
63
If you would like to contribute to this project or run the unit tests on within
64
your own environment you will need to install the development dependencies, in
65
this case that means [PHPUnit](https://phpunit.de/). If you clone the repo and
66
run `composer install` from within the repo, this will also grab PHPUnit and all
67
its dependencies for you. If you only need the autoloader installed, then you
68
can always specify to Composer not to run in development mode, e.g. `composer
69
install --no-dev`.
70

  
71
*Note:* These dependencies are only required for development, there's no
72
requirement for them to be included in your production code.
73

  
74
## Usage
75

  
76
First, register keys for your site at https://www.google.com/recaptcha/admin
77

  
78
When your app receives a form submission containing the `g-recaptcha-response`
79
field, you can verify it using:
80
```php
81
<?php
82
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
83
$resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp);
84
if ($resp->isSuccess()) {
85
    // verified!
86
} else {
87
    $errors = $resp->getErrorCodes();
88
}
89
```
90

  
91
You can see an end-to-end working example in
92
[examples/example-captcha.php](examples/example-captcha.php)
93

  
94
## Upgrading
95

  
96
### From 1.0.0
97

  
98
The previous version of this client is still available on the `1.0.0` tag [in
99
this repo](https://github.com/google/recaptcha/tree/1.0.0) but it is purely for
100
reference and will not receive any updates.
101

  
102
The major changes in 1.1.0 are:
103
* installation now via Composer;
104
* class loading also via Composer;
105
* classes now namespaced;
106
* old method call was `$rc->verifyResponse($remoteIp, $response)`, new call is
107
  `$rc->verify($response, $remoteIp)`
108

  
109
## Contributing
110

  
111
We accept contributions via GitHub Pull Requests, but all contributors need to
112
be covered by the standard Google Contributor License Agreement. You can find
113
instructions for this in [CONTRIBUTING](CONTRIBUTING.md)
drupal7/sites/all/modules/recaptcha/recaptcha-php/composer.json
1
{
2
    "name": "google/recaptcha",
3
    "description": "Client library for reCAPTCHA, a free service that protect websites from spam and abuse.",
4
    "type": "library",
5
    "keywords": ["recaptcha", "captcha", "spam", "abuse"],
6
    "homepage": "http://www.google.com/recaptcha/",
7
    "license": "BSD-3-Clause",
8
    "support": {
9
        "forum": "https://groups.google.com/forum/#!forum/recaptcha",
10
        "source": "https://github.com/google/recaptcha"
11
    },
12
    "require": {
13
        "php": ">=5.3.2"
14
    },
15
    "require-dev": {
16
        "phpunit/phpunit": "4.5.*"
17
    },
18
    "autoload": {
19
        "psr-4": {
20
            "ReCaptcha\\": "src/ReCaptcha"
21
        }
22
    },
23
    "extra": {
24
        "branch-alias": {
25
            "dev-master": "1.1.x-dev"
26
        }
27
    }
28
}
drupal7/sites/all/modules/recaptcha/recaptcha-php/examples/example-captcha.php
1
<?php
2
/**
3
 * Working sample code to accompany the library. The instructions here assume
4
 * you've just cloned the repo. If you've installed via composer, you will want
5
 * to adjust the path to the autoloader.
6
 *
7
 * 1. Run the server. For example, under Linux you can probably use:
8
 * /usr/bin/php -S "localhost:8000" "examples/example-captcha.php"
9
 * 2. Point your browser at http://localhost:8000
10
 * 3. Follow the instructions
11
 *
12
 * @copyright Copyright (c) 2015, Google Inc.
13
 * @link      http://www.google.com/recaptcha
14
 *
15
 * Permission is hereby granted, free of charge, to any person obtaining a copy
16
 * of this software and associated documentation files (the "Software"), to deal
17
 * in the Software without restriction, including without limitation the rights
18
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
 * copies of the Software, and to permit persons to whom the Software is
20
 * furnished to do so, subject to the following conditions:
21
 *
22
 * The above copyright notice and this permission notice shall be included in
23
 * all copies or substantial portions of the Software.
24
 *
25
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31
 * THE SOFTWARE.
32
 */
33
// Initiate the autoloader. The file should be generated by Composer.
34
// You will provide your own autoloader or require the files directly if you did
35
// not install via Composer.
36
require_once __DIR__ . '/../vendor/autoload.php';
37

  
38
// Register API keys at https://www.google.com/recaptcha/admin
39
$siteKey = '';
40
$secret = '';
41

  
42
// reCAPTCHA supported 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
43
$lang = 'en';
44
?>
45
<html>
46
    <head>
47
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
48
        <title>reCAPTCHA Example</title>
49
        <link rel="shortcut icon" href="//www.gstatic.com/recaptcha/admin/favicon.ico" type="image/x-icon"/>
50
        <style type="text/css">
51
            body {
52
                margin: 1em 5em 0 5em;
53
                font-family: sans-serif;
54
            }
55
            fieldset {
56
                display: inline;
57
                padding: 1em;
58
            }
59
        </style>
60
    </head>
61
    <body>
62
        <h1>reCAPTCHA Example</h1>
63
        <?php if ($siteKey === '' || $secret === ''): ?>
64
            <h2>Add your keys</h2>
65
            <p>If you do not have keys already then visit <tt>
66
            <a href = "https://www.google.com/recaptcha/admin">
67
                https://www.google.com/recaptcha/admin</a></tt> to generate them.
68
        Edit this file and set the respective keys in <tt>$siteKey</tt> and
69
        <tt>$secret</tt>. Reload the page after this.</p>
70
    <?php
71
elseif (isset($_POST['g-recaptcha-response'])):
72
    // The POST data here is unfiltered because this is an example.
73
    // In production, *always* sanitise and validate your input'
74
    ?>
75
    <h2><tt>POST</tt> data</h2>
76
    <tt><pre><?php var_export($_POST); ?></pre></tt>
77
    <?php
78
// If the form submission includes the "g-captcha-response" field
79
// Create an instance of the service using your secret
80
    $recaptcha = new \ReCaptcha\ReCaptcha($secret);
81

  
82
// If file_get_contents() is locked down on your PHP installation to disallow
83
// its use with URLs, then you can use the alternative request method instead.
84
// This makes use of fsockopen() instead.
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff