Révision 66b5cbf6
Ajouté par Assos Assos il y a presque 10 ans
drupal7/sites/all/modules/captcha/captcha.module | ||
---|---|---|
6 | 6 |
* administrators can add a CAPTCHA to desired forms that users without |
7 | 7 |
* the 'skip CAPTCHA' permission (typically anonymous visitors) have |
8 | 8 |
* to solve. |
9 |
* |
|
10 | 9 |
*/ |
11 | 10 |
|
12 | 11 |
/** |
... | ... | |
216 | 215 |
'#value' => $captcha_sid, |
217 | 216 |
); |
218 | 217 |
|
219 |
// Additional one time CAPTCHA token: store in database and send with form. |
|
220 |
$captcha_token = md5(mt_rand()); |
|
221 |
db_update('captcha_sessions') |
|
222 |
->fields(array('token' => $captcha_token)) |
|
218 |
$captcha_token = db_select('captcha_sessions', 'c') |
|
219 |
->fields('c', array('token')) |
|
223 | 220 |
->condition('csid', $captcha_sid) |
224 |
->execute(); |
|
221 |
->execute() |
|
222 |
->fetchField(); |
|
223 |
if (!isset($captcha_token) && !$form_state['submitted']) { |
|
224 |
// Additional one-time CAPTCHA token: store in database and send with form. |
|
225 |
$captcha_token = md5(mt_rand()); |
|
226 |
db_update('captcha_sessions') |
|
227 |
->fields(array('token' => $captcha_token)) |
|
228 |
->condition('csid', $captcha_sid) |
|
229 |
->execute(); |
|
230 |
} |
|
231 |
|
|
225 | 232 |
$element['captcha_token'] = array( |
226 | 233 |
'#type' => 'hidden', |
227 | 234 |
'#value' => $captcha_token, |
... | ... | |
349 | 356 |
_captcha_insert_captcha_element($form, $captcha_placement, $captcha_element); |
350 | 357 |
} |
351 | 358 |
} |
352 |
else if (
|
|
353 |
variable_get('captcha_administration_mode', FALSE) |
|
354 |
&& user_access('administer CAPTCHA settings') |
|
355 |
&& (arg(0) != 'admin' || variable_get('captcha_allow_on_admin_pages', FALSE)) |
|
359 |
elseif ( |
|
360 |
variable_get('captcha_administration_mode', FALSE)
|
|
361 |
&& user_access('administer CAPTCHA settings')
|
|
362 |
&& (arg(0) != 'admin' || variable_get('captcha_allow_on_admin_pages', FALSE))
|
|
356 | 363 |
) { |
357 | 364 |
// Add CAPTCHA administration tools. |
358 | 365 |
module_load_include('inc', 'captcha'); |
Formats disponibles : Unified diff
Weekly update of contrib modules