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

+111
View File
@@ -0,0 +1,111 @@
<?php
/**
* @brief bestSellers Widget
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage nexus
* @since 16 Jul 2018
*/
namespace IPS\nexus\widgets;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* bestSellers Widget
*/
class _bestSellers extends \IPS\Widget\PermissionCache
{
/**
* @brief Widget Key
*/
public $key = 'bestSellers';
/**
* @brief App
*/
public $app = 'nexus';
/**
* @brief Plugin
*/
public $plugin = '';
/**
* Init widget
*
* @return null
*/
public function init()
{
\IPS\Output::i()->cssFiles = array_merge(
\IPS\Output::i()->cssFiles,
\IPS\Theme::i()->css( 'widgets.css', 'nexus' ),
\IPS\Theme::i()->css( 'store.css', 'nexus' )
);
parent::init();
}
/**
* Specify widget configuration
*
* @param null|\IPS\Helpers\Form $form Form object
* @return null|\IPS\Helpers\Form
*/
public function configuration( &$form=null )
{
$form = parent::configuration( $form );
$form->add( new \IPS\Helpers\Form\Number( 'number_to_show', isset( $this->configuration['number_to_show'] ) ? $this->configuration['number_to_show'] : 5, TRUE ) );
return $form;
}
/**
* Ran before saving widget configuration
*
* @param array $values Values from form
* @return array
*/
public function preConfig( $values )
{
return $values;
}
/**
* Render a widget
*
* @return string
*/
public function render()
{
$packages = array();
$purchases = \IPS\Db::i()->select( 'count(*) as purchased, ps_item_id', 'nexus_purchases', array(
array( 'p_store=1' ),
array( "( p_member_groups='*' OR " . \IPS\Db::i()->findInSet( 'p_member_groups', \IPS\Member::loggedIn()->groups ) . ' )' )
), 'purchased DESC', array( 0, ( isset( $this->configuration['number_to_show'] ) AND $this->configuration['number_to_show'] > 0 ) ? $this->configuration['number_to_show'] : 5 ), 'ps_item_id' )
->join( 'nexus_packages', array( "ps_item_id=p_id") );
foreach ( $purchases as $purchase )
{
$packages[] = $purchase['ps_item_id'];
}
if ( empty( $packages ) )
{
return "";
}
$packages = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_packages', array( \IPS\Db::i()->in( 'p_id', $packages ) ) ), 'IPS\nexus\Package' );
return $this->output( $packages );
}
}
+1 -1
View File
@@ -12,7 +12,7 @@
namespace IPS\nexus\widgets;
/* 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;
@@ -0,0 +1,149 @@
<?php
/**
* @brief featuredProduct Widget
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage nexus
* @since 18 Jul 2018
*/
namespace IPS\nexus\widgets;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* featuredProduct Widget
*/
class _featuredProduct extends \IPS\Widget\PermissionCache
{
/**
* @brief Widget Key
*/
public $key = 'featuredProduct';
/**
* @brief App
*/
public $app = 'nexus';
/**
* @brief Plugin
*/
public $plugin = '';
/**
* Initialise this widget
*
* @return void
*/
public function init()
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'widgets.css', 'nexus' ) );
parent::init();
}
/**
* Specify widget configuration
*
* @param null|\IPS\Helpers\Form $form Form object
* @return null|\IPS\Helpers\Form
*/
public function configuration( &$form=null )
{
$form = parent::configuration( $form );
$value = 0;
if ( isset( $this->configuration['package'] ) )
{
if ( \is_array( $this->configuration['package'] ) )
{
$value = $this->configuration['package'];
}
else
{
$value = array( $this->configuration['package'] );
}
}
$form->add( new \IPS\Helpers\Form\Node( 'package', $value, FALSE, array(
'class' => '\IPS\nexus\Package',
'permissionCheck' => function( $node )
{
if ( $node->canView() and $node->store )
{
return TRUE;
}
return FALSE;
},
'multiple' => true,
'subnodes' => false,
) ) );
return $form;
}
/**
* Ran before saving widget configuration
*
* @param array $values Values from form
* @return array
*/
public function preConfig( $values )
{
if ( \is_array( $values['package'] ) )
{
$save = array();
foreach( $values['package'] AS $pkg )
{
$save[] = $pkg->id;
}
$values['package'] = $save;
}
else
{
$values['package'] = array( $values['package']->id );
}
return $values;
}
/**
* Render a widget
*
* @return string
*/
public function render()
{
//Load the product
$packages = array();
if( isset( $this->configuration['package'] ) )
{
if ( \is_array( $this->configuration['package'] ) )
{
$packages = new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_packages', array( array( 'p_store=1' ), array( \IPS\Db::i()->in( 'p_id', $this->configuration['package'] ) ) ) ), 'IPS\nexus\Package' );
}
else
{
try
{
$packages = array( \IPS\nexus\Package::load( $this->configuration['package'] ) );
}
catch ( \OutOfRangeException $e ){}
}
}
if ( !\count( $packages ) )
{
return "";
}
return $this->output( $packages );
}
}
@@ -0,0 +1,104 @@
<?php
/**
* @brief latestProducts Widget
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage nexus
* @since 16 Jul 2018
*/
namespace IPS\nexus\widgets;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* latestProducts Widget
*/
class _latestProducts extends \IPS\Widget\PermissionCache
{
/**
* @brief Widget Key
*/
public $key = 'latestProducts';
/**
* @brief App
*/
public $app = 'nexus';
/**
* @brief Plugin
*/
public $plugin = '';
/**
* Initialise this widget
*
* @return void
*/
public function init()
{
\IPS\Output::i()->cssFiles = array_merge(
\IPS\Output::i()->cssFiles,
\IPS\Theme::i()->css( 'widgets.css', 'nexus' ),
\IPS\Theme::i()->css( 'store.css', 'nexus' )
);
parent::init();
}
/**
* Specify widget configuration
*
* @param null|\IPS\Helpers\Form $form Form object
* @return null|\IPS\Helpers\Form
*/
public function configuration( &$form=null )
{
$form = parent::configuration( $form );
$form->add( new \IPS\Helpers\Form\Number( 'number_to_show', isset( $this->configuration['number_to_show'] ) ? $this->configuration['number_to_show'] : 5, TRUE ) );
return $form;
}
/**
* Ran before saving widget configuration
*
* @param array $values Values from form
* @return array
*/
public function preConfig( $values )
{
return $values;
}
/**
* Render a widget
*
* @return string
*/
public function render()
{
//Load the products
$select = \IPS\Db::i()->select( '*', 'nexus_packages', array(
array( 'p_store=1' ),
array( "( p_member_groups='*' OR " . \IPS\Db::i()->findInSet( 'p_member_groups', \IPS\Member::loggedIn()->groups ) . ' )' )
), "p_date_added DESC", array( 0, ( isset( $this->configuration['number_to_show'] ) AND $this->configuration['number_to_show'] > 0 ) ? $this->configuration['number_to_show'] : 5 ) );
if ( !\count( $select ) )
{
return "";
}
$packages = new \IPS\Patterns\ActiveRecordIterator( $select, 'IPS\nexus\Package' );
return $this->output( $packages );
}
}
+8 -11
View File
@@ -12,7 +12,7 @@
namespace IPS\nexus\widgets;
/* 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;
@@ -74,10 +74,7 @@ class _pendingActions extends \IPS\Widget
*/
public function configuration( &$form=null )
{
if ( $form === null )
{
$form = new \IPS\Helpers\Form;
}
$form = parent::configuration( $form );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'pendingActions_stuff', $this->configuration['pendingActions_stuff'], TRUE, array( 'options' => static::$options ) ) );
@@ -98,7 +95,7 @@ class _pendingActions extends \IPS\Widget
/* Pending transactions *might* happen some weird way, so always get the count... but only show the count if we have fraud rules set up */
$pendingTransactions = NULL;
if ( in_array( 'transactions', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'transactions_manage' ) )
if ( \in_array( 'transactions', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'transactions_manage' ) )
{
$pendingTransactions = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_transactions', array( 't_status=?', \IPS\nexus\Transaction::STATUS_HELD ) )->first();
if ( !$pendingTransactions and !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_fraud_rules' )->first() )
@@ -109,7 +106,7 @@ class _pendingActions extends \IPS\Widget
/* Same with shipments */
$pendingShipments = NULL;
if ( in_array( 'shipments', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'shiporders_manage' ) )
if ( \in_array( 'shipments', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'shiporders_manage' ) )
{
$pendingShipments = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_ship_orders', array( 'o_status=?', \IPS\nexus\Shipping\Order::STATUS_PENDING ) )->first();
if ( !$pendingShipments and !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_packages_products', 'p_physical=1' )->first() )
@@ -120,7 +117,7 @@ class _pendingActions extends \IPS\Widget
/* And advertisements */
$pendingAdvertisements = NULL;
if ( in_array( 'ads', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'promotion', 'advertisements_manage' ) )
if ( \in_array( 'ads', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'promotion', 'advertisements_manage' ) )
{
$pendingAdvertisements = \IPS\Db::i()->select( 'COUNT(*)', 'core_advertisements', array( 'ad_active=-1' ) )->first();
if ( !$pendingAdvertisements and !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_packages_ads' )->first() )
@@ -131,7 +128,7 @@ class _pendingActions extends \IPS\Widget
/* And hosting errors */
$hostingErrors = NULL;
if ( in_array( 'hosting', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'hosting', 'errors_manage' ) )
if ( \in_array( 'hosting', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'hosting', 'errors_manage' ) )
{
$hostingErrors = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_hosting_errors' )->first();
if ( !$hostingErrors and !\IPS\Db::i()->select( 'COUNT(*)', 'nexus_hosting_servers' )->first() )
@@ -142,14 +139,14 @@ class _pendingActions extends \IPS\Widget
/* Withdrawals will only be if enabled */
$pendingWithdrawals = NULL;
if ( in_array( 'withdrawals', $this->configuration['pendingActions_stuff'] ) and \IPS\Settings::i()->nexus_payout and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'payouts_manage' ) )
if ( \in_array( 'withdrawals', $this->configuration['pendingActions_stuff'] ) and \IPS\Settings::i()->nexus_payout and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'payouts_manage' ) )
{
$pendingWithdrawals = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_payouts', array( 'po_status=?', \IPS\nexus\Payout::STATUS_PENDING ) )->first();
}
/* Show support if there are departments we can see */
$openSupportRequests = NULL;
if ( in_array( 'support', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'support', 'requests_manage' ) and \IPS\Db::i()->select( '*', 'nexus_support_departments', array( "( dpt_staff='*' OR " . \IPS\Db::i()->findInSet( 'dpt_staff', \IPS\nexus\Support\Department::staffDepartmentPerms() ) . ')' ) ) )
if ( \in_array( 'support', $this->configuration['pendingActions_stuff'] ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'support', 'requests_manage' ) and \IPS\Db::i()->select( '*', 'nexus_support_departments', array( "( dpt_staff='*' OR " . \IPS\Db::i()->findInSet( 'dpt_staff', \IPS\nexus\Support\Department::staffDepartmentPerms() ) . ')' ) ) )
{
$myStream = \IPS\nexus\Support\Stream::myStream();
$openSupportRequests = $myStream->count( \IPS\Member::loggedIn() );
@@ -0,0 +1,115 @@
<?php
/**
* @brief recentCommerceReviews Widget
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @subpackage nexus
* @since 17 Jul 2018
*/
namespace IPS\nexus\widgets;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* recentCommerceReviews Widget
*/
class _recentCommerceReviews extends \IPS\Widget\PermissionCache
{
/**
* @brief Widget Key
*/
public $key = 'recentCommerceReviews';
/**
* @brief App
*/
public $app = 'nexus';
/**
* @brief Plugin
*/
public $plugin = '';
/**
* Init widget
*
* @return null
*/
public function init()
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'widgets.css', 'nexus', 'front' ) );
parent::init();
}
/**
* Specify widget configuration
*
* @param null|\IPS\Helpers\Form $form Form object
* @return null|\IPS\Helpers\Form
*/
public function configuration( &$form=null )
{
$form = parent::configuration( $form );
/* Container */
$form->add( new \IPS\Helpers\Form\Node( 'widget_group', isset( $this->configuration['widget_group'] ) ? $this->configuration['widget_group'] : 0, FALSE, array(
'class' => '\IPS\nexus\Package\Group',
'zeroVal' => 'all',
'permissionCheck' => 'view',
'multiple' => true,
'subnodes' => false,
) ) );
$form->add( new \IPS\Helpers\Form\Number( 'review_count', isset( $this->configuration['review_count'] ) ? $this->configuration['review_count'] : 5, TRUE ) );
return $form;
}
/**
* Ran before saving widget configuration
*
* @param array $values Values from form
* @return array
*/
public function preConfig( $values )
{
if ( \is_array( $values['widget_group'] ) )
{
$values['widget_group'] = array_keys( $values['widget_group'] );
}
return $values;
}
/**
* Render a widget
*
* @return string
*/
public function render()
{
$where = array();
if ( ! empty( $this->configuration['widget_group'] ) )
{
$where['item'][] = array( \IPS\Db::i()->in( 'p_group', $this->configuration['widget_group'] ) );
}
$reviews = \IPS\nexus\Package\Review::getItemsWithPermission( $where, NULL, ( isset( $this->configuration['review_count'] ) AND $this->configuration['review_count'] > 0 ) ? $this->configuration['review_count'] : 5, 'read', \IPS\Content\Hideable::FILTER_PUBLIC_ONLY );
if ( !\count( $reviews ) )
{
return "";
}
return $this->output( $reviews );
}
}
+1 -1
View File
@@ -12,7 +12,7 @@
namespace IPS\nexus\widgets;
/* 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;