[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/mollom/ -> mollom.module (summary)

(no description)

File Size: 2498 lines (89 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 includes/install.inc

Defines 67 functions

  mollom_help()
  mollom_init()
  mollom_link()
  mollom_menu()
  _mollom_access()
  mollom_report_access()
  mollom_perm()
  mollom_flush_caches()
  mollom_cron()
  mollom_data_load()
  mollom_data_save()
  mollom_data_delete()
  mollom_data_delete_multiple()
  mollom_data_delete_form_alter()
  mollom_data_delete_form_submit()
  mollom_data_report()
  mollom_data_report_multiple()
  mollom_form_alter()
  mollom_form_cache()
  mollom_get_mode()
  mollom_form_list()
  mollom_form_info()
  mollom_form_new()
  mollom_form_load()
  mollom_form_save()
  mollom_form_get_values()
  _mollom_flatten_form_values()
  _mollom_get_openid()
  _mollom_status()
  _mollom_testing_mode_warning()
  _mollom_fallback()
  mollom_elements()
  mollom_theme()
  theme_mollom()
  mollom_process_mollom()
  mollom_process_mollom_session_id()
  mollom_validate_analysis()
  mollom_validate_captcha()
  mollom_pre_render_mollom()
  mollom_form_submit()
  mollom()
  _mollom_watchdog()
  _mollom_watchdog_multiple()
  _mollom_get_version()
  _mollom_send_feedback()
  mollom_get_statistics()
  mollom_content_extra_fields()
  mollom_get_captcha()
  mollom_mail_alter()
  mollom_mail_add_report_link()
  node_mollom_form_list()
  node_mollom_form_info()
  mollom_nodeapi()
  mollom_form_node_admin_content_alter()
  node_mollom_report_access()
  node_mollom_report_delete()
  comment_mollom_form_list()
  comment_mollom_form_info()
  mollom_form_comment_form_alter()
  mollom_comment_form_validate()
  mollom_comment()
  mollom_form_comment_admin_overview_alter()
  comment_mollom_report_delete()
  user_mollom_form_list()
  user_mollom_form_info()
  contact_mollom_form_list()
  contact_mollom_form_info()

Functions
Functions that are not part of a class:

mollom_help($path, $arg)   X-Ref
Implements hook_help().


mollom_init()   X-Ref
Implements hook_init().


mollom_link($type, $object, $teaser = FALSE)   X-Ref
Implements hook_link().


mollom_menu()   X-Ref
Implements hook_menu().


_mollom_access($permission = FALSE)   X-Ref
Access callback; check if the module is configured.

This function does not actually check whether Mollom keys are valid for the
site, but just if the keys have been entered.

param: $permission
return:

mollom_report_access($entity, $id)   X-Ref
Menu access callback; Determine access to report to Mollom.

The special $entity type "session" may be used for mails and messages, which
originate from form submissions protected by Mollom, and can be reported by
anyone; $id is expected to be a Mollom session id instead of an entity id
then.

param: $entity
param: $id

mollom_perm()   X-Ref
Implements hook_perm().


mollom_flush_caches()   X-Ref
Implements hook_flush_caches().


mollom_cron()   X-Ref
Implements hook_cron().


mollom_data_load($entity, $id)   X-Ref
Load a Mollom data record from the database.

param: $entity
param: $id

mollom_data_save($entity, $id)   X-Ref
Save Mollom validation data to the database.

Based on the specified entity type and id, this function stores the
validation results returned by Mollom in the database. The stored data
is an associative array containing Mollom session information for the posted
content:
- session: The session ID returned by the Mollom server.
- quality: A quality rating assigned to the content to tell whether or not
it's spam.
- languages: An array containing language codes the content might be
written in.

The special $entity type "session" may be used for mails and messages, which
originate from form submissions protected by Mollom, and can be reported by
anyone; $id is expected to be a Mollom session id instead of an entity id
then.

param: $entity
param: $id

mollom_data_delete($entity, $id)   X-Ref
Deletes a Mollom session data record from the database.

param: $entity
param: $id

mollom_data_delete_multiple($entity, $ids)   X-Ref
Deletes multiple Mollom session data records from the database.

param: $entity
param: $ids

mollom_data_delete_form_alter(&$form, &$form_state)   X-Ref
Helper function to add Mollom feedback options to confirmation forms.


mollom_data_delete_form_submit($form, &$form_state)   X-Ref
Send feedback to Mollom and delete Mollom data.


mollom_data_report($entity, $id, $feedback)   X-Ref
Sends feedback for a Mollom session data record.

param: $entity
param: $id

mollom_data_report_multiple($entity, $ids, $feedback)   X-Ref
Sends feedback for multiple Mollom session data records.

param: $entity
param: $ids

mollom_form_alter(&$form, &$form_state, $form_id)   X-Ref
Implements hook_form_alter().

This function intercepts all forms in Drupal and Mollom-enables them if
necessary.

mollom_form_cache($reset = FALSE)   X-Ref
Returns a cached mapping of protected and delete confirmation form ids.

param: $reset
return:

mollom_get_mode($form_id)   X-Ref
Return the protection mode for a given form id.

return:

mollom_form_list()   X-Ref
Returns a list of protectable forms registered via hook_mollom_form_info().


mollom_form_info($form_id, $module)   X-Ref
Returns information about a form registered via hook_mollom_form_info().

param: $form_id
param: $module

mollom_form_new($form_id = NULL)   X-Ref
Creates a bare Mollom form configuration.

param: $form_id

mollom_form_load($form_id)   X-Ref
Menu argument loader; Loads Mollom configuration and form information for a given form id.


mollom_form_save(&$mollom_form)   X-Ref
Saves a Mollom form configuration.


mollom_form_get_values($form_values, $fields, $mapping)   X-Ref
Given an array of values and an array of fields, extract data for use.

This function generates the data to send for validation to Mollom by walking
through the submitted form values and
- copying element values as specified via 'mapping' in hook_mollom_form_info()
into the dedicated data properties
- collecting and concatenating all fields that have been selected for textual
analysis into the 'post_body' property

The processing accounts for the following possibilities:
- A field was selected for textual analysis, but there is no submitted form
value. The value should have been appended to the 'post_body' property, but
will be skipped.
- A field is contained in the 'mapping' and there is a submitted form value.
The value will not be appended to the 'post_body', but instead be assigned
to the specified data property.
- All fields specified in 'mapping', for which there is a submitted value,
but which were NOT selected for textual analysis, are assigned to the
specified data property. This is usually the case for form elements that
hold system user information.

param: $values
param: $fields
param: $mapping

_mollom_flatten_form_values(&$values)   X-Ref
Recursive helper function to flatten nested form values.

Takes a potentially nested array and moves all nested keys to the top-level.

_mollom_get_openid($account)   X-Ref
Helper function to return OpenID identifiers associated with a given user account.


_mollom_status($reset = FALSE)   X-Ref
Returns the (last known) status of the configured Mollom API keys.

param: $reset
return:

_mollom_testing_mode_warning()   X-Ref
Outputs a warning message about enabled testing mode (once).


_mollom_fallback()   X-Ref
Helper function to log and optionally output an error message when Mollom servers are unavailable.


mollom_elements()   X-Ref
Implements hook_elements().


mollom_theme()   X-Ref
Implements hook_theme().


theme_mollom($element)   X-Ref
Format the Mollom form element.

This works like #type 'markup' and is only required, because D6 only supports
#process callbacks on elements with #input = TRUE.


mollom_process_mollom($element, $input, &$form_state, $complete_form)   X-Ref
Form element #process callback for the 'mollom' element.

The 'mollom' form element is stateful. The Mollom session ID that is exchanged
between Drupal, the Mollom back-end, and the user allows us to keep track of
the form validation state.

The session ID is valid for a given $form_id only. We expire it as soon as
the form is submitted, to avoid it being replayed.

mollom_process_mollom_session_id($element, $input, &$form_state)   X-Ref
Form element #process callback for Mollom's form storage handling.

Albeit this *should* be an #element_validate handler that is only executed
during form validation, we must use a #process callback, because
mollom_process_mollom() needs to copy over $form_state['mollom'] into
$element['#mollom'], and as of now, Form API does not allow form validation
handlers to alter any elements in the form structure by reference.

mollom_validate_analysis(&$form, &$form_state)   X-Ref
Form validation handler to perform textual analysis of submitted form values.

Validation needs to re-run in case of a form validation error (elsewhere in
the form). In case Mollom's textual analysis returns no definite result, we
must trigger a CAPTCHA, but text analysis is always performed, even if the
CAPTCHA was solved correctly.

mollom_validate_captcha(&$form, &$form_state)   X-Ref
Form validation handler for Mollom's CAPTCHA form element.

Validates whether a CAPTCHA was solved correctly. A form may contain a
CAPTCHA, if it was configured to be protected by a CAPTCHA only, or when the
text analysis result is "unsure".

mollom_pre_render_mollom($element)   X-Ref
Form element #pre_render callback for CAPTCHA element.

Conditionally alters the #type of the CAPTCHA form element into a 'hidden'
element if the response was correct. If it was not, then we empty the value
of the textfield to allow the user to re-enter a new one.

This #pre_render trick is required, because form API validation does not
allow form validation handlers to alter the actual form structure. Both the
form constructor function and the #process callback for the 'mollom' element
are therefore executed too early (before form validation), so the CAPTCHA
element still contains not yet validated (default) values.
We also cannot invoke a form validation handler during form construction or
processing, because mollom_form_get_values() would be invoked too early
and therefore $form_state['values'] would not contain any additions from
form validation functions like mollom_comment_form_validate().

mollom_form_submit($form, &$form_state)   X-Ref
Form submit handler to flush Mollom session and form information from cache.


mollom($method, $data = array()   X-Ref
Call a remote procedure at the Mollom server.

This function automatically adds the information required to authenticate
against Mollom.


_mollom_watchdog(array $parts, $severity = WATCHDOG_NOTICE)   X-Ref
Log a Mollom system message.

param: $parts
param: $severity

_mollom_watchdog_multiple($messages, $severity)   X-Ref
Helper function for mollom() to invoke watchdog() with cumulative messages.

We do not want false errors to clutter the log, for example, when the server
list failed, but we were able to retrieve new servers. We therefore collect
all messages and invoke this function in mollom() right before returning any
XML-RPC response with the entire stack of collected messages.
This is also required for tests to pass.

_mollom_get_version()   X-Ref
Returns version information to send with mollom.verifyKey.

Retrieves platform and module version information for mollom.verifyKey, which
is normally invoked on Mollom's administration pages only.

This information is solely used to speed up support requests and technical
inquiries. The data may also be aggregated to help the Mollom staff to make
decisions on new features or the necessity of back-porting improved
functionality to older versions.

return:

_mollom_send_feedback($session_id, $feedback = 'spam')   X-Ref
Send feedback to Mollom.


mollom_get_statistics($refresh = FALSE)   X-Ref
Fetch the site's Mollom statistics from the API.

param: $refresh
return:

mollom_content_extra_fields($type_name)   X-Ref
Implements hook_content_extra_fields().

Allow users of CCK to re-order the CAPTCHA field on node forms through the
CCK UI.

mollom_get_captcha($type, array $data = array()   X-Ref
Get the HTML markup for a Mollom CAPTCHA.

param: $type
param: $data
return:

mollom_mail_alter(&$message)   X-Ref
Implements hook_mail_alter().

Adds a "report as inappropriate" link to e-mails sent after Mollom-protected
form submissions.

mollom_mail_add_report_link(&$message)   X-Ref
Add the 'Report as innapropriate' link to an e-mail message.


node_mollom_form_list()   X-Ref
Implements hook_mollom_form_list().


node_mollom_form_info($form_id)   X-Ref
Implements hook_mollom_form_info().


mollom_nodeapi($node, $op)   X-Ref
Implements hook_nodeapi().


mollom_form_node_admin_content_alter(&$form, $form_state)   X-Ref
Implements hook_form_FORMID_alter().

Hook into the mass comment administration page and add some operations to
communicate ham/spam to the XML-RPC server.


node_mollom_report_access($entity, $id)   X-Ref
Mollom report access callback; Determine access to report and delete a node.


node_mollom_report_delete($entity, $id)   X-Ref
Mollom report delete callback; Deletes a node.


comment_mollom_form_list()   X-Ref
Implements hook_mollom_form_list().


comment_mollom_form_info($form_id)   X-Ref
Implements hook_mollom_form_info().


mollom_form_comment_form_alter(&$form, &$form_state)   X-Ref
Implements hook_form_FORMID_alter().

When a registered user posts a comment or when a comment administrator edits
an existing comment, comment_form() does not define 'name' and 'mail' form
elements, so our form element mapping will fail.


mollom_comment_form_validate($form, &$form_state)   X-Ref
Form validation handler for comment_form().


mollom_comment($comment, $op)   X-Ref
Implements hook_comment().


mollom_form_comment_admin_overview_alter(&$form, $form_state)   X-Ref
Implements hook_form_FORMID_alter().

Hook into the mass comment administration page and add some operations to
communicate ham/spam to the XML-RPC server.


comment_mollom_report_delete($entity, $id)   X-Ref
Mollom report delete callback; Deletes a comment and its replies.


user_mollom_form_list()   X-Ref
Implements hook_mollom_form_list().


user_mollom_form_info($form_id)   X-Ref
Implements hook_mollom_form_info().


contact_mollom_form_list()   X-Ref
Implements hook_mollom_form_list().


contact_mollom_form_info($form_id)   X-Ref
Implements hook_mollom_form_info().




Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7