Révision 01d522a6
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/webform/webform.module | ||
---|---|---|
616 | 616 |
|
617 | 617 |
$token_access = $submission && isset($_GET['token']) && $_GET['token'] == webform_get_submission_access_token($submission); |
618 | 618 |
|
619 |
// If access is granted via a token, then allow subsequent submission access |
|
620 |
// for anonymous users. |
|
621 |
if (!$user->uid && $token_access) { |
|
622 |
$_SESSION['webform_submission'][$submission->sid] = $node->nid; |
|
623 |
} |
|
624 |
|
|
619 | 625 |
$general_access = $access_all || $access_own_submission || $access_node_submissions || $token_access; |
620 | 626 |
|
621 | 627 |
// Disable the page cache for anonymous users in this access callback, |
... | ... | |
2259 | 2265 |
'#node' => $node, |
2260 | 2266 |
'#sid' => $_SESSION['webform_confirmation'][$nid]['sid'], |
2261 | 2267 |
); |
2262 |
} elseif (strlen(trim(strip_tags($node->webform['confirmation'])))) { |
|
2268 |
} |
|
2269 |
elseif (strlen(trim(strip_tags($node->webform['confirmation'])))) { |
|
2263 | 2270 |
// Display confirmation link drupal status messages, but in the block. |
2264 | 2271 |
$message = webform_replace_tokens($node->webform['confirmation'], |
2265 | 2272 |
$node, |
... | ... | |
2407 | 2414 |
form_load_include($form_state, 'inc', 'webform', 'includes/webform.components'); |
2408 | 2415 |
form_load_include($form_state, 'inc', 'webform', 'includes/webform.submissions'); |
2409 | 2416 |
|
2417 |
// For ajax requests, $form_state['values']['details'] is missing. Restore |
|
2418 |
// from storage, if available, for multi-page forms. |
|
2419 |
if (empty($form_state['values']['details']) && !empty($form_state['storage']['details'])) { |
|
2420 |
$form_state['values']['details'] = $form_state['storage']['details']; |
|
2421 |
} |
|
2422 |
|
|
2410 | 2423 |
// If in a multi-step form, a submission ID may be specified in form state. |
2411 | 2424 |
// Load this submission. This allows anonymous users to use auto-save. |
2412 | 2425 |
if (empty($submission) && !empty($form_state['values']['details']['sid'])) { |
... | ... | |
2513 | 2526 |
// Allow values from other pages to be sent to browser for conditionals. |
2514 | 2527 |
$form['#conditional_values'] = $input_values; |
2515 | 2528 |
|
2529 |
// Allow components access to most up-to-date values. |
|
2530 |
$form_state['#conditional_values'] = $input_values; |
|
2531 |
|
|
2516 | 2532 |
// For resuming a previous draft, find the next page after the last |
2517 | 2533 |
// validated page. |
2518 | 2534 |
if (!isset($form_state['storage']['page_num']) && $submission && $submission->is_draft && $submission->highest_valid_page) { |
... | ... | |
2529 | 2545 |
// Force a preview to avert an unintended submission via Next. |
2530 | 2546 |
$form_state['webform']['preview'] = TRUE; |
2531 | 2547 |
$form_state['webform']['page_count']++; |
2532 |
// The form hasn't been submitted (ever) and the preview code will |
|
2533 |
// expect $form_state['values']['submitted'] to be set from a previous |
|
2534 |
// submission, so provide these values here. |
|
2535 |
$form_state['values']['submitted'] = $input_values; |
|
2536 | 2548 |
} |
2549 |
// The form hasn't been submitted (ever) and the preview code will |
|
2550 |
// expect $form_state['values']['submitted'] to be set from a previous |
|
2551 |
// submission, so provide these values here. |
|
2552 |
$form_state['values']['submitted'] = $input_values; |
|
2537 | 2553 |
$form_state['storage']['submitted'] = $input_values; |
2538 | 2554 |
} |
2539 | 2555 |
|
... | ... | |
3238 | 3254 |
// exist, but webform_get_submission() will not find the draft. So, make a new |
3239 | 3255 |
// submission. |
3240 | 3256 |
if ($sid && $submission = webform_get_submission($node->webform['nid'], $sid)) { |
3257 |
// Store original data on object for use in update hook. |
|
3258 |
$submission->original = clone $submission; |
|
3259 |
|
|
3241 | 3260 |
// Merge with new submission data. The + operator maintains numeric keys. |
3242 | 3261 |
// This maintains existing data with just-submitted data when a user resumes |
3243 | 3262 |
// a submission previously saved as a draft. |
... | ... | |
3279 | 3298 |
$form_state['values']['details']['sid'] = $sid = webform_submission_insert($node, $submission); |
3280 | 3299 |
$form_state['values']['details']['is_new'] = TRUE; |
3281 | 3300 |
|
3301 |
// Save the new details in storage. When ajax calls for file upload/remove, |
|
3302 |
// $form_state['values']['details'] is missing. This allows the proper |
|
3303 |
// submission to be retrieved in webform_client_form. See #2562703. |
|
3304 |
$form_state['storage']['details'] = $form_state['values']['details']; |
|
3305 |
|
|
3282 | 3306 |
// Set a cookie including the server's submission time. The cookie expires |
3283 | 3307 |
// in the length of the interval plus a day to compensate for timezones. |
3284 | 3308 |
$tracking_mode = webform_variable_get('webform_tracking_mode'); |
... | ... | |
3292 | 3316 |
// Save session information about this submission for anonymous users, |
3293 | 3317 |
// allowing them to access or edit their submissions. |
3294 | 3318 |
if (!$user->uid && user_access('access own webform submissions')) { |
3295 |
$_SESSION['webform_submission'][$form_state['values']['details']['sid']] = $node->nid;
|
|
3319 |
$_SESSION['webform_submission'][$sid] = $node->nid;
|
|
3296 | 3320 |
} |
3297 | 3321 |
} |
3298 | 3322 |
else { |
... | ... | |
3603 | 3627 |
$prefix = isset($element['#field_prefix']) ? '<span class="field-prefix">' . webform_filter_xss($element['#field_prefix']) . '</span> ' : ''; |
3604 | 3628 |
$suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . webform_filter_xss($element['#field_suffix']) . '</span>' : ''; |
3605 | 3629 |
|
3630 |
// Generate description for above or below the field. |
|
3631 |
$above = !empty($element['#webform_component']['extra']['description_above']); |
|
3632 |
$description = array( |
|
3633 |
FALSE => '', |
|
3634 |
TRUE => !empty($element['#description']) ? ' <div class="description">' . $element['#description'] . "</div>\n" : '', |
|
3635 |
); |
|
3636 |
|
|
3606 | 3637 |
switch ($element['#title_display']) { |
3607 | 3638 |
case 'inline': |
3639 |
$output .= $description[$above]; |
|
3640 |
$description[$above] = ''; |
|
3641 |
// FALL THRU. |
|
3608 | 3642 |
case 'before': |
3609 | 3643 |
case 'invisible': |
3610 | 3644 |
$output .= ' ' . theme('form_element_label', $variables); |
3611 |
$output .= ' ' . $prefix . $element['#children'] . $suffix . "\n"; |
|
3645 |
$output .= ' ' . $prefix . $description[$above] . $element['#children'] . $suffix . "\n";
|
|
3612 | 3646 |
break; |
3613 | 3647 |
|
3614 | 3648 |
case 'after': |
3615 |
$output .= ' ' . $prefix . $element['#children'] . $suffix; |
|
3649 |
$output .= ' ' . $prefix . $description[$above] . $element['#children'] . $suffix;
|
|
3616 | 3650 |
$output .= ' ' . theme('form_element_label', $variables) . "\n"; |
3617 | 3651 |
break; |
3618 | 3652 |
|
3619 | 3653 |
case 'none': |
3620 | 3654 |
case 'attribute': |
3621 | 3655 |
// Output no label and no required marker, only the children. |
3622 |
$output .= ' ' . $prefix . $element['#children'] . $suffix . "\n"; |
|
3656 |
$output .= ' ' . $prefix . $description[$above] . $element['#children'] . $suffix . "\n";
|
|
3623 | 3657 |
break; |
3624 | 3658 |
} |
3625 | 3659 |
|
3626 |
if (!empty($element['#description'])) { |
|
3627 |
$output .= ' <div class="description">' . $element['#description'] . "</div>\n"; |
|
3628 |
} |
|
3629 |
|
|
3660 |
$output .= $description[!$above]; |
|
3630 | 3661 |
$output .= "</div>\n"; |
3631 | 3662 |
|
3632 | 3663 |
return $output; |
... | ... | |
4167 | 4198 |
case 'webform_csv_delimiter': |
4168 | 4199 |
$result = variable_get('webform_csv_delimiter', '\t'); |
4169 | 4200 |
break; |
4201 |
case 'webform_csv_line_ending': |
|
4202 |
$result = variable_get('webform_csv_line_ending', "\n"); |
|
4203 |
break; |
|
4170 | 4204 |
case 'webform_export_wordwrap': |
4171 | 4205 |
$result = variable_get('webform_export_wordwrap', 0); |
4172 | 4206 |
break; |
... | ... | |
4315 | 4349 |
if (webform_component_implements($component['type'], 'options')) { |
4316 | 4350 |
$options = webform_component_invoke($component['type'], 'options', $component); |
4317 | 4351 |
foreach ($name as &$one_name) { |
4318 |
$name = isset($options[$one_name]) ? $options[$one_name] : $name;
|
|
4352 |
$one_name = isset($options[$one_name]) ? $options[$one_name] : $one_name;
|
|
4319 | 4353 |
} |
4320 | 4354 |
unset($one_name); // Drop PHP reference. |
4321 | 4355 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules