Vergleich inc/class_captcha.php - 1.8.26 - 1.8.36

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 48Zeile 48
	 * @var int
*/
public $type = 0;

	 * @var int
*/
public $type = 0;

 

/**
* CAPTCHA constants declaration
*
* @var int
*/
const DEFAULT_CAPTCHA = 1;
const NOCAPTCHA_RECAPTCHA = 4;
const RECAPTCHA_INVISIBLE = 5;
const HCAPTCHA = 6;
const HCAPTCHA_INVISIBLE = 7;
const RECAPTCHA_V3 = 8;


/**
* The template to display the CAPTCHA in


/**
* The template to display the CAPTCHA in

Zeile 104Zeile 116

// Prepare the build template
if($template)


// Prepare the build template
if($template)

		{

		{

			$this->captcha_template = $template;


			$this->captcha_template = $template;


			if($this->type == 4)

			if($this->type == captcha::NOCAPTCHA_RECAPTCHA)

			{
$this->captcha_template .= "_nocaptcha";
}

			{
$this->captcha_template .= "_nocaptcha";
}

			elseif($this->type == 5)
{
$this->captcha_template .= "_recaptcha_invisible";
}
elseif($this->type == 6)
{
$this->captcha_template .= "_hcaptcha";
}
elseif($this->type == 7)
{
$this->captcha_template .= "_hcaptcha_invisible";
}
elseif($this->type == 8)

			elseif($this->type == captcha::RECAPTCHA_INVISIBLE)
{
$this->captcha_template .= "_recaptcha_invisible";
}
elseif($this->type == captcha::HCAPTCHA)
{
$this->captcha_template .= "_hcaptcha";
}
elseif($this->type == captcha::HCAPTCHA_INVISIBLE)
{
$this->captcha_template .= "_hcaptcha_invisible";
}
elseif($this->type == captcha::RECAPTCHA_V3)

			{
$this->captcha_template .= "_recaptcha_invisible";

			{
$this->captcha_template .= "_recaptcha_invisible";

			}
}

			}
}


// Work on which CAPTCHA we've got installed


// Work on which CAPTCHA we've got installed

		if(in_array($this->type, array(4, 5, 8)) && $mybb->settings['recaptchapublickey'] && $mybb->settings['recaptchaprivatekey'])

		if(in_array($this->type, array(captcha::NOCAPTCHA_RECAPTCHA, captcha::RECAPTCHA_INVISIBLE, captcha::RECAPTCHA_V3)) && $mybb->settings['recaptchapublickey'] && $mybb->settings['recaptchaprivatekey'])

		{
// We want to use noCAPTCHA or reCAPTCHA invisible, set the server options
$this->server = "//www.google.com/recaptcha/api.js";

		{
// We want to use noCAPTCHA or reCAPTCHA invisible, set the server options
$this->server = "//www.google.com/recaptcha/api.js";

Zeile 141Zeile 153
				$this->build_recaptcha();
}
}

				$this->build_recaptcha();
}
}

		elseif(in_array($this->type, array(6, 7)) && $mybb->settings['hcaptchapublickey'] && $mybb->settings['hcaptchaprivatekey'])

		elseif(in_array($this->type, array(captcha::HCAPTCHA, captcha::HCAPTCHA_INVISIBLE)) && $mybb->settings['hcaptchapublickey'] && $mybb->settings['hcaptchaprivatekey'])

		{
// We want to use hCaptcha or hCaptcha invisible, set the server options

		{
// We want to use hCaptcha or hCaptcha invisible, set the server options

			$this->server = "//www.hcaptcha.com/1/api.js";

			$this->server = "//js.hcaptcha.com/1/api.js";

			$this->verify_server = "https://hcaptcha.com/siteverify";

if($build == true)

			$this->verify_server = "https://hcaptcha.com/siteverify";

if($build == true)

Zeile 152Zeile 164
				$this->build_hcaptcha();
}
}

				$this->build_hcaptcha();
}
}

		elseif($this->type == 1)

		elseif($this->type == captcha::DEFAULT_CAPTCHA)

		{
if(!function_exists("imagecreatefrompng"))
{

		{
if(!function_exists("imagecreatefrompng"))
{

Zeile 204Zeile 216

function build_hcaptcha()
{


function build_hcaptcha()
{

		global $lang, $mybb, $templates;

		global $lang, $mybb, $templates, $theme;


// This will build a hCaptcha
$server = $this->server;


// This will build a hCaptcha
$server = $this->server;

Zeile 224Zeile 236

$field = array();



$field = array();


		if($this->type == 1)

		if($this->type == captcha::DEFAULT_CAPTCHA)

		{
// Names
$hash = "imagehash";
$string = "imagestring";

// Values

		{
// Names
$hash = "imagehash";
$string = "imagestring";

// Values

			$field['hash'] = $db->escape_string($mybb->input['imagehash']);
$field['string'] = $db->escape_string($mybb->input['imagestring']);

			$field['hash'] = $db->escape_string($mybb->get_input('imagehash'));
$field['string'] = $db->escape_string($mybb->get_input('imagestring'));

		}
elseif($this->type == 3)
{

		}
elseif($this->type == 3)
{

Zeile 253Zeile 265

$plugins->run_hooks('captcha_validate_start', $this);



$plugins->run_hooks('captcha_validate_start', $this);


		if($this->type == 1)

		if($this->type == captcha::DEFAULT_CAPTCHA)

		{
// We have a normal CAPTCHA to handle

		{
// We have a normal CAPTCHA to handle

			$imagehash = $db->escape_string($mybb->input['imagehash']);
$imagestring = $db->escape_string(my_strtolower($mybb->input['imagestring']));

			$imagehash = $db->escape_string($mybb->get_input('imagehash'));
$imagestring = $db->escape_string(my_strtolower($mybb->get_input('imagestring')));


switch($db->type)
{


switch($db->type)
{

Zeile 279Zeile 291
				$db->delete_query("captcha", "imagehash = '{$imagehash}'");
}
}

				$db->delete_query("captcha", "imagehash = '{$imagehash}'");
}
}

		elseif(in_array($this->type, array(4, 5)))

		elseif(in_array($this->type, array(captcha::NOCAPTCHA_RECAPTCHA, captcha::RECAPTCHA_INVISIBLE)))

		{

		{

			$response = $mybb->input['g-recaptcha-response'];

			$response = $mybb->get_input('g-recaptcha-response');

			if(!$response || strlen($response) == 0)
{
$this->set_error($lang->invalid_nocaptcha);

			if(!$response || strlen($response) == 0)
{
$this->set_error($lang->invalid_nocaptcha);

Zeile 312Zeile 324
				}
}
}

				}
}
}

		elseif($this->type == 8)

		elseif($this->type == captcha::RECAPTCHA_V3)

		{

		{

			$response = $mybb->input['g-recaptcha-response'];

			$response = $mybb->get_input('g-recaptcha-response');

			if(!$response || strlen($response) == 0)
{
$this->set_error($lang->invalid_nocaptcha);

			if(!$response || strlen($response) == 0)
{
$this->set_error($lang->invalid_nocaptcha);

Zeile 346Zeile 358
				}
}
}

				}
}
}

		elseif(in_array($this->type, array(6, 7)))

		elseif(in_array($this->type, array(captcha::HCAPTCHA, captcha::HCAPTCHA_INVISIBLE)))

		{

		{

			$response = $mybb->input['h-captcha-response'];

			$response = $mybb->get_input('h-captcha-response');

			if(!$response || strlen($response) == 0)
{
$this->set_error($lang->invalid_hcaptcha);

			if(!$response || strlen($response) == 0)
{
$this->set_error($lang->invalid_hcaptcha);

Zeile 394Zeile 406
	{
global $db, $mybb, $plugins;


	{
global $db, $mybb, $plugins;


		if($this->type == 1)

		if($this->type == captcha::DEFAULT_CAPTCHA)

		{
// We have a normal CAPTCHA to handle

		{
// We have a normal CAPTCHA to handle

			$imagehash = $db->escape_string($mybb->input['imagehash']);

			$imagehash = $db->escape_string($mybb->get_input('imagehash'));

			if($imagehash)
{
$db->delete_query("captcha", "imagehash = '{$imagehash}'");

			if($imagehash)
{
$db->delete_query("captcha", "imagehash = '{$imagehash}'");