by pass the exception (error) where there's an error on spamprotecter field

This commit is contained in:
Saophalkun Ponlu 2009-02-24 00:35:59 +00:00
parent cbe2fa3171
commit 98e0c85937
1 changed files with 12 additions and 3 deletions

View File

@ -27,14 +27,23 @@ class SpamProtecterManager {
* and a string of field names (seperated by comma) as a value.
* The naming of the fields is based on the implementation of the subclass of SpamProtecterField.
* *** Most of the web service doesn't require this.
* @return SpamProtector object or return null if the spamprotecter class is not found
* or spamprotecterfield creation fails.
* @return SpamProtector object on success or null if the spamprotecter class is not found
* also null if spamprotecterfield creation fails.
*/
static function update_form($form, $before=null, $callbackObject=null, $fieldsToSpamServiceMapping=null) {
if (!class_exists(self::$spam_protecter)) return null;
$protecter = new self::$spam_protecter();
$check = $protecter->updateForm($form, $before, $callbackObject, $fieldsToSpamServiceMapping);
try {
$check = $protecter->updateForm($form, $before, $callbackObject, $fieldsToSpamServiceMapping);
}
catch (Exception $e) {
$form->setMessage(
_t("SpamProtection.SPAMSPECTIONFAILED", self::$spam_protecter . " failed."),
"warning"
);
return null;
}
if (!$check) return null;