protected function renderErrorSave($commentOn)
	{
		if ($this->_captcha)
		{
			$this->commentCaptcha = $this->_captcha;
		}
		else if (!UserSession::get())
		{
			$this->commentCaptcha = Mollom::refresh();
		}
		parent::renderErrorSave($commentOn);
	}
Exemple #2
0
 /**
  * generates a Mollom captcha for comments
  *
  * Returns the captcha code string and image URL (via the $image parameter).
  *
  * @return string;
  */
 function generateCaptcha(&$image)
 {
     Mollom::setPublicKey(getOption('public_key'));
     Mollom::setPrivateKey(getOption('private_key'));
     $servers = Mollom::getServerList();
     Mollom::setServerList($servers);
     // get captcha
     $captcha = Mollom::getImageCaptcha();
     $session_id = $captcha['session_id'];
     query('DELETE FROM ' . prefix('captcha') . ' WHERE `ptime`<' . (time() - 3600), true);
     // expired tickets
     query("INSERT INTO " . prefix('captcha') . " (ptime, hash) VALUES ('" . escape(time()) . "','" . escape($session_id) . "')", true);
     $image = $captcha['url'];
     return $session_id;
 }
	public function save()
	{
		parent::validate('');
		Mollom::setPublicKey($this->publicKey);
		Mollom::setPrivateKey($this->privateKey);
		Mollom::setServerList(CoOrg::config()->get('mollom/serverlist'));
		try
		{
			if (!Mollom::verifyKey())
			{
				$this->publicKey_error = t('Invalid keys');
				throw new ValidationException($this);
			}
		}
		catch (ServerListException $e)
		{
			CoOrg::config()->set('mollom/serverlist', Mollom::getServerList());
			try
			{
				if (!Mollom::verifyKey())
				{
					$this->publicKey_error = t('Invalid keys');
					CoOrg::config()->save(); // Save the new serverlist
					throw new ValidationException($this);
				}
			}
			catch (InternalException $e)
			{
				
			}
			catch (ServerListException $e)
			{
			}
		}
		CoOrg::config()->set('mollom/public', $this->publicKey);
		CoOrg::config()->set('mollom/private', $this->privateKey);
		CoOrg::config()->save();
	}
    public function execute($par)
    {
        global $wgOut, $wgUser;
        /* check for user permissions */
        if (!$this->userCanExecute($wgUser)) {
            $this->displayRestrictionError();
            return;
        }
        $wgOut->setPageTitle(wfMsg('mollommw-statistics'));
        try {
            $validKeys = Mollom::verifyKey();
            if ($validKeys) {
                $wgOut->addHtml('<embed src="http://mollom.com/statistics.swf?key=' . Mollom::getPublicKey() . '"
				quality="high" width="500" height="480" name="Mollom" align="middle" play="true" loop="false" allowScriptAccess="sameDomain"
				type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed>');
            } else {
                $wgOut->addWikiText("'''" . wfMsg('mollommw-key-validation-failure') . "'''");
            }
        } catch (Exception $e) {
            wfDebugLog('MollomMW', 'Exception on statistics page: ' . $e->getMessage());
            $wgOut->addWikiText("'''" . wfMsg('mollommw-mollom-error') . "'''");
        }
    }
Exemple #5
0
 /**
  * The function for processing a message to see if it might be SPAM
  *       returns:
  *         0 if the message is SPAM
  *         1 if the message might be SPAM (it will be marked for moderation)
  *         2 if the message is not SPAM
  *
  * @param string $author Author field from the posting
  * @param string $email Email field from the posting
  * @param string $website Website field from the posting
  * @param string $body The text of the comment
  * @param string $imageLink A link to the album/image on which the post was made
  * @param string $ip the IP address of the comment poster
  * 
  * @return int
  */
 function filterMessage($author, $email, $website, $body, $imageLink, $ip)
 {
     // set keys
     Mollom::setPublicKey(getOption('public_key'));
     Mollom::setPrivateKey(getOption('private_key'));
     $servers = Mollom::getServerList();
     Mollom::setServerList($servers);
     // get feedback
     try {
         $feedback = Mollom::checkContent(null, null, $body, $author, $website, $email);
     } catch (Exception $e) {
         // mark comment for moderation, Mollom is acting strange
     }
     // process feedback
     if (in_array($feedback['spam'], array('unsure', 'unknow'))) {
         $result = 1;
     } elseif ($feedback['spam'] == 'ham') {
         $result = 2;
     } elseif ($feedback['spam'] == 'spam') {
         $result = 0;
     }
     return $result;
 }
Exemple #6
0
 /**
  * Check if comment is spam using Mollom.
  *
  * @param Comment $comment The Comment object
  * @param string $public_key The Mollom public key
  * @param string $private_key The Mollom private key
  *
  * @return void
  *
  * @since 2.0
  */
 public function mollom($comment, $public_key = '', $private_key = '')
 {
     // check if curl functions are available
     if (!function_exists('curl_init')) {
         return;
     }
     // load mollom class
     $this->app->loader->register('Mollom', 'libraries:mollom/mollom.php');
     // set keys and get servers
     Mollom::setPublicKey($public_key);
     Mollom::setPrivateKey($private_key);
     Mollom::setServerList(Mollom::getServerList());
     // check comment
     $feedback = Mollom::checkContent(null, null, $comment->content, $comment->author, $comment->url, $comment->email);
     // set state
     if ($feedback['spam'] != 'ham') {
         $comment->state = Comment::STATE_SPAM;
     }
 }
Exemple #7
0
 /**
  * Set a new object to use as ServerListCache
  * @param ServerListCache $cache
  */
 public static function setServerListCache($cache)
 {
     self::$serverListCache = $cache;
 }
	private function prepare()
	{
		Mollom::setPublicKey(CoOrg::config()->get('mollom/public'));
		Mollom::setPrivateKey(CoOrg::config()->get('mollom/private'));
		Mollom::setServerList(CoOrg::config()->get('mollom/serverlist'));
	}
Exemple #9
0
    $wgDebugLogGroups['MollomMW'] = dirname(__FILE__) . '/debug.log';
}
if (isset($wgMollomReverseProxyAddresses) && is_array($wgMollomReverseProxyAddresses)) {
    MollomClient::setAllowedReverseProxyAddresses($wgMollomReverseProxyAddresses);
}
if (isset($wgMollomRunsOnClusterSetup)) {
    MollomClient::setUsesServerSetup($wgMollomRunsOnClusterSetup);
}
if (!isset($wgMollomMWAcceptPolicy) && !is_bool($wgMollomMWAcceptPolicy)) {
    $wgMollomMWAPIAcceptPolicy = true;
}
if (!isset($wgMollomMWAPIAcceptPolicy) && !is_bool($wgMollomMWAPIAcceptPolicy)) {
    $wgMollomMWAPIAcceptPolicy = false;
}
Mollom::setPublicKey($wgMollomPublicKey);
Mollom::setPrivateKey($wgMollomPrivateKey);
/* Connect the hooks for the mollom filters */
global $wgHooks;
$wgHooks['EditFilter'][] = 'MollomSpamFilter::onEditFilter';
$wgHooks['APIEditBeforeSave'][] = 'MollomSpamFilter::onAPIEditBeforeSave';
/**
 * Extension initialisation function, used to set up special pages.
 */
