Révision 00c2605a
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/modules/captcha/captcha.admin.inc | ||
---|---|---|
64 | 64 |
); |
65 | 65 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'] = array(); |
66 | 66 |
$captcha_type_options = _captcha_available_challenge_types(); |
67 |
$result = db_select('captcha_points', 'cp')->fields('cp')->orderBy('form_id')->execute();
|
|
68 |
foreach ($result as $captcha_point) {
|
|
69 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id] = array();
|
|
70 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['form_id'] = array(
|
|
67 |
$captcha_points = captcha_get_captcha_points();
|
|
68 |
foreach ($captcha_points as $captcha_point) {
|
|
69 |
$elem = array();
|
|
70 |
$elem['form_id'] = array(
|
|
71 | 71 |
'#markup' => $captcha_point->form_id, |
72 | 72 |
); |
73 | 73 |
// Select widget for CAPTCHA type. |
... | ... | |
80 | 80 |
else { |
81 | 81 |
$captcha_type = 'none'; |
82 | 82 |
} |
83 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['captcha_type'] = array(
|
|
83 |
$elem['captcha_type'] = array(
|
|
84 | 84 |
'#type' => 'select', |
85 | 85 |
'#default_value' => $captcha_type, |
86 | 86 |
'#options' => $captcha_type_options, |
87 | 87 |
); |
88 |
// Additional operations. |
|
89 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['operations'] = array( |
|
90 |
'#markup' => implode(", ", array( |
|
91 |
l(t('delete'), "admin/config/people/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"), |
|
92 |
)), |
|
93 |
); |
|
88 |
$ops = array(); |
|
89 |
if (module_exists('ctools') && $captcha_point->export_type & EXPORT_IN_CODE) { |
|
90 |
if ($captcha_point->export_type & EXPORT_IN_DATABASE) { |
|
91 |
$ops[] = l(t('revert'), "admin/config/people/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"); |
|
92 |
} |
|
93 |
// TODO Disable exported points. |
|
94 |
} |
|
95 |
else { |
|
96 |
$ops[] = l(t('delete'), "admin/config/people/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"); |
|
97 |
} |
|
98 |
$elem['operations'] = array('#markup' => implode(", ", $ops)); |
|
99 |
|
|
100 |
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id] = $elem; |
|
94 | 101 |
} |
95 | 102 |
|
96 | 103 |
// Form items for new form_id. |
... | ... | |
281 | 288 |
|
282 | 289 |
// Process CAPTCHA points. |
283 | 290 |
if (isset($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'])) { |
291 |
// Load existing data. |
|
292 |
$captcha_points = captcha_get_captcha_points(); |
|
284 | 293 |
foreach ($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'] as $captcha_point_form_id => $data) { |
294 |
// If this is an in-code captcha point and its settings are unchanged, |
|
295 |
// don't save to the database. |
|
296 |
if (module_exists('ctools') && isset($captcha_points[$captcha_point_form_id])) { |
|
297 |
// Parse module and captcha_type from submitted values. |
|
298 |
if (is_string($data['captcha_type']) && substr_count($data['captcha_type'], '/') == 1) { |
|
299 |
list($module, $captcha_type) = explode('/', $data['captcha_type']); |
|
300 |
} |
|
301 |
else { |
|
302 |
$module = ''; |
|
303 |
$captcha_type = $data['captcha_type']; |
|
304 |
} |
|
305 |
|
|
306 |
$point = $captcha_points[$captcha_point_form_id]; |
|
307 |
if ($point->export_type & EXPORT_IN_CODE && !($point->export_type & EXPORT_IN_DATABASE) && $point->module == $module && $point->captcha_type == $captcha_type) { |
|
308 |
continue; |
|
309 |
} |
|
310 |
} |
|
285 | 311 |
captcha_set_form_id_setting($captcha_point_form_id, $data['captcha_type']); |
286 | 312 |
} |
287 | 313 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules