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

+14 -9
View File
@@ -12,7 +12,7 @@
namespace IPS\nexus\api;
/* 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;
@@ -46,7 +46,10 @@ class _purchases extends \IPS\Api\Controller
{
/* Where clause */
$where = array();
/* Get only the purchases from active applications */
$where[] = array( "ps_app IN('" . implode( "','", array_keys( \IPS\Application::enabledApplications() ) ) . "')" );
/* Customers */
if ( $this->member )
{
@@ -56,15 +59,15 @@ class _purchases extends \IPS\Api\Controller
{
$where[] = array( \IPS\Db::i()->in( 'ps_member', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->customers ) ) ) ) );
}
/* Status */
if ( isset( \IPS\Request::i()->active ) )
{
$where[] = array( 'ps_active=?', intval( \IPS\Request::i()->active ) );
$where[] = array( 'ps_active=?', \intval( \IPS\Request::i()->active ) );
}
if ( isset( \IPS\Request::i()->canceled ) )
{
$where[] = array( 'ps_cancelled=?', intval( \IPS\Request::i()->canceled ) );
$where[] = array( 'ps_cancelled=?', \intval( \IPS\Request::i()->canceled ) );
}
/* Item */
@@ -84,17 +87,17 @@ class _purchases extends \IPS\Api\Controller
/* Parent */
if ( isset( \IPS\Request::i()->parent ) )
{
$where[] = array( 'ps_parent=?', intval( \IPS\Request::i()->parent ) );
$where[] = array( 'ps_parent=?', \intval( \IPS\Request::i()->parent ) );
}
/* Show */
if ( isset( \IPS\Request::i()->show ) )
{
$where[] = array( 'ps_show=?', intval( \IPS\Request::i()->show ) );
$where[] = array( 'ps_show=?', \intval( \IPS\Request::i()->show ) );
}
/* Sort */
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'start', 'expire' ) ) )
if ( isset( \IPS\Request::i()->sortBy ) and \in_array( \IPS\Request::i()->sortBy, array( 'start', 'expire' ) ) )
{
$sortBy = 'ps_' . \IPS\Request::i()->sortBy;
}
@@ -102,7 +105,7 @@ class _purchases extends \IPS\Api\Controller
{
$sortBy = 'ps_id';
}
$sortDir = ( isset( \IPS\Request::i()->sortDir ) and in_array( mb_strtolower( \IPS\Request::i()->sortDir ), array( 'asc', 'desc' ) ) ) ? \IPS\Request::i()->sortDir : 'asc';
$sortDir = ( isset( \IPS\Request::i()->sortDir ) and \in_array( mb_strtolower( \IPS\Request::i()->sortDir ), array( 'asc', 'desc' ) ) ) ? \IPS\Request::i()->sortDir : 'asc';
/* Return */
return new \IPS\Api\PaginatedResponse(
@@ -148,6 +151,8 @@ class _purchases extends \IPS\Api\Controller
*
* @apiclientonly
* @apiparam object customFields Values for custom fields
* @param int $id ID Number
* @throws 2X309/1 INVALID_ID The purchase ID does not exist
* @return \IPS\nexus\Purchase
*/
public function POSTitem( $id )