Index: feedback.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feedback/feedback.module,v retrieving revision 1.51.2.13 diff -u -r1.51.2.13 feedback.module --- feedback.module 11 Sep 2006 14:02:58 -0000 1.51.2.13 +++ feedback.module 15 Oct 2006 15:09:32 -0000 @@ -283,10 +283,11 @@ $breadcrumb[] = array ('path' => 'feedback', 'title' => $page->title); menu_set_location($breadcrumb); - - if (!flood_is_allowed('feedback'.$page->name, $page->hourly_threshold)) { + + $flood_id = _feedback_get_flood_id($page); + 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)); - } + } else { if ($page->field_name) { $form['emailname'] = array( @@ -461,7 +462,9 @@ 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); + $flood_id = _feedback_get_flood_id($page); + flood_register_event($flood_id); + if ($page->logging) { watchdog('mail', t('%name-from sent an feedback e-mail', array ('%name-from' => theme('placeholder', $name ." <$from>")))); } @@ -473,6 +476,12 @@ drupal_goto(); } +function _feedback_get_flood_id($page) { + global $user; + $flood_id = ($user->uid) ? ':uid:' . $user->uid : ':sid:' . session_id(); + return 'feedback:' . md5($page->name . $flood_id); +} + /* * Returns some additional user information to append to the mail */