Vergleich inc/class_stopforumspamchecker.php - 1.8.0 - 1.8.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 63Zeile 63
	 * @param bool         $check_emails              Whether to check email address against StopForumSpam.
* @param bool $check_ips Whether to check IP addresses against StopForumSpam.
*/

	 * @param bool         $check_emails              Whether to check email address against StopForumSpam.
* @param bool $check_ips Whether to check IP addresses against StopForumSpam.
*/

	public function __construct(&$plugins = null, $min_weighting_before_spam = 50.00, $check_usernames = false, $check_emails = true, $check_ips = true, $log_blocks = true)

	public function __construct(&$plugins, $min_weighting_before_spam = 50.00, $check_usernames = false, $check_emails = true, $check_ips = true, $log_blocks = true)

	{

	{

		$this->plugins                   = & $plugins;

		$this->plugins                   = $plugins;

		$this->min_weighting_before_spam = (double)$min_weighting_before_spam;
$this->check_usernames = (bool)$check_usernames;
$this->check_emails = (bool)$check_emails;

		$this->min_weighting_before_spam = (double)$min_weighting_before_spam;
$this->check_usernames = (bool)$check_usernames;
$this->check_emails = (bool)$check_emails;

Zeile 89Zeile 89

if(filter_var($email, FILTER_VALIDATE_EMAIL) && filter_var($ip_address, FILTER_VALIDATE_IP)) // Calls to the API with invalid email/ip formats cause issues
{


if(filter_var($email, FILTER_VALIDATE_EMAIL) && filter_var($ip_address, FILTER_VALIDATE_IP)) // Calls to the API with invalid email/ip formats cause issues
{

			$username = urlencode($username);
$email = urlencode($email);

			$username_encoded = urlencode($username);
$email_encoded = urlencode($email);





			$check_url = sprintf(self::STOP_FORUM_SPAM_API_URL_FORMAT, $username, $email, $ip_address);

			$check_url = sprintf(self::STOP_FORUM_SPAM_API_URL_FORMAT, $username_encoded, $email_encoded, $ip_address);


$result = fetch_remote_file($check_url);

if($result !== false)
{


$result = fetch_remote_file($check_url);

if($result !== false)
{

				$result_json = @json_decode($check_url);

				$result_json = @json_decode($result);





				if(json_last_error() == JSON_ERROR_NONE && $result_json != null && !isset($result_json->error))

				if($result_json != null && !isset($result_json->error))

				{
if($this->check_usernames && $result_json->username->appears)
{

				{
if($this->check_usernames && $result_json->username->appears)
{

Zeile 124Zeile 124
				}
else
{

				}
else
{

					throw new Exception('Error decoding data from StopForumSpam.');

					throw new Exception('stopforumspam_error_decoding');

				}
}
else
{

				}
}
else
{

				throw new Exception('Error retrieving data from StopForumSpam.');

				throw new Exception('stopforumspam_error_retrieving');

			}
}


			}
}


Zeile 156Zeile 156
		}

return $is_spammer;

		}

return $is_spammer;

 
	}

public function getErrorText($sfsSettingsEnabled)
{
global $mybb, $lang;

foreach($sfsSettingsEnabled as $setting)
{
if($setting == 'stopforumspam_check_usernames' && $mybb->settings[$setting])
{
$settingsenabled[] = $lang->sfs_error_username;
continue;
}

if($setting == 'stopforumspam_check_emails' && $mybb->settings[$setting])
{
$settingsenabled[] = $lang->sfs_error_email;
continue;
}

if($setting = 'stopforumspam_check_ips' && $mybb->settings[$setting])
{
$settingsenabled[] = $lang->sfs_error_ip;
continue;
}
}

if(sizeof($settingsenabled) > 1)
{
$lastsetting = $settingsenabled[sizeof($settingsenabled)-1];
unset($settingsenabled[sizeof($settingsenabled)-1]);

$stopforumspamerror = implode($lang->comma, $settingsenabled) . " {$lang->sfs_error_or} " . $lastsetting;
}
else
{
$stopforumspamerror = $settingsenabled[0];
}
return $stopforumspamerror;

	}
}

	}
}