? .svn ? p_219181_editown.patch ? p_238958_typos.patch ? p_239336_pagebreak.patch ? p_239751_throttle.patch ? components/.svn ? po/.svn Index: webform.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v retrieving revision 1.113.2.70.2.30 diff -u -p -r1.113.2.70.2.30 webform.module --- webform.module 21 Mar 2008 23:46:54 -0000 1.113.2.70.2.30 +++ webform.module 28 Mar 2008 15:30:27 -0000 @@ -839,10 +839,20 @@ function webform_view(&$node, $teaser = } } - $output = drupal_get_form('webform_client_form_'. $node->nid, $node, $submission, $enabled, $preview); + // check if the user can add another submission. + if ($node->webform['submit_limit'] != '-1') { // -1: submissions are never throttled. + include_once(drupal_get_path('module', 'webform') ."/webform_submissions.inc"); + if ($violation_count = _webform_submission_limit_check($node)) { + drupal_set_message(t("You may not submit another entry at this time."), 'error'); + $submission_throttled = 1; // checked below before rendering of form. + } + } + + if (!$submission_throttled) { // show the form, but only if the user can submit another right now. + $output = drupal_get_form('webform_client_form_'. $node->nid, $node, $submission, $enabled, $preview); + } - // Remove the surrounding
tag if this is a preview. - if ($preview) { + if ($preview) { // Remove the surrounding tag. $output = preg_replace('/<\/?form[^>]*>/', '', $output); } @@ -1193,7 +1203,6 @@ function _webform_client_form_add_compon function webform_client_form_validate($form_id, $form_values) { global $user; - include_once(drupal_get_path('module', 'webform') ."/webform_submissions.inc"); $node = node_load(array('nid' => $form_values['details']['nid'])); @@ -1201,32 +1210,6 @@ function webform_client_form_validate($f $form_values['submitted_tree'] = $form_values['submitted']; _webform_client_form_submit_flatten($node, $form_values['submitted'], $form_values['submitted']); - // Verify that this submission is within the submission limits on this form. - if ($violation_count = _webform_submission_limit_check($node, $form_values) && !$form_values['details']['sid']) { - // If the webform is being swamped by repeated entries, limit the messages in watchdog. - if ($violation_count < 21) { - if ($user->uid > 0) { - watchdog('webform', t('The authenticated user %username attempted to submit more entries than allowed on the %webform_title webform', - array( - '%user_url' => url('user/'. $user->uid), - '%username' => $user->name, - '%webform_url' => url('node/'. $node->nid), - '%webform_title' => $node->title, - )), WATCHDOG_WARNING); - } - else { - watchdog('webform', t('An anonymous user with IP address %ip attempted to submit more entries than allowed on the %webform_title webform', - array( - '%ip' => $_SERVER['REMOTE_ADDR'], - '%webform_url' => url('node/'. $node->nid), - '%webform_title' => $node->title, - )), WATCHDOG_WARNING); - } - } - form_set_error('', t("You have submitted the maximum number of entries. Check submission guidelines.")); - return; - } - if (trim($node->webform['additional_validate'])) { // We use eval here (rather than drupal_eval) because the user needs access to local variables. eval("?>". $node->webform['additional_validate']); Index: webform_submissions.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform_submissions.inc,v retrieving revision 1.1.2.8 diff -u -p -r1.1.2.8 webform_submissions.inc --- webform_submissions.inc 21 Mar 2008 21:19:57 -0000 1.1.2.8 +++ webform_submissions.inc 28 Mar 2008 15:30:27 -0000 @@ -230,7 +230,7 @@ function _webform_submission_spam_check( return false; // Not spam. } -function _webform_submission_limit_check($node, $form_values) { +function _webform_submission_limit_check($node) { global $user, $db_type; // Check if submission limiting is enabled.