static function getServerList() { if ($list = self::getCachedServerList()) { return $list; } $servers = self::doCall("getServerList", null); if (!$servers) { return null; } foreach ($servers as $server) { $mollomServer = new MollomServer(); $mollomServer->ServerURL = $server; $mollomServer->write(); $mollomServer->destroy(); } return $servers; }
/** * Send Feedback about a Object to the Mollom Service. Note that Mollom does not * want to know about ham (or valid entries) so the only valid feedback is what * level of spam it is, Which we currently do not support. * * @param DataObject The DataObject which you want to send feedback about * @param String Feedback information * * @return bool Whether feedback was sent */ function sendFeedback($object = null, $feedback = "") { if ($object) { if ($object->hasField('SessionID')) { if (in_array($feedback, array('spam', 'profanity', 'low-quality', 'unwanted'))) { MollomServer::initServerList(); return MollomServer::sendFeedback($object->SessionID, $feedback); } } } return false; }
/** * This function first gets values from mapped fields and then check these values against * Mollom web service and then notify callback object with the spam checking result. * @return boolean - true when Mollom confirms that the submission is ham (not spam) * - false when Mollom confirms that the submission is spam * - false when Mollom say 'unsure'. * In this case, 'mollom_captcha_requested' session is set to true * so that Field() knows it's time to display captcha */ function validate($validator) { // If the user is ADMIN let them post comments without checking if (Permission::check('ADMIN')) { $this->clearMollomSession(); return true; } // if the user has logged and there's no force check on member if (Member::currentUser() && !self::$force_check_on_members) { return true; } // Info from the session $session_id = Session::get("mollom_session_id"); // get fields to check $spamFields = $this->getFieldMapping(); // Check validate the captcha answer if the captcha was displayed if ($this->showCaptcha()) { if (MollomServer::checkCaptcha($session_id, $this->Value())) { $this->clearMollomSession(); return true; } else { $validator->validationError($this->name, _t('MollomCaptchaField.INCORRECTSOLUTION', "You didn't type in the correct captcha text. Please type it in again.", "Mollom Captcha provides words in an image, and expects a user to type them in a textfield"), "validation", false); Session::set('mollom_captcha_requested', true); return false; } } // populate mollom fields foreach ($spamFields as $key => $field) { if (array_key_exists($field, $this->mollomFields)) { $this->mollomFields[$field] = isset($_REQUEST[$key]) ? $_REQUEST[$key] : ""; } } $this->mollomFields['session_id'] = $session_id; $response = MollomServer::checkContent($this->mollomFields['session_id'], $this->mollomFields['post_title'], $this->mollomFields['post_body'], $this->mollomFields['author_name'], $this->mollomFields['author_url'], $this->mollomFields['author_mail'], $this->mollomFields['author_openid'], $this->mollomFields['author_id']); Session::set("mollom_session_id", $response['session_id']); Session::set("mollom_user_session_id", $response['session_id']); // response was fine, let it pass through if ($response['spam'] == 'ham') { $this->clearMollomSession(); return true; } else { if ($response['spam'] == 'unsure') { $validator->validationError($this->name, _t('MollomCaptchaField.CAPTCHAREQUESTED', "Please answer the captcha question", "Mollom Captcha provides words in an image, and expects a user to type them in a textfield"), "warning"); Session::set('mollom_captcha_requested', true); return false; } else { if ($response['spam'] == 'spam') { $this->clearMollomSession(); $validator->validationError($this->name, _t('MollomCaptchaField.SPAM', "Your submission has been rejected because it was treated as spam.", "Mollom Captcha provides words in an image, and expects a user to type them in a textfield"), "error"); $this->clearMollomSession(); return false; } } } return true; }
function isKeyVerified() { return MollomServer::verifyKey(); }