Index: mollom.admin.inc
===================================================================
RCS file: mollom.admin.inc
diff -N mollom.admin.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mollom.admin.inc	25 Mar 2009 22:00:06 -0000
@@ -0,0 +1,129 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * Administrative page callbacks for the Mollom module.
+ */
+
+/**
+ * Administration settings form.
+ *
+ * @see system_settings_form()
+ */
+function mollom_admin_settings() {
+
+  // _mollom_update_comments();
+
+  $keys = variable_get('mollom_public_key', '') && variable_get('mollom_private_key', '');
+
+  if ($keys) {
+    // Print a status message about the key:
+    if (!$_POST) {
+      // When a user visits the Mollom administration page, automatically
+      // clear the server list.  This causes the client to fetch a fresh
+      // server list from the server.
+      variable_del('mollom_servers');
+
+      // Verify the key:
+      _mollom_verify_key();
+    }
+
+    $form['statistics'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Site usage statistics'),
+      '#collapsible' => TRUE,
+    );
+    $form['statistics']['message'] = array(
+      '#value' => '<div><embed src="http://mollom.com/statistics.swf?key='. check_plain(variable_get('mollom_public_key', '')) .'" quality="high" width="100%" height="430" name="Mollom" align="middle" play="true" loop="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></div>',
+    );
+
+    $form['spam'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Spam protection settings'),
+      '#description' =>
+        '<p>'. t("Mollom can be used to block all types of spam received on your website's protected forms. Each form can be set to one of the following options:") .'</p>'.
+        '<ul><li>'. t("<strong>Text analysis and CAPTCHA backup</strong>: Mollom analyzes the data submitted on the form and presents a CAPTCHA challenge if necessary. This option is strongly recommended, as it takes full advantage of the Mollom anti-spam service to categorize your posts into ham (not spam) and spam.") .'</li>'.
+        '<li>'. t("<strong>CAPTCHA only</strong>: the form's data is not sent to Mollom for analysis, and a remotely-hosted CAPTCHA challenge is always presented. This option is useful when you wish to always display a CAPTCHA or want to send less data to the Mollom network. Note, however, that forms displayed with a CAPTCHA are never cached, so always displaying a CAPTCHA challenge may reduce performance.") .'</li>'.
+        '<li>'. t('<strong>No protection</strong>: Mollom is not used with this form.') .'</li></ul>'.
+        '<p>'. t("Data is processsed and stored as explained in our <a href=\"@mollom-privacy\">Web Service Privacy Policy</a>. It is your responsibility to provide any necessary notices and obtain the appropriate consent regarding Mollom's use of your data. For more information, see <a href=\"@mollom-works\">How Mollom Works</a> and the <a href=\"@mollom-faq\">Mollom FAQ</a>.", array('@mollom-privacy' => 'http://mollom.com/service-agreement-free-subscriptions', '@mollom-works' => 'http://mollom.com/how-mollom-works', '@mollom-faq' => 'http://mollom.com/faq')) .'</p>',
+      '#collapsible' => TRUE,
+    );
+
+    $forms = _mollom_protectable_forms();
+    foreach ($forms as $form_id => $details) {
+      $mode = _mollom_get_mode($form_id);
+      $name = 'mollom_'. $form_id;
+
+      $options = array_slice(array(
+        MOLLOM_MODE_DISABLED => t('No protection'),
+        MOLLOM_MODE_CAPTCHA => t('CAPTCHA only'),
+        MOLLOM_MODE_ANALYSIS => t('Text analysis and CAPTCHA backup'),
+      ), 0, $details['mode'] + 1);
+
+      $form['spam'][$name] = array(
+        '#type' => 'select',
+        '#title' => t('Protect @name', array('@name' => $details['name'])),
+        '#options' => $options,
+        '#default_value' => $mode,
+      );
+    }
+
+    $form['server'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Server settings'),
+      '#collapsible' => TRUE,
+      '#collapsed' => $keys,
+    );
+    $form['server']['mollom_fallback'] = array(
+      '#type' => 'radios',
+      '#title' => t('Fallback strategy'),
+      '#default_value' => variable_get('mollom_fallback', MOLLOM_FALLBACK_BLOCK), // we default to treating everything as inappropriate
+      '#options' => array(
+        MOLLOM_FALLBACK_BLOCK => t('Block all submissions of protected forms until the server problems are resolved'),
+        MOLLOM_FALLBACK_ACCEPT => t('Leave all forms unprotected and accept all submissions'),
+      ),
+      '#description' => t('When the Mollom servers are down or otherwise unreachable, no text analysis is performed and no CAPTCHAs are generated. If this occurs, your Drupal site will use the configured fallback strategy, and will either accept all submissions without spam checking, or block all submissions until the server or connection problems are resolved. Subscribers to <a href="@pricing">Mollom Plus</a> receive access to <a href="@sla">Mollom\'s high-availability backend infrastructure</a>, not available to free users, reducing potential downtime.', array('@pricing' => 'http://mollom.com/pricing', '@sla' => 'http://mollom.com/standard-service-level-agreement')),
+    );
+  }
+
+  $form['access-keys'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Mollom access keys'),
+    '#description' => t('In order to use Mollom, you need both a public and private key. To obtain your keys, simply <a href="http://mollom.com/user/register">create a user account on mollom.com</a>, <a href="@mollom-user">login to mollom.com</a>, and <a href="@mollom-site-add">create a subscription</a> for your site.  Once you created a subscription, your private and public access keys will be available from the <a href="@mollom-sites">site manager on mollom.com</a>. Copy-paste them in the form below, and you are ready to go.', array('@mollom-user' => 'http://mollom.com/user', '@mollom-site-add' => 'http://mollom.com/site-manager/add', '@mollom-sites' => 'http://mollom.com/site-manager')),
+    '#collapsible' => TRUE,
+    '#collapsed' => $keys,
+  );
+  $form['access-keys']['mollom_public_key'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Public key'),
+    '#default_value' => variable_get('mollom_public_key', ''),
+    '#description' => t('The public key is used to uniquely identify you.'),
+    '#required' => TRUE,
+  );
+  $form['access-keys']['mollom_private_key'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Private key'),
+    '#default_value' => variable_get('mollom_private_key', ''),
+    '#description' => t('The private key is used to prevent someone from hijacking your requests. Similar to a password, it should never be shared with anyone.'),
+    '#required' => TRUE,
+  );
+
+  return system_settings_form($form);
+}
+
+/**
+ * This function contacts Mollom to verify the configured key pair.
+ */
+function _mollom_verify_key() {
+  $status = mollom('mollom.verifyKey');
+
+  $message = t('We contacted the Mollom servers to verify your keys');
+
+  if ($status) {
+    drupal_set_message(t('@message: the Mollom services are operating correctly. We are now blocking spam.', array('@message' => $message)));
+  }
+  else {
+    drupal_set_message(t('@message: your keys do not exist or are no longer valid. Please visit the <em>Manage sites</em> page on the Mollom website again: <a href="@mollom-user">@mollom-user</a>.', array('@message' => $message, '@mollom-user' => 'http://mollom.com/user')), 'error');
+  }
+}
Index: mollom.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mollom/mollom.module,v
retrieving revision 1.2.2.55
diff -u -p -r1.2.2.55 mollom.module
--- mollom.module	25 Feb 2009 07:41:00 -0000	1.2.2.55
+++ mollom.module	25 Mar 2009 22:00:08 -0000
@@ -92,6 +92,7 @@ function mollom_menu() {
     'page callback' => 'drupal_get_form',
     'page arguments' => array('mollom_admin_settings'),
     'access arguments' => array('administer site configuration'),
+    'file' => 'mollom.admin.inc',
   );
 
   // Menu callback used for AJAX purposes:
@@ -639,106 +640,6 @@ function _mollom_update_comments() {
   }
 }
 
-function mollom_admin_settings() {
-
-  // _mollom_update_comments();
-
-  $keys = variable_get('mollom_public_key', '') && variable_get('mollom_private_key', '');
-
-  if ($keys) {
-    // Print a status message about the key:
-    if (!$_POST) {
-      // When a user visits the Mollom administration page, automatically
-      // clear the server list.  This causes the client to fetch a fresh
-      // server list from the server.
-      variable_del('mollom_servers');
-
-      // Verify the key:
-      _mollom_verify_key();
-    }
-
-    $form['statistics'] = array(
-        '#type' => 'fieldset',
-        '#title' => t('Site usage statistics'),
-        '#collapsible' => TRUE,
-    );
-    $form['statistics']['message'] = array(
-      '#value' => '<div><embed src="http://mollom.com/statistics.swf?key='. check_plain(variable_get('mollom_public_key', '')) .'" quality="high" width="100%" height="430" name="Mollom" align="middle" play="true" loop="false" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></div>',
-    );
-
-    $form['spam'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Spam protection settings'),
-      '#description' =>
-        '<p>'. t("Mollom can be used to block all types of spam received on your website's protected forms. Each form can be set to one of the following options:") .'</p>'.
-        '<ul><li>'. t("<strong>Text analysis and CAPTCHA backup</strong>: Mollom analyzes the data submitted on the form and presents a CAPTCHA challenge if necessary. This option is strongly recommended, as it takes full advantage of the Mollom anti-spam service to categorize your posts into ham (not spam) and spam.") .'</li>'.
-        '<li>'. t("<strong>CAPTCHA only</strong>: the form's data is not sent to Mollom for analysis, and a remotely-hosted CAPTCHA challenge is always presented. This option is useful when you wish to always display a CAPTCHA or want to send less data to the Mollom network. Note, however, that forms displayed with a CAPTCHA are never cached, so always displaying a CAPTCHA challenge may reduce performance.") .'</li>'.
-        '<li>'. t('<strong>No protection</strong>: Mollom is not used with this form.') .'</li></ul>'.
-        '<p>'. t("Data is processsed and stored as explained in our <a href=\"http://mollom.com/service-agreement-free-subscriptions\">Web Service Privacy Policy</a>. It is your responsibility to provide any necessary notices and obtain the appropriate consent regarding Mollom's use of your data. For more information, see <a href=\"http://mollom.com/how-mollom-works\">How Mollom Works</a> and the <a href=\"http://mollom.com/faq\">Mollom FAQ</a>.") .'</p>',
-      '#collapsible' => TRUE,
-    );
-
-    $forms = _mollom_protectable_forms();
-    foreach ($forms as $form_id => $details) {
-      $mode = _mollom_get_mode($form_id);
-      $name = 'mollom_'. $form_id;
-
-      $options = array_slice(array(
-        MOLLOM_MODE_DISABLED => t('No protection'),
-        MOLLOM_MODE_CAPTCHA => t('CAPTCHA only'),
-        MOLLOM_MODE_ANALYSIS => t('Text analysis and CAPTCHA backup'),
-      ), 0, $details['mode'] + 1);
-
-      $form['spam'][$name] = array(
-        '#type' => 'select',
-        '#title' => t('Protect @name', array('@name' => $details['name'])),
-        '#options' => $options,
-        '#default_value' => $mode,
-      );
-    }
-
-    $form['server'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Server settings'),
-      '#collapsible' => TRUE,
-      '#collapsed' => $keys,
-    );
-    $form['server']['mollom_fallback'] = array(
-      '#type' => 'radios',
-      '#title' => t('Fallback strategy'),
-      '#default_value' => variable_get('mollom_fallback', MOLLOM_FALLBACK_BLOCK), // we default to treating everything as inappropriate
-      '#options' => array(
-        MOLLOM_FALLBACK_BLOCK => t('Block all submissions of protected forms until the server problems are resolved'),
-        MOLLOM_FALLBACK_ACCEPT => t('Leave all forms unprotected and accept all submissions'),
-      ),
-      '#description' => t('When the Mollom servers are down or otherwise unreachable, no text analysis is performed and no CAPTCHAs are generated. If this occurs, your Drupal site will use the configured fallback strategy, and will either accept all submissions without spam checking, or block all submissions until the server or connection problems are resolved. Subscribers to <a href="@pricing">Mollom Plus</a> receive access to <a href="@sla">Mollom\'s high-availability backend infrastructure</a>, not available to free users, reducing potential downtime.', array('@pricing' => 'http://mollom.com/pricing', '@sla' => 'http://mollom.com/standard-service-level-agreement')));
-  }
-
-  $form['access-keys'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Mollom access keys'),
-    '#description' => t('In order to use Mollom, you need both a public and private key. To obtain your keys, simply <a href="http://mollom.com/user/register">create a user account on mollom.com</a>, <a href="http://mollom.com/user">login to mollom.com</a>, and <a href="http://mollom.com/site-manager/add">create a subscription</a> for your site.  Once you created a subscription, your private and public access keys will be available from the <a href="http://mollom.com/site-manager">site manager on mollom.com</a>. Copy-paste them in the form below, and you are ready to go.'),
-    '#collapsible' => TRUE,
-    '#collapsed' => $keys,
-  );
-  $form['access-keys']['mollom_public_key'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Public key'),
-    '#default_value' => variable_get('mollom_public_key', ''),
-    '#description' => t('The public key is used to uniquely identify you.'),
-    '#required' => TRUE,
-  );
-  $form['access-keys']['mollom_private_key'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Private key'),
-    '#default_value' => variable_get('mollom_private_key', ''),
-    '#description' => t('The private key is used to prevent someone from hijacking your requests. Similar to a password, it should never be shared with anyone.'),
-    '#required' => TRUE,
-  );
-
-  return system_settings_form($form);
-}
-
 /**
  * A helper function that returns the OpenID identifiers associated with the specified user account.
  */
@@ -1031,22 +932,6 @@ function _mollom_insert_captcha(&$mollom
 }
 
 /**
- * This function contacts Mollom to verify the configured key pair.
- */
-function _mollom_verify_key() {
-  $status = mollom('mollom.verifyKey');
-
-  $message = t('We contacted the Mollom servers to verify your keys');
-
-  if ($status) {
-    drupal_set_message(t('@message: the Mollom services are operating correctly. We are now blocking spam.', array('@message' => $message)));
-  }
-  else {
-    drupal_set_message(t('@message: your keys do not exist or are no longer valid. Please visit the <em>Manage sites</em> page on the Mollom website again: <a href="@mollom-user">@mollom-user</a>.', array('@message' => $message, '@mollom-user' => 'http://mollom.com/user')), 'error');
-  }
-}
-
-/**
  * This function refreshes the list of servers that can be used to contact Mollom.
  */
 function _mollom_retrieve_server_list() {
