Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

@@ -151,6 +151,7 @@ class _checkout extends \IPS\Dispatcher\Controller
try
{
$this->invoice->billaddress = \IPS\nexus\Customer\Address::constructFromData( \IPS\Db::i()->select( '*', 'nexus_customer_addresses', array( 'member=? AND primary_billing=1', \IPS\Member::loggedIn()->member_id ) )->first() )->address;
$this->invoice->recalculateTotal();
$this->invoice->save();
$_SESSION[ 'wizard-' . md5( $checkoutUrl ) . '-step' ] = isset( $steps['checkout_shipping'] ) ? 'checkout_shipping' : 'checkout_pay';
}
@@ -418,17 +419,7 @@ class _checkout extends \IPS\Dispatcher\Controller
/* Misc */
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_admin_mails', $guestData ? $guestData['member']['allow_admin_mails'] : \IPS\Settings::i()->updates_consent_default == 'enabled' ? TRUE : FALSE, FALSE ) );
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] = sprintf( \IPS\Member::loggedIn()->language()->get("reg_agreed_terms"), \IPS\Http\Url::internal( 'app=core&module=system&controller=terms', 'front', 'terms', array(), \IPS\Http\Url::PROTOCOL_RELATIVE ) );
/* Build the appropriate links for registration terms & privacy policy */
if ( \IPS\Settings::i()->privacy_type == "internal" )
{
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::internal( 'app=core&module=system&controller=privacy', 'front', 'privacy', array(), \IPS\Http\Url::PROTOCOL_RELATIVE ), 'data-ipsDialog data-ipsDialog-size="wide" data-ipsDialog-title="' . \IPS\Member::loggedIn()->language()->get("privacy") . '"' );
}
else if ( \IPS\Settings::i()->privacy_type == "external" )
{
\IPS\Member::loggedIn()->language()->words[ "reg_agreed_terms" ] .= sprintf( \IPS\Member::loggedIn()->language()->get("reg_privacy_link"), \IPS\Http\Url::external( \IPS\Settings::i()->privacy_link ), 'target="_blank"' );
}
\IPS\core\modules\front\system\register::buildRegistrationTerm();
$form->add( new \IPS\Helpers\Form\Checkbox( 'reg_agreed_terms', (bool) $guestData, TRUE, array(), function( $val )
{
if ( !$val )
@@ -479,7 +470,7 @@ class _checkout extends \IPS\Dispatcher\Controller
{
if ( isset( $securityQuestionAnswers[ $v ] ) )
{
$form->error = \IPS\Member::loggedIn()->language()->addToStack('security_questions_unique');
$form->error = \IPS\Member::loggedIn()->language()->addToStack( 'security_questions_unique', FALSE, array( 'pluralize' => array( \IPS\Settings::i()->security_questions_number ?: 3 ) ) );
break;
}
else
@@ -646,6 +637,7 @@ class _checkout extends \IPS\Dispatcher\Controller
}
/* Save */
$this->invoice->recalculateTotal();
$this->invoice->save();
return array();
}
@@ -1243,6 +1235,11 @@ class _checkout extends \IPS\Dispatcher\Controller
{
foreach ( $paymentMethods as $k => $v )
{
if ( in_array( '*', $item->paymentMethodIds ) ) // This looks odd but in older versions IPS\nexus\extensions\nexus\Item\Subscription::renewalPaymentMethodIds() was mistakenly returning array('*') and since the value is stored in the invoice we have to keep this for compatibility with invoices created at that time
{
continue;
}
if ( !in_array( $k, $item->paymentMethodIds ) )
{
unset( $paymentMethods[ $k ] );
@@ -1312,7 +1309,7 @@ class _checkout extends \IPS\Dispatcher\Controller
}
if ( \IPS\Settings::i()->nexus_tac === 'checkbox' )
{
$form->add( new \IPS\Helpers\Form\Checkbox( 'i_agree_to_tac', FALSE, TRUE, array( 'labelHtmlSprintf' => array( "<a href='" . htmlspecialchars( \IPS\Settings::i()->nexus_tac_link, ENT_DISALLOWED, 'UTF-8', FALSE ) . "' target='_blank'>" . \IPS\Member::loggedIn()->language()->addToStack( 'terms_and_conditions' ) . '</a>' ) ), function( $val )
$form->add( new \IPS\Helpers\Form\Checkbox( 'i_agree_to_tac', FALSE, TRUE, array( 'labelHtmlSprintf' => array( "<a href='" . htmlspecialchars( \IPS\Settings::i()->nexus_tac_link, ENT_DISALLOWED, 'UTF-8', FALSE ) . "' target='_blank' rel='noopener'>" . \IPS\Member::loggedIn()->language()->addToStack( 'terms_and_conditions' ) . '</a>' ) ), function( $val )
{
if ( !$val )
{
@@ -1512,7 +1509,7 @@ class _checkout extends \IPS\Dispatcher\Controller
{
$invoice->addItem( $values['coupon_code'] );
$invoice->save();
\IPS\Output::i()->redirect( $invoice->checkoutUrl() );
\IPS\Output::i()->redirect( $invoice->checkoutUrl()->setQueryString( '_step', 'checkout_pay' ) );
}
}
}
@@ -82,6 +82,7 @@ class _cards extends \IPS\Dispatcher\Controller
*/
public function add()
{
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'global_gateways.js', 'nexus', 'global' ) );
$form = \IPS\nexus\Customer\CreditCard::create( \IPS\nexus\Customer::loggedIn() );
if ( $form instanceof \IPS\nexus\Customer\CreditCard )
{
@@ -111,8 +112,10 @@ class _cards extends \IPS\Dispatcher\Controller
$card = \IPS\nexus\Customer\CreditCard::load( \IPS\Request::i()->id );
if ( $card->member->member_id === \IPS\nexus\Customer::loggedIn()->member_id )
{
$cardData = $card->card;
$card->delete();
\IPS\nexus\Customer::loggedIn()->log( 'card', array( 'type' => 'delete', 'number' => $card->card->lastFour ) );
\IPS\nexus\Customer::loggedIn()->log( 'card', array( 'type' => 'delete', 'number' => $cardData->lastFour ) );
}
}
catch ( \Exception $e ) { }
@@ -59,6 +59,16 @@ class _invoices extends \IPS\Dispatcher\Controller
\IPS\Output::i()->error( 'node_error', '2X215/5', 404, '' );
}
}
else if ( isset( \IPS\Request::i()->do ) and \IPS\Request::i()->do == 'printout' and isset( \IPS\Request::i()->key ) )
{
$this->invoice = \IPS\nexus\Invoice::load( \IPS\Request::i()->id );
$guest = $this->invoice->guest_data;
if ( md5( $guest['member']['email'] . ';' . $guest['member']['joined'] ) != \IPS\Request::i()->key )
{
\IPS\Output::i()->error( 'node_error', '2X215/7', 404, '' );
}
}
else
{
\IPS\Output::i()->error( 'no_module_permission_guest', '2X215/6', 404, '' );
@@ -243,7 +243,7 @@ class _product extends \IPS\Content\Controller
\IPS\Output::i()->jsonLd['package']['image'] = (string) $package->image;
}
if( $package->reviewable )
if( $package->reviewable AND $item->averageReviewRating() )
{
\IPS\Output::i()->jsonLd['package']['aggregateRating'] = array(
'@type' => 'AggregateRating',
@@ -323,9 +323,9 @@ class _product extends \IPS\Content\Controller
{
$customFields = \IPS\nexus\Package\CustomField::roots();
$stickyFields = array();
foreach ( $item->details as $k => $v )
foreach ( $item->details as $_k => $v )
{
if ( $v and isset( $customFields[ $k ] ) and $customFields[ $k ]->sticky )
if ( $v and isset( $customFields[ $_k ] ) and $customFields[ $_k ]->sticky )
{
$stickyFields[] = $v;
}
@@ -196,7 +196,7 @@ class _store extends \IPS\Dispatcher\Controller
\IPS\Output::i()->jsonLd['package' . $package->id ]['image'] = (string) $package->image;
}
if( $package->reviewable )
if( $package->reviewable and $item->averageReviewRating() )
{
\IPS\Output::i()->jsonLd['package' . $package->id ]['aggregateRating'] = array(
'@type' => 'AggregateRating',
@@ -194,6 +194,12 @@ class _subscriptions extends \IPS\Dispatcher\Controller
/* CSRF Check */
\IPS\Session::i()->csrfCheck();
/* Already purchased a subscription? */
if ( \IPS\nexus\Subscription::loadActiveByMember( \IPS\nexus\Customer::loggedIn() ) )
{
\IPS\Output::i()->error( 'nexus_subs_already_got_package', '2X379/6', 403, '' );
}
$package = \IPS\nexus\Subscription\Package::load( \IPS\Request::i()->id );
$price = $package->price();