Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -9,16 +9,23 @@
|
||||
* @since 01 Apr 2015
|
||||
*/
|
||||
|
||||
define('REPORT_EXCEPTIONS', TRUE);
|
||||
\define('REPORT_EXCEPTIONS', TRUE);
|
||||
require_once '../../../../init.php';
|
||||
\IPS\Dispatcher\External::i();
|
||||
|
||||
if ( \IPS\NEXUS_LKEY_API_ALLOW_IP_OVERRIDE )
|
||||
{
|
||||
$_SERVER['REMOTE_ADDR'] = isset( \IPS\Request::i()->ip ) ? \IPS\Request::i()->ip : $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
||||
/**
|
||||
* API Exception
|
||||
*/
|
||||
class ApiException extends \Exception { }
|
||||
|
||||
/**
|
||||
* API class to verify license keys
|
||||
*/
|
||||
class Api
|
||||
{
|
||||
/**
|
||||
@@ -42,9 +49,14 @@ class Api
|
||||
protected function getKey( $validateIdentifier=TRUE )
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
$key = \IPS\nexus\Purchase\LicenseKey::load( isset( \IPS\Request::i()->key ) ? \IPS\Request::i()->key : NULL );
|
||||
|
||||
if ( $key->key !== \IPS\Request::i()->key )
|
||||
{
|
||||
throw new ApiException( 'BAD_KEY_OR_ID', 105 );
|
||||
}
|
||||
|
||||
if ( $validateIdentifier and $identifier = $this->getIdentifier( $key ) and ( !isset( \IPS\Request::i()->identifier ) or $identifier != \IPS\Request::i()->identifier ) )
|
||||
{
|
||||
throw new ApiException( 'BAD_KEY_OR_ID', 101 );
|
||||
@@ -125,7 +137,7 @@ class Api
|
||||
{
|
||||
if ( $identifier != $providedIdentifier )
|
||||
{
|
||||
if ( $identifier or in_array( $key->identifier, array( 'name', 'email', 'username' ) ) )
|
||||
if ( $identifier or \in_array( $key->identifier, array( 'name', 'email', 'username' ) ) )
|
||||
{
|
||||
throw new ApiException( 'BAD_KEY_OR_ID', 101 );
|
||||
}
|
||||
@@ -143,7 +155,7 @@ class Api
|
||||
throw new ApiException( 'BAD_KEY_OR_ID', 101 );
|
||||
}
|
||||
|
||||
if ( defined( 'NEXUS_LKEY_API_ALLOW_IP_OVERRIDE' ) )
|
||||
if ( \defined( 'NEXUS_LKEY_API_ALLOW_IP_OVERRIDE' ) )
|
||||
{
|
||||
$ip = $this->params['ip'] ? $this->params['ip'] : $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user