Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
Whitespace-only changes.
@@ -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;
|
||||
@@ -58,7 +58,7 @@ class _invoices extends \IPS\Api\Controller
|
||||
}
|
||||
|
||||
/* Sort */
|
||||
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'date', 'title', 'total' ) ) )
|
||||
if ( isset( \IPS\Request::i()->sortBy ) and \in_array( \IPS\Request::i()->sortBy, array( 'date', 'title', 'total' ) ) )
|
||||
{
|
||||
$sortBy = 'i_' . \IPS\Request::i()->sortBy;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class _invoices extends \IPS\Api\Controller
|
||||
{
|
||||
$sortBy = 'i_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(
|
||||
|
||||
@@ -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;
|
||||
@@ -56,6 +56,7 @@ class _lkey extends \IPS\Api\Controller
|
||||
*
|
||||
* @apiclientonly
|
||||
* @apiparam object customFields Values for custom fields
|
||||
* @param string $lkey License key
|
||||
* @throws 2X310/2 INVALID_KEY The license key does not exist
|
||||
* @return \IPS\nexus\Purchase
|
||||
*/
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
@@ -60,7 +60,7 @@ class _shipments extends \IPS\Api\Controller
|
||||
}
|
||||
|
||||
/* Sort */
|
||||
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'date', 'shipped_date' ) ) )
|
||||
if ( isset( \IPS\Request::i()->sortBy ) and \in_array( \IPS\Request::i()->sortBy, array( 'date', 'shipped_date' ) ) )
|
||||
{
|
||||
$sortBy = 'o_' . \IPS\Request::i()->sortBy;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ class _shipments extends \IPS\Api\Controller
|
||||
{
|
||||
$sortBy = 'o_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(
|
||||
|
||||
@@ -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;
|
||||
@@ -79,7 +79,7 @@ class _supportreplies extends \IPS\Content\Api\CommentController
|
||||
|
||||
/* Are we a staff member? */
|
||||
$bypassPerms = FALSE;
|
||||
if ( $this->member and $this->member->isAdmin() and count( \IPS\nexus\Support\Department::departmentsWithPermission( $this->member ) ) )
|
||||
if ( $this->member and $this->member->isAdmin() and \count( \IPS\nexus\Support\Department::departmentsWithPermission( $this->member ) ) )
|
||||
{
|
||||
$where[] = array( \IPS\Db::i()->in( 'r_department', array_keys( iterator_to_array( \IPS\nexus\Support\Department::departmentsWithPermission( $this->member ) ) ) ) );
|
||||
$bypassPerms = TRUE;
|
||||
@@ -146,7 +146,7 @@ class _supportreplies extends \IPS\Content\Api\CommentController
|
||||
{
|
||||
// Okay
|
||||
}
|
||||
elseif ( $this->member->isAdmin() and ( $request->department->staff === '*' or count( array_intersect( explode( ',', $request->department->staff ), Department::staffDepartmentPerms( $this->member ) ) ) ) )
|
||||
elseif ( $this->member->isAdmin() and ( $request->department->staff === '*' or \count( array_intersect( explode( ',', $request->department->staff ), Department::staffDepartmentPerms( $this->member ) ) ) ) )
|
||||
{
|
||||
// Okay
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -102,7 +102,7 @@ class _supportrequests extends \IPS\Content\Api\ItemController
|
||||
|
||||
/* Are we a staff member? */
|
||||
$bypassPerms = FALSE;
|
||||
if ( $this->member and $this->member->isAdmin() and count( \IPS\nexus\Support\Department::departmentsWithPermission( $this->member ) ) )
|
||||
if ( $this->member and $this->member->isAdmin() and \count( \IPS\nexus\Support\Department::departmentsWithPermission( $this->member ) ) )
|
||||
{
|
||||
$where[] = array( \IPS\Db::i()->in( 'r_department', array_keys( iterator_to_array( \IPS\nexus\Support\Department::departmentsWithPermission( $this->member ) ) ) ) );
|
||||
$bypassPerms = TRUE;
|
||||
@@ -195,7 +195,7 @@ class _supportrequests extends \IPS\Content\Api\ItemController
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( $key === 'severity' and ( !$this->member->cm_no_sev or !in_array( $object, \IPS\nexus\Support\Department::load( \IPS\Request::i()->department )->availableSeverities() ) ) )
|
||||
if ( $key === 'severity' and ( !$this->member->cm_no_sev or !\in_array( $object, \IPS\nexus\Support\Department::load( \IPS\Request::i()->department )->availableSeverities() ) ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -331,6 +331,7 @@ class _supportrequests extends \IPS\Content\Api\ItemController
|
||||
if ( !$this->member and isset( \IPS\Request::i()->email ) )
|
||||
{
|
||||
$item->email = \IPS\Request::i()->email;
|
||||
$item->save();
|
||||
}
|
||||
|
||||
/* Do it */
|
||||
@@ -349,6 +350,7 @@ class _supportrequests extends \IPS\Content\Api\ItemController
|
||||
* @apiparam int purchase Associated purchase ID number. Ignored for requests using an OAuth Access Token for a particular member (users cannot change associated purchase of request after its created)
|
||||
* @apiparam string lkey License key of associated purchase ID number. (Will be ignored if "purchase" is provided). Ignored for requests using an OAuth Access Token for a particular member (users cannot change associated purchase of request after its created)
|
||||
* @apiparam int staff Assigned staff ID number. Ignored for requests using an OAuth Access Token for a particular member
|
||||
* @param int $id ID Number
|
||||
* @throws 2X313/7 INVALID_ID The topic ID does not exist or the authorized user does not have permission to view it
|
||||
* @return \IPS\nexus\Support\Request
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
@@ -65,7 +65,7 @@ class _transactions extends \IPS\Api\Controller
|
||||
}
|
||||
|
||||
/* Sort */
|
||||
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'date', 'amount' ) ) )
|
||||
if ( isset( \IPS\Request::i()->sortBy ) and \in_array( \IPS\Request::i()->sortBy, array( 'date', 'amount' ) ) )
|
||||
{
|
||||
$sortBy = 't_' . \IPS\Request::i()->sortBy;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ class _transactions extends \IPS\Api\Controller
|
||||
{
|
||||
$sortBy = 't_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(
|
||||
|
||||
@@ -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;
|
||||
@@ -58,7 +58,7 @@ class _withdrawals extends \IPS\Api\Controller
|
||||
}
|
||||
|
||||
/* Sort */
|
||||
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'date', 'amount' ) ) )
|
||||
if ( isset( \IPS\Request::i()->sortBy ) and \in_array( \IPS\Request::i()->sortBy, array( 'date', 'amount' ) ) )
|
||||
{
|
||||
$sortBy = 'po_' . \IPS\Request::i()->sortBy;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class _withdrawals extends \IPS\Api\Controller
|
||||
{
|
||||
$sortBy = 'po_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(
|
||||
|
||||
Reference in new issue
Block a user