Projet

Général

Profil

Révision 66b5cbf6

Ajouté par Assos Assos il y a presque 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/captcha/image_captcha/image_captcha.user.inc
29 29

  
30 30
  // Only generate captcha if code exists in the session.
31 31
  if ($code !== FALSE) {
32
    // Seed the random generators used for image CAPTCHA distortion based on session and code
33
    // to counter attacks that re-request the same challenge and pick the simplest image one or combine info.
34
    $seed = hexdec(substr(md5($captcha_sid . $code), 0, 8));
35
    srand($seed);
36
    mt_srand($seed);
32 37
    // generate the image
33 38
    $image = @_image_captcha_generate_image($code);
34 39
    // check of generation was successful
......
124 129
  $distortion_amplitude = .25 * $font_size * variable_get('image_captcha_distortion_amplitude', 0) / 10.0;
125 130
  if ($distortion_amplitude > 1) {
126 131
    // distortion parameters
127
    $wavelength_xr = (2+3*lcg_value())*$font_size;
128
    $wavelength_yr = (2+3*lcg_value())*$font_size;
132
    $wavelength_xr = (2 + 3 * mt_rand(0, 1000) / 1000) * $font_size;
133
    $wavelength_yr = (2 + 3 * mt_rand(0, 1000) / 1000) * $font_size;
129 134
    $freq_xr = 2 * 3.141592 / $wavelength_xr;
130 135
    $freq_yr = 2 * 3.141592 / $wavelength_yr;
131
    $wavelength_xt = (2+3*lcg_value())*$font_size;
132
    $wavelength_yt = (2+3*lcg_value())*$font_size;
136
    $wavelength_xt = (2 + 3 * mt_rand(0, 1000) / 1000) * $font_size;
137
    $wavelength_yt = (2 + 3 * mt_rand(0, 1000) / 1000) * $font_size;
133 138
    $freq_xt = 2 * 3.141592 / $wavelength_xt;
134 139
    $freq_yt = 2 * 3.141592 / $wavelength_yt;
135 140

  

Formats disponibles : Unified diff