Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\front\clients;
|
||||
|
||||
/* 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;
|
||||
@@ -80,8 +80,9 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
$where = array( array( 'ps_member=?', \IPS\Member::loggedIn()->member_id ) );
|
||||
|
||||
$parentContacts = \IPS\nexus\Customer::loggedIn()->parentContacts();
|
||||
if ( count( $parentContacts ) )
|
||||
if ( \count( $parentContacts ) )
|
||||
{
|
||||
$or = array();
|
||||
foreach ( $parentContacts as $contact )
|
||||
@@ -90,9 +91,12 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
$where[] = array( 'ps_show=1' );
|
||||
|
||||
/* Get only the purchases from active applications */
|
||||
$where[] = array( "ps_app IN('" . implode( "','", array_keys( \IPS\Application::enabledApplications() ) ) . "')" );
|
||||
|
||||
$purchases = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_purchases', $where ), 'IPS\nexus\Purchase' ) as $purchase )
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_purchases', $where, 'ps_active DESC, ps_expire DESC, ps_start DESC' ), 'IPS\nexus\Purchase' ) as $purchase )
|
||||
{
|
||||
$purchases[ $purchase->parent ][ $purchase->id ] = $purchase;
|
||||
}
|
||||
@@ -151,7 +155,7 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
elseif ( isset( \IPS\Request::i()->cycles ) and \IPS\Login::compareHashes( (string) \IPS\Session::i()->csrfKey, (string) \IPS\Request::i()->csrfKey ) )
|
||||
{
|
||||
$_cycles = intval( \IPS\Request::i()->cycles );
|
||||
$_cycles = \intval( \IPS\Request::i()->cycles );
|
||||
if ( $_cycles >= 1 and ( $cycles === TRUE or $_cycles <= $cycles ) )
|
||||
{
|
||||
$cycles = $_cycles;
|
||||
@@ -179,14 +183,14 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form = new \IPS\Helpers\Form( 'form', 'continue' );
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'renew_for', 1, TRUE, array( 'min' => 1, 'max' => $cycles === TRUE ? NULL : $cycles ), NULL, NULL, $suffix ) );
|
||||
if( $values = $form->values() or $cycles === 1 )
|
||||
{
|
||||
if ( $pendingInvoice = $this->purchase->invoice_pending and $pendingInvoice->status === $pendingInvoice::STATUS_PENDING )
|
||||
{
|
||||
if ( count( $pendingInvoice->items ) === 1 )
|
||||
if ( \count( $pendingInvoice->items ) === 1 )
|
||||
{
|
||||
foreach ( $pendingInvoice->items as $item )
|
||||
{
|
||||
@@ -214,7 +218,7 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->redirect( $invoice->checkoutUrl() );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form;
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core' ), 'popupTemplate' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,7 +229,7 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
protected function cancel()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
|
||||
if ( !$this->purchase->canCancel() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'you_cannot_cancel', '2X212/5', 403, '' );
|
||||
@@ -246,6 +250,10 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
$this->purchase->can_reactivate = TRUE;
|
||||
$this->purchase->save();
|
||||
|
||||
if ( $ref = \IPS\Request::i()->referrer( FALSE, TRUE ) )
|
||||
{
|
||||
\IPS\Output::i()->redirect( $ref );
|
||||
}
|
||||
\IPS\Output::i()->redirect( $this->purchase->url() );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user