Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+16 -6
View File
@@ -11,7 +11,7 @@
namespace IPS\Helpers\Form;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -35,7 +35,7 @@ class _Captcha extends FormAbstract
*/
public function __construct()
{
$params = func_get_args();
$params = \func_get_args();
if ( !isset( $params[0] ) )
{
$params[0] = 'captcha_field';
@@ -51,7 +51,8 @@ class _Captcha extends FormAbstract
$this->captcha = new $class;
}
call_user_func_array( 'parent::__construct', $params );
parent::__construct( ...$params );
$this->required = TRUE;
}
@@ -86,6 +87,7 @@ class _Captcha extends FormAbstract
/**
* Get HTML
*
* @param \IPS\Helpers\Form|null $form Form helper object
* @return string
*/
public function rowHtml( $form=NULL )
@@ -111,9 +113,17 @@ class _Captcha extends FormAbstract
else
{
/* If we previously did an AJAX validate which is still valid, return true */
if ( isset( $_SESSION[ 'captcha-val-' . $this->name ] ) and $_SESSION[ 'captcha-val-' . $this->name ] > ( time() - 60 ) )
$cached = NULL;
$cacheKey = 'captcha-val-' . $this->name . '-' . \IPS\Member::loggedIn()->ip_address;
try
{
unset( $_SESSION[ 'captcha-val-' . $this->name ] );
$cached = \IPS\Data\Cache::i()->getWithExpire( $cacheKey, TRUE );
}
catch( \Exception $ex ) { }
if ( $cached )
{
unset( \IPS\Data\Cache::i()->$cacheKey );
return TRUE;
}
/* Otherwise, check with service */
@@ -125,7 +135,7 @@ class _Captcha extends FormAbstract
/* If it's valid and we're doing an AJAX validate, save that in the session so the next request doesn't check again */
if ( $return and \IPS\Request::i()->isAjax() )
{
$_SESSION[ 'captcha-val-' . $this->name ] = time();
\IPS\Data\Cache::i()->storeWithExpire( $cacheKey, time(), \IPS\DateTime::create()->add( new \DateInterval( 'PT1M' ) ), TRUE );
}
/* Return */