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

@@ -12,7 +12,7 @@
namespace IPS\nexus\Purchase;
/* 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;
@@ -22,7 +22,20 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
* License Key Model
*/
abstract class _LicenseKey extends \IPS\Patterns\ActiveRecord
{
{
/**
* License Key Types
*
* @return array
*/
public static function licenseKeyTypes()
{
return array(
'Standard' => 'IPS\nexus\Purchase\LicenseKey\Standard',
'Mdfive' => 'IPS\nexus\Purchase\LicenseKey\Mdfive',
);
}
/**
* @brief Multiton Store
*/
@@ -62,7 +75,8 @@ abstract class _LicenseKey extends \IPS\Patterns\ActiveRecord
*/
public static function constructFromData( $data, $updateMultitonStoreIfExists = TRUE )
{
$classname = 'IPS\nexus\Purchase\LicenseKey\\' . mb_ucfirst( $data['lkey_type'] );
$types = static::licenseKeyTypes();
$classname = $types[ mb_ucfirst( $data['lkey_type'] ) ];
/* Initiate an object */
$obj = new $classname;
@@ -97,7 +111,7 @@ abstract class _LicenseKey extends \IPS\Patterns\ActiveRecord
*/
public function setDefaultValues()
{
$exploded = explode( '\\', get_class( $this ) );
$exploded = explode( '\\', \get_class( $this ) );
$this->type = mb_strtolower( array_pop( $exploded ) );
$this->active = TRUE;
$this->uses = 0;
@@ -182,7 +196,7 @@ abstract class _LicenseKey extends \IPS\Patterns\ActiveRecord
{
$this->key = $this->generate();
}
while ( count( \IPS\Db::i()->select( '*', 'nexus_licensekeys', array( 'lkey_key=?', $this->key ) ) ) );
while ( \count( \IPS\Db::i()->select( '*', 'nexus_licensekeys', array( 'lkey_key=?', $this->key ) ) ) );
}
return parent::save();
}