--- feedback.module.old 2006-09-11 19:01:58.000000000 +0200 +++ feedback.module.new 2006-10-15 15:18:39.062500000 +0200 @@ -283,10 +283,19 @@ $breadcrumb[] = array ('path' => 'feedback', 'title' => $page->title); menu_set_location($breadcrumb); - - if (!flood_is_allowed('feedback'.$page->name, $page->hourly_threshold)) { + + // Fix flood protection 1/3 + $flood_id = $page->name; + if ($user->uid) { + $flood_id .= ':uid:' . $user->uid; + } else { + $flood_id .= ':sid:' . session_id(); + } + $flood_id = 'feedback:' . md5($flood_id); + if (!flood_is_allowed($flood_id, $page->hourly_threshold)) { $output = t('You cannot send more than %number messages per hour. Please try again later.', array ('%number' => $page->hourly_threshold)); - } + } + // end Fix flood protection 1/3 else { if ($page->field_name) { $form['emailname'] = array( @@ -431,6 +440,11 @@ * Process the site-wide form submission. */ function feedback_mail_page_submit($form_id, &$edit, $page) { + + // Fix flood protection 2/3 + global $user; + // End Fix flood protection 2/3 + // Prepare the sender: $from = feedback_plain_text($edit['mail']); $name = feedback_plain_text($edit['emailname']); @@ -461,7 +475,17 @@ user_mail($page->email, $subject, $body, "From: $name <$from>\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from"); // Log the operation: - flood_register_event('feedback'. $page->name); + // Fix flood protection 3/3 + $flood_id = $page->name; + if ($user->uid) { + $flood_id .= ':uid:' . $user->uid; + } else { + $flood_id .= ':sid:' . session_id(); + } + $flood_id = 'feedback:' . md5($flood_id); + flood_register_event($flood_id); + // End Fix flood protection 3/3 + if ($page->logging) { watchdog('mail', t('%name-from sent an feedback e-mail', array ('%name-from' => theme('placeholder', $name ." <$from>")))); }