Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Mollom Class Reference

Static Public Member Functions

static checkCaptcha ($sessionId, $solution)
 
static checkContent ($sessionId=null, $postTitle=null, $postBody=null, $authorName=null, $authorUrl=null, $authorEmail=null, $authorOpenId=null, $authorId=null)
 
static getAudioCaptcha ($sessionId=null)
 
static getImageCaptcha ($sessionId=null)
 
static getIpAddress ()
 
static getServerList ($counter=0)
 
static getStatistics ($type)
 
static sendFeedback ($sessionId, $feedback)
 
static setAllowedReverseProxyAddresses ($addresses)
 
static setPrivateKey ($key)
 
static setPublicKey ($key)
 
static setServerList ($servers)
 
static setTimeOut ($timeout)
 
static setUserAgent ($newUserAgent)
 
static verifyKey ()
 
static getContentTypes ()
 
static loadMollom ()
 
static verifySubmission ($assetid, $parameters)
 
static getMollomCaptchaKeywordReplacement ($assetid)
 
static getMollomCaptchaFieldKeywordReplacement ($assetid)
 
static getMollomCaptchaRegenLinkKeywordReplacement ($assetid, $regen_text='Regenerate security key')
 
static getMollomCaptchaAudioKeywordReplacement ($assetid)
 
static getMollomCaptchaImageKeywordReplacement ($assetid)
 
static checkCaptchaResponse ($assetid)
 
static refreshMollomSession ($assetid)
 

Static Public Attributes

static $default_server_list = array('http://xmlrpc3.mollom.com', 'http://xmlrpc2.mollom.com', 'http://xmlrpc1.mollom.com')
 

Detailed Description

Mollom class

This source file can be used to communicate with mollom (http://mollom.com)

The class is documented in the file itself, but you can find more documentation and examples on the docs-page (http://mollom.crsolutions.be/docs). If you find any bugs help me out and report them. Reporting can be done by sending an email to php-mollom-bugs[at]verkoyen[dot]eu. If you report a bug, make sure you give me enough ination (include your code). If you have questions, try the Mollom-forum, don't send them by mail, I won't read them.

Changelog since 1.0.1

  • Fixed a nasty bug. Possible infinite loop in doCall().
  • Fixed getServerList. I misinterpreted the documentation, so now the defaultserver is xmlrpc.mollom.com instead of the first fallback-server.
  • Fixed the timeout-issue. With fsockopen the timeout on connect wasn't respected. Rewrote the doCall function to use CURL over sockets.

Changelog since 1.1.0

Changelog since 1.1.1

  • PHPMollom was using HTTP 1.1, now HTTP 1.0.
  • Fallbackserver are hardcoded, when no servers could be retrieved the fallbacks are used

Changelog since 1.1.2

  • Typo
  • New Licence: BSD Modified

License Copyright (c) 2008, Tijs Verkoyen. All rights reserved.

Redistribution and use in source and binary s, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

This software is provided by the author ``as is'' and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the author be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Author
Tijs Verkoyen mollo.nosp@m.m@ve.nosp@m.rkoye.nosp@m.n.eu
Version
1.1.3

Definition at line 79 of file mollom.inc.

Member Function Documentation

static checkCaptcha (   $sessionId,
  $solution 
)
static

Validates the answer for a CAPTCHA

When the answer is false, you should request a new image- or audio-CAPTCHA, make sure your provide the current Mollom-sessionid. The sessionid will be used to track spambots that try to solve CAPTHCA's by brute force.

Returns
bool
Parameters
string$sessionId
string$solution

Definition at line 231 of file mollom.inc.

static checkCaptchaResponse (   $assetid)
static

Check the value submitted for captcha

Parameters
string$assetidAssetid of Matrix asset using the Mollom
Returns
boolean private

Definition at line 1137 of file mollom.inc.

static checkContent (   $sessionId = null,
  $postTitle = null,
  $postBody = null,
  $authorName = null,
  $authorUrl = null,
  $authorEmail = null,
  $authorOpenId = null,
  $authorId = null 
)
static

Check if the data is spam or not, and gets an assessment of the datas quality

This function will be used most. The more data you submit the more accurate the claasification will be. If the spamstatus is 'unsure', you could send the user an extra check (eg. a captcha).

REMARK: the Mollom-sessionid is NOT related to HTTP-session, so don't send 'session_id'.

The function will return an array with 3 elements:

  • spam the spam-status (unknown/ham/spam/unsure)
  • quality an assessment of the content's quality (between 0 and 1)
  • session_id Molloms session_id
Returns
array
Parameters
string[optional]$sessionId
string[optional]$postTitle
string[optional]$postBody
string[optional]$authorName
string[optional]$authorUrl
string[optional]$authorEmail
string[optional]$authorOpenId
string[optional]$authorId

Definition at line 281 of file mollom.inc.

static getAudioCaptcha (   $sessionId = null)
static

Get a CAPTCHA-mp3 generated by Mollom

If your already called getAudioCaptcha make sure you provide at least the $sessionId. It will be used to identify visitors that are trying to break a CAPTCHA with brute force.

REMARK: the Mollom-sessionid is NOT related to HTTP-session, so don't send 'session_id'.

The function will return an array with 3 elements:

  • session_id the session_id from Mollom
  • url the url to the mp3-file
  • html html that can be used on your website to display the CAPTCHA
Returns
array
Parameters
string[optional]$sessionId

Definition at line 531 of file mollom.inc.

static getContentTypes ( )
static

Get all the Mollom content types

Returns
array

Definition at line 873 of file mollom.inc.

static getImageCaptcha (   $sessionId = null)
static

Get a CAPTCHA-image generated by Mollom

If your already called getImageCaptcha make sure you provide at least the $sessionId. It will be used to identify visitors that are trying to break a CAPTCHA with brute force.

REMARK: the Mollom-sessionid is NOT related to HTTP-session, so don't send 'session_id'.

The function will return an array with 3 elements:

  • session_id the session_id from Mollom
  • url the url to the image
  • html html that can be used on your website to display the CAPTCHA
Returns
array
Parameters
string[optional]$sessionId

Definition at line 580 of file mollom.inc.

static getIpAddress ( )
static

Get the real IP-address

Returns
string

Definition at line 615 of file mollom.inc.

static getMollomCaptchaAudioKeywordReplacement (   $assetid)
static

Get Mollom captcha audio keyword replacement

Parameters
string$assetidAssetid of Matrix asset using the Mollom
Returns
string public

Definition at line 1085 of file mollom.inc.

static getMollomCaptchaFieldKeywordReplacement (   $assetid)
static

Get captcha input field keyword replacement

Parameters
string$assetidAssetid of Matrix asset using the Mollom
Returns
string public

Definition at line 1031 of file mollom.inc.

static getMollomCaptchaImageKeywordReplacement (   $assetid)
static

Get Mollom captcha image keyword replacement

Parameters
string$assetidAssetid of Matrix asset using the Mollom
Returns
string public

Definition at line 1116 of file mollom.inc.

static getMollomCaptchaKeywordReplacement (   $assetid)
static

Get Mollom captcha keyword replacement

Parameters
string$assetidAssetid of Matrix asset using the Mollom
Returns
string public

Definition at line 1007 of file mollom.inc.

static getMollomCaptchaRegenLinkKeywordReplacement (   $assetid,
  $regen_text = 'Regenerate security key' 
)
static

Get Mollom captcha link regenerate keyword replacement

Parameters
string$assetidAssetid of Matrix asset using the Mollom
string$regen_text
Returns
string public

Definition at line 1062 of file mollom.inc.

static getServerList (   $counter = 0)
static

Obtains a list of valid servers

Returns
array

Definition at line 647 of file mollom.inc.

static getStatistics (   $type)
static

Retrieve statistics from Mollom

Allowed types are listed below:

  • total_days Number of days Mollom has been used
  • total_accepted Total of blocked spam
  • total_rejected Total accepted posts (not working?)
  • yesterday_accepted Amount of spam blocked yesterday
  • yesterday_rejected Number of posts accepted yesterday (not working?)
  • today_accepted Amount of spam blocked today
  • today_rejected Number of posts accepted today (not working?)
Returns
int
Parameters
string$type

Definition at line 686 of file mollom.inc.

static refreshMollomSession (   $assetid)
static

Refresh Mollom session

If the form having Mollom captcha is idle for more than given time, refresh the mollom session

Returns
void private

Definition at line 1164 of file mollom.inc.

static sendFeedback (   $sessionId,
  $feedback 
)
static

Send feedback to Mollom.

With this method you can help train Mollom. Implement this method if possible. The more feedback is provided the more accurate Mollom will be.

Allowed feedback-strings are listed below:

  • spam Spam or unsolicited advertising
  • profanity Obscene, violent or profane content
  • low-quality Low-quality content or writing
  • unwanted Unwanted, taunting or off-topic content
Returns
bool
Parameters
string$sessionId
string$feedback

Definition at line 724 of file mollom.inc.

static setAllowedReverseProxyAddresses (   $addresses)
static

Set the allowed reverse proxy Addresses

Returns
void
Parameters
array$addresses

Definition at line 760 of file mollom.inc.

static setPrivateKey (   $key)
static

Set the private key

Returns
void
Parameters
string$key

Definition at line 776 of file mollom.inc.

static setPublicKey (   $key)
static

Set the public key

Returns
void
Parameters
string$key

Definition at line 788 of file mollom.inc.

static setServerList (   $servers)
static

Set the server list

Returns
void
Parameters
array$servers

Definition at line 800 of file mollom.inc.

static setTimeOut (   $timeout)
static

Set timeout

Returns
void
Parameters
int$timeout

Definition at line 816 of file mollom.inc.

static setUserAgent (   $newUserAgent)
static

Set the user agent

Returns
void
Parameters
string$newUserAgent

Definition at line 835 of file mollom.inc.

static verifyKey ( )
static

Verifies your key

Returns ination about the status of your key. Mollom will respond with a boolean value (true/false). False means that your keys is disabled or doesn't exists. True means the key is enabled and working properly.

Returns
bool

Definition at line 849 of file mollom.inc.

static verifySubmission (   $assetid,
  $parameters 
)
static

Verify the content for spam

Parameters
string$assetidAssetid of Matrix asset using the Mollom
array$parameters
Returns
integer public

Definition at line 923 of file mollom.inc.


The documentation for this class was generated from the following file: