? url_admin.patch
Index: spam_filter_url.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/spam/filters/spam_filter_url/Attic/spam_filter_url.module,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 spam_filter_url.module
--- spam_filter_url.module	2 Feb 2010 20:31:54 -0000	1.1.2.1
+++ spam_filter_url.module	3 Feb 2010 11:35:11 -0000
@@ -96,6 +96,8 @@ function spam_filter_url_spam_filter($co
   $spam = FALSE;
 
   $spam_filter_urls = _spam_filter_url_extract($content, $type, $fields, $extra);
+  
+  $probability = variable_get('spam_filter_url_probability', 99)
 
   if (is_array($spam_filter_urls) && !empty($spam_filter_urls)) {
     $count = _spam_filter_url_count();
@@ -107,7 +109,7 @@ function spam_filter_url_spam_filter($co
         'limit' => 'total',
         'total' => $count['total'],
       );
-      $action['total'] = 99;
+      $action['total'] = $probability;
       return $action;
     }
     $limit = variable_get('spam_filter_url_limit_repeat', 5);
@@ -125,7 +127,8 @@ function spam_filter_url_spam_filter($co
           'limit' => 'repeat',
           'total' => $max,
         );
-        $action['total'] = 99;
+        $action['total'] = $probability;
+      return $action;
       }
     }
 
@@ -145,7 +148,7 @@ function spam_filter_url_spam_filter($co
   }
 
   if ($spam) {
-    $action['total'] = 99;
+    $action['total'] = $probability;
   }
   else {
     $action['total'] = 0;
@@ -180,3 +183,75 @@ function _spam_filter_url_count($spam_fi
   return $spam_filter_urls;
 }
 
+function spam_filter_url_menu() {
+  $items = array();
+
+  $items['admin/settings/spam/filters/url'] = array(
+    'title' => 'URL',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('spam_filter_url_admin_settings'),
+    'access arguments' => array('administer spam'),
+    'description' => 'Configure the url filter.',
+    'type' => MENU_LOCAL_TASK,
+  );
+
+  return $items;
+}
+
+function spam_filter_url_admin_settings() {
+  $form = array();
+  $form['short'] = array(
+    '#type' => 'fieldset',
+    '#title' => 'URL limits',
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+  $max_urls = drupal_map_assoc(array(-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 40, 100));
+  $max_urls[-1] = "Unlimited";
+  $form['short']['spam_filter_url_limit_total'] = array(
+    '#type' => 'select',
+    '#title' => t('Maximum total URLs per post'),
+    '#options' => $max_urls,
+    '#required' => TRUE,
+    '#default_value' => variable_get('spam_filter_url_limit_total', 10),
+  );
+  $max_dups = drupal_map_assoc(array(-1, 0, 1, 2, 3, 4, 5, 10, 15, 20, 25, 40, 100));
+  $max_dups[-1] = "Unlimited";
+  $form['short']['spam_filter_url_limit_repeat'] = array(
+    '#type' => 'select',
+    '#title' => t('Maximum number of times the same URL can appear in a post'),
+    '#options' => $max_dups,
+    '#required' => TRUE,
+    '#default_value' => variable_get('spam_filter_url_limit_repeat', 5),
+  );
+  $url_spam_prob = drupal_map_assoc(array(60, 65, 70, 75, 80, 85, 90, 95, 99));
+  $form['short']['spam_filter_url_probability'] = array(
+    '#type' => 'select',
+    '#title' => t('Probability that content posted that exceeds the url limit or duplicate url limit is spam'),
+    '#options' => $url_spam_prob,
+    '#required' => TRUE,
+    '#default_value' => variable_get('spam_filter_url_probability', 99),
+  );
+  return system_settings_form($form);
+}
+
+function spam_filter_url_admin_settings_validate($form, &$form_state) {
+  $limit_long = $form_state['values']['spam_filter_url_limit_total'];
+  $limit_short = $form_state['values']['spam_filter_url_limit_repeat'];
+  if ($limit_short > $limit_long) {
+    form_set_error('spam_filter_url_limit_total', t('Total URL limit must be at least as big as the repeated URL limit.'));
+  }
+}
+
+function spam_filter_url_admin_settings_submit($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Reset to defaults')) {
+    variable_del('spam_filter_url_limit_total');
+    variable_del('spam_filter_url_limit_repeat');
+    drupal_set_message('Configuration reset to defaults.');
+  }
+  else {
+    variable_set('spam_filter_url_limit_total', $form_state['values']['spam_filter_url_limit_total']);
+    variable_set('spam_filter_url_limit_repeat', $form_state['values']['spam_filter_url_limit_repeat']);
+    drupal_set_message('Configuration saved.');
+  }
+}