function setupMollomMW()
{
    /* setup autoloading of special page classes */
    global $wgAutoloadClasses;
    $wgAutoloadClasses['MollomSpamFilter'] = dirname(__FILE__) . '/mollommw.filter.php';
    $wgAutoloadClasses['MollomMWStatPage'] = dirname(__FILE__) . '/pages/mollommw.stats.php';
    $wgAutoloadClasses['MollomMWBlacklistPage'] = dirname(__FILE__) . '/pages/mollommw.blacklist.php';
    /* setup the special statistics page */
 /**
  * Set timeout
  *
  * @return	void
  * @param	int $timeout
  */
 public static function setTimeOut($timeout)
 {
     // redefine
     $timeout = (int) $timeout;
     // validate
     if ($timeout == 0) {
         throw new Exception('Invalid timeout. Timeout shouldn\'t be 0.');
     }
     // set property
     self::$timeout = $timeout;
 }
 private function performChecks()
 {
     $request = JRequest::get();
     // Calc check
     if ($this->params->get('type_calc')) {
         if ($this->_session->get('rot13', null, 'easycalccheck') == 1) {
             $spamcheckresult = base64_decode(str_rot13($this->_session->get('spamcheckresult', null, 'easycalccheck')));
         } else {
             $spamcheckresult = base64_decode($this->_session->get('spamcheckresult', null, 'easycalccheck'));
         }
         $spamcheck = JRequest::getInt($this->_session->get('spamcheck', null, 'easycalccheck'), '', 'post');
         $this->_session->clear('rot13', 'easycalccheck');
         $this->_session->clear('spamcheck', 'easycalccheck');
         $this->_session->clear('spamcheckresult', 'easycalccheck');
         if (!is_numeric($spamcheckresult) || $spamcheckresult != $spamcheck) {
             return false;
             // Failed
         }
     }
     // Hidden field
     if ($this->params->get('type_hidden')) {
         $hidden_field = $this->_session->get('hidden_field', null, 'easycalccheck');
         $this->_session->clear('hidden_field', 'easycalccheck');
         if (JRequest::getVar($hidden_field, '', 'post')) {
             return false;
             // Hidden field was filled out - failed
         }
     }
     // Time lock
     if ($this->params->get('type_time')) {
         $time = $this->_session->get('time', null, 'easycalccheck');
         $this->_session->clear('time', 'easycalccheck');
         if (time() - $this->params->get('type_time_sec') <= $time) {
             return false;
             // Submitted too fast - failed
         }
     }
     // Own Question
     // Conversion to lower case
     if ($this->params->get('question')) {
         $answer = strtolower(JRequest::getString($this->_session->get('question', null, 'easycalccheck'), '', 'post'));
         $this->_session->clear('question', 'easycalccheck');
         if ($answer != strtolower($this->params->get('question_a'))) {
             return false;
             // Question wasn't answered - failed
         }
     }
     // StopForumSpam - Check the IP Address
     // Further informations: http://www.stopforumspam.com
     if ($this->params->get('stopforumspam')) {
         $url = 'http://www.stopforumspam.com/api?ip=' . $this->_session->get('ip', null, 'easycalccheck');
         // Function test - Comment out to test - Important: Enter a active Spam-IP
         // $ip = '88.180.52.46';
         // $url = 'http://www.stopforumspam.com/api?ip='.$ip;
         $response = false;
         $is_spam = false;
         if (function_exists('curl_init')) {
             $ch = curl_init($url);
             curl_setopt($ch, CURLOPT_HEADER, 0);
             curl_setopt($ch, CURLOPT_POST, 0);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             $response = curl_exec($ch);
             curl_close($ch);
         }
         if ($response) {
             preg_match('#<appears>(.*)</appears>#', $response, $out);
             $is_spam = $out[1];
         } else {
             $response = @fopen($url, 'r');
             if ($response) {
                 while (!feof($response)) {
                     $line = fgets($response, 1024);
                     if (preg_match('#<appears>(.*)</appears>#', $line, $out)) {
                         $is_spam = $out[1];
                         break;
                     }
                 }
                 fclose($response);
             }
         }
         if ($is_spam == 'yes' and $response == true) {
             return false;
             // Spam-IP - failed
         }
     }
     // Honeypot Project
     // Further informations: http://www.projecthoneypot.org/home.php
     // BL ACCESS KEY - http://www.projecthoneypot.org/httpbl_configure.php
     if ($this->params->get('honeypot')) {
         require_once dirname(__FILE__) . DS . 'easycalccheckplus' . DS . 'honeypot.php';
         $http_blKey = $this->params->get('honeypot_key');
         if ($http_blKey) {
             $http_bl = new http_bl($http_blKey);
             $result = $http_bl->query($this->_session->get('ip', null, 'easycalccheck'));
             // Function test - Comment out to test - Important: Enter a active Spam-IP
             // $ip = '117.21.224.251';
             // $result = $http_bl->query($ip);
             if ($result == 2) {
                 return false;
             }
         }
     }
     // Akismet
     // Further informations: http://akismet.com/
     if ($this->params->get('akismet')) {
         require_once dirname(__FILE__) . DS . 'easycalccheckplus' . DS . 'akismet.php';
         $akismet_key = $this->params->get('akismet_key');
         if ($akismet_key) {
             $akismet_url = JURI::getInstance()->toString();
             $name = '';
             $email = '';
             $url = '';
             $comment = '';
             if ($request['option'] == 'com_contact') {
                 $name = $request['jform']['contact_name'];
                 $email = $request['jform']['contact_email'];
                 $comment = $request['jform']['contact_message'];
             } elseif ($request['option'] == 'com_users') {
                 $name = $request['jform']['name'];
                 $email = $request['jform']['email1'];
                 if (isset($request['jform']['email'])) {
                     $email = $request['jform']['email'];
                 }
             } elseif ($request['option'] == 'com_comprofiler') {
                 $name = $request['name'];
                 $email = $request['email'];
                 if (isset($request['checkusername'])) {
                     $name = $request['checkusername'];
                 }
                 if (isset($request['checkemail'])) {
                     $email = $request['checkemail'];
                 }
             } elseif ($request['option'] == 'com_easybookreloaded') {
                 $name = $request['gbname'];
                 $email = $request['gbmail'];
                 $comment = $request['gbtext'];
                 if (isset($request['gbpage'])) {
                     $url = $request['gbpage'];
                 }
             } elseif ($request['option'] == 'com_phocaguestbook') {
                 $name = $request['pgusername'];
                 $email = $request['email'];
                 $comment = $request['pgbcontent'];
             } elseif ($request['option'] == 'com_dfcontact') {
                 $name = $request['name'];
                 $email = $request['email'];
                 $comment = $request['message'];
             } elseif ($request['option'] == 'com_flexicontact') {
                 $name = $request['from_name'];
                 $email = $request['from_email'];
                 $comment = $request['area_data'];
             } elseif ($request['option'] == 'com_alfcontact') {
                 $name = $request['name'];
                 $email = $request['email'];
                 $comment = $request['message'];
             } elseif ($request['option'] == 'com_community') {
                 $name = $request['usernamepass'];
                 $email = $request['emailpass'];
             } elseif ($request['option'] == 'com_virtuemart') {
                 $name = $request['name'];
                 $email = $request['email'];
                 $comment = $request['comment'];
             } elseif ($request['option'] == 'com_jshopping') {
                 $name = $request['f_name'];
                 $email = $request['email'];
             }
             $akismet = new Akismet($akismet_url, $akismet_key);
             $akismet->setCommentAuthor($name);
             $akismet->setCommentAuthorEmail($email);
             $akismet->setCommentAuthorURL($url);
             $akismet->setCommentContent($comment);
             if ($akismet->isCommentSpam()) {
                 return false;
             }
         }
     }
     // ReCaptcha
     // Further informations: http://www.google.com/recaptcha
     if ($this->params->get('recaptcha') and $this->params->get('recaptcha_publickey') and $this->params->get('recaptcha_privatekey')) {
         require_once dirname(__FILE__) . DS . 'easycalccheckplus' . DS . 'recaptchalib.php';
         $privatekey = $this->params->get('recaptcha_privatekey');
         $resp = recaptcha_check_answer($privatekey, $this->_session->get('ip', null, 'easycalccheck'), $request['recaptcha_challenge_field'], $request['recaptcha_response_field']);
         if (!$resp->is_valid) {
             return false;
         }
     }
     // Botscout - Check the IP Address
     // Further informations: http://botscout.com/
     if ($this->params->get('botscout') and $this->params->get('botscout_key')) {
         $url = 'http://botscout.com/test/?ip=' . $this->_session->get('ip', null, 'easycalccheck') . '&key=' . $this->params->get('botscout_key');
         // Function test - Comment out to test - Important: Enter a active Spam-IP
         // $ip = '87.103.128.199';
         // $url = 'http://botscout.com/test/?ip='.$ip.'&key='.$this->params->get('botscout_key');
         $response = false;
         $is_spam = false;
         if (function_exists('curl_init')) {
             $ch = curl_init($url);
             curl_setopt($ch, CURLOPT_HEADER, 0);
             curl_setopt($ch, CURLOPT_POST, 0);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             $response = curl_exec($ch);
             curl_close($ch);
         }
         if ($response) {
             $is_spam = substr($response, 0, 1);
         } else {
             $response = @fopen($url, 'r');
             if ($response) {
                 while (!feof($response)) {
                     $line = fgets($response, 1024);
                     $is_spam = substr($line, 0, 1);
                 }
                 fclose($response);
             }
         }
         if ($is_spam == 'Y' and $response == true) {
             // Spam-IP - failed
             return false;
         }
     }
     // Mollom
     // Further informations: http://mollom.com/
     if ($this->params->get('mollom') and $this->params->get('mollom_publickey') and $this->params->get('mollom_privatekey')) {
         require_once dirname(__FILE__) . DS . 'easycalccheckplus' . DS . 'mollom.php';
         Mollom::setPublicKey($this->params->get('mollom_publickey'));
         Mollom::setPrivateKey($this->params->get('mollom_privatekey'));
         $servers = Mollom::getServerList();
         $name = '';
         $email = '';
         $url = '';
         $comment = '';
         if ($request['option'] == 'com_contact') {
             $name = $request['jform']['contact_name'];
             $email = $request['jform']['contact_email'];
             $comment = $request['jform']['contact_message'];
         } elseif ($request['option'] == 'com_users') {
             $name = $request['jform']['name'];
             $email = $request['jform']['email1'];
             if (isset($request['jform']['email'])) {
                 $email = $request['jform']['email'];
             }
         } elseif ($request['option'] == 'com_comprofiler') {
             $name = $request['name'];
             $email = $request['email'];
             if (isset($request['checkusername'])) {
                 $name = $request['checkusername'];
             }
             if (isset($request['checkemail'])) {
                 $email = $request['checkemail'];
             }
         } elseif ($request['option'] == 'com_easybookreloaded') {
             $name = $request['gbname'];
             $email = $request['gbmail'];
             $comment = $request['gbtext'];
             if (isset($request['gbpage'])) {
                 $url = $request['gbpage'];
             }
         } elseif ($request['option'] == 'com_phocaguestbook') {
             $name = $request['pgusername'];
             $email = $request['email'];
             $comment = $request['pgbcontent'];
         } elseif ($request['option'] == 'com_dfcontact') {
             $name = $request['name'];
             $email = $request['email'];
             $comment = $request['message'];
         } elseif ($request['option'] == 'com_flexicontact') {
             $name = $request['from_name'];
             $email = $request['from_email'];
             $comment = $request['area_data'];
         } elseif ($request['option'] == 'com_alfcontact') {
             $name = $request['name'];
             $email = $request['email'];
             $comment = $request['message'];
         } elseif ($request['option'] == 'com_community') {
             $name = $request['usernamepass'];
             $email = $request['emailpass'];
         } elseif ($request['option'] == 'com_virtuemart') {
             $name = $request['name'];
             $email = $request['email'];
             $comment = $request['comment'];
         } elseif ($request['option'] == 'com_jshopping') {
             $name = $request['f_name'];
             $email = $request['email'];
         }
         $feedback = Mollom::checkContent(null, null, $comment, $name, $url, $email);
         if ($feedback['spam'] == 'spam') {
             return false;
         }
     }
     $this->_session->clear('ip', 'easycalccheck');
     $this->_session->clear('saved_data', 'easycalccheck');
     return true;
 }
 public function action_comment_insert_before(Comment $comment)
 {
     if ($comment->info->mollom_session_id) {
         return;
     }
     $user = User::identify();
     $author_name = $comment->name;
     $author_url = $comment->url ? $comment->url : null;
     $author_email = $comment->email ? $comment->email : null;
     $author_id = $user->loggedin ? $user->id : null;
     $author_open_id = $user instanceof User && $user->info->openid_url ? $user->info->openid_url : null;
     $post_body = $comment->content;
     try {
         $result = Mollom::checkContent(null, null, $post_body, $author_name, $author_url, $author_email, $author_open_id, $author_id);
         $comment->info->mollom_session_id = $result['session_id'];
         $comment->info->mollom_quality = $result['quality'];
         switch ($result['spam']) {
             case 'spam':
                 $comment->status = 'spam';
                 if ($comment->info->spamcheck) {
                     $comment->info->spamcheck[] = _t('Flagged as Spam by Mollom', 'mollom');
                 } else {
                     $comment->info->spamcheck = array(_t('Flagged as Spam by Mollom', 'mollom'));
                 }
                 break;
             case 'ham':
                 // Mollom is 100% it is ham, so approve it
                 $comment->status = 'ham';
                 return;
                 break;
             case 'unsure':
             case 'unknown':
                 // make it spam until we are sure
                 $comment->status = 'spam';
                 Plugins::act('mollom_fallback', Controller::get_handler()->handler_vars, $comment);
                 return;
                 break;
         }
     } catch (Exception $e) {
         EventLog::log($e->getMessage(), 'notice', 'comment', 'Mollom');
     }
 }
    public function execute()
    {
        global $wgOut, $wgUser, $wgScriptPath;
        /* check for user permissions */
        if (!$this->userCanExecute($wgUser)) {
            $this->displayRestrictionError();
            return;
        }
        try {
            if (!Mollom::verifyKey()) {
                $wgOut->addWikiText("'''" . wfMsg('mollommw-key-validation-failure') . "'''");
                return;
            }
        } catch (Exception $e) {
            $this->exceptionOccured($e);
            return;
        }
        if (isset($_POST['add']) && isset($_POST['url'])) {
            MollomClient::addBlacklistURL($_POST['url']);
        }
        if (isset($_POST['remove']) && isset($_POST['url'])) {
            MollomClient::removeBlacklistURL($_POST['url']);
        }
        if (isset($_POST['add']) && isset($_POST['text']) && isset($_POST['context']) && isset($_POST['reason'])) {
            MollomClient::addBlacklistText($_POST['text'], $_POST['context'], $_POST['reason']);
        }
        if (isset($_POST['remove']) && isset($_POST['text']) && isset($_POST['context']) && isset($_POST['reason'])) {
            MollomClient::removeBlacklistText($_POST['text'], $_POST['context'], $_POST['reason']);
        }
        $wgOut->addExtensionStyle($wgScriptPath . '/extensions/mollommw/skins/mollommw.css');
        $wgOut->setPageTitle(wfMsg('mollommw-blacklists'));
        $wgOut->addWikiText('== ' . wfMsg('mollommw-blacklist-url-title') . ' ==');
        try {
            $urls = MollomClient::listBlacklistURL();
            $wgOut->addHtml('<table class="blacklist">');
            foreach ($urls as $url) {
                $wgOut->addHtml('<tr>');
                $wgOut->addHtml('	<td style="padding-right: 100px;">' . wfMsg('mollommw-blacklist-addedon', $url['url'], date('d-m-Y H:i', strtotime($url['created']))) . '</td>');
                $wgOut->addHtml('
					<td><form method="post">
						<input type="hidden" name="url" value="' . $url['url'] . '">
						<input type="submit" name="remove" value="' . wfMsg('mollommw-blacklist-url-remove') . '">
					</form></td>');
                $wgOut->addHtml('</tr>');
            }
            $wgOut->addHtml('<tr>
				<form method="post">
					<td><input type="text" name="url"></td>
					<td><input type="submit" name="add" value="' . wfMsg('mollommw-blacklist-url-add') . '"></td>
				</form>');
            $wgOut->addHtml('</table><br>');
        } catch (Exception $e) {
            $this->exceptionOccured($e);
            return;
        }
        $wgOut->addWikiText('== ' . wfMsg('mollommw-blacklist-text-title') . ' ==');
        try {
            $entries = MollomClient::listBlacklistText();
            $wgOut->addHtml('<table>
				<thead>
					<tr>
						<td>' . wfMsg('mollommw-blacklist-text') . '</td>
						<td>' . wfMsg('mollommw-blacklist-context') . '</td>
						<td>' . wfMsg('mollommw-blacklist-reason') . '</td>
						<td></td>
					</tr>
				</thead>
			');
            foreach ($entries as $entry) {
                $wgOut->addHtml('<tr>');
                $wgOut->addHtml('	<td>' . wfMsg('mollommw-blacklist-addedon', $entry['text'], date('d-m-Y H:i', strtotime($entry['created']))) . '</td>');
                $wgOut->addHtml('	<td>' . wfMsg('mollommw-blacklist-context-' . $entry['context']) . '</td>');
                $wgOut->addHtml('	<td>' . wfMsg('mollommw-blacklist-reason-' . $entry['reason']) . '</td>');
                $wgOut->addHtml('
					<td><form method="post">
						<input type="hidden" name="text" value="' . $entry['text'] . '">
						<input type="hidden" name="context" value="' . $entry['context'] . '">
						<input type="hidden" name="reason" value="' . $entry['reason'] . '">
						<input type="submit" name="remove" value="' . wfMsg('mollommw-blacklist-text-remove') . '">
					</form></td>');
                $wgOut->addHtml('</tr>');
            }
            $wgOut->addHtml('<tr>');
            $wgOut->addHtml('	<form method="post">');
            $wgOut->addHtml('		<td><input type="text" name="text"></td>');
            $wgOut->addHtml('		<td>');
            $wgOut->addHtml('			<select name="context">');
            $wgOut->addHtml('				<option value="everything">' . wfMsg('mollommw-blacklist-context-everything') . '</option>');
            $wgOut->addHtml('				<option value="links">' . wfMsg('mollommw-blacklist-context-links') . '</option>');
            $wgOut->addHtml('				<option value="author">' . wfMsg('mollommw-blacklist-context-author') . '</option>');
            $wgOut->addHtml('			</select>');
            $wgOut->addHtml('		</td>');
            $wgOut->addHtml('		<td>');
            $wgOut->addHtml('			<select name="reason">');
            $wgOut->addHtml('				<option value="spam">' . wfMsg('mollommw-blacklist-reason-spam') . '</option>');
            $wgOut->addHtml('				<option value="profanity">' . wfMsg('mollommw-blacklist-reason-profanity') . '</option>');
            $wgOut->addHtml('				<option value="low-quality">' . wfMsg('mollommw-blacklist-reason-low-quality') . '</option>');
            $wgOut->addHtml('				<option value="unwanted">' . wfMsg('mollommw-blacklist-reason-unwanted') . '</option>');
            $wgOut->addHtml('			</select>');
            $wgOut->addHtml('		</td>');
            $wgOut->addHtml('		<td><input type="submit" name="add" value="' . wfMsg('mollommw-blacklist-text-add') . '"></td>');
            $wgOut->addHtml('	</form>');
            $wgOut->addHtml('</tr></table>');
        } catch (Exception $e) {
            $this->exceptionOccured($e);
            return;
        }
    }
Exemple #14
0
	public function testCheckContentOutDatedServerList()
	{
		CoOrg::config()->set('mollom/serverlist', array('outdated'));
		
		$mollomMessage = new MollomMessage;
		$mollomMessage->authorEmail = '*****@*****.**';
		$mollomMessage->body = 'SPAM BODY';
		$this->assertEquals(PropertySpamStatus::SPAM, $mollomMessage->check());
		
		$this->assertTrue(Session::has('mollom/sessionid'));
		Session::delete('mollom/sessionid');
		Mollom::clear();
		CoOrg::config()->set('mollom/serverlist', array('outdated'));
		
		$mollomMessage = new MollomMessage;
		$mollomMessage->authorEmail = '*****@*****.**';
		$mollomMessage->body = 'GOOD BODY';
		$this->assertEquals(PropertySpamStatus::OK, $mollomMessage->check());
		$this->assertTrue(Session::has('mollom/sessionid'));
	}
Exemple #15
0
	public static function getServerList()
	{
		self::$_serverList = array('valid-server-list');
		return array('retrieved-list');
	}