Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -30,6 +30,14 @@ class _Application extends \IPS\Application
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if ( !\IPS\Request::i()->isAjax() )
|
||||
{
|
||||
if ( \IPS\Settings::i()->gateways_counts and $decoded = json_decode( \IPS\Settings::i()->gateways_counts, TRUE ) and isset( $decoded['Stripe'] ) and $decoded['Stripe'] > 0 )
|
||||
{
|
||||
\IPS\Output::i()->jsFiles[] = 'https://js.stripe.com/v3/';
|
||||
}
|
||||
}
|
||||
|
||||
if ( \IPS\Request::i()->app == 'nexus' and \IPS\Request::i()->module == 'payments' and \IPS\Request::i()->section == 'receive' and \IPS\Request::i()->validate == 'paypal' )
|
||||
{
|
||||
if ( ( \IPS\Request::i()->txn_type == 'subscr_payment' or \IPS\Request::i()->txn_type == 'recurring_payment' ) and \IPS\Request::i()->payment_status == 'Completed' )
|
||||
@@ -343,6 +351,61 @@ class _Application extends \IPS\Application
|
||||
{
|
||||
return 'shopping-cart';
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of whitelisted modules which should be accessible without the subscription check.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
static $bypassSubscriptionCheckControllers = ['store', 'checkout', 'subscriptions', 'system'];
|
||||
|
||||
/**
|
||||
* Do Member Check
|
||||
*
|
||||
* @return \IPS\Http\Url|NULL
|
||||
*/
|
||||
public function doMemberCheck(): ?\IPS\Http\Url
|
||||
{
|
||||
/* These checks do not apply to staff accounts or support account */
|
||||
if( \is_array( \IPS\Member::loggedIn()->modPermissions() ) OR \IPS\Member::loggedIn()->isAdmin() OR \IPS\Member::loggedIn()->members_bitoptions['is_support_account'] )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( \IPS\Settings::i()->nexus_subs_enabled AND \IPS\Settings::i()->nexus_subs_register AND !\in_array( \IPS\Dispatcher::i()->module->key, static::$bypassSubscriptionCheckControllers ) )
|
||||
{
|
||||
if( !isset( \IPS\Data\Store::i()->nexus_sub_count ) )
|
||||
{
|
||||
\IPS\Data\Store::i()->nexus_sub_count = \IPS\Db::i()->select( 'count(*)', 'nexus_member_subscription_packages', [ 'sp_enabled=?', 1 ] )->first();
|
||||
}
|
||||
|
||||
/* This user didn't join recently, so we don't need to redirect them */
|
||||
if( \IPS\Data\Store::i()->nexus_sub_count AND (int) \IPS\Settings::i()->nexus_subs_register === 1 AND !\IPS\Member::loggedIn()->joinedRecently() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( \IPS\Data\Store::i()->nexus_sub_count AND !\IPS\nexus\Subscription::loadByMember( \IPS\Member::loggedIn(), (int) \IPS\Settings::i()->nexus_subs_register === 2 ? TRUE : FALSE ) )
|
||||
{
|
||||
return \IPS\Http\Url::internal( "app=nexus&module=subscriptions&controller=subscriptions®ister=" . (int) \IPS\Settings::i()->nexus_subs_register, 'front', 'nexus_subscriptions' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( \IPS\Settings::i()->nexus_reg_force AND !\in_array( \IPS\Dispatcher::i()->module->key, static::$bypassSubscriptionCheckControllers ) AND \IPS\Member::loggedIn()->joinedRecently() )
|
||||
{
|
||||
if( !isset( \IPS\Data\Store::i()->nexus_reg_product_count ) )
|
||||
{
|
||||
\IPS\Data\Store::i()->nexus_reg_product_count = \IPS\nexus\Package::haveRegistrationProducts();
|
||||
}
|
||||
|
||||
if ( \IPS\Data\Store::i()->nexus_reg_product_count AND !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_purchases', array( "ps_member=? AND ps_active=?", \IPS\Member::loggedIn()->member_id, 1 ) )->first() )
|
||||
{
|
||||
return \IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=store&controller=store&do=register', 'front', 'store' ) );
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can view page even when user is a guest when guests cannot access the site
|
||||
@@ -489,19 +552,24 @@ class _Application extends \IPS\Application
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of specific links to add to the sitemap
|
||||
* Returns a list of all existing webhooks and their payload in this app.
|
||||
*
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public function sitemapLinks()
|
||||
public function getWebhooks(): array
|
||||
{
|
||||
$return = array( \IPS\Http\Url::internal( 'app=nexus&module=store&controller=store', 'front', 'store' ) );
|
||||
|
||||
if( \IPS\Settings::i()->nexus_subs_enabled )
|
||||
foreach( [
|
||||
\IPS\nexus\Support\Request::class,
|
||||
\IPS\nexus\Support\Reply::class,
|
||||
] as $class )
|
||||
{
|
||||
$return[] = \IPS\Http\Url::internal( 'app=nexus&module=subscriptions&controller=subscriptions', 'front', 'nexus_subscriptions' );
|
||||
$key = str_replace( '\\', '', \substr( $class, 3 ) );
|
||||
$hooks[$key .'_create'] = $class;
|
||||
$hooks[$key .'_delete'] = $class;
|
||||
\IPS\Member::loggedIn()->language()->words[ 'webhook_' . $key .'_create' ] = \IPS\Member::loggedIn()->language()->addToStack('webhook_contentitem_created', FALSE, ['sprintf' => [ $class::_indefiniteArticle() ]]);
|
||||
\IPS\Member::loggedIn()->language()->words[ 'webhook_' . $key .'_delete' ] = \IPS\Member::loggedIn()->language()->addToStack('webhook_contentitem_deleted', FALSE, ['sprintf' => [ $class::_indefiniteArticle() ]]);
|
||||
}
|
||||
|
||||
return $return;
|
||||
return $hooks;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user