Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

+8 -23
View File
@@ -34,28 +34,7 @@ class _Recaptcha2
*/
public function getHtml()
{
$publicKey = \IPS\Settings::i()->recaptcha2_public_key;
$theme = \IPS\Theme::i()->settings['recaptcha2_theme'];
$lang = preg_replace( '/^(.+?)\..*$/', '$1', \IPS\Member::loggedIn()->language()->short );
return <<<HTML
<div data-ipsCaptcha data-ipsCaptcha-service='recaptcha2' data-ipsCaptcha-key="{$publicKey}" data-ipsCaptcha-lang="{$lang}" data-ipsCaptcha-theme="{$theme}">
<noscript>
<div style="width: 302px; height: 352px;">
<div style="width: 302px; height: 352px; position: relative;">
<div style="width: 302px; height: 352px; position: absolute;">
<iframe src="https://www.google.com/recaptcha/api/fallback?k={$publicKey}" style="width: 302px; height:352px; border-style: none;">
</iframe>
</div>
<div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">
<textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 80px; border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;" value="">
</textarea>
</div>
</div>
</div>
</noscript>
</div>
HTML;
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->captchaRecaptcha2( \IPS\Settings::i()->recaptcha2_public_key, preg_replace( '/^(.+?)\..*$/', '$1', \IPS\Member::loggedIn()->language()->short ), \IPS\Theme::i()->settings['recaptcha2_theme'] );
}
/**
@@ -73,7 +52,13 @@ HTML;
'remoteip' => \IPS\Request::i()->ipAddress(),
) )->decodeJson( TRUE );
return (bool) $response['success'];
return ( ( (bool) $response['success'] ) and ( $response['hostname'] === \IPS\Http\Url::internal('')->data[ \IPS\Http\Url::COMPONENT_HOST ] ) );
}
catch( \IPS\Http\Request\Exception $e )
{
\IPS\Log::log( $e, 'recaptcha2_exception' );
return FALSE;
}
catch( \RuntimeException $e )
{