Index: webform.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v retrieving revision 1.124.2.103 diff -u -p -r1.124.2.103 webform.module --- webform.module 22 Dec 2009 02:33:11 -0000 1.124.2.103 +++ webform.module 15 Jan 2010 21:08:17 -0000 @@ -2488,3 +2488,49 @@ function webform_load_components($return // Ensure only wanted components are returned, even all are loaded. return $return_all ? $component_list : array_intersect_assoc($component_list, $enabled_list); } + +/** + * Implements hook_mollom_form_info(). + */ +function webform_mollom_form_info() { + $forms = array(); + $nodes = db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE n.type = 'webform'")); + while ($nid = db_result($nodes)) { + $node = node_load($nid); + $additions = webform_load($node); + $node->webform = $additions->webform; + + $form_id = 'webform_client_form_'. $node->nid; + $forms[$form_id] = array( + 'title' => t('@name webform', array('@name' => $node->title)), + 'mode' => MOLLOM_MODE_ANALYSIS, + 'bypass access' => array('access webform results', 'edit webforms'), + 'entity' => 'webform', + 'elements' => array(), + 'mapping' => array( + 'post_id' => 'details][sid', + ), + ); + + // Gather the elements available. + foreach ($node->webform['components'] as $cid => $component) { + if (in_array($component['type'], array('textfield', 'email', 'textarea'))) { + $forms[$form_id]['elements']['submitted][' . $component['form_key']] = check_plain(t($component['name'])); + } + } + + // Find any mappings. + $mappings = array( + 'post_title' => 'email_subject', + 'author_name' => 'email_from_name', + 'author_mail' => 'email_from_address', + ); + foreach ($mappings as $mapping => $setting) { + if (isset($node->webform['components'][$node->webform[$setting]])) { + $forms[$form_id]['mapping'][$mapping] = 'submitted][' . $node->webform['components'][$node->webform[$setting]]['form_key']; + } + } + } + + return $forms; +} Index: webform_submissions.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform/Attic/webform_submissions.inc,v retrieving revision 1.6.2.23 diff -u -p -r1.6.2.23 webform_submissions.inc --- webform_submissions.inc 14 Feb 2009 06:26:23 -0000 1.6.2.23 +++ webform_submissions.inc 15 Jan 2010 21:08:18 -0000 @@ -59,6 +59,10 @@ function webform_submission_insert($node } } + if (module_exists('mollom')) { + mollom_data_save('webform', $sid); + } + return $sid; } @@ -80,6 +84,10 @@ function webform_submission_delete($node } } + if (module_exists('webform')) { + mollom_data_delete('webform', $submission->sid); + } + db_query('DELETE FROM {webform_submitted_data} WHERE nid = %d AND sid = %d', $node->nid, $submission->sid); db_query('DELETE FROM {webform_submissions} WHERE nid = %d AND sid = %d', $node->nid, $submission->sid); }