Index: mollom.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.admin.inc,v
retrieving revision 1.7
diff -u -r1.7 mollom.admin.inc
--- mollom.admin.inc	14 Jan 2010 18:42:50 -0000	1.7
+++ mollom.admin.inc	24 Jan 2010 22:21:02 -0000
@@ -266,6 +266,177 @@
   $form_state['redirect'] = 'admin/config/content/mollom';
 }
 
+function mollom_admin_blacklist() {
+  $output  = '<h2>'. t('Text blacklist') .'</h2>';
+  $output .= drupal_render(drupal_get_form('mollom_admin_blacklist_text_form'));
+  $output .= '<h2>'. t('URL blacklist') .'</h2>';
+  $output .= drupal_render(drupal_get_form('mollom_admin_blacklist_url_form'));
+  
+  return $output;
+}
+
+function mollom_admin_blacklist_text_form() {
+
+  $form['text'] = array(
+    '#type' => 'textfield',
+    '#size' => 30,
+    '#required' => TRUE,
+    '#maxlength' => 64,
+  );
+
+  $form['match'] = array(
+    '#type' => 'select',
+    '#options' => array(
+      'exact' => t('Exact'),
+      'contains' => t('Contains'),
+    ),
+    '#default_value' => 'exact',
+    '#required' => TRUE,
+  );
+
+  $form['reason'] = array(
+    '#type' => 'select',
+    '#options' => array(
+        'spam' => t('Spam'),
+        'profanity' => t('Profanity'),
+        'unwanted' => t('Unwanted'),
+      ),
+    '#default_value' => 'spam',
+    '#required' => TRUE,
+  );
+
+  include_once DRUPAL_ROOT . '/includes/locale.inc';
+  $predefined = _locale_prepare_predefined_list();
+
+  $form['language'] = array(
+    '#type' => 'select',
+    '#options' => $predefined,
+    '#default_value' => 'en',
+    '#required' => TRUE,
+  );
+      
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save'),
+  );
+    
+  $form['#submit'][] = 'mollom_admin_blacklist_text_form_submit';
+      
+  return $form;
+}
+
+function mollom_admin_blacklist_text_form_submit($form, &$form_state) {
+  
+  $result = mollom('mollom.addBlacklistText', array(
+    'text' => $form_state['values']['text'],
+    'match' => $form_state['values']['match'],
+    'reason' => $form_state['values']['reason'],
+    'language' => $form_state['values']['language'],
+  ));
+
+  drupal_set_message(t('The word has been added to the blacklist.'));
+}
+
+function theme_mollom_admin_blacklist_text_form($variables) {
+  
+  $form = $variables['form'];
+
+  $header = array(t('Text'),
+    t('Match'),
+    t('Reason'),
+    t('Language'),
+    t('Operations')
+  );
+  
+  $blacklist = mollom('mollom.listBlacklistText');
+
+  $rows = array();
+  foreach ($blacklist as $entry) {
+    $rows[] = array(
+      check_plain($entry['text']),
+      check_plain($entry['match']),
+      check_plain($entry['reason']),
+      check_plain($entry['language']),
+      // @todo the text should be encoded, or we should pass in an ID ...
+      l(t('delete'), 'admin/config/content/mollom/delete/' . $entry['text'])
+    );  
+  }
+  
+  $rows[] = array(
+    drupal_render($form['text']),
+    drupal_render($form['match']),
+    drupal_render($form['reason']),
+    drupal_render($form['language']),
+    drupal_render($form['submit'])
+  );
+  
+  $output  = theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No words have been added to the blacklist.')));
+  $output .= drupal_render_children($form);
+  
+  return $output;
+}
+
+
+function mollom_admin_blacklist_url_form() {
+
+  $form['url'] = array(
+    '#type' => 'textfield',
+    '#size' => 30,
+    '#required' => TRUE,
+    '#prefix' => 'http://',
+    '#maxlength' => 64,
+  );
+      
+  $form['submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save'),
+  );
+    
+  // @todo: not necessary?
+  $form['#submit'][] = 'mollom_admin_blacklist_url_form_submit';
+      
+  return $form;
+}
+
+function mollom_admin_blacklist_url_form_submit($form, &$form_state) {
+  
+  $result = mollom('mollom.addBlacklistURL', array(
+    'url' => 'http://' . $form_state['values']['url'],
+  ));
+
+  drupal_set_message(t('The URL has been added to the blacklist.'));
+}
+
+function theme_mollom_admin_blacklist_url_form($variables) {
+  
+  $form = $variables['form'];
+
+  $header = array(t('URL'),
+    t('Operations')
+  );
+  
+  $blacklist = mollom('mollom.listBlacklistURL');
+
+  $rows = array();
+  foreach ($blacklist as $entry) {
+    $rows[] = array(
+      check_plain($entry['url']),
+      // @todo the URL should be encoded, or we should pass in an ID ...
+      l(t('delete'), 'admin/config/content/mollom/delete/' . $entry['url'])
+    );  
+  }
+  
+  $rows[] = array(
+    drupal_render($form['url']),
+    drupal_render($form['submit'])
+  );
+  
+  $output  = theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No URLs have been added to the blacklist.')));
+  $output .= drupal_render_children($form);
+  
+  return $output;
+}
+
 /**
  * Form builder; Global Mollom settings form.
  */
Index: mollom.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.module,v
retrieving revision 1.15
diff -u -r1.15 mollom.module
--- mollom.module	18 Jan 2010 22:35:58 -0000	1.15
+++ mollom.module	24 Jan 2010 22:21:02 -0000
@@ -143,8 +143,8 @@
     'access arguments' => array('administer mollom'),
     'file' => 'mollom.admin.inc',
   );
-  $items['admin/config/content/mollom/list'] = array(
-    'title' => 'List',
+  $items['admin/config/content/mollom/forms'] = array(
+    'title' => 'Forms',
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => -10,
   );
@@ -171,6 +171,14 @@
     'type' => MENU_CALLBACK,
     'file' => 'mollom.admin.inc',
   );
+  $items['admin/config/content/mollom/blacklist'] = array(
+    'title' => 'Blacklist',
+    'description' => 'Configure word and URL blacklists.',
+    'page callback' => 'mollom_admin_blacklist',
+    'access arguments' => array('administer mollom'),
+    'type' => MENU_LOCAL_TASK,
+    'file' => 'mollom.admin.inc',
+  );
   $items['admin/config/content/mollom/settings'] = array(
     'title' => 'Settings',
     'description' => 'Configure Mollom keys and global settings.',
@@ -204,6 +212,22 @@
 }
 
 /**
+ * Implements hook_theme().
+ */
+function mollom_theme() {
+  return array(
+    'mollom_admin_blacklist_text_form' => array(
+      'render element' => 'form',
+      'file' => 'mollom.admin.inc',
+    ),
+    'mollom_admin_blacklist_url_form' => array(
+      'render element' => 'form',
+      'file' => 'mollom.admin.inc',
+    ),
+  );
+}
+
+/**
  * Access callback; check if the module is configured.
  *
  * This function does not actually check whether Mollom keys are valid for the
