Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+95 -6
View File
@@ -2,9 +2,9 @@
/**
* @brief Nexus Application Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 10 Feb 2014
* @version SVN_VERSION_NUMBER
@@ -148,7 +148,7 @@ class _Application extends \IPS\Application
try
{
$purchase = \IPS\nexus\Purchase::load( $purchaseId );
if ( !$purchase->cancelled )
if ( $purchase->renewals and !$purchase->cancelled )
{
$invoice->addItem( \IPS\nexus\Invoice\Item\Renewal::create( $purchase ) );
}
@@ -166,7 +166,10 @@ class _Application extends \IPS\Application
$transaction = new \IPS\nexus\Transaction;
$transaction->member = $invoice->member;
$transaction->invoice = $invoice;
$transaction->method = $gateway;
if ( $gateway )
{
$transaction->method = $gateway;
}
$transaction->amount = new \IPS\nexus\Money( $_POST['mc_gross'], $_POST['mc_currency'] );
$transaction->gw_id = $_POST['txn_id'];
$transaction->approve();
@@ -210,8 +213,8 @@ class _Application extends \IPS\Application
break;
case 'requests':
$myFilters = \IPS\nexus\Support\Request::myFilters();
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_requests', array( array( "( dpt_staff='*' OR " . \IPS\Db::i()->findInSet( 'dpt_staff', \IPS\nexus\Support\Department::staffDepartmentPerms() ) . ')' ), $myFilters['whereClause'] ) )->join( 'nexus_support_departments', 'dpt_id=r_department' )->first();
$myStream = \IPS\nexus\Support\Stream::myStream();
return $myStream->count( \IPS\Member::loggedIn() );
break;
case 'errors':
@@ -258,4 +261,90 @@ class _Application extends \IPS\Application
{
return $module->key == 'store';
}
/**
* Default front navigation
*
* @code
// Each item...
array(
'key' => 'Example', // The extension key
'app' => 'core', // [Optional] The extension application. If ommitted, uses this application
'config' => array(...), // [Optional] The configuration for the menu item
'title' => 'SomeLangKey', // [Optional] If provided, the value of this language key will be copied to menu_item_X
'children' => array(...), // [Optional] Array of child menu items for this item. Each has the same format.
)
return array(
'rootTabs' => array(), // These go in the top row
'browseTabs' => array(), // These go under the Browse tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
'browseTabsEnd' => array(), // These go under the Browse tab after all other items on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Browse tab may not exist)
'activityTabs' => array(), // These go under the Activity tab on a new install or when restoring the default configuraiton; or in the top row if installing the app later (when the Activity tab may not exist)
)
* @endcode
* @return array
*/
public function defaultFrontNavigation()
{
return array(
'rootTabs' => array(
array(
'key' => 'Store',
'children' => array(
array( 'key' => 'Donations' ),
array( 'key' => 'Orders' ),
array( 'key' => 'Purchases' ),
array(
'app' => 'core',
'key' => 'Menu',
'title' => 'default_menu_item_my_details',
'children' => array(
array( 'key' => 'Info' ),
array( 'key' => 'Addresses' ),
array( 'key' => 'Cards' ),
array( 'key' => 'BillingAgreements' ),
array( 'key' => 'Credit' ),
array( 'key' => 'Alternatives' ),
array( 'key' => 'Referrals' ),
)
)
),
),
array(
'app' => 'core',
'key' => 'CustomItem',
'title' => 'default_menu_item_support',
'config' => array( 'menu_custom_item_url' => 'app=nexus&module=support&controller=home', 'internal' => 'support' ),
'children' => array(
array( 'key' => 'Support' ),
array( 'key' => 'NetworkStatus' ),
)
)
),
'browseTabs' => array(),
'browseTabsEnd' => array(),
'activityTabs' => array()
);
}
/**
* Perform some legacy URL parameter conversions
*
* @return void
*/
public function convertLegacyParameters()
{
/* Support legacy subscriptions */
if( isset( \IPS\Request::i()->app ) AND \IPS\Request::i()->app == 'subscriptions' )
{
/* Redirecting isn't necessary, we just need to route the payment to the appropriate area.
@see \IPS\nexus\Application */
\IPS\Request::i()->app = 'nexus';
\IPS\Request::i()->module = 'payments';
\IPS\Request::i()->section = 'receive'; /* It actually looks for section=receive, so make sure we set that */
\IPS\Request::i()->controller = 'receive'; /* We set this just to be complete in case anywhere else only looks at controller */
\IPS\Request::i()->validate = 'paypal';
}
}
}
+95
View File
@@ -0,0 +1,95 @@
<?php
/**
* @brief Invoices API
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 9 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\api;
/* 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;
}
/**
* @brief Invoices API
*/
class _invoices extends \IPS\Api\Controller
{
/**
* GET /nexus/invoices
* Get list of invoices
*
* @apiparam string customers Comma-delimited list of customer IDs - if provided, only invoices belonging to those customers are returned
* @apiparam string statuses Comma-delimited list of statuses - if provided, only invoices with those statuses are returned - see invoice object for status keys
* @apiparam string sortBy What to sort by. Can be 'date', 'paid' (for paid date), 'total', 'title' or do not specify for ID
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Invoice>
*/
public function GETindex()
{
/* Where clause */
$where = array();
/* Customers */
if ( isset( \IPS\Request::i()->customers ) )
{
$where[] = array( \IPS\Db::i()->in( 'i_member', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->customers ) ) ) ) );
}
/* Statuses */
if ( isset( \IPS\Request::i()->statuses ) )
{
$where[] = array( \IPS\Db::i()->in( 'i_status', array_filter( explode( ',', \IPS\Request::i()->statuses ) ) ) );
}
/* Sort */
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'date', 'title', 'total' ) ) )
{
$sortBy = 'i_' . \IPS\Request::i()->sortBy;
}
else
{
$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';
/* Return */
return new \IPS\Api\PaginatedResponse(
200,
\IPS\Db::i()->select( '*', 'nexus_invoices', $where, "{$sortBy} {$sortDir}" ),
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
'IPS\nexus\Invoice',
\IPS\Db::i()->select( 'COUNT(*)', 'nexus_invoices', $where )->first()
);
}
/**
* GET /nexus/invoices/{id}
* Get information about a specific invoice
*
* @param int $id ID Number
* @throws 2X299/1 INVALID_ID The invoice ID does not exist
* @return \IPS\nexus\Invoice
*/
public function GETitem( $id )
{
try
{
return new \IPS\Api\Response( 200, \IPS\nexus\Invoice::load( $id )->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X299/1', 404 );
}
}
}
+84
View File
@@ -0,0 +1,84 @@
<?php
/**
* @brief License Key API
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 10 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\api;
/* 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;
}
/**
* @brief License Key API
*/
class _lkey extends \IPS\Api\Controller
{
/**
* GET /nexus/lkey/{key}
* Get information about a specific purchase from its license key
*
* @param string $lkey License key
* @throws 2X310/1 INVALID_KEY The license key does not exist
* @return \IPS\nexus\Purchase
*/
public function GETitem( $lkey )
{
try
{
$licenseKey = \IPS\nexus\Purchase\LicenseKey::load( $lkey );
$purchase = $licenseKey->purchase;
return new \IPS\Api\Response( 200, $purchase->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_KEY', '2X332/1', 404 );
}
}
/**
* POST /nexus/lkey/{key}
* Update custom fields for a purchase from its license key
*
* @apiparam object customFields Values for custom fields
* @throws 2X310/2 INVALID_KEY The license key does not exist
* @return \IPS\nexus\Purchase
*/
public function POSTitem( $lkey )
{
try
{
$licenseKey = \IPS\nexus\Purchase\LicenseKey::load( $lkey );
$purchase = $licenseKey->purchase;
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_KEY', '2X332/2', 404 );
}
if ( isset( \IPS\Request::i()->customFields ) )
{
$customFields = $purchase->custom_fields;
foreach ( \IPS\Request::i()->customFields as $k => $v )
{
$customFields[ $k ] = $v;
}
$purchase->custom_fields = $customFields;
}
$purchase->save();
return new \IPS\Api\Response( 200, $purchase->apiOutput() );
}
}
+165
View File
@@ -0,0 +1,165 @@
<?php
/**
* @brief Purchases API
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 10 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\api;
/* 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;
}
/**
* @brief Purchases API
*/
class _purchases extends \IPS\Api\Controller
{
/**
* GET /nexus/purchases
* Get list of purchases
*
* @apiparam string customers Comma-delimited list of customer IDs - if provided, only invoices belonging to those customers are returned
* @apiparam int active If 1, only active purchases are returned. If 0, only inactive
* @apiparam int canceled If 1, only canceled purchases are returned. If 0, only not canceled
* @apiparam string itemApp If specified, only purchases with this application key are returned
* @apiparam string itemType If specified, only purchases with this item type are returned
* @apiparam int itemId If specified, only purchases with this item ID are returned
* @apiparam int parent If specified, only purchases with which are children of the purchase with the ID specified are returned
* @apiparam int show If 1, only purchases which show in the Admin CP are returned, if 0, only purchases which do not
* @apiparam string sortBy What to sort by. Can be 'start' (for purchase date), 'expire' (for the epiry date) or do not specify for ID
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Purchase>
*/
public function GETindex()
{
/* Where clause */
$where = array();
/* Customers */
if ( isset( \IPS\Request::i()->customers ) )
{
$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 ) );
}
if ( isset( \IPS\Request::i()->canceled ) )
{
$where[] = array( 'ps_cancelled=?', intval( \IPS\Request::i()->canceled ) );
}
/* Item */
if ( isset( \IPS\Request::i()->itemApp ) )
{
$where[] = array( 'ps_app=?', \IPS\Request::i()->itemApp );
}
if ( isset( \IPS\Request::i()->itemType ) )
{
$where[] = array( 'ps_type=?', \IPS\Request::i()->itemType );
}
if ( isset( \IPS\Request::i()->itemId ) )
{
$where[] = array( 'ps_item_id=?', \IPS\Request::i()->itemId );
}
/* Parent */
if ( isset( \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 ) );
}
/* Sort */
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'start', 'expire' ) ) )
{
$sortBy = 'ps_' . \IPS\Request::i()->sortBy;
}
else
{
$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';
/* Return */
return new \IPS\Api\PaginatedResponse(
200,
\IPS\Db::i()->select( '*', 'nexus_purchases', $where, "{$sortBy} {$sortDir}" ),
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
'IPS\nexus\Purchase',
\IPS\Db::i()->select( 'COUNT(*)', 'nexus_purchases', $where )->first()
);
}
/**
* GET /nexus/purchases/{id}
* Get information about a specific purchase
*
* @param int $id ID Number
* @throws 2X310/1 INVALID_ID The purchase ID does not exist
* @return \IPS\nexus\Purchase
*/
public function GETitem( $id )
{
try
{
return new \IPS\Api\Response( 200, \IPS\nexus\Purchase::load( $id )->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X309/1', 404 );
}
}
/**
* POST /nexus/purchases/{id}
* Update custom fields for a purchase
*
* @apiparam object customFields Values for custom fields
* @throws 2X310/2 INVALID_ID The purchase ID does not exist
* @return \IPS\nexus\Purchase
*/
public function POSTitem( $id )
{
try
{
$purchase = \IPS\nexus\Purchase::load( $id );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X309/1', 404 );
}
if ( isset( \IPS\Request::i()->customFields ) )
{
$customFields = $purchase->custom_fields;
foreach ( \IPS\Request::i()->customFields as $k => $v )
{
$customFields[ $k ] = $v;
}
$purchase->custom_fields = $customFields;
}
$purchase->save();
return new \IPS\Api\Response( 200, $purchase->apiOutput() );
}
}
+95
View File
@@ -0,0 +1,95 @@
<?php
/**
* @brief Shipments API
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 10 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\api;
/* 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;
}
/**
* @brief Shipments API
*/
class _shipments extends \IPS\Api\Controller
{
/**
* GET /nexus/shipments
* Get list of shipments
*
* @apiparam string statuses Comma-delimited list of statuses - if provided, only transactions with those statuses are returned - see order object for status keys
* @apiparam string methods Comma-delimited list of shipping method IDs - if provided, only shipments from those methods are returned
* @apiparam string sortBy What to sort by. Can be 'date', 'shipped_date' or do not specify for ID
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Shipping\Order>
*/
public function GETindex()
{
/* Where clause */
$where = array();
/* Statuses */
if ( isset( \IPS\Request::i()->statuses ) )
{
$where[] = array( \IPS\Db::i()->in( 'o_status', array_filter( explode( ',', \IPS\Request::i()->statuses ) ) ) );
}
/* Methods */
if ( isset( \IPS\Request::i()->methods ) )
{
$where[] = array( \IPS\Db::i()->in( 'o_method', array_filter( explode( ',', \IPS\Request::i()->methods ) ) ) );
}
/* Sort */
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'date', 'shipped_date' ) ) )
{
$sortBy = 'o_' . \IPS\Request::i()->sortBy;
}
else
{
$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';
/* Return */
return new \IPS\Api\PaginatedResponse(
200,
\IPS\Db::i()->select( '*', 'nexus_ship_orders', $where, "{$sortBy} {$sortDir}" ),
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
'IPS\nexus\Shipping\Order',
\IPS\Db::i()->select( 'COUNT(*)', 'nexus_ship_orders', $where )->first()
);
}
/**
* GET /nexus/shipments/{id}
* Get information about a specific shipment
*
* @param int $id ID Number
* @throws 2X307/1 INVALID_ID The shipment ID does not exist
* @return \IPS\nexus\Shipping\Order
*/
public function GETitem( $id )
{
try
{
return new \IPS\Api\Response( 200, \IPS\nexus\Shipping\Order::load( $id )->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X308/1', 404 );
}
}
}
+237
View File
@@ -0,0 +1,237 @@
<?php
/**
* @brief Support Replies API
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 11 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\api;
/* 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;
}
/**
* @brief Support Replies API
*/
class _supportreplies extends \IPS\Content\Api\CommentController
{
/**
* Class
*/
protected $class = 'IPS\nexus\Support\Reply';
/**
* GET /nexus/supportreplies
* Get list of support replies
*
* @apiparam int staffReplies If 1, only replies by staff will be included. If 0, only replies by non-staff.
* @apiparam string authors Comma-delimited list of member IDs - if provided, only replies by those members are returned
* @apiparam string departments Comma-delimited list of department IDs
* @apiparam string statuses Comma-delimited list of status IDs
* @apiparam string severities Comma-delimited list of severity IDs
* @apiparam string sortBy What to sort by. Can be 'date', 'title' or leave unspecified for ID
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Support\Reply>
*/
public function GETindex()
{
/* Init */
$where = array();
/* Type */
if ( isset( \IPS\Request::i()->staffReplies ) )
{
$where[] = array( \IPS\Db::i()->in( 'reply_type', \IPS\Request::i()->staffReplies ? array( \IPS\nexus\Support\Reply::REPLY_STAFF, \IPS\nexus\Support\Reply::REPLY_HIDDEN ) : array( \IPS\nexus\Support\Reply::REPLY_MEMBER, \IPS\nexus\Support\Reply::REPLY_ALTCONTACT, \IPS\nexus\Support\Reply::REPLY_EMAIL ) ) );
}
else
{
$where[] = array( 'reply_type<>?', \IPS\nexus\Support\Reply::REPLY_PENDING );
}
/* Departments */
if ( isset( \IPS\Request::i()->departments ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_department', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->departments ) ) ) ) );
}
/* Statuses */
if ( isset( \IPS\Request::i()->statuses ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_status', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->statuses ) ) ) ) );
}
/* Severities */
if ( isset( \IPS\Request::i()->severities ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_severity', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->statuses ) ) ) ) );
}
/* Return */
return $this->_list( $where );
}
/**
* GET /nexus/supportreplies/{id}
* View information about a specific reply
*
* @param int $id ID Number
* @throws 2X314/1 INVALID_ID The reply ID does not exist
* @return \IPS\nexus\Support\Reply
*/
public function GETitem( $id )
{
try
{
return new \IPS\Api\Response( 200, \IPS\nexus\Support\Reply::load( $id )->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X314/1', 404 );
}
}
/**
* POST /nexus/supportreplies
* Create a reply
*
* @reqapiparam int request The ID number of the request the reply is for
* @reqapiparam int author The ID number of the member making the post (0 for guest)
* @reqapiparam string message The reply content as HTML (e.g. "<p>This is a post.</p>")
* @apiparam datetime date The date/time that should be used for the topic/post post date. If not provided, will use the current date/time
* @apiparam string ip_address The IP address that should be stored for the topic/post. If not provided, will use the IP address from the API request
* @apiparam bool hidden If true will be added as a hidden note
* @throws 2X314/2 NO_REQUEST The forum ID does not exist
* @throws 1X314/3 NO_AUTHOR The author ID does not exist
* @throws 1X314/4 NO_MESSAGE No message was supplied
* @return \IPS\nexus\Support\Reply
*/
public function POSTindex()
{
/* Get request */
try
{
$request = \IPS\nexus\Support\Request::load( \IPS\Request::i()->request );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'NO_REQUEST', '2X314/2', 403 );
}
/* Get author */
if ( \IPS\Request::i()->author )
{
$author = \IPS\Member::load( \IPS\Request::i()->author );
if ( !$author->member_id )
{
throw new \IPS\Api\Exception( 'NO_AUTHOR', '1X314/3', 403 );
}
}
else
{
$author = new \IPS\Member;
$author->name = \IPS\Request::i()->author_name;
}
/* Check we have a post */
if ( !\IPS\Request::i()->message )
{
throw new \IPS\Api\Exception( 'NO_MESSAGE', '1X314/4', 403 );
}
/* Do it */
return $this->_create( $request, $author, 'message' );
}
/**
* Create
*
* @param \IPS\Content\Item $item Content Item
* @param \IPS\Member $author Author
* @param string $contentParam The parameter that contains the content body
* @return \IPS\Api\Response
*/
protected function _createComment( \IPS\Content\Item $item, \IPS\Member $author, $contentParam='content' )
{
$comment = parent::_createComment( $item, $author, $contentParam );
if ( \IPS\Request::i()->hidden )
{
$comment->type = $comment::REPLY_HIDDEN;
}
$comment->save();
return $comment;
}
/**
* POST /nexus/supportreplies/{id}
* Edit a reply
*
* @param int $id ID Number
* @apiparam int author The ID number of the member making the post (0 for guest)
* @apiparam string message The post content as HTML (e.g. "<p>This is a post.</p>")
* @throws 2X314/5 INVALID_ID The post ID does not exist
* @throws 1X314/6 NO_AUTHOR The author ID does not exist
* @return \IPS\forums\Topic\Post
*/
public function POSTitem( $id )
{
try
{
/* Load */
$post = \IPS\nexus\Support\Reply::load( $id );
/* Do it */
try
{
return $this->_edit( $post, 'message' );
}
catch ( \InvalidArgumentException $e )
{
throw new \IPS\Api\Exception( 'NO_AUTHOR', '1X314/6', 400 );
}
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X314/5', 404 );
}
}
/**
* DELETE /nexus/supportreplies/{id}
* Deletes a reply
*
* @param int $id ID Number
* @throws 2X314/7 INVALID_ID The post ID does not exist
* @throws 1X314/8 CANNOT_DELETE_FIRST_POST You cannot delete the first reply to a request. Delete the request itself instead.
* @return void
*/
public function DELETEitem( $id )
{
try
{
$reply = \IPS\nexus\Support\Reply::load( $id );
if ( $reply->isFirst() )
{
throw new \IPS\Api\Exception( 'CANNOT_DELETE_FIRST_POST', '1X314/8', 403 );
}
$reply->delete();
return new \IPS\Api\Response( 200, NULL );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X314/7', 404 );
}
}
}
+324
View File
@@ -0,0 +1,324 @@
<?php
/**
* @brief Support Requests API
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 4 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\api;
/* 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;
}
/**
* @brief Support Requests API
*/
class _supportrequests extends \IPS\Content\Api\ItemController
{
/**
* Class
*/
protected $class = 'IPS\nexus\Support\Request';
/**
* GET /nexus/supportrequests
* Get list of support requests
*
* @apiparam string authors Comma-delimited list of member IDs - if provided, only support requests belonging to those members (or emails specified by email param) are returned
* @apiparam string email Comma-delimited list of email addresses - if provided, only support requests created by those emails (or members specified by authors param) are returned
* @apiparam string departments Comma-delimited list of department IDs
* @apiparam string statuses Comma-delimited list of status IDs
* @apiparam string severities Comma-delimited list of severity IDs
* @apiparam string purchases Comma-delimited list of purchase IDs - if provided, only support requests associated with one of the provided purchase IDs are returned
* @apiparam string staff Comma-delimited list of member IDs - if provided, only support requests assigned to the staff members with one of the provided IDs are returned
* @apiparam int hidden If 1, only replies which are hidden are returned, if 0 only not hidden
* @apiparam string sortBy What to sort by. Can be 'date', 'title' or leave unspecified for ID
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Support\Request>
*/
public function GETindex()
{
/* Init */
$where = array();
/* Authors */
if ( isset( \IPS\Request::i()->authors ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_member', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->authors ) ) ) ) );
}
if ( isset( \IPS\Request::i()->authors ) and isset( \IPS\Request::i()->emails ) )
{
$where[] = array( '( ' . \IPS\Db::i()->in( 'r_member', array_filter( explode( ',', \IPS\Request::i()->authors ) ) ) . ' OR ' . \IPS\Db::i()->in( 'r_email', array_filter( explode( ',', \IPS\Request::i()->emails ) ) ) . ' )' );
}
elseif ( isset( \IPS\Request::i()->authors ) )
{
$where[] = array( '( ' . \IPS\Db::i()->in( 'r_member', array_filter( explode( ',', \IPS\Request::i()->authors ) ) ) . ' OR r_email<>? )', '' );
}
elseif ( isset( \IPS\Request::i()->emails ) )
{
$where[] = array( '( r_member>0 OR ' . \IPS\Db::i()->findInSet( 'r_email', array_filter( explode( ',', \IPS\Request::i()->emails ) ) ) . ' )' );
}
/* Departments */
if ( isset( \IPS\Request::i()->departments ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_department', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->departments ) ) ) ) );
}
/* Statuses */
if ( isset( \IPS\Request::i()->statuses ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_status', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->statuses ) ) ) ) );
}
/* Severities */
if ( isset( \IPS\Request::i()->severities ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_severity', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->statuses ) ) ) ) );
}
/* Purchases */
if ( isset( \IPS\Request::i()->purchases ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_purchase', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->purchases ) ) ) ) );
}
/* Staff */
if ( isset( \IPS\Request::i()->staff ) )
{
$where[] = array( \IPS\Db::i()->in( 'r_staff', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->staff ) ) ) ) );
}
/* Return */
return $this->_list( $where );
}
/**
* GET /nexus/supportrequests/{id}
* Get information about and replies to a specific support request
*
* @param int $id ID Number
* @apiparam int hidden If 1, only posts which are hidden are returned, if 0 only not hidden
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @throws 2X313/1 INVALID_ID The topic ID does not exist
* @return \IPS\nexus\Support\Request
*/
public function GETitem( $id )
{
try
{
return new \IPS\Api\Response( 200, \IPS\nexus\Support\Request::load( $id )->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X313/1', 404 );
}
}
/**
* GET /nexus/supportrequests/{id}/replies
* Get replies to a specific support request
*
* @param int $id ID Number
* @apiparam int hidden If 1, only replies which are hidden are returned, if 0 only not hidden
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @throws 2X313/2 INVALID_ID The topic ID does not exist
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Support\Reply>
*/
public function GETitem_replies( $id )
{
try
{
return $this->_comments( $id, 'IPS\nexus\Support\Reply', array( array( 'reply_type<>?', \IPS\nexus\Support\Reply::REPLY_PENDING ) ) );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X313/2', 404 );
}
}
/**
* Create or update topic
*
* @param \IPS\Content\Item $item The item
* @return \IPS\Content\Item
*/
protected function _createOrUpdate( \IPS\Content\Item $item )
{
/* Department, statuc, etc */
foreach ( array( 'department' => 'IPS\nexus\Support\Department', 'status' => 'IPS\nexus\Support\Status', 'severity' => 'IPS\nexus\Support\Severity', 'purchase' => 'IPS\nexus\Purchase', 'staff' => 'IPS\Member' ) as $key => $class )
{
if ( isset( \IPS\Request::i()->$key ) )
{
try
{
$object = $class::load( \IPS\Request::i()->$key );
$item->$key = $object;
}
catch ( \OutOfRangeException $e ) {}
}
}
if ( !isset( \IPS\Request::i()->purchase ) and isset( \IPS\Request::i()->lkey ) )
{
try
{
$licenseKey = \IPS\nexus\Purchase\LicenseKey::load( \IPS\Request::i()->lkey );
$item->purchase = $licenseKey->purchase;
}
catch ( \OutOfRangeException $e ) {}
}
/* Defaults */
if ( !$item->id )
{
if ( !$item->_data['status'] )
{
$item->status = \IPS\nexus\Support\Status::load( TRUE, 'status_default_member' );
}
if ( !$item->_data['severity'] )
{
$item->severity = \IPS\nexus\Support\Severity::load( TRUE, 'sev_default' );
}
}
/* Pass up */
return parent::_createOrUpdate( $item );
}
/**
* POST /nexus/supportrequests
* Create a support request
*
* @reqapiparam string title The support request title
* @reqapiparam int department Department ID number
* @reqapiparam int account The ID number of the member creating the support request - not required if email is provided
* @reqapiparam string email The email address creating the support request - not required if account is provided
* @reqapiparam string message The content as HTML (e.g. "<p>This is a support request.</p>")
* @apiparam int status Status ID number. If not provided, will use the default.
* @apiparam int severity Severity ID number. If not provided, will use the default.
* @apiparam int purchase Associated purchase ID number.
* @apiparam string lkey License key of associated purchase ID number. (Will be ignored if "purchase" is provided)
* @apiparam int staff Assigned staff ID number.
* @apiparam datetime date The date/time that should be used for the support request date. If not provided, will use the current date/time
* @throws 1X313/3 NO_DEPARTMENT The forum ID does not exist
* @throws 1X313/4 NO_AUTHOR The author ID does not exist
* @throws 1X313/5 NO_TITLE No title was supplied
* @throws 1X313/4 NO_POST No post was supplied
* @return \IPS\forums\Topic
*/
public function POSTindex()
{
/* Get department */
try
{
$department = \IPS\nexus\Support\Department::load( \IPS\Request::i()->department );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'NO_DEPARTMENT', '1X313/3', 400 );
}
/* Get author */
if ( \IPS\Request::i()->account )
{
$author = \IPS\Member::load( \IPS\Request::i()->account );
if ( !$author->member_id )
{
throw new \IPS\Api\Exception( 'NO_AUTHOR', '1X313/4', 400 );
}
}
else
{
$author = new \IPS\Member;
}
/* Check we have a title and a post */
if ( !\IPS\Request::i()->title )
{
throw new \IPS\Api\Exception( 'NO_TITLE', '1X313/5', 400 );
}
if ( !\IPS\Request::i()->message )
{
throw new \IPS\Api\Exception( 'NO_POST', '1X313/4', 400 );
}
/* Create */
$item = $this->_create( NULL, $author, 'message' );
/* Email */
if ( isset( \IPS\Request::i()->email ) )
{
$item->email = \IPS\Request::i()->email;
}
/* Do it */
return new \IPS\Api\Response( 201, $item->apiOutput() );
}
/**
* POST /nexus/supportrequests/{id}
* Edit a support request
*
* @apiparam string title The support request title
* @apiparam int department Department ID number
* @apiparam int status Status ID number. If not provided, will use the default.
* @apiparam int severity Severity ID number. If not provided, will use the default.
* @apiparam int purchase Associated purchase ID number.
* @apiparam string lkey License key of associated purchase ID number. (Will be ignored if "purchase" is provided)
* @apiparam int staff Assigned staff ID number.
* @throws 2X313/7 INVALID_ID The topic ID does not exist
* @return \IPS\nexus\Support\Request
*/
public function POSTitem( $id )
{
try
{
$request = \IPS\nexus\Support\Request::load( $id );
/* Process */
$this->_createOrUpdate( $request );
/* Save and return */
$request->save();
return new \IPS\Api\Response( 200, $request->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X313/7', 404 );
}
}
/**
* DELETE /nexus/supportrequests/{id}
* Delete a support request
*
* @param int $id ID Number
* @throws 1F294/5 INVALID_ID The topic ID does not exist
* @return void
*/
public function DELETEitem( $id )
{
try
{
\IPS\nexus\Support\Request::load( $id )->delete();
return new \IPS\Api\Response( 200, NULL );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X313/8', 404 );
}
}
}
+102
View File
@@ -0,0 +1,102 @@
<?php
/**
* @brief Transactions API
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 10 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\api;
/* 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;
}
/**
* @brief Transactions API
*/
class _transactions extends \IPS\Api\Controller
{
/**
* GET /nexus/transactions
* Get list of transactions
*
* @apiparam string customers Comma-delimited list of customer IDs - if provided, only transactions from those customers are returned
* @apiparam string statuses Comma-delimited list of statuses - if provided, only transactions with those statuses are returned - see transaction object for status keys
* @apiparam string gateways Comma-delimited list of gateway IDs - if provided, only transactions from those gateways are returned
* @apiparam string sortBy What to sort by. Can be 'date', 'amount' or do not specify for ID
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Transaction>
*/
public function GETindex()
{
/* Where clause */
$where = array();
/* Customers */
if ( isset( \IPS\Request::i()->customers ) )
{
$where[] = array( \IPS\Db::i()->in( 't_member', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->customers ) ) ) ) );
}
/* Statuses */
if ( isset( \IPS\Request::i()->statuses ) )
{
$where[] = array( \IPS\Db::i()->in( 't_status', array_filter( explode( ',', \IPS\Request::i()->statuses ) ) ) );
}
/* Methods */
if ( isset( \IPS\Request::i()->gateways ) )
{
$where[] = array( \IPS\Db::i()->in( 't_method', array_filter( explode( ',', \IPS\Request::i()->gateways ) ) ) );
}
/* Sort */
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'date', 'amount' ) ) )
{
$sortBy = 't_' . \IPS\Request::i()->sortBy;
}
else
{
$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';
/* Return */
return new \IPS\Api\PaginatedResponse(
200,
\IPS\Db::i()->select( '*', 'nexus_transactions', $where, "{$sortBy} {$sortDir}" ),
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
'IPS\nexus\Transaction',
\IPS\Db::i()->select( 'COUNT(*)', 'nexus_transactions', $where )->first()
);
}
/**
* GET /nexus/transactions/{id}
* Get information about a specific transaction
*
* @param int $id ID Number
* @throws 2X307/1 INVALID_ID The transaction ID does not exist
* @return \IPS\nexus\Transaction
*/
public function GETitem( $id )
{
try
{
return new \IPS\Api\Response( 200, \IPS\nexus\Transaction::load( $id )->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X307/1', 404 );
}
}
}
+95
View File
@@ -0,0 +1,95 @@
<?php
/**
* @brief Withdrawals API
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 10 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\api;
/* 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;
}
/**
* @brief Withdrawals API
*/
class _withdrawals extends \IPS\Api\Controller
{
/**
* GET /nexus/shipments
* Get list of shipments
*
* @apiparam string customers Comma-delimited list of customer IDs - if provided, only invoices belonging to those customers are returned
* @apiparam string statuses Comma-delimited list of statuses - if provided, only transactions with those statuses are returned - see payout object for status keys
* @apiparam string sortBy What to sort by. Can be 'date', 'completed' (for the date it was completed), 'amount' or do not specify for ID
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
* @apiparam int page Page number
* @return \IPS\Api\PaginatedResponse<IPS\nexus\Shipping\Order>
*/
public function GETindex()
{
/* Where clause */
$where = array();
/* Customers */
if ( isset( \IPS\Request::i()->customers ) )
{
$where[] = array( \IPS\Db::i()->in( 'po_member', array_map( 'intval', array_filter( explode( ',', \IPS\Request::i()->customers ) ) ) ) );
}
/* Statuses */
if ( isset( \IPS\Request::i()->statuses ) )
{
$where[] = array( \IPS\Db::i()->in( 'po_status', array_filter( explode( ',', \IPS\Request::i()->statuses ) ) ) );
}
/* Sort */
if ( isset( \IPS\Request::i()->sortBy ) and in_array( \IPS\Request::i()->sortBy, array( 'date', 'amount' ) ) )
{
$sortBy = 'po_' . \IPS\Request::i()->sortBy;
}
else
{
$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';
/* Return */
return new \IPS\Api\PaginatedResponse(
200,
\IPS\Db::i()->select( '*', 'nexus_payouts', $where, "{$sortBy} {$sortDir}" ),
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
'IPS\nexus\Payout`',
\IPS\Db::i()->select( 'COUNT(*)', 'nexus_payouts', $where )->first()
);
}
/**
* GET /nexus/withdrawals/{id}
* Get information about a specific invoice
*
* @param int $id ID Number
* @throws 2X307/1 INVALID_ID The withdrawal ID does not exist
* @return \IPS\nexus\Payout
*/
public function GETitem( $id )
{
try
{
return new \IPS\Api\Response( 200, \IPS\nexus\Payout::load( $id )->apiOutput() );
}
catch ( \OutOfRangeException $e )
{
throw new \IPS\Api\Exception( 'INVALID_ID', '2X309/1', 404 );
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
"transactions": {
"tab": "nexus",
"controller": "transactions",
"do": "",
"do": "&filter=tstatus_hold",
"restriction": "transactions_manage"
},
"invoices": {
+11 -7
View File
@@ -41,6 +41,10 @@
"donations": {
"donations_manage": "donations_manage",
"donationgoals_manage": "donationgoals_manage"
},
"billingagreements": {
"billingagreements_view": "billingagreements_view",
"billingagreements_manage": "billingagreements_manage"
}
},
"customers": {
@@ -80,14 +84,15 @@
},
"support": {
"requests": {
"requests_manage": "requests_manage",
"requests_ratings": "requests_ratings",
"requests_ratings_feedback": "requests_ratings_feedback",
"requests_split": "requests_split",
"requests_block_sev": "requests_block_sev",
"requests_reply_delete": "requests_reply_delete",
"requests_create": "requests_create",
"requests_merge": "requests_merge",
"requests_delete": "requests_delete",
"requests_reply_delete": "requests_reply_delete",
"requests_block_sev": "requests_block_sev",
"requests_ratings": "requests_ratings",
"requests_ratings_feedback": "requests_ratings_feedback"
"requests_manage": "requests_manage"
},
"support_reports": {
"reports_manage": "reports_manage"
@@ -102,8 +107,7 @@
"autoresolve_manage": "autoresolve_manage",
"customerfeedback_manage": "customerfeedback_manage",
"outgoingemail_manage": "outgoingemail_manage",
"incomingemail_manage": "incomingemail_manage",
"support_display_settings": "support_display_settings"
"incomingemail_manage": "incomingemail_manage"
},
"stats": {
"volume_manage": "volume_manage"
File diff suppressed because it is too large. Load diff
@@ -2,9 +2,9 @@
/**
* @brief {class}
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
{subpackage}
* @since {date}
* @version SVN_VERSION_NUMBER
File diff suppressed because it is too large. Load diff
+396 -104
View File
@@ -8,7 +8,7 @@
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='background: #f5f5f5'>
<tr>
<td dir='{dir}'>
{$email->parseTextForEmail( $newMessage->content() )|raw}
{$email->parseTextForEmail( $newMessage->content(), $email->language )|raw}
</td>
</tr>
</table>
@@ -23,7 +23,7 @@
{$email->language->addToStack("send_it", FALSE)}: {expression="\IPS\Settings::i()->base_url"}applications/nexus/interface/email/sendDiscard.php?id={$message->id}&key={expression="md5( $message->item()->email_key . $message->date )"}&send=1
{$email->language->addToStack("discard_it", FALSE)} {expression="\IPS\Settings::i()->base_url"}applications/nexus/interface/email/sendDiscard.php?id={$message->id}&key={expression="md5( $message->item()->email_key . $message->date )"}&send=0
---
{expression="\IPS\Email::buildPlaintextBody( $newMessage->content()|)"}
{expression="\IPS\Email::buildPlaintextBody( $newMessage->content() )"}
---
{$email->language->addToStack("view_support_request", FALSE)}: {$message->item()->acpUrl()}
@@ -101,7 +101,7 @@
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
<span style="color: #8d8d8d">{$item->quantity} x</span> {$item->name}
{{if $item instanceof \IPS\nexus\Invoice\Item\Renewal}}
{{if ( $item instanceof \IPS\nexus\Invoice\Item\Renewal ) AND \IPS\nexus\Purchase::load( $item->id )->expire}}
<span style="color: #8d8d8d; font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px;">
({$email->language->addToStack('ps_expire', FALSE)}: {expression="\IPS\nexus\Purchase::load( $item->id )->expire->localeDate( $invoice->member )"})
</span>
@@ -110,7 +110,7 @@
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {$v}<br>
{$email->language->addToStack('nexus_pfield_' . $k, FALSE)}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
@@ -276,7 +276,20 @@
{$email->language->get('email_paid_by')} {{if $transaction->method}}{$transaction->method->_title}{{else}}{$email->language->get('account_credit')}{{endif}}: {$transaction->amount}
{{endif}}{{endforeach}}{$email->language->get('total_to_pay')}: {$invoice->amountToPay()->toString( $email->language )}
{{endif}}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>invoiceWarning</template_name><template_content_html><![CDATA[
{$email->language->get('email_expire_warning')|raw}
{$email->language->get('email_expire_warning')}
<br /><br />
{{if $billingAgreement}}
{$email->language->get('email_expire_warning_billing_agreement')}
<br /><br />
<a href='{$billingAgreement->url()}' style="color: #ffffff; font-family: 'Helvetica Neue', helvetica, sans-serif; text-decoration: none; font-size: 12px; background: #417ba3; line-height: 32px; padding: 0 10px; display: inline-block; border-radius: 3px;">{$email->language->addToStack("view_billing_agreement", FALSE)}</a>
{{elseif count( $cards ) and $credit and $credit->amount->isGreaterThanZero()}}
{expression="sprintf( $email->language->get('email_expire_warning_card_and_credit'), $credit->toString( $email->language ) )"}
{{elseif count( $cards )}}
{$email->language->get('email_expire_warning_card')}
{{else}}
{expression="sprintf( $email->language->get('email_expire_warning_credit'), $credit->toString( $email->language ) )"}
{{endif}}
<br /><br />
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>
@@ -284,43 +297,46 @@
<br />
<br />
<table cellpadding="10" cellspacing="0" border="0" width="100%" bgcolor='#f9f9f9'>
<tr>
<td dir='{dir}' colspan="2" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f0f0f0">
<strong>{$email->language->get('email_card_on_file')}</strong>
</td>
</tr>
<tr>
<td dir='{dir}' width='100' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
<strong>{$email->language->get('card_type')}</strong>
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='left'>
{$email->language->get('card_type_' . $card->card->type)} {expression="sprintf( $email->language->get('email_ending_in'), $card->card->lastFour )"}
</td>
</tr>
<tr>
<td dir='{dir}' width='100' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
<strong>{$email->language->get('card_expires')}</strong>
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='left'>
{$card->card->expMonth}/{$card->card->expYear}
</td>
</tr>
<tr bgcolor="#f0f0f0">
<td dir='{dir}' width='100' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
&nbsp;
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='left'>
<a href='{url="app=nexus&module=clients&controller=cards" seoTemplate="clientscards" base="front"}' style="color: #ffffff; font-family: 'Helvetica Neue', helvetica, sans-serif; text-decoration: none; font-size: 14px; background: {setting="email_color"}; line-height: 32px; padding: 0 10px; display: inline-block; border-radius: 3px;">{$email->language->get('email_update_payment')}</a>
</td>
</tr>
</table>
<br /><br />
{{if count( $cards )}}
<table cellpadding="10" cellspacing="0" border="0" width="100%" bgcolor='#f9f9f9'>
<tr>
<td dir='{dir}' colspan="4" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f0f0f0">
<strong>{$email->language->get('email_card_on_file')}</strong>
</td>
</tr>
{{foreach $cards as $card}}
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
<strong>{$email->language->get('card_type')}</strong>
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='left'>
{{if $card->card->type}}{$email->language->get('card_type_' . $card->card->type)}{{else}}{$email->language->get('card_type_generic')}{{endif}} {expression="sprintf( $email->language->get('email_ending_in'), $card->card->lastFour )"}
</td>
{{if !is_null( $card->card->expMonth ) AND !is_null( $card->card->expYear )}}
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
<strong>{$email->language->get('card_expires')}</strong>
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='left'>
{$card->card->expMonth}/{$card->card->expYear}
</td>
{{endif}}
</tr>
{{endforeach}}
<tr bgcolor="#f0f0f0">
<td dir='{dir}' width='100' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
&nbsp;
</td>
<td dir='{dir}' colspan="3" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='left'>
<a href='{url="app=nexus&module=clients&controller=cards" seoTemplate="clientscards" base="front"}' style="color: #ffffff; font-family: 'Helvetica Neue', helvetica, sans-serif; text-decoration: none; font-size: 14px; background: {setting="email_color"}; line-height: 32px; padding: 0 10px; display: inline-block; border-radius: 3px;">{$email->language->get('email_update_payment')}</a>
</td>
</tr>
</table>
<br /><br />
{{endif}}
<table cellpadding="10" cellspacing="0" border="0" width="100%">
<tr>
<td dir='{dir}' colspan="4" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f0f0f0">
<td dir='{dir}' colspan="5" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f0f0f0">
<strong>{$email->language->get("email_expiring_soon")}</strong>
</td>
</tr>
@@ -358,7 +374,7 @@
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {$v}<br>
{lang="nexus_pfield_{$k}"}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
@@ -367,18 +383,23 @@
</td>
</tr>
{{endforeach}}
</table>]]></template_content_html><template_data>$card, $invoice, $summary, $email</template_data><template_content_plaintext><![CDATA[
</table>]]></template_content_html><template_data>$cards, $credit, $billingAgreement, $invoice, $summary, $email</template_data><template_content_plaintext><![CDATA[
{$email->language->get('email_expire_warning')|raw}
{{if $billingAgreement}}{$email->language->get('email_expire_warning_billing_agreement')}{{elseif count( $cards ) and $credit and $credit->amount->isGreaterThanZero()}}{expression="sprintf( $email->language->get('email_expire_warning_card_and_credit'), $credit->toString( $email->language ) )"}{{elseif count( $cards )}}{$email->language->get('email_expire_warning_card')}{{else}}{expression="sprintf( $email->language->get('email_expire_warning_credit'), $credit->toString( $email->language ) )"}{{endif}}
-- {setting="board_name"}
{{if count( $cards )}}
{$email->language->get('email_card_on_file')}
=====
{$email->language->get('card_type')}: {$email->language->get('card_type_' . $card->card->type)} {expression="sprintf( $email->language->get('email_ending_in'), $card->card->lastFour )"}
{{foreach $cards as $card}}{$email->language->get('card_type')}: {{if $card->card->type}}{$email->language->get('card_type_' . $card->card->type)}{{else}}{$email->language->get('card_type_generic')}{{endif}} {expression="sprintf( $email->language->get('email_ending_in'), $card->card->lastFour )"}
{{if !is_null( $card->card->expMonth ) AND !is_null( $card->card->expYear )}}
{$email->language->get('card_expires')}: {$card->card->expMonth}/{$card->card->expYear}
{{endif}}
{{endforeach}}
{$email->language->get('email_update_payment')}: {url="app=nexus&module=clients&controller=cards" seoTemplate="clientscards" base="front"}
{{endif}}
{$email->language->get("email_expiring_soon")}
=====
@@ -391,10 +412,10 @@
<br />
<br />
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='background: #dbe2c9; color: #556b45;'>
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='color: #556b45;'>
<tr>
<td dir='{dir}'>
{expression="$email->language->addToStack( 'monitor_email_reset_done', FALSE, array( 'sprintf' => array( $server->hostname, $by ) ) )"}
<strong>{expression="$email->language->addToStack( 'monitor_email_reset_done', FALSE, array( 'sprintf' => array( $server->hostname, $by ) ) )"}</strong>
</td>
</tr>
</table>
@@ -408,10 +429,10 @@
<br />
<br />
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='background: #b52b38; color: #fff;'>
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='color: #b52b38;'>
<tr>
<td dir='{dir}'>
{expression="$email->language->addToStack( 'monitor_email_eom', FALSE, array( 'sprintf' => array( $rule->url ) ) )"}
<strong>{expression="$email->language->addToStack( 'monitor_email_eom', FALSE, array( 'sprintf' => array( $rule->url ) ) )"}</strong>
</td>
</tr>
</table>
@@ -508,16 +529,16 @@
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
<span style="color: #8d8d8d">{$item->quantity} x</span> {$item->name}
{{if $item instanceof \IPS\nexus\Invoice\Item\Renewal}}
{{if $item instanceof \IPS\nexus\Invoice\Item\Renewal and $purchase = \IPS\nexus\Purchase::load( $item->id ) and $expire = $purchase->expire}}
<span style="color: #8d8d8d; font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px;">
({$email->language->addToStack('ps_expire', FALSE)}: {expression="\IPS\nexus\Purchase::load( $item->id )->expire->localeDate( $invoice->member )"})
({$email->language->addToStack('ps_expire', FALSE)}: {expression="$expire->localeDate( $invoice->member )"})
</span>
{{endif}}
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {$v}<br>
{lang="nexus_pfield_{$k}"}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
@@ -633,19 +654,263 @@
{{if $transactions = $invoice->transactions() and count( $transactions )}}{{foreach $transactions as $transaction}}{{if $transaction->status === $transaction::STATUS_PAID}}
{$email->language->get('email_paid_by')} {{if $transaction->method}}{$transaction->method->_title}{{else}}{$email->language->get('account_credit')}{{endif}}: {$transaction->amount}
{{endif}}{{endforeach}}
{{endif}}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>staffNotifyNew</template_name><template_content_html><![CDATA[{$email->language->addToStack("staffnotify_new_header", FALSE, array( 'sprintf' => array( $request->supportAuthor()->name() ) ) )}<br />
{{endif}}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>unsubscribeStaffNotify</template_name><template_content_html><![CDATA[<tr>
<td dir='{dir}' valign="top"><img src='{setting="base_url"}applications/core/interface/email/spacer.png' width='1' height='1' alt=''></td>
<td dir='{dir}' valign='middle' align='center' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 12px; line-height: 18px; padding-left: 10px;">
{$email->language->addToStack("unsubscribe_blurb", FALSE)} <a href="{url="app=nexus&module=support&controller=requests&do=notifications" base="admin"}" style='color: #4a8aca; text-decoration: none; display: inline-block'>{$email->language->addToStack( 'manage_notification_settings', FALSE )}</a>.
<br />
</td>
</tr>]]></template_content_html><template_data>$member, $email</template_data><template_content_plaintext><![CDATA[{$email->language->addToStack("manage_notification_settings", FALSE)} {$email->language->addToStack( 'adjust_digest_prefs', FALSE )}: {url="app=nexus&module=support&controller=requests&do=notifications" base="admin"}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>transactionGatewayPending</template_name><template_content_html><![CDATA[<br />
{$email->language->addToStack("email_gateway_pending", FALSE)}
<br />
<br />
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>
<br />
<br />
<h3 style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 24px; font-weight: 500; color: #333333; line-height: 21px; margin: 0">
{expression="sprintf( $email->language->get('order_number'), $invoice->id )"}
</h3>
<br />
<a href='{$invoice->url()}' style="color: #ffffff; font-family: 'Helvetica Neue', helvetica, sans-serif; text-decoration: none; font-size: 14px; background: {setting="email_color"}; line-height: 32px; padding: 0 10px; display: inline-block; border-radius: 3px;">{$email->language->addToStack("email_view_order", FALSE)}</a>
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#ffffff" class='responsive_table'>
<tr>
<td dir='{dir}' width="{{if $invoice->hasPhysicalItems() and $invoice->shipaddress}}48%{{else}}100%{{endif}}" class='responsive_fullwidth' bgcolor="#f9f9f9">
<table cellpadding="10" cellspacing="0" border="0" width="100%">
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f0f0f0">
<strong>{$email->language->addToStack("billing_address", FALSE)}</strong>
</td>
</tr>
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$invoice->member->cm_name}<br />
{{if $invoice->billaddress}}{$invoice->billaddress->toString('<br />')|raw}{{endif}}
</td>
</tr>
</table>
</td>
{{if $invoice->hasPhysicalItems() and $invoice->shipaddress}}
<td dir='{dir}' width="4%"><img src='{setting="base_url"}applications/core/interface/email/spacer.png' width='1' height='1' alt=''></td>
<td dir='{dir}' width="48%" class='responsive_fullwidth' bgcolor="#f9f9f9">
<table cellpadding="10" cellspacing="0" border="0" width="100%">
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f0f0f0">
<strong>{$email->language->addToStack("shipping_address", FALSE)}</strong>
</td>
</tr>
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$invoice->member->cm_name}<br />
{$invoice->shipaddress->toString('<br />')|raw}
</td>
</tr>
</table>
</td>
{{endif}}
</tr>
</table>
<br />
<table cellpadding="10" cellspacing="0" border="0" width="100%">
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f0f0f0">
<strong>{$email->language->addToStack("payment_details", FALSE)}</strong>
</td>
</tr>
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f9f9f9">
<table width="100%" cellpadding="2" cellspacing="0" border="0">
<tr>
<td dir='{dir}' width="150" align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px"><strong>{$email->language->addToStack("status", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">&nbsp;&nbsp;{$email->language->addToStack("transaction_title_pending", FALSE)}</td>
</tr>
<tr>
<td dir='{dir}' width="150" align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px"><strong>{$email->language->addToStack("email_payment_method", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">&nbsp;&nbsp;{{if $transaction->method}}{$transaction->method->_title}{{else}}{$email->language->addToStack("account_credit", FALSE)}{{endif}}</td>
</tr>
{{if $transaction->gw_id}}
<tr>
<td dir='{dir}' width="150" align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px"><strong>{$email->language->addToStack("email_transaction_id", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">&nbsp;&nbsp;{$transaction->gw_id}</td>
</tr>
{{endif}}
<tr>
<td dir='{dir}' width="150" align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px"><strong>{$email->language->addToStack("date", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">&nbsp;&nbsp;{$transaction->date}</td>
</tr>
<tr>
<td dir='{dir}' width="150" align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px"><strong>{$email->language->addToStack("amount", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">&nbsp;&nbsp;{$transaction->amount}</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<table cellpadding="10" cellspacing="0" border="0" width="100%">
<tr>
<td dir='{dir}' colspan="5" style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" bgcolor="#f0f0f0">
<strong>{$email->language->addToStack("order_details", FALSE)}</strong>
</td>
</tr>
<tr bgcolor="#f9f9f9">
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
&nbsp;
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 13px; color: #333333; line-height: 21px" colspan="2">
<strong>{$email->language->addToStack('invoice_item', FALSE)}</strong>
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 13px; color: #333333; line-height: 21px" align='right'>
<strong>{$email->language->get('total')}</strong>
</td>
</tr>
{{foreach $invoiceSummary['items'] as $k => $item}}
<tr style='border-top: 1px solid #f5f5f5'>
<td dir='{dir}' width='100' valign='top' class='hidePhone' style='width: 0; max-height: 0; overflow: hidden; float: left;'>
{{if $image = $item->image()}}
<img src='{$image->url}' width='100' style='border: 0; vertical-align: middle;'>
{{endif}}
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
<span style="color: #8d8d8d">{$item->quantity} x</span> {$item->name}
{{if $item instanceof \IPS\nexus\Invoice\Item\Renewal}}
<span style="color: #8d8d8d; font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px;">
({$email->language->addToStack('ps_expire', FALSE)}: {expression="\IPS\nexus\Purchase::load( $item->id )->expire->localeDate( $invoice->member )"})
</span>
{{endif}}
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
<strong>{$item->linePrice()->toString( $email->language )}</strong>
{{if $item->quantity > 1}}
<br><span style="color: #8d8d8d; font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px;">{$email->language->addToStack("each_short", FALSE, array( 'sprintf' => array( $item->price ) ) )}</span>
{{endif}}
</td>
</tr>
{{endforeach}}
<tr style='border-top: 1px solid #dddddd'>
<td dir='{dir}' colspan='3' align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
<strong>{$email->language->get('subtotal')}</strong>
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
<strong>{$invoiceSummary['subtotal']->toString( $email->language )}</strong>
</td>
</tr>
{{foreach $invoiceSummary['shipping'] as $shipping}}
<tr style='border-top: 1px solid #f5f5f5'>
<td dir='{dir}' colspan='3' align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$shipping->name}
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
<strong>{$shipping->linePrice()->toString( $email->language )}</strong>
</td>
</tr>
{{endforeach}}
{{foreach $invoiceSummary['tax'] as $tax}}
<tr style='border-top: 1px solid #f5f5f5'>
<td dir='{dir}' colspan='3' align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$tax['name']} ({expression="$tax['rate']*100"}%)
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px" align='right'>
<strong>{$tax['amount']}</strong>
</td>
</tr>
{{endforeach}}
<tr style='border-top: 1px solid #dddddd'>
<td dir='{dir}' colspan='3' align='right' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 17px; color: #cd3816; line-height: 21px">
<strong>{$email->language->get('total')}</strong>
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 17px; color: #cd3816; line-height: 21px" align='right'>
<strong>{$invoiceSummary['total']->toString( $email->language )}</strong>
</td>
</tr>
</table>]]></template_content_html><template_data>$transaction, $invoice, $invoiceSummary, $email</template_data><template_content_plaintext><![CDATA[
{$email->language->addToStack("email_gateway_pending_plain", FALSE)}
&mdash; {setting="board_name"}
-----
**{expression="sprintf( $email->language->get('order_number'), $invoice->id )"}**
{$email->language->addToStack("email_view_order", FALSE)}: {$invoice->url()}
{$email->language->addToStack("billing_address", FALSE)}
===
{$invoice->member->cm_name}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('\n')|raw}{{endif}}
{{if $invoice->hasPhysicalItems() and $invoice->shipaddress}}
{$email->language->addToStack("shipping_address", FALSE)}
===
{$invoice->member->cm_name}
{$invoice->shipaddress->toString('\n')|raw}
{{endif}}
{$email->language->addToStack("payment_details", FALSE)}
===
{$email->language->addToStack("status", FALSE)}: {$email->language->addToStack("transaction_title_pending", FALSE)}
{$email->language->addToStack("email_payment_method", FALSE)}: {{if $transaction->method}}{$transaction->method->_title}{{else}}{$email->language->addToStack("account_credit", FALSE)}{{endif}}
{$email->language->addToStack("email_transaction_id", FALSE)}: {$transaction->gw_id}
{$email->language->addToStack("date", FALSE)}: {$transaction->date}
{$email->language->addToStack("amount", FALSE)}: {$transaction->amount}
{$email->language->addToStack("order_details", FALSE)}
===
{{foreach $invoiceSummary['items'] as $k => $item}}
{$item->quantity} x</span> {$item->name} [{$email->language->addToStack("each_short", FALSE, array( 'sprintf' => array( $item->price ) ) )}] ({$item->linePrice()->toString( $email->language )})
{{endforeach}}
---
{$email->language->get('subtotal')}: {$invoiceSummary['subtotal']->toString( $email->language )}
{{if count( $invoiceSummary['shipping'] )}}
---
{{foreach $invoiceSummary['shipping'] as $shipping}}
{$shipping->name}: {$shipping->linePrice()->toString( $email->language )}
{{endforeach}}
{{endif}}
{{if count( $invoiceSummary['tax'] )}}
---
{{foreach $invoiceSummary['tax'] as $tax}}
{$tax['name']} ({expression="$tax['rate']*100"}%): {$tax['amount']}
{{endforeach}}
{{endif}}
---
{$email->language->get('total')}: {$invoiceSummary['total']->toString( $email->language )}
-- {setting="board_name"}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>staffNotifyNew</template_name><template_content_html><![CDATA[{{if $request->member == $firstMessage->member and $request->email == $firstMessage->email}}
{$email->language->addToStack("staffnotify_new_header", FALSE, array( 'sprintf' => array( $request->supportAuthor()->name() ) ) )}<br />
{{else}}
{$email->language->addToStack("staffnotify_new_header_on_behalf", FALSE, array( 'sprintf' => array( $firstMessage->member ? $firstMessage->author()->cm_name : $firstMessage->email, $request->supportAuthor()->name() ) ) )}<br />
{{endif}}
<br />
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='background: #f5f5f5'>
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5;">
<h2 style='margin: 0; font-size: 19px; font-weight: 500'>{$request->title}</h2>
{$email->parseTextForEmail( $request->content() )|raw}
<h2 style='margin: 0; font-size: 19px; font-weight: 500'>#{$request->id} {$request->title}</h2>
{$email->parseTextForEmail( $request->content(), $email->language )|raw}
</td>
</tr>
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px; color: #8d8d8d">
{$email->language->addToStack("department", FALSE)}: {$email->language->addToStack("nexus_department_".$request->department->_id, FALSE)} &middot; {$email->language->addToStack("r_severity", FALSE)}: {$email->language->addToStack("nexus_severity_".$request->department->_id, FALSE)}
{$email->language->addToStack("department", FALSE)}: {$email->language->addToStack("nexus_department_".$request->department->_id, FALSE)} &middot; {$email->language->addToStack("r_severity", FALSE)}: {$email->language->addToStack("nexus_severity_".$request->severity->_id, FALSE)}
</td>
</tr>
@@ -661,12 +926,13 @@
<br />
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>
<br />
<div style="font-size: 0px; line-height: 0px; color:#ffffff !important;">{$email->language->addToStack("support_reply_email_id", FALSE, array( 'sprintf' => array( '[SR' . $request->id . '.' . $request->email_key . '.' . $request->comments( 1, NULL, 'date', 'asc', NULL, FALSE )->id . ']' ) ) )}</div>]]></template_content_html><template_data>$request, $email</template_data><template_content_plaintext><![CDATA[
{$email->language->addToStack("staffnotify_new_header", FALSE, array( 'sprintf' => array( $request->supportAuthor()->name() ) ) )}
<div style="font-size: 0px; line-height: 0px; color:#ffffff !important;">{$email->language->addToStack("support_reply_email_id", FALSE, array( 'sprintf' => array( '[SR' . $request->id . '.' . $request->email_key . '.' . $request->comments( 1, NULL, 'date', 'asc', NULL, FALSE )->id . ']' ) ) )}</div>]]></template_content_html><template_data>$request, $firstMessage, $email</template_data><template_content_plaintext><![CDATA[
{{if $request->member == $firstMessage->member and $request->email == $firstMessage->email}}{$email->language->addToStack("staffnotify_new_header", FALSE, array( 'sprintf' => array( $request->supportAuthor()->name() ) ) )}{{else}}{$email->language->addToStack("staffnotify_new_header_on_behalf", FALSE, array( 'sprintf' => array( $firstMessage->member ? $firstMessage->author()->cm_name : $firstMessage->email, $request->supportAuthor()->name() ) ) )}{{endif}}
-----
{$email->language->addToStack("r_id", FALSE)}: {$request->id}
{$email->language->addToStack("r_title", FALSE)}: {$request->title}
{$email->language->addToStack("department", FALSE)}: {$email->language->addToStack("nexus_department_".$request->department->_id)}
{$email->language->addToStack("r_severity", FALSE)}: {$email->language->addToStack("nexus_severity_".$request->department->_id)}
{$email->language->addToStack("r_severity", FALSE)}: {$email->language->addToStack("nexus_severity_".$request->severity->_id)}
-----
{expression="\IPS\Email::buildPlaintextBody( $request->content() )"}
-----
@@ -681,8 +947,8 @@
<table width='100%' cellpadding='15' cellspacing='0' border='0' bgcolor="#f6f0e4" style="border: 3px solid #ecdcb9;">
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5;">
<h2 style='margin: 0; font-size: 19px; font-weight: 500; color: #977b3e !important'>{$message->item()->title}</h2>
{$email->parseTextForEmail( $message->content() )|raw}
<h2 style='margin: 0; font-size: 19px; font-weight: 500; color: #977b3e !important'>#{$message->item()->id} {$message->item()->title}</h2>
{$email->parseTextForEmail( $message->content(), $email->language )|raw}
</td>
</tr>
<tr>
@@ -690,15 +956,15 @@
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td dir='{dir}' width='120' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;"><strong>{$email->language->addToStack("status", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$message->item()->status->_title}</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$email->language->addToStack("nexus_status_".$message->item()->status->_id."_admin", FALSE)}</td>
</tr>
<tr>
<td dir='{dir}' width='120' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;"><strong>{$email->language->addToStack("department", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$message->item()->department->_title}</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$email->language->addToStack("nexus_department_".$message->item()->department->_id, FALSE)}</td>
</tr>
<tr>
<td dir='{dir}' width='120' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;"><strong>{$email->language->addToStack("r_severity", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$message->item()->severity->_title}</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$email->language->addToStack("nexus_severity_".$message->item()->severity->_id, FALSE)}</td>
</tr>
</table>
</td>
@@ -719,10 +985,11 @@
<div style="font-size: 0px; line-height: 0px; color:#ffffff !important;">{$email->language->addToStack("support_reply_email_id", FALSE, array( 'sprintf' => array( '[SR' . $message->item()->id . '.' . $message->item()->email_key . '.' . $message->id . ']' ) ) )}</div>]]></template_content_html><template_data>$message, $email</template_data><template_content_plaintext><![CDATA[
{$email->language->addToStack("staffnotify_note_header", FALSE, array( 'sprintf' => array( $message->author()->name ) ) )}
-----
{$email->language->addToStack("r_id", FALSE)}: {$message->item()->id}
{$email->language->addToStack("r_title", FALSE)}: {$message->item()->title}
{$email->language->addToStack("status", FALSE)}: {$message->item()->status->_title}
{$email->language->addToStack("department", FALSE)}: {$message->item()->department->_title}
{$email->language->addToStack("r_severity", FALSE)}: {$message->item()->severity->_title}
{$email->language->addToStack("status", FALSE)}: {$email->language->addToStack("nexus_status_".$message->item()->status->_id."_admin", FALSE)}
{$email->language->addToStack("department", FALSE)}: {$email->language->addToStack("nexus_department_".$message->item()->department->_id, FALSE)}
{$email->language->addToStack("r_severity", FALSE)}: {$email->language->addToStack("nexus_severity_".$message->item()->severity->_id, FALSE)}
-----
{expression="\IPS\Email::buildPlaintextBody( $message->content() )"}
-----
@@ -744,12 +1011,12 @@
</tr>
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px">
<strong>{$email->language->addToStack("email_timeelapsed", FALSE)}:</strong> {expression="\IPS\DateTime::formatInterval( \IPS\DateTime::ts( time() )->diff( \IPS\DateTime::ts( $request->mapped('date') ) ) )"}
<strong>{$email->language->addToStack("email_timeelapsed", FALSE)}:</strong> {expression="\IPS\DateTime::formatInterval( \IPS\DateTime::ts( time() )->diff( \IPS\DateTime::ts( $request->mapped('date') ) ), 2, $email->language )"}
</td>
</tr>
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px; color: #8d8d8d;">
<strong>{$email->language->addToStack("status", FALSE)}:</strong> {$request->status->_title} &nbsp;&nbsp;&nbsp;<strong>{$email->language->addToStack("department", FALSE)}:</strong> {$request->department->_title} &nbsp;&nbsp;&nbsp;<strong>{$email->language->addToStack("r_severity", FALSE)}:</strong> {$request->severity->_title}
<strong>{$email->language->addToStack("status", FALSE)}:</strong> {$email->language->addToStack("nexus_status_".$request->status->_id."_admin", FALSE)} &nbsp;&nbsp;&nbsp;<strong>{$email->language->addToStack("department", FALSE)}:</strong> {$email->language->addToStack("nexus_department_".$request->department->_id, FALSE)} &nbsp;&nbsp;&nbsp;<strong>{$email->language->addToStack("r_severity", FALSE)}:</strong> {$email->language->addToStack("nexus_severity_".$request->severity->_id, FALSE)}
<br /><br />
</td>
</tr>
@@ -763,7 +1030,7 @@
-----
{{foreach $requests as $request}}
{$request->title} #{$request->id} ({$request->acpUrl()})
{$email->language->addToStack("status", FALSE)}: {$request->status->_title} {$email->language->addToStack("department", FALSE)}: {$request->department->_title} {$email->language->addToStack("r_severity", FALSE)}: {$request->severity->_title}
{$email->language->addToStack("status", FALSE)}: {$email->language->addToStack("nexus_status_".$request->status->_id."_admin", FALSE)} {$email->language->addToStack("department", FALSE)}: {$email->language->addToStack("nexus_department_".$request->department->_id, FALSE)} {$email->language->addToStack("r_severity", FALSE)}: {$email->language->addToStack("nexus_severity_".$request->severity->_id, FALSE)}
{{endforeach}}
-- {setting="board_name"}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>payoutComplete</template_name><template_content_html><![CDATA[
@@ -808,7 +1075,7 @@
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$invoice->member->cm_name}<br />
{$invoice->billaddress->toString('<br />')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('<br />')|raw}{{endif}}
</td>
</tr>
</table>
@@ -907,7 +1174,7 @@
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {$v}<br>
{lang="nexus_pfield_{$k}"}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
@@ -975,7 +1242,7 @@
{$email->language->addToStack("billing_address", FALSE)}
===
{$invoice->member->cm_name}
{$invoice->billaddress->toString('\n')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('\n')|raw}{{endif}}
{{if $invoice->hasPhysicalItems() and $invoice->shipaddress}}
{$email->language->addToStack("shipping_address", FALSE)}
@@ -1014,15 +1281,38 @@
---
{$email->language->get('total')}: {$invoiceSummary['total']->toString( $email->language )}
-- {setting="board_name"}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>replyRequestLocked</template_name><template_content_html><![CDATA[
{$email->language->addToStack("support_bounced")}<br /><br />
{{if $member->member_id AND $request->department->email}}
{$email->language->addToStack("support_bounced_member", FALSE, array( 'sprintf' => $request->department->email))}<br /><br />
<a href='{url="app=nexus&module=support&controller=home&do=create" seoTemplate="support_create" base="front"}' style="color: #ffffff; font-family: 'Helvetica Neue', helvetica, sans-serif; text-decoration: none; font-size: 14px; background: {setting="email_color"}; line-height: 32px; padding: 0 10px; display: inline-block; border-radius: 3px;">{$email->language->addToStack("support_bounced_link", FALSE)}</a>
{{else}}
{$email->language->addToStack("support_bounced_guest", FALSE, array( 'sprintf' => $request->department->email))}
{{endif}}
<br /><br />
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>]]></template_content_html><template_data>$request, $member, $email</template_data><template_content_plaintext><![CDATA[{$email->language->addToStack("support_bounced")}
{{if $member->member_id AND $request->department->email}}
{$email->language->addToStack("support_bounced_member", FALSE, array( 'sprintf' => $request->department->email))}
{$email->language->addToStack("support_bounced_link", FALSE)}: {url="app=nexus&module=support&controller=home&do=create" seoTemplate="support_create" base="front"}
{{else}}
{$email->language->addToStack("support_bounced_guest", FALSE, array( 'sprintf' => $request->department->email))}
{{endif}}
-- {setting="board_name"}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>monitoring_panic</template_name><template_content_html><![CDATA[
{expression="$email->language->addToStack( 'monitor_email_intro', FALSE, array( 'sprintf' => \IPS\Settings::i()->board_name ) )"}
<br />
<br />
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='background: #b52b38; color: #fff;'>
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='color: #b52b38;'>
<tr>
<td dir='{dir}'>
{expression="$email->language->addToStack( 'monitor_email_offline_panic', FALSE, array( 'sprintf' => $server->hostname ) )"}
<strong>{expression="$email->language->addToStack( 'monitor_email_offline_panic', FALSE, array( 'sprintf' => $server->hostname ) )"}</strong>
</td>
</tr>
</table>
@@ -1049,8 +1339,8 @@
<table width='100%' cellpadding='15' cellspacing='0' border='0' bgcolor="#f5f5f5">
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5;">
<h2 style='margin: 0; font-size: 19px; font-weight: 500'>{$message->item()->title}</h2>
{$email->parseTextForEmail( $message->content() )|raw}
<h2 style='margin: 0; font-size: 19px; font-weight: 500'>#{$message->item()->id} {$message->item()->title}</h2>
{$email->parseTextForEmail( $message->content(), $email->language )|raw}
</td>
</tr>
<tr>
@@ -1058,15 +1348,15 @@
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td dir='{dir}' width='120' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;"><strong>{$email->language->addToStack("status", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$message->item()->status->_title}</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$email->language->addToStack("nexus_status_".$message->item()->status->_id."_admin", FALSE)}</td>
</tr>
<tr>
<td dir='{dir}' width='120' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;"><strong>{$email->language->addToStack("department", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$message->item()->department->_title}</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$email->language->addToStack("nexus_department_".$message->item()->department->_id, FALSE)}</td>
</tr>
<tr>
<td dir='{dir}' width='120' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;"><strong>{$email->language->addToStack("r_severity", FALSE)}</strong></td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$message->item()->severity->_title}</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; line-height: 1.5; font-size: 13px;">{$email->language->addToStack("nexus_severity_".$message->item()->severity->_id, FALSE)}</td>
</tr>
</table>
</td>
@@ -1092,9 +1382,10 @@
{$email->language->addToStack("staffnotify_reply_header", FALSE, array( 'sprintf' => array( $message->email ) ) )}
{{endif}}
-----
{$email->language->addToStack("r_id", FALSE)}: {$message->item()->id}
{$email->language->addToStack("r_title", FALSE)}: {$message->item()->title}
{$email->language->addToStack("department", FALSE)}: {$message->item()->department->_title}
{$email->language->addToStack("r_severity", FALSE)}: {$message->item()->severity->_title}
{$email->language->addToStack("department", FALSE)}: {$email->language->addToStack("nexus_department_".$message->item()->department->_id, FALSE)}
{$email->language->addToStack("r_severity", FALSE)}: {$email->language->addToStack("nexus_severity_".$message->item()->severity->_id, FALSE)}
-----
{expression="\IPS\Email::buildPlaintextBody( $message->content() )"}
-----
@@ -1103,7 +1394,7 @@
-- {setting="board_name"}
{$email->language->addToStack("support_reply_email_id", FALSE, array( 'sprintf' => array( '[SR' . $message->item()->id . '.' . $message->item()->email_key . '.' . $message->id . ']' ) ) )}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>transactionHeld</template_name><template_content_html><![CDATA[
{$email->language->addToStack("support_reply_email_id", FALSE, array( 'sprintf' => array( '[SR' . $message->item()->id . '.' . $message->item()->email_key . '.' . $message->id . ']' ) ) )}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>transactionHeld</template_name><template_content_html><![CDATA[<br />
{$email->language->addToStack("email_held_approval", FALSE)}
<br />
<br />
@@ -1114,6 +1405,7 @@
<h3 style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 24px; font-weight: 500; color: #333333; line-height: 21px; margin: 0">
{expression="sprintf( $email->language->get('order_number'), $invoice->id )"}
</h3>
<br />
<a href='{$invoice->url()}' style="color: #ffffff; font-family: 'Helvetica Neue', helvetica, sans-serif; text-decoration: none; font-size: 14px; background: {setting="email_color"}; line-height: 32px; padding: 0 10px; display: inline-block; border-radius: 3px;">{$email->language->addToStack("email_view_order", FALSE)}</a>
<br />
@@ -1132,7 +1424,7 @@
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$invoice->member->cm_name}<br />
{$invoice->billaddress->toString('<br />')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('<br />')|raw}{{endif}}
</td>
</tr>
</table>
@@ -1231,7 +1523,7 @@
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {$v}<br>
{lang="nexus_pfield_{$k}"}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
@@ -1297,7 +1589,7 @@
{$email->language->addToStack("billing_address", FALSE)}
===
{$invoice->member->cm_name}
{$invoice->billaddress->toString('\n')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('\n')|raw}{{endif}}
{{if $invoice->hasPhysicalItems() and $invoice->shipaddress}}
{$email->language->addToStack("shipping_address", FALSE)}
@@ -1396,7 +1688,7 @@
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$invoice->member->cm_name}<br />
{$invoice->billaddress->toString('<br />')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('<br />')|raw}{{endif}}
</td>
</tr>
</table>
@@ -1458,7 +1750,7 @@
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {$v}<br>
{lang="nexus_pfield_{$k}"}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
@@ -1526,7 +1818,7 @@
{$email->language->addToStack("billing_address", FALSE)}
===
{$invoice->member->cm_name}
{$invoice->billaddress->toString('\n')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('\n')|raw}{{endif}}
{{if $invoice->hasPhysicalItems() and $invoice->shipaddress}}
{$email->language->addToStack("shipping_address", FALSE)}
@@ -1597,7 +1889,7 @@
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$invoice->member->cm_name}<br />
{$invoice->billaddress->toString('<br />')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('<br />')|raw}{{endif}}
</td>
</tr>
</table>
@@ -1659,7 +1951,7 @@
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {$v}<br>
{lang="nexus_pfield_{$k}"}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
@@ -1727,7 +2019,7 @@
{$email->language->addToStack("billing_address", FALSE)}
===
{$invoice->member->cm_name}
{$invoice->billaddress->toString('\n')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('\n')|raw}{{endif}}
{{if $invoice->hasPhysicalItems() and $invoice->shipaddress}}
{$email->language->addToStack("shipping_address", FALSE)}
@@ -1801,7 +2093,7 @@
<tr>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{$invoice->member->cm_name}<br />
{$invoice->billaddress->toString('<br />')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('<br />')|raw}{{endif}}
</td>
</tr>
</table>
@@ -1863,7 +2155,7 @@
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 15px; color: #333333; line-height: 21px">
{{if count( $item->details )}}
{{foreach $item->details as $k => $v}}
{lang="nexus_pfield_{$k}"}: {$v}<br>
{lang="nexus_pfield_{$k}"}: {expression="\IPS\nexus\Package\CustomField::load( $k )->displayValue( $v )" raw="true"}<br>
{{endforeach}}
{{endif}}
</td>
@@ -1929,7 +2221,7 @@
{$email->language->addToStack("billing_address", FALSE)}
===
{$invoice->member->cm_name}
{$invoice->billaddress->toString('\n')|raw}
{{if $invoice->billaddress}}{$invoice->billaddress->toString('\n')|raw}{{endif}}
{{if $invoice->hasPhysicalItems() and $invoice->shipaddress}}
{$email->language->addToStack("shipping_address", FALSE)}
@@ -1965,10 +2257,10 @@
<br />
<br />
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='background: #5e707d; color: #fff;'>
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='color: #5e707d;'>
<tr>
<td dir='{dir}'>
{expression="$email->language->addToStack( 'monitor_email_acknowledged', FALSE, array( 'sprintf' => array( $server->hostname, $by ) ) )"}
<strong>{expression="$email->language->addToStack( 'monitor_email_acknowledged', FALSE, array( 'sprintf' => array( $server->hostname, $by ) ) )"}</strong>
</td>
</tr>
</table>
@@ -1989,7 +2281,7 @@
<tr>
<td dir='{dir}'>
<h2 style='margin: 0; font-size: 19px; font-weight: 500'>Re: {$message->item()->title}</h2>
{$email->parseTextForEmail( $message->content() )|raw}
{$email->parseTextForEmail( $message->content(), $email->language )|raw}
</td>
</tr>
</table>
@@ -2169,7 +2461,7 @@
<strong>{$email->language->addToStack("email_purchase_date", FALSE)}</strong>
</td>
<td dir='{dir}' style="font-family: 'Helvetica Neue', helvetica, sans-serif; font-size: 14px; color: #333333; line-height: 21px" align="left">
{$invoice->date->format( 'd F Y' )}
{$invoice->date->localeDate( $email->language )}
</td>
</tr>
<tr>
@@ -2189,17 +2481,17 @@
{$email->language->addToStack("email_purchase_information", FALSE)}
{$email->language->addToStack("email_invoice_number", FALSE)}: {$invoice->id}
{$email->language->addToStack("email_purchase_date", FALSE)}: {$invoice->date->format( 'd F Y' )}
{$email->language->addToStack("email_purchase_date", FALSE)}: {$invoice->date->localeDate( $email->language )}
{$email->language->addToStack("email_order_total", FALSE)}: {$invoice->total->toString( $email->language )}
]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>monitoring_offline</template_name><template_content_html><![CDATA[
{expression="$email->language->addToStack( 'monitor_email_intro', FALSE, array( 'sprintf' => \IPS\Settings::i()->board_name ) )"}
<br />
<br />
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='background: #b52b38; color: #fff;'>
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='color: #b52b38;'>
<tr>
<td dir='{dir}'>
{expression="$email->language->addToStack( 'monitor_email_offline', FALSE, array( 'sprintf' => $server->hostname ) )"}
<strong>{expression="$email->language->addToStack( 'monitor_email_offline', FALSE, array( 'sprintf' => $server->hostname ) )"}</strong>
</td>
</tr>
</table>
@@ -2346,10 +2638,10 @@
<br />
<br />
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='background: #dbe2c9; color: #556b45;'>
<table width='100%' cellpadding='15' cellspacing='0' border='0' style='color: #556b45;'>
<tr>
<td dir='{dir}'>
{expression="$email->language->addToStack( 'monitor_email_online', FALSE, array( 'sprintf' => $server->hostname ) )"}
<strong>{expression="$email->language->addToStack( 'monitor_email_online', FALSE, array( 'sprintf' => $server->hostname ) )"}</strong>
</td>
</tr>
</table>
@@ -2358,7 +2650,7 @@
<em style='color: #8c8c8c'>&mdash; {setting="board_name"}</em>]]></template_content_html><template_data>$server, $encoded, $email</template_data><template_content_plaintext><![CDATA[
{expression="$email->language->addToStack( 'monitor_email_intro', FALSE, array( 'sprintf' => \IPS\Settings::i()->board_name ) )"}
{expression="$email->language->addToStack( 'monitor_email_online', FALSE, array( 'sprintf' => $server->hostname ) )"}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>staffReplyNoChrome</template_name><template_content_html><![CDATA[{$email->parseTextForEmail( $message->content() )|raw}
{expression="$email->language->addToStack( 'monitor_email_online', FALSE, array( 'sprintf' => $server->hostname ) )"}]]></template_content_plaintext></template><template><template_app>nexus</template_app><template_name>staffReplyNoChrome</template_name><template_content_html><![CDATA[{$email->parseTextForEmail( $message->content(), $email->language )|raw}
<div style="font-size: 0px; line-height: 0px; color:#ffffff !important;">{$email->language->addToStack("support_reply_email_id", FALSE, array( 'sprintf' => array( '[SR' . $message->item()->id . '.' . $message->item()->email_key . ']' ) ) )}</div>]]></template_content_html><template_data>$message, $email</template_data><template_content_plaintext><![CDATA[{expression="\IPS\Email::buildPlaintextBody( $message->content() )"}
-----
+20
View File
@@ -67,6 +67,18 @@
"friendly": "store",
"real": "app=nexus&module=store&controller=store"
},
"clientspurchasecancel": {
"friendly": "clients/purchases/{#id}-{?}/cancel",
"real": "app=nexus&module=clients&controller=purchases&do=cancel"
},
"clientspurchaserenew": {
"friendly": "clients/purchases/{#id}-{?}/renew",
"real": "app=nexus&module=clients&controller=purchases&do=renew"
},
"clientspurchaseextra": {
"friendly": "clients/purchases/{#id}-{?}/extra",
"real": "app=nexus&module=clients&controller=purchases&do=extra"
},
"clientspurchase": {
"friendly": "clients/purchases/{#id}-{?}",
"real": "app=nexus&module=clients&controller=purchases&do=view",
@@ -93,6 +105,14 @@
"friendly": "clients/cards",
"real": "app=nexus&module=clients&controller=cards"
},
"clientsbillingagreements": {
"friendly": "clients/billing-agreements",
"real": "app=nexus&module=clients&controller=billingagreements"
},
"clientsbillingagreement": {
"friendly": "clients/billing-agreements/{#id}",
"real": "app=nexus&module=clients&controller=billingagreements&do=view"
},
"clientsalternatives": {
"friendly": "clients/alternative-contacts",
"real": "app=nexus&module=clients&controller=alternatives"
+4
View File
@@ -14,5 +14,9 @@
"clientAreaLink": {
"type": "S",
"class": "\\IPS\\Theme\\class_core_front_global"
},
"Database": {
"type": "C",
"class": "\\IPS\\Data\\Store\\Database"
}
}
+16 -16
View File
@@ -1,18 +1,18 @@
{
"nexus_status_1_front": "Open",
"nexus_status_1_admin": "Open",
"nexus_status_2_front": "On Hold",
"nexus_status_2_admin": "Hold",
"nexus_status_3_front": "Awaiting your reply",
"nexus_status_3_admin": "Closed",
"nexus_status_4_front": "Resolved",
"nexus_status_4_admin": "Resolved",
"nexus_status_4_set": "Mark Resolved",
"nexus_status_5_front": "Marked as Spam - Reply if this is an error",
"nexus_status_5_admin": "Spam",
"nexus_status_6_front": "In Progress",
"nexus_status_6_admin": "Working",
"nexus_severity_1": "Normal",
"cm_phone": "Phone Number",
"nexus_ccfield_1": "Phone Number"
"nexus_status_1_front": "Открыт",
"nexus_status_1_admin": "Открыт",
"nexus_status_2_front": "На рассмотрении",
"nexus_status_2_admin": "На рассмотрении",
"nexus_status_3_front": "Ожидает вашего ответа",
"nexus_status_3_admin": "Закрыто",
"nexus_status_4_front": "Решено",
"nexus_status_4_admin": "Решено",
"nexus_status_4_set": "Отметить решённым",
"nexus_status_5_front": "Отмечено как спам - ответьте, если это ошибка",
"nexus_status_5_admin": "Спам",
"nexus_status_6_front": "В процессе",
"nexus_status_6_admin": "В работе",
"nexus_severity_1": "Обычный",
"cm_phone": "Номер телефона",
"nexus_ccfield_1": "Номер телефона"
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -13,7 +13,7 @@
"protected": 0
},
"clients": {
"default_controller": "splash",
"default_controller": "invoices",
"protected": 0
},
"promotion": {
File diff suppressed because it is too large. Load diff
+34 -6
View File
@@ -1,4 +1,8 @@
[
{
"key": "billing_agreement_gateways",
"default": "0"
},
{
"key": "card_storage_gateways",
"default": "0"
@@ -147,6 +151,10 @@
"key": "nexus_checkreg_usernames",
"default": "0"
},
{
"key": "nexus_checkreg_validate",
"default": "0"
},
{
"key": "nexus_com_rules",
"default": "1"
@@ -183,6 +191,10 @@
"key": "nexus_gift_vouchers_free",
"default": "0"
},
{
"key": "nexus_hosting_allow_change_domain",
"default": "1"
},
{
"key": "nexus_hosting_allow_own_domain",
"default": "1"
@@ -199,6 +211,14 @@
"key": "nexus_hosting_nameservers",
"default": ""
},
{
"key": "nexus_hosting_own_domain_sub",
"default": ""
},
{
"key": "nexus_hosting_own_domains",
"default": ""
},
{
"key": "nexus_hosting_subdomains",
"default": ""
@@ -251,6 +271,14 @@
"key": "nexus_payout_approve",
"default": "1"
},
{
"key": "nexus_payout_max",
"default": ""
},
{
"key": "nexus_payout_max_period",
"default": "[\"1\",\"day\"]"
},
{
"key": "nexus_payout_min",
"default": ""
@@ -263,6 +291,10 @@
"key": "nexus_reg_group",
"default": "0"
},
{
"key": "nexus_require_billing",
"default": "product,giftvoucher,donation,domain,other"
},
{
"key": "nexus_revw_sa",
"default": "0"
@@ -316,11 +348,7 @@
"default": ""
},
{
"key": "support_old_number",
"default": "0"
},
{
"key": "support_old_stat",
"default": "r_last_new_reply"
"key": "reply_request_resolved",
"default": "reopen"
}
]
+1 -1
View File
@@ -1 +1 @@
{"capture":"P0Y0M0DT1H0M0S","sendInvoiceWarnings":"P0Y0M0DT1H0M0S","generateRenewalInvoices":"P0Y0M0DT0H30M0S","expirePurchases":"P0Y0M0DT1H0M0S","expireInvoices":"P0Y0M0DT1H0M0S","supportAutoresolve":"P0Y0M0DT1H0M0S","supportAssignedReminder":"P0Y0M1DT0H0M0S","monitor":"P0Y0M0DT0H5M0S","terminateHosting":"P0Y0M1DT0H0M0S","expectedOutputMonitoring":"P0Y0M0DT0H30M0S"}
{"capture":"P0Y0M0DT1H0M0S","sendInvoiceWarnings":"P0Y0M0DT1H0M0S","generateRenewalInvoices":"P0Y0M0DT0H30M0S","expirePurchases":"P0Y0M0DT1H0M0S","expireInvoices":"P0Y0M0DT1H0M0S","supportAutoresolve":"P0Y0M0DT1H0M0S","supportAssignedReminder":"P0Y0M1DT0H0M0S","monitor":"P0Y0M0DT0H5M0S","terminateHosting":"P0Y0M1DT0H0M0S","expectedOutputMonitoring":"P0Y0M0DT0H30M0S","billingAgreements":"P0Y0M0DT0H10M0S","cartCleanup":"P0Y0M1DT0H0M0S","gatewayPending":"P0Y0M0DT0H2M0S"}
File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -9,6 +9,7 @@
"sc_tab_key": "custom",
"sc_show_in_vse": 0,
"sc_title": "themesetting_cm_store_view",
"sc_order": 10
"sc_order": 10,
"sc_condition": null
}
]
+75 -1
View File
@@ -124,5 +124,79 @@
"101009": "4.1.0 Beta 10",
"101010": "4.1.0",
"101011": "4.1.1",
"101012": "4.1.2"
"101012": "4.1.2",
"101013": "4.1.3",
"101014": "4.1.3.1",
"101015": "4.1.3.2",
"101016": "4.1.4",
"101017": "4.1.4.1",
"101018": "4.1.5",
"101019": "4.1.5.1",
"101020": "4.1.5.2",
"101021": "4.1.6",
"101022": "4.1.6.1",
"101023": "4.1.7",
"101024": "4.1.8",
"101025": "4.1.8.1",
"101026": "4.1.9",
"101027": "4.1.10",
"101028": "4.1.11",
"101029": "4.1.11.1",
"101030": "4.1.12",
"101031": "4.1.12.1",
"101032": "4.1.12.2",
"101033": "4.1.12.3",
"101034": "4.1.13 Beta 1",
"101035": "4.1.13 Beta 2",
"101036": "4.1.13",
"101037": "4.1.13",
"101038": "4.1.13.1",
"101040": "4.1.13.2",
"101041": "4.1.13.2",
"101042": "4.1.14 Beta 1",
"101043": "4.1.14 Beta 2",
"101044": "4.1.14 Beta 3",
"101045": "4.1.14 Beta 4",
"101046": "4.1.14 Beta 5",
"101049": "4.1.14 Beta 6",
"101050": "4.1.14 Beta 7",
"101051": "4.1.14 RC",
"101052": "4.1.14",
"101053": "4.1.14.1",
"101054": "4.1.14.2",
"101055": "4.1.14.3",
"101056": "4.1.15",
"101057": "4.1.15 Beta 1",
"101058": "4.1.15 Beta 2",
"101059": "4.1.15 Beta 2a",
"101060": "4.1.15 Beta 3",
"101061": "4.1.15",
"101062": "4.1.15",
"101063": "4.1.15",
"101064": "4.1.16 Beta 1",
"101065": "4.1.16 Beta 2",
"101066": "4.1.16 Beta 3",
"101067": "4.1.16 Beta 4",
"101068": "4.1.16 Beta 5",
"101069": "4.1.16",
"101070": "4.1.16.1",
"101071": "4.1.17 Beta 1",
"101072": "4.1.17 Beta 1a",
"101073": "4.1.17 Beta 1b",
"101074": "4.1.17 Beta 2",
"101075": "4.1.17 Beta 3",
"101076": "4.1.17 Beta 3",
"101077": "4.1.17",
"101078": "4.1.17.1",
"101079": "4.1.18 Beta 1",
"101082": "4.1.18 Beta 1b",
"101083": "4.1.18 Beta 2",
"101084": "4.1.18 Beta 3",
"101085": "4.1.18",
"101088": "4.1.18.1",
"101089": "4.1.18.2",
"101090": "4.1.19 Beta 1",
"101091": "4.1.19 Beta 2",
"101092": "4.1.19 Beta 3",
"101093": "4.1.19"
}
@@ -2,9 +2,9 @@
/**
* @brief Community Enhancements: EasyPost
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Jun 2014
* @version SVN_VERSION_NUMBER
@@ -2,10 +2,11 @@
/**
* @brief Community Enhancements: eNom
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage 08 Aug 2014
* @package IPS Community Suite
* @subpackage Nexus
* @since 08 Aug 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,9 +2,9 @@
/**
* @brief Community Enhancements: MaxMind
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 07 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -0,0 +1,127 @@
<?php
/**
* @brief Contact Us extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @since 29 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\ContactUs;
/* 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;
}
/**
* Contact Us extension
*/
class _SupportRequest
{
/**
* Process Form
*
* @param \IPS\Helpers\Form $form The form
* @param array $formFields Additional Configuration Formfields
* @param array $options Type Radio Form Options
* @param array $toggles Type Radio Form Toggles
* @param array $disabled Type Radio Form Disabled Options
* @return void
*/
public function process( &$form, &$formFields, &$options, &$toggles, &$disabled )
{
if ( count( \IPS\nexus\Support\Department::roots() ) )
{
$options['contact_nexus_department'] = 'contact_nexus_department';
}
else
{
$options['contact_nexus_no_departments'] = 'contact_nexus_no_departments';
$disabled['contact_nexus_no_departments'] = 'contact_nexus_no_departments';
}
$toggles['contact_nexus_department'] = array( 'contact_nexus' );
if ( count( \IPS\nexus\Support\Department::roots() ) )
{
$formFields[] = new \IPS\Helpers\Form\Node( 'contact_nexus_department', \IPS\Settings::i()->contact_nexus_department , FALSE, array( 'class' => 'IPS\nexus\Support\Department' ), function( $value ){
if( !$value AND \IPS\Request::i()->contact_type == 'contact_nexus_department' )
{
throw new \DomainException( 'form_required' );
}
}, NULL, NULL, 'contact_nexus' );
}
}
/**
* Handle the Form
*
* @param array $values Values from form
* @return bool
*/
public function handleForm( $values )
{
if ( \IPS\Settings::i()->contact_type == 'contact_nexus_department' )
{
$fromEmail = ( \IPS\Member::loggedIn()->member_id ) ? \IPS\Member::loggedIn()->email : $values['email_address'];
$content = $values['contact_text'];
$department = \IPS\nexus\Support\Department::load( \IPS\Settings::i()->contact_nexus_department );
$member = \IPS\Member::loggedIn();
$request = new \IPS\nexus\Support\Request;
$request->status = \IPS\nexus\Support\Status::load( TRUE, 'status_default_member' );
$request->severity = \IPS\nexus\Support\Severity::load( TRUE, 'sev_default' );
$request->last_reply = time();
$request->last_reply_by = (int) $member->member_id;
$request->last_new_reply = time();
$request->started = time();
$request->replies = 1;
$request->title = \IPS\Member::loggedIn()->language()->get( 'contact_nexus_title' );
if ( \IPS\Member::loggedIn()->member_id)
{
$request->member = \IPS\Member::loggedIn()->member_id;
}
else
{
$request->email = $fromEmail;
}
$request->department = $department;
$request->save();
$reply = new \IPS\nexus\Support\Reply;
$reply->request = $request->id;
$reply->member = (int) \IPS\Member::loggedIn()->member_id;
$reply->post = $content;
$reply->type = \IPS\Member::loggedIn()->member_id ? $reply::REPLY_MEMBER : $reply::REPLY_EMAIL;
$reply->date = time();
$reply->email = $fromEmail;
$reply->ip_address = \IPS\Request::i()->ipAddress();
$reply->save();
$request->processAfterCreate( $reply, $values );
$request->sendNotifications();
return TRUE;
}
return FALSE;
}
/**
* Allows extensions to do something before the form is shown... e.g. add your own custom fields, or redirect the page
*
* @param \IPS\Helpers\Form $form The form
* @return void
*/
public function runBeforeFormOutput( &$form )
{
}
}
@@ -2,9 +2,9 @@
/**
* @brief Content Router extension: Reviews
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 05 May 2014
* @version SVN_VERSION_NUMBER
@@ -28,7 +28,7 @@ class _Reviews
* @brief Content Item Classes
*/
public $classes = array();
/**
* Constructor
*
@@ -37,7 +37,12 @@ class _Reviews
*/
public function __construct( \IPS\Member $member = NULL )
{
if ( ( $member === NULL or $member->canAccessModule( \IPS\Application\Module::get( 'nexus', 'store', 'front' ) ) ) and \IPS\Db::i()->select( 'COUNT(*)', 'nexus_packages', array( 'p_store=1 AND p_reviewable=1' ) )->first() )
if( !isset( \IPS\Data\Store::i()->nexusPackagesWithReviews ) )
{
\IPS\Data\Store::i()->nexusPackagesWithReviews = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_packages', array( 'p_store=1 AND p_reviewable=1' ) )->first();
}
if ( ( $member === NULL or $member->canAccessModule( \IPS\Application\Module::get( 'nexus', 'store', 'front' ) ) ) and \IPS\Data\Store::i()->nexusPackagesWithReviews > 0 )
{
$this->classes[] = 'IPS\nexus\Package\Review';
}
@@ -2,10 +2,10 @@
/**
* @brief Dashboard extension: Income
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Dashboard extension: PendingActions
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -104,8 +104,8 @@ class _PendingActions
$openSupportRequests = NULL;
if ( \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() ) . ')' ) ) )
{
$myFilters = \IPS\nexus\Support\Request::myFilters();
$openSupportRequests = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_requests', array( array( "( dpt_staff='*' OR " . \IPS\Db::i()->findInSet( 'dpt_staff', \IPS\nexus\Support\Department::staffDepartmentPerms() ) . ')' ), $myFilters['whereClause'] ) )->join( 'nexus_support_departments', 'dpt_id=r_department' )->first();
$myStream = \IPS\nexus\Support\Stream::myStream();
$openSupportRequests = $myStream->count( \IPS\Member::loggedIn() );
}
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'widgets.css', 'nexus', 'front' ) );
@@ -2,10 +2,10 @@
/**
* @brief Editor Extension: Admin
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -46,7 +46,7 @@ class _Admin
{
return NULL;
}
/**
* Permission check for attachments
*
@@ -76,11 +76,11 @@ class _Admin
{
try
{
$purchase = \IPS\nexus\Purchase::loadFromUrl( new \IPS\Http\Url( $_SERVER['HTTP_REFERER'] ) );
$purchase = \IPS\nexus\Purchase::loadFromUrl( \IPS\Http\Url\Friendly::createFromString( $_SERVER['HTTP_REFERER'] ) );
$options['ps_id'] = $purchase->id;
$options['ps_name'] = $purchase->name;
}
catch ( \OutOfRangeException $e ) { }
catch ( \LogicException $e ) { }
}
$customer->log( 'download', $options );
@@ -2,9 +2,9 @@
/**
* @brief Editor Extension: Customer Fields and Notes
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Aug 2014
* @version SVN_VERSION_NUMBER
@@ -46,7 +46,7 @@ class _Customer
{
return NULL;
}
/**
* Permission check for attachments
*
@@ -54,9 +54,10 @@ class _Customer
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
if ( ( $id3 !== 'note' and $member->member_id == $id1 ) or $member->hasAcpRestriction( 'nexus', 'customers', 'customers_view' ) )
{
@@ -2,9 +2,9 @@
/**
* @brief Editor Extension: Purchase Custom Fields
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 23 Feb 2015
* @version SVN_VERSION_NUMBER
@@ -46,7 +46,7 @@ class _Purchases
{
return NULL;
}
/**
* Permission check for attachments
*
@@ -54,12 +54,35 @@ class _Purchases
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
try
{
return \IPS\nexus\Purchase::load( $id )->canView( $member );
/* If it's in the cart, we have to allow it to be public
so the member can see what they're doing. This is only a
temporary state */
if ( $id3 == 'cart' )
{
return TRUE;
}
/* If it's in an invoice, we can check that */
if ( mb_substr( $id3, 0, 7 ) == 'invoice' )
{
return \IPS\nexus\Invoice::load( intval( mb_substr( $id3, 7 ) ) )->canView( $member );
}
/* If it's in an purchase, we can link to that */
if ( $id3 == 'purchase' )
{
return \IPS\nexus\Purchase::load( $id1 )->canView( $member );
}
/* Still here? Return false */
return FALSE;
}
catch ( \OutOfRangeException $e )
{
@@ -78,6 +101,26 @@ class _Purchases
*/
public function attachmentLookup( $id1, $id2, $id3 )
{
return \IPS\nexus\Purchase::load( $id2 );
/* If it's in the cart, wer obviously can't link to that */
if ( $id3 == 'cart' )
{
throw new \LogicException;
}
/* If it's in an invoice, we can link to that */
if ( mb_substr( $id3, 0, 8 ) == 'invoice-' )
{
$invoice = \IPS\nexus\Invoice::load( intval( mb_substr( $id3, 8 ) ) );
return \IPS\Dispatcher::i()->controllerLocation == 'admin' ? $invoice->acpUrl() : $invoice->url();
}
/* If it's in an purchase, we can link to that */
if ( $id3 == 'purchase' )
{
return \IPS\nexus\Purchase::load( $id1 );
}
/* Still here? No idea */
throw new \LogicException;
}
}
@@ -2,9 +2,9 @@
/**
* @brief Editor Extension: Product Reviews
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 5 May 2014
* @version SVN_VERSION_NUMBER
@@ -46,7 +46,7 @@ class _Store
{
return NULL;
}
/**
* Permission check for attachments
*
@@ -54,9 +54,10 @@ class _Store
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
try
{
@@ -2,9 +2,9 @@
/**
* @brief Editor Extension: Support
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 09 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -44,9 +44,14 @@ class _Support
*/
public function canAttach( $member, $field )
{
if ( $field->options['autoSaveKey'] == 'default_content' )
{
return FALSE;
}
return NULL;
}
/**
* Permission check for attachments
*
@@ -54,8 +59,10 @@ class _Support
* @param int|null $id1 Primary ID
* @param int|null $id2 Secondary ID
* @param string|null $id3 Arbitrary data
* @param array $attachment The attachment data
* @return bool
*/
public function attachmentPermissionCheck( $member, $id1, $id2, $id3 )
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
{
try
{
@@ -89,10 +96,9 @@ class _Support
*/
public function htmlPurifierConfig( \HTMLPurifier_Config $config )
{
$config->set( 'AutoFormat.Linkify', TRUE );
$config->set( 'URI.Munge', (string) \IPS\Http\Url::internal( "app=core&module=system&controller=redirect&url=%s&key=%t&resource=%r", 'front' ) );
$config->set( 'URI.Munge', \IPS\Settings::i()->base_url . 'index.php?app=core&module=system&controller=redirect&url=%s&key=%t&resource=%r' );
$config->set( 'URI.MungeResources', TRUE );
$config->set( 'URI.MungeSecretKey', md5( \IPS\Settings::i()->sql_pass . \IPS\Settings::i()->board_url . \IPS\Settings::i()->sql_database ) );
$config->set( 'URI.MungeSecretKey', \IPS\Settings::i()->site_secret_key );
}
}
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Advertisement Images
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 14 Aug 2014
* @version SVN_VERSION_NUMBER
@@ -77,7 +77,10 @@ class _Ads
foreach ( $images as $key => $location )
{
$images[ $key ] = \IPS\File::repairUrl( $location );
if ( $new = \IPS\File::repairUrl( $location ) )
{
$images[ $key ] = $new;
}
}
\IPS\Db::i()->update( 'core_advertisements', array( 'ad_images' => json_encode( $images ) ), array( 'ad_id=?', $record['ad_id'] ) );
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Customer Fields
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Aug 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Package Groups
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 5 May 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Product Images
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 5 May 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Purchase Custom Fields
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 23 Feb 2015
* @version SVN_VERSION_NUMBER
@@ -140,7 +140,7 @@ class _PurchaseFields
$customFields = \IPS\nexus\Package\CustomField::roots( NULL, NULL, array( 'cf_type=?', 'upload' ) );
if ( count( $customFields ) )
{
foreach ( \IPS\Db::i()->select( '*', 'nexus_purchases', array( "ps_custom_fields LIKE ?", "%{$file}%" ) ) as $purchase )
foreach ( \IPS\Db::i()->select( '*', 'nexus_purchases', array( "ps_custom_fields LIKE ?", "%" . str_replace( '\\', '\\\\', trim( json_encode( (string) $file ), '"' ) . "%" ) ) ) as $purchase )
{
$fieldValues = json_decode( $purchase['ps_custom_fields'], TRUE );
foreach ( $customFields as $field )
@@ -152,7 +152,6 @@ class _PurchaseFields
}
}
}
return FALSE;
}
@@ -2,9 +2,9 @@
/**
* @brief File Storage Extension: Referral Banners
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Aug 2014
* @version SVN_VERSION_NUMBER
@@ -1,11 +1,11 @@
<?php
/**
* @brief File Storage Extension: Support Custom Fields / Severity Icons
* @brief File Storage Extension: Support Custom Fields
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 17 Apr 2014
* @version SVN_VERSION_NUMBER
*/
@@ -20,7 +20,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
}
/**
* File Storage Extension: Support Custom Fields / Severity Icons
* File Storage Extension: Support Custom Fields
*/
class _Support
{
@@ -31,7 +31,7 @@ class _Support
*/
public function count()
{
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_fields', array( 'sf_type=?', 'upload' ) )->first() + \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_severities', 'sev_icon IS NOT NULL' )->first();
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_fields', array( 'sf_type=?', 'upload' ) )->first();
}
/**
@@ -45,17 +45,6 @@ class _Support
*/
public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
{
if ( $offset === 0 )
{
foreach ( \IPS\Db::i()->select( '*', 'nexus_support_severities' ) as $severity )
{
if ( $severity['sev_icon'] )
{
\IPS\Db::i()->update( 'nexus_support_severities', array( 'sev_icon' => \IPS\File::get( $oldConfiguration ?: 'nexus_Support', $severity['sev_icon'] )->move( $storageConfiguration ) ), array( 'sev_id=?', $severity['sev_id'] ) );
}
}
}
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( 'sf_type=?', 'upload' ) );
if ( count( $customFields ) )
{
@@ -110,17 +99,6 @@ class _Support
*/
public function fixUrls( $offset )
{
if ( $offset === 0 )
{
foreach ( \IPS\Db::i()->select( '*', 'nexus_support_severities' ) as $severity )
{
if ( $new = \IPS\File::repairUrl( $severity['sev_icon'] ) )
{
\IPS\Db::i()->update( 'nexus_support_severities', array( 'sev_icon' => $new ), array( 'sev_id=?', $severity['sev_id'] ) );
}
}
}
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( 'sf_type=?', 'upload' ) );
if ( count( $customFields ) )
{
@@ -170,18 +148,11 @@ class _Support
* @return bool
*/
public function isValidFile( $file )
{
try
{
\IPS\Db::i()->select( '*', 'nexus_support_severities', array( 'sev_icon=?', (string) $file ) )->first();
return TRUE;
}
catch ( \UnderflowException $e ) { }
{
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( 'sf_type=?', 'upload' ) );
if ( count( $customFields ) )
{
foreach ( \IPS\Db::i()->select( '*', 'nexus_support_requests', array( "r_cfields LIKE ?", "%{$file}%" ) ) as $request )
foreach ( \IPS\Db::i()->select( '*', 'nexus_support_requests', array( "r_cfields LIKE ?", "%" . str_replace( '\\', '\\\\', trim( json_encode( (string) $file ), '"' ) . "%" ) ) ) as $request )
{
$fieldValues = json_decode( $request['r_cfields'], TRUE );
foreach ( $customFields as $field )
@@ -204,14 +175,6 @@ class _Support
*/
public function delete()
{
foreach ( \IPS\Db::i()->select( '*', 'nexus_support_severities' ) as $severity )
{
if ( $severity['sev_icon'] )
{
\IPS\File::get( 'nexus_Support', $severity['sev_icon'] )->delete();
}
}
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( 'sf_type=?', 'upload' ) );
if ( count( $customFields ) )
{
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Addresses
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,13 @@ class _Addresses extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Alternative Contacts
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,13 @@ class _Alternatives extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -0,0 +1,88 @@
<?php
/**
* @brief Front Navigation Extension: Billing Agreements
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Nexus
* @since 17 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\FrontNavigation;
/* 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;
}
/**
* Front Navigation Extension: Billing Agreements
*/
class _BillingAgreements extends \IPS\core\FrontNavigation\FrontNavigationAbstract
{
/**
* Get Type Title which will display in the AdminCP Menu Manager
*
* @return string
*/
public static function typeTitle()
{
return \IPS\Member::loggedIn()->language()->addToStack('client_billing_agreements');
}
/**
* Can this item be used at all?
* For example, if this will link to a particular feature which has been diabled, it should
* not be available, even if the user has permission
*
* @return bool
*/
public static function isEnabled()
{
return \IPS\Settings::i()->billing_agreement_gateways;
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
* Get Title
*
* @return string
*/
public function title()
{
return \IPS\Member::loggedIn()->language()->addToStack('client_billing_agreements');
}
/**
* Get Link
*
* @return \IPS\Http\Url
*/
public function link()
{
return \IPS\Http\Url::internal( "app=nexus&module=clients&controller=billingagreements", 'front', 'clientsbillingagreements', \IPS\Settings::i()->nexus_https );
}
/**
* Is Active?
*
* @return bool
*/
public function active()
{
return \IPS\Dispatcher::i()->application->directory === 'nexus' and \IPS\Dispatcher::i()->module and \IPS\Dispatcher::i()->module->key === 'clients' and \IPS\Dispatcher::i()->controller == 'billingagreements';
}
}
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Cards
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -33,15 +33,27 @@ class _Cards extends \IPS\core\FrontNavigation\FrontNavigationAbstract
{
return \IPS\Member::loggedIn()->language()->addToStack('client_cards');
}
/**
* Can access?
* Can this item be used at all?
* For example, if this will link to a particular feature which has been diabled, it should
* not be available, even if the user has permission
*
* @return bool
*/
public function canView()
public static function isEnabled()
{
return \IPS\Settings::i()->card_storage_gateways and parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return \IPS\Settings::i()->card_storage_gateways;
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Account Credit
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -34,15 +34,27 @@ class _Credit extends \IPS\core\FrontNavigation\FrontNavigationAbstract
{
return \IPS\Member::loggedIn()->language()->addToStack('client_credit');
}
/**
* Can access?
* Can this item be used at all?
* For example, if this will link to a particular feature which has been diabled, it should
* not be available, even if the user has permission
*
* @return bool
*/
public function canView()
public static function isEnabled()
{
return ( \IPS\Settings::i()->nexus_min_topup or count( json_decode( \IPS\Settings::i()->nexus_payout, TRUE ) ) ) and parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return ( \IPS\Settings::i()->nexus_min_topup or count( json_decode( \IPS\Settings::i()->nexus_payout, TRUE ) ) );
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Donations
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -33,15 +33,27 @@ class _Donations extends \IPS\core\FrontNavigation\FrontNavigationAbstract
{
return \IPS\Member::loggedIn()->language()->addToStack('client_donations');
}
/**
* Can access?
* Can this item be used at all?
* For example, if this will link to a particular feature which has been diabled, it should
* not be available, even if the user has permission
*
* @return bool
*/
public function canView()
public static function isEnabled()
{
return \IPS\Settings::i()->donation_goals and parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return \IPS\Settings::i()->donation_goals;
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Personal Information
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,13 @@ class _Info extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return \IPS\Settings::i()->customer_fields and parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Network Status
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 08 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,25 @@ class _NetworkStatus extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can this item be used at all?
* For example, if this will link to a particular feature which has been diabled, it should
* not be available, even if the user has permission
*
* @return bool
*/
public function canView()
public static function isEnabled()
{
return \IPS\Settings::i()->network_status and parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return \IPS\Settings::i()->network_status;
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Orders
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,13 @@ class _Orders extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Purchases
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,13 @@ class _Purchases extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) ) and \IPS\Db::i()->select( 'COUNT(*)', 'nexus_purchases', array( 'ps_member=? AND ps_show=1', \IPS\Member::loggedIn()->member_id ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) ) and \IPS\Db::i()->select( 'COUNT(*)', 'nexus_purchases', array( 'ps_member=? AND ps_show=1', \IPS\Member::loggedIn()->member_id ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Referrals
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -33,15 +33,27 @@ class _Referrals extends \IPS\core\FrontNavigation\FrontNavigationAbstract
{
return \IPS\Member::loggedIn()->language()->addToStack('client_referrals');
}
/**
* Can access?
* Can this item be used at all?
* For example, if this will link to a particular feature which has been diabled, it should
* not be available, even if the user has permission
*
* @return bool
*/
public function canView()
public static function isEnabled()
{
return \IPS\Settings::i()->cm_ref_on and parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
return \IPS\Settings::i()->cm_ref_on;
}
/**
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canAccessContent()
{
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'clients' ) );
}
/**
@@ -61,7 +73,7 @@ class _Referrals extends \IPS\core\FrontNavigation\FrontNavigationAbstract
*/
public function link()
{
return \IPS\Http\Url::internal( "app=nexus&module=clients&controller=donations", 'front', 'clientsreferrals', \IPS\Settings::i()->nexus_https );
return \IPS\Http\Url::internal( "app=nexus&module=clients&controller=referrals", 'front', 'clientsreferrals', \IPS\Settings::i()->nexus_https );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Store
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,13 @@ class _Store extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'store' ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'store' ) );
}
/**
@@ -71,6 +71,6 @@ class _Store extends \IPS\core\FrontNavigation\FrontNavigationAbstract
*/
public function active()
{
return \IPS\Dispatcher::i()->application->directory === 'nexus' and \IPS\Dispatcher::i()->module and ( \IPS\Dispatcher::i()->module->key === 'store' or \IPS\Dispatcher::i()->module->key === 'clients' );
return \IPS\Dispatcher::i()->application->directory === 'nexus' and \IPS\Dispatcher::i()->module and \IPS\Dispatcher::i()->module->key === 'store';
}
}
@@ -2,9 +2,9 @@
/**
* @brief Front Navigation Extension: Support
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 08 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -35,13 +35,13 @@ class _Support extends \IPS\core\FrontNavigation\FrontNavigationAbstract
}
/**
* Can access?
* Can the currently logged in user access the content this item links to?
*
* @return bool
*/
public function canView()
public function canAccessContent()
{
return parent::canView() and \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'support' ) );
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'support' ) );
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Nexus Incoming Email Handler
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 07 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -27,229 +27,411 @@ class _Support
/**
* Handle email
*
* @param \IPS\Email\Incoming $email The email
* @param \IPS\Email\Incoming\Email $email The email
* @return bool
*/
public function process( \IPS\Email\Incoming $email )
public function process( \IPS\Email\Incoming\Email $email )
{
/* Is it from an actual member? */
$member = \IPS\Member::load( $email->data['from'], 'email' );
$member = \IPS\Member::load( $email->from, 'email' );
/* Replying? */
if ( preg_match( '/\[SR(\d+?)\.(.+?)(\.(\d+))?\]/', $email->data['raw'], $matches ) or preg_match( '/\[SR(\d+?)\.(.+?)(\.(\d+))?\]/', $email->data['message'], $matches ) )
$request = $this->_emailIsReplyForRequest( $email );
$department = $this->_getDepartment( $email );
if ( $request )
{
/* IS this request locked? */
if ( $request->status->is_locked )
{
/* Figure out what we are doing */
switch( \IPS\Settings::i()->reply_request_resolved )
{
case 'reject': // The reply is rejected - let the customer know
$this->_processLocked( $email, $member, $request );
return TRUE;
break;
case 'create': // We are accepting the reply, however we are creating a new request from it rather than opening a new one.
$this->_processNewRequest( $email, $member, $department, $request );
return TRUE;
break;
}
}
/* Still here? Normal reply, or we are just re-opening the request regardless of resolved status - do that */
$this->_processReply( $email, $member, $request );
return TRUE;
}
/* Still here? Make sure the department is valid */
if ( !$department )
{
return FALSE;
}
/* Create request */
$this->_processNewRequest( $email, $member, $department );
return TRUE;
}
/**
* Is reply?
*
* @param \IPS\Email\Incoming\Email $email The email
* @return \IPS\nexus\Support\Request|NULL
* @note The key may come in as quoted printable
* @see <a href='https://invisionpower.com/4bugtrack/active-reports/email-replies-starting-a-new-ticket-r12922/'>Bug Report</a>
*/
protected function _emailIsReplyForRequest( \IPS\Email\Incoming\Email $email )
{
/* Figure out if this email belongs to an existing request */
if (
/* Look for [SRXX.XXX] in the raw content */
preg_match( '/\[SR(\d+?)\.(.+?)(\.(\d+))?\]/', $email->raw, $matches ) or
/* Look for the same in the message */
preg_match( '/\[SR(\d+?)\.(.+?)(\.(\d+))?\]/', $email->message, $matches ) or
/* If neither of those are found, look for the quoted printable version */
preg_match( '/\=5BSR(\d+?)\.(.+?)(\.(\d+))?\=5D/', $email->raw, $matches )
)
{
try
{
$request = \IPS\nexus\Support\Request::load( $matches[1] );
if ( $request->email_key === $matches[2] )
if ( $request->email_key === quoted_printable_decode( $matches[2] ) )
{
$staff = array_key_exists( $member->member_id, \IPS\nexus\Support\Request::staff() );
$pending = FALSE;
$newMessage = NULL;
if ( $staff and isset( $matches[4] ) )
{
$newMessage = $request->comments( 1, 0, 'date', 'desc' );
if ( $matches[4] != $newMessage->id )
{
$pending = TRUE;
}
}
$request->status = \IPS\nexus\Support\Status::load( TRUE, $staff ? 'status_default_staff' : 'status_default_member' );
$request->last_reply = time();
$request->last_reply_by = (int) $member->member_id;
$request->replies++;
$request->save();
$reply = new \IPS\nexus\Support\Reply;
$reply->request = $request->id;
$reply->member = (int) $member->member_id;
$reply->type = $staff ? ( $pending ? $reply::REPLY_PENDING : $reply::REPLY_STAFF ) : $reply::REPLY_EMAIL;
$reply->post = $email->data['message'];
$reply->date = time();
$reply->email = $email->data['from'];
$reply->cc = $email->data['cc'];
$reply->raw = $email->data['raw'];
$reply->textformat = $email->data['alternative'];
$reply->save();
static::makeAndClaimAttachments( $email->data['attachments'], $reply );
if ( $pending )
{
$notifyEmail = \IPS\Email::buildFromTemplate( 'nexus', 'staffReplyPending', array( $reply, $newMessage ) );
$notifyEmail->send( $member );
}
else
{
if ( $staff )
{
$defaultRecipients = $request->getDefaultRecipients();
$reply->sendCustomerNotifications( $defaultRecipients['to'], $defaultRecipients['cc'], $defaultRecipients['bcc'] );
}
$reply->sendNotifications();
}
return TRUE;
return $request;
}
}
catch ( \OutOfRangeException $e ) {}
catch ( \OutOfRangeException $e ) { }
}
/* Nope, creating a new one */
/* If the same email generated a new support request within the last 10 minutes, add this as a reply to that */
try
{
/* Load department */
$department = \IPS\nexus\Support\Department::load( $email->data['to'], 'dpt_email' );
/* Has it been forwarded? */
if ( preg_match( '/^FWD?: (.*)$/i', $email->data['subject'], $matches ) )
{
$originallyFromEmail = NULL;
if ( isset( $email->mail->headers['original-recipient'] ) )
{
$originallyFromEmail = preg_replace( '/^.*;(.*)$/', '$1', $email->mail->headers['original-recipient'] );
}
else
{
if ( preg_match( '/From:.+?(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)/i', $email->data['quoted'], $_matches ) )
{
$originallyFromEmail = $_matches[1];
}
}
if ( $originallyFromEmail )
{
$originallyFrom = \IPS\Member::load( $originallyFromEmail, 'email' );
if ( $member->member_id and array_key_exists( $member->member_id, \IPS\nexus\Support\Request::staff() ) )
{
/* Strip any headers from the forwarded message */
$quoted = $email->data['quoted'];
$haveInitialHeader = FALSE;
$exploded = explode( '<br>', $quoted );
foreach ( $exploded as $k => $line )
{
if ( $line )
{
if ( !$haveInitialHeader and preg_match( '/^.*:/', $line ) )
{
$haveInitialHeader = TRUE;
}
elseif ( !preg_match( '/^.*:.*$/', $line ) )
{
$quoted = implode( '<br>', array_splice( $exploded, $k ) );
break;
}
}
}
$quoted = \IPS\Text\Parser::parseStatic( '<div>' . $quoted . '</div>' );
/* Create request */
$request = new \IPS\nexus\Support\Request;
$request->title = $matches[1];
$request->department = $department;
$request->member = (int) $originallyFrom->member_id;
$request->status = \IPS\nexus\Support\Status::load( TRUE, 'status_default_member' );
$request->severity = \IPS\nexus\Support\Severity::load( TRUE, 'sev_default' );
$request->started = time();
$request->last_reply = time();
$request->last_reply_by = (int) $member->member_id;
$request->last_new_reply = time();
$request->replies = 1;
$request->email = $originallyFromEmail;
$request->save();
/* Create the reply */
$reply = new \IPS\nexus\Support\Reply;
$reply->request = $request->id;
$reply->member = (int) $member->member_id;
$reply->type = $reply::REPLY_EMAIL;
$reply->post = $quoted;
$reply->date = time();
$reply->email = $originallyFromEmail;
$reply->cc = $email->data['cc'];
$reply->raw = $email->data['raw'];
$reply->textformat = $email->data['alternative'];
$reply->save();
/* Create a hidden note */
if ( trim( $email->data['message'] ) or count( $email->data['attachments'] ) )
{
$note = new \IPS\nexus\Support\Reply;
$note->request = $request->id;
$note->member = (int) $member->member_id;
$note->type = $reply::REPLY_HIDDEN;
$note->post = $email->data['message'];
$note->date = time();
$note->email = $email->data['from'];
$note->save();
static::makeAndClaimAttachments( $email->data['attachments'], $note );
}
/* Return */
return TRUE;
}
}
}
/* Nope - normal email */
else
{
/* Create request */
$request = new \IPS\nexus\Support\Request;
$request->title = $email->data['subject'];
$request->department = $department;
$request->member = (int) $member->member_id;
$request->status = \IPS\nexus\Support\Status::load( TRUE, 'status_default_member' );
$request->severity = \IPS\nexus\Support\Severity::load( TRUE, 'sev_default' );
$request->started = time();
$request->last_reply = time();
$request->last_reply_by = (int) $member->member_id;
$request->last_new_reply = time();
$request->replies = 1;
$request->email = $email->data['from'];
$request->save();
/* Create the reply */
$reply = new \IPS\nexus\Support\Reply;
$reply->request = $request->id;
$reply->member = (int) $member->member_id;
$reply->type = $reply::REPLY_EMAIL;
$reply->post = $email->data['message'];
$reply->date = time();
$reply->email = $email->data['from'];
$reply->cc = $email->data['cc'];
$reply->raw = $email->data['raw'];
$reply->textformat = $email->data['alternative'];
$reply->save();
static::makeAndClaimAttachments( $email->data['attachments'], $reply );
/* Send confirmation email */
if ( \IPS\Settings::i()->nexus_sout_autoreply )
{
$confirmationEmail = \IPS\Email::buildFromTemplate( 'nexus', 'emailConfirmation', array( $request ) );
$confirmationEmail->from = $request->department->email;
switch ( \IPS\Settings::i()->nexus_sout_from )
{
case 'staff':
case 'dpt':
$confirmationEmail->fromName = $confirmationEmail->language->get( 'nexus_department_' . $request->department->_id );
break;
default:
$confirmationEmail->fromName = \IPS\Settings::i()->nexus_sout_from;
break;
}
$confirmationEmail->send( $member->member_id ? $member : $email->data['from'] );
}
}
/* Return */
return TRUE;
}
catch ( \OutOfRangeException $e )
{
return FALSE;
$recentRequest = \IPS\Db::i()->select( '*', 'nexus_support_requests', array( 'r_email=? AND r_started>?', $email->from, ( time() - 600 ) ) )->first();
return \IPS\nexus\Support\Request::constructFromData( $recentRequest );
}
catch ( \UnderflowException $e ) { }
/* Still here? It must be a new thing */
return NULL;
}
/**
* Handle reply to locked request
*
* @param \IPS\Email\Incoming\Email $email The email
* @param \IPS\Member $member The member it's from
* @param \IPS|nexus\Support\Request $request The support request
* @return void
*/
protected function _processLocked( \IPS\Email\Incoming\Email $email, \IPS\Member $member, \IPS\nexus\Support\Request $request )
{
\IPS\Email::buildFromTemplate( 'nexus', 'replyRequestLocked', array( $request, $member ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $member->member_id ? $member : $email->from );
}
/**
* Handle reply
*
* @param \IPS\Email\Incoming\Email $email The email
* @param \IPS\Member $member The member it's from
* @param \IPS\nexus\Support\Request $request The support request to make it a reply of
* @return void
*/
protected function _processReply( \IPS\Email\Incoming\Email $email, \IPS\Member $member, \IPS\nexus\Support\Request $request )
{
$staff = array_key_exists( $member->member_id, \IPS\nexus\Support\Request::staff() );
$pending = FALSE;
$newMessage = NULL;
if ( $staff and isset( $matches[4] ) )
{
$newMessage = $request->comments( 1, 0, 'date', 'desc' );
if ( $matches[4] != $newMessage->id )
{
$pending = TRUE;
}
}
$request->status = \IPS\nexus\Support\Status::load( TRUE, $staff ? 'status_default_staff' : 'status_default_member' );
$request->last_reply = time();
$request->last_reply_by = (int) $member->member_id;
$request->replies++;
$request->save();
$reply = new \IPS\nexus\Support\Reply;
$reply->request = $request->id;
$reply->member = (int) $member->member_id;
$reply->type = $staff ? ( $pending ? $reply::REPLY_PENDING : $reply::REPLY_STAFF ) : $reply::REPLY_EMAIL;
$reply->post = $email->message;
$reply->date = time();
$reply->email = $email->from;
$reply->cc = implode( ',', $email->cc );
$reply->raw = $email->raw;
$reply->save();
static::makeAndClaimAttachments( $email->attachments, $reply, $member );
if ( $pending )
{
$notifyEmail = \IPS\Email::buildFromTemplate( 'nexus', 'staffReplyPending', array( $reply, $newMessage ), \IPS\Email::TYPE_TRANSACTIONAL );
$notifyEmail->send( $member );
}
else
{
if ( $staff )
{
$defaultRecipients = $request->getDefaultRecipients();
$reply->sendCustomerNotifications( $defaultRecipients['to'], $defaultRecipients['cc'], $defaultRecipients['bcc'] );
}
$reply->sendNotifications();
}
}
/**
* Get department
*
* @param \IPS\Email\Incoming\Email $email The email
* @return \IPS\nexus\Support\Department
*/
protected function _getDepartment( \IPS\Email\Incoming\Email $email )
{
foreach ( $email->to as $to )
{
try
{
return \IPS\nexus\Support\Department::load( $to, 'dpt_email' );
}
catch ( \OutOfRangeException $e ) { }
}
return NULL;
}
/**
* Handle new requst
*
* @param \IPS\Email\Incoming\Email $email The email
* @param \IPS\Member $member The member it's from
* @param \IPS\nexus\Support\Department $department The department to put it in
* @param \IPS\nexus\Support\Request|NULL $request If this is from a previous request, the request, otherwise NULL
* @return void
*/
protected function _processNewRequest( \IPS\Email\Incoming\Email $email, \IPS\Member $member, \IPS\nexus\Support\Department $department, \IPS\nexus\Support\Request $previousRequest = NULL )
{
/* Make sure we're looking at the right department. */
if ( !is_null( $previousRequest ) )
{
/* Use the existing requests department instead. */
$department = $previousRequest->department;
}
/* Forwarded by a staff member? */
if (
preg_match( '/^FWD?: (.*)$/i', $email->subject, $matches ) // Was forwarded
and $member->member_id and array_key_exists( $member->member_id, \IPS\nexus\Support\Request::staff() ) // By a staff member
and $originallyFromEmail = $this->_originalSenderOfForwardedMessage( $email ) // And we can get the email address of the original sender
) {
list( $request, $reply ) = $this->_createRequestFromStaffForward( $email, $member, $department, $originallyFromEmail );
}
/* Nope, normal request */
else
{
list( $request, $reply ) = $this->_createNormalNewRequest( $email, $member, $department );
}
/* Send staff notifications */
$request->afterCreateLog( $reply );
if ( $previousRequest )
{
$request->log( 'previous_request', $previousRequest, NULL, $member );
$previousRequest->log( 'previous_request', NULL, $request, $member );
}
$request->sendNotifications();
}
/**
* Handle new request for an email that was forwarded by a staff member
*
* @param \IPS\Email\Incoming\Email $email The email
* @param \IPS\Member $member The member it's from
* @param \IPS\nexus\Support\Department $department The department to put it in
* @param string $originallyFromEmail The email address of the original sender
* @return [ \IPS\nexus\Support\Request, \IPS\nexus\Support\Reply ]
*/
protected function _createRequestFromStaffForward( \IPS\Email\Incoming\Email $email, \IPS\Member $member, \IPS\nexus\Support\Department $department, $originallyFromEmail )
{
/* Get the member for the original email */
$originallyFrom = \IPS\Member::load( $originallyFromEmail, 'email' );
/* Init request */
$request = $this->_initRequest( $member, $department );
preg_match( '/^FWD?: (.*)$/i', $email->subject, $matches );
$request->title = $matches[1];
$request->member = (int) $originallyFrom->member_id;
$request->email = $originallyFromEmail;
$request->save();
/* Strip any headers from the forwarded message */
$quoted = $email->quote;
$haveInitialHeader = FALSE;
$exploded = explode( '<br>', $quoted );
foreach ( $exploded as $k => $line )
{
if ( $line )
{
if ( !$haveInitialHeader and preg_match( '/^.*:/', $line ) )
{
$haveInitialHeader = TRUE;
}
elseif ( !preg_match( '/^.*:.*$/', $line ) )
{
$quoted = implode( '<br>', array_splice( $exploded, $k ) );
break;
}
}
}
$quoted = \IPS\Text\Parser::parseStatic( '<div>' . $quoted . '</div>' );
/* Create the reply */
$reply = $this->_createReply( $email, $request, $member, $quoted, $originallyFromEmail );
/* Create a hidden note */
if ( trim( $email->message ) or count( $email->attachments ) )
{
$note = new \IPS\nexus\Support\Reply;
$note->request = $request->id;
$note->member = (int) $member->member_id;
$note->type = $reply::REPLY_HIDDEN;
$note->post = $email->message;
$note->date = time();
$note->email = $email->from;
$note->save();
static::makeAndClaimAttachments( $email->attachments, $note, $member );
}
/* Return */
return array( $request, $reply );
}
/**
* Handle new request from a normal email
*
* @param \IPS\Email\Incoming\Email $email The email
* @param \IPS\Member $member The member it's from
* @param \IPS\nexus\Support\Department $department The department to put it in
* @return [ \IPS\nexus\Support\Request, \IPS\nexus\Support\Reply ]
*/
protected function _createNormalNewRequest( \IPS\Email\Incoming\Email $email, \IPS\Member $member, \IPS\nexus\Support\Department $department )
{
/* Init request */
$request = $this->_initRequest( $member, $department );
$request->title = $email->subject;
$request->member = (int) $member->member_id;
$request->email = $email->from;
$request->save();
/* Create the reply */
$reply = $this->_createReply( $email, $request, $member, $email->message . $email->quote, $email->from );
static::makeAndClaimAttachments( $email->attachments, $reply, $member );
/* Send confirmation email */
if ( \IPS\Settings::i()->nexus_sout_autoreply )
{
$confirmationEmail = \IPS\Email::buildFromTemplate( 'nexus', 'emailConfirmation', array( $request ), \IPS\Email::TYPE_TRANSACTIONAL );
switch ( \IPS\Settings::i()->nexus_sout_from )
{
case 'staff':
case 'dpt':
$fromName = $member->language()->get( 'nexus_department_' . $request->department->_id );
break;
default:
$fromName = \IPS\Settings::i()->nexus_sout_from;
break;
}
$confirmationEmail->send( $member->member_id ? $member : $email->from, array(), array(), $request->department->email, $fromName );
}
/* Return */
return array( $request, $reply );
}
/**
* Create a basic support request object
*
* @param \IPS\Member $member The member it's from
* @param \IPS\nexus\Support\Department $department The department to put it in
* @return \IPS\nexus\Support\Request
*/
protected function _initRequest( \IPS\Member $member, \IPS\nexus\Support\Department $department )
{
$request = new \IPS\nexus\Support\Request;
$request->department = $department;
$request->status = \IPS\nexus\Support\Status::load( TRUE, 'status_default_member' );
$request->severity = \IPS\nexus\Support\Severity::load( TRUE, 'sev_default' );
$request->started = time();
$request->last_reply = time();
$request->last_reply_by = (int) $member->member_id;
$request->last_new_reply = time();
$request->replies = 1;
return $request;
}
/**
* Create a basic support reply object
*
* @param \IPS\Email\Incoming\Email $email The email
* @param \IPS\nexus\Support\Request $request The request it's for
* @param \IPS\Member $member The member it's from
* @param string $message The message body
* @param string $emailFrom The email address it is from
* @return \IPS\nexus\Support\Reply
*/
protected function _createReply( \IPS\Email\Incoming\Email $email, \IPS\nexus\Support\Request $request, \IPS\Member $member, $message, $emailFrom )
{
$reply = new \IPS\nexus\Support\Reply;
$reply->request = $request->id;
$reply->member = (int) $member->member_id;
$reply->type = $reply::REPLY_EMAIL;
$reply->post = $message;
$reply->date = time();
$reply->email = $emailFrom;
$reply->cc = implode( ',', $email->cc );
$reply->raw = $email->raw;
$reply->save();
return $reply;
}
/**
* If this message was forwarded by a staff member, get the
* email address it was sent to that staff member from (i.e.
* the user who should show as creating the support request)
*
* @param \IPS\Email\Incoming\Email $email The email
* @return bool
*/
protected function _originalSenderOfForwardedMessage( \IPS\Email\Incoming\Email $email )
{
$originallyFrom = NULL;
if ( isset( $email->headers['original-recipient'] ) )
{
$originallyFrom = preg_replace( '/^.*;(.*)$/', '$1', $email->headers['original-recipient'] );
}
else
{
if ( preg_match( '/From:.+?(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)/i', $email->quote, $_matches ) )
{
$originallyFrom = $_matches[1];
}
}
return $originallyFrom;
}
/**
@@ -257,13 +439,19 @@ class _Support
*
* @param array $files \IPS\File objects
* @param \IPS\nexus\Support\Reply $reply The support request reply
* @param \IPS\Member $member The member it's from
* @return void
*/
public static function makeAndClaimAttachments( array $files, \IPS\nexus\Support\Reply $reply )
public static function makeAndClaimAttachments( array $files, \IPS\nexus\Support\Reply $reply, \IPS\Member $member )
{
$replacements = array();
foreach ( $files as $file )
{
$attachment = $file->makeAttachment('');
$attachment = $file->makeAttachment('', $member);
if ( !$file->isImage() )
{
$replacements["<fileStore.core_Attachment>/{$file}"] = \IPS\Settings::i()->base_url . "applications/core/interface/file/attachment.php?id={$attachment['attach_id']}";
}
\IPS\Db::i()->insert( 'core_attachments_map', array(
'attachment_id' => $attachment['attach_id'],
@@ -272,5 +460,14 @@ class _Support
'id2' => $reply->id,
) );
}
if ( count( $replacements ) )
{
foreach ( $replacements as $find => $replace )
{
$reply->post = str_replace( $find, $replace, $reply->post );
}
$reply->save();
}
}
}
@@ -2,10 +2,10 @@
/**
* @brief IP Address Lookup extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -24,6 +24,28 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Payouts
{
/**
* Supported in the ACP IP address lookup tool?
*
* @return bool
* @note If the method does not exist in an extension, the result is presumed to be TRUE
*/
public function supportedInAcp()
{
return TRUE;
}
/**
* Supported in the ModCP IP address lookup tool?
*
* @return bool
* @note If the method does not exist in an extension, the result is presumed to be TRUE
*/
public function supportedInModCp()
{
return FALSE;
}
/**
* Find Records by IP
*
@@ -36,10 +58,13 @@ class _Payouts
/* Return count */
if ( $baseUrl === NULL )
{
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_payouts', array( "po_ip LIKE CONCAT( ?, '%' )", $ip ) )->first();
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_payouts', array( "po_ip LIKE ?", $ip ) )->first();
}
return (string) \IPS\nexus\Payout::table( array( "po_ip LIKE CONCAT( ?, '%' )", $ip ), $baseUrl );
$table = \IPS\nexus\Payout::table( array( "po_ip LIKE ?", $ip ), $baseUrl );
$table->include[] = 'po_ip';
return (string) $table;
}
/**
@@ -2,10 +2,10 @@
/**
* @brief IP Address Lookup extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -24,6 +24,28 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Support
{
/**
* Supported in the ACP IP address lookup tool?
*
* @return bool
* @note If the method does not exist in an extension, the result is presumed to be TRUE
*/
public function supportedInAcp()
{
return TRUE;
}
/**
* Supported in the ModCP IP address lookup tool?
*
* @return bool
* @note If the method does not exist in an extension, the result is presumed to be TRUE
*/
public function supportedInModCp()
{
return TRUE;
}
/**
* Find Records by IP
*
@@ -36,7 +58,7 @@ class _Support
/* Return count */
if ( $baseUrl === NULL )
{
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_replies', array( "reply_ip_address LIKE CONCAT( ?, '%' )", $ip ) )->first();
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_replies', array( "reply_ip_address LIKE ?", $ip ) )->first();
}
$class = new \IPS\core\extensions\core\IpAddresses\Content;
@@ -2,10 +2,10 @@
/**
* @brief IP Address Lookup extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -24,6 +24,28 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Transactions
{
/**
* Supported in the ACP IP address lookup tool?
*
* @return bool
* @note If the method does not exist in an extension, the result is presumed to be TRUE
*/
public function supportedInAcp()
{
return TRUE;
}
/**
* Supported in the ModCP IP address lookup tool?
*
* @return bool
* @note If the method does not exist in an extension, the result is presumed to be TRUE
*/
public function supportedInModCp()
{
return FALSE;
}
/**
* Find Records by IP
*
@@ -36,10 +58,13 @@ class _Transactions
/* Return count */
if ( $baseUrl === NULL )
{
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_transactions', array( "t_ip LIKE CONCAT( ?, '%' )", $ip ) )->first();
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_transactions', array( "t_ip LIKE ?", $ip ) )->first();
}
return (string) \IPS\nexus\Transaction::table( array( array( "t_ip LIKE CONCAT( ?, '%' )", $ip ) ), $baseUrl );
$table = \IPS\nexus\Transaction::table( array( array( "t_ip LIKE ?", $ip ) ), $baseUrl );
$table->include[] = 't_ip';
return (string) $table;
}
/**
@@ -2,10 +2,10 @@
/**
* @brief ACP Live Search Extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -154,4 +154,14 @@ class _Nexus
return $results;
}
/**
* Is default for current page?
*
* @return bool
*/
public function isDefault()
{
return \IPS\Dispatcher::i()->application->directory == 'nexus';
}
}
@@ -0,0 +1,36 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Commerce
* @since 30 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\MFAArea;
/* 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;
}
/**
* Multi-Factor Authentication Area
*/
class _AccountCredit
{
/**
* Is this area available and should show in the ACP configuration?
*
* @return bool
*/
public function isEnabled()
{
return ( \IPS\Settings::i()->nexus_min_topup or count( json_decode( \IPS\Settings::i()->nexus_payout, TRUE ) ) );
}
}
@@ -0,0 +1,36 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Commerce
* @since 30 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\MFAArea;
/* 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;
}
/**
* Multi-Factor Authentication Area
*/
class _Addresses
{
/**
* Is this area available and should show in the ACP configuration?
*
* @return bool
*/
public function isEnabled()
{
return TRUE;
}
}
@@ -0,0 +1,36 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Commerce
* @since 30 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\MFAArea;
/* 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;
}
/**
* Multi-Factor Authentication Area
*/
class _Alternatives
{
/**
* Is this area available and should show in the ACP configuration?
*
* @return bool
*/
public function isEnabled()
{
return TRUE;
}
}
@@ -0,0 +1,36 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Commerce
* @since 30 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\MFAArea;
/* 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;
}
/**
* Multi-Factor Authentication Area
*/
class _BillingAgreements
{
/**
* Is this area available and should show in the ACP configuration?
*
* @return bool
*/
public function isEnabled()
{
return \IPS\Settings::i()->billing_agreement_gateways;
}
}
@@ -0,0 +1,36 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Commerce
* @since 30 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\MFAArea;
/* 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;
}
/**
* Multi-Factor Authentication Area
*/
class _BillingInfo
{
/**
* Is this area available and should show in the ACP configuration?
*
* @return bool
*/
public function isEnabled()
{
return TRUE;
}
}
@@ -0,0 +1,36 @@
<?php
/**
* @brief Multi-Factor Authentication Area
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @subpackage Commerce
* @since 30 Sep 2016
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\MFAArea;
/* 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;
}
/**
* Multi-Factor Authentication Area
*/
class _Cards
{
/**
* Is this area available and should show in the ACP configuration?
*
* @return bool
*/
public function isEnabled()
{
return \IPS\Settings::i()->card_storage_gateways;
}
}
@@ -1,16 +1,16 @@
<?php
/**
* @brief Bulk mail extension
* @brief Member filter extension
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage Commerce
* @package IPS Community Suite
* @subpackage Nexus
* @since 20 Apr 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\nexus\extensions\core\BulkMail;
namespace IPS\nexus\extensions\core\MemberFilter;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
@@ -20,7 +20,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
}
/**
* Bulk mail extension
* Member filter extension
*/
class _Purchases
{
@@ -84,7 +84,7 @@ class _Purchases
{
if ( isset( $data['nexus_bm_filters_packages'] ) and $data['nexus_bm_filters_packages'] )
{
return 'ps_id IS NOT NULL';
return 'nexus_purchases.ps_id IS NOT NULL';
}
return NULL;
}
@@ -2,10 +2,10 @@
/**
* @brief Admin CP Member Form
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Sep 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,10 +2,10 @@
/**
* @brief Member Sync
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage
* @package IPS Community Suite
* @subpackage Nexus
* @since 31 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -105,6 +105,10 @@ class _Nexus
\IPS\Db::i()->update( 'nexus_referrals', array( 'member_id' => $member->member_id ), array( 'member_id=?', $member2->member_id ) );
\IPS\Db::i()->update( 'nexus_referrals', array( 'referred_by' => $member->member_id ), array( 'referred_by=?', $member2->member_id ) );
\IPS\Db::i()->update( 'nexus_transactions', array( 't_member' => $member->member_id ), array( 't_member=?', $member2->member_id ) );
\IPS\Db::i()->update( 'nexus_alternate_contacts', array( 'main_id' => $member->member_id ), array( 'main_id=?', $member2->member_id ) );
\IPS\Db::i()->update( 'nexus_alternate_contacts', array( 'alt_id' => $member->member_id ), array( 'alt_id=?', $member2->member_id ) );
\IPS\Db::i()->update( 'nexus_support_streams', array( 'stream_owner' => $member->member_id ), array( 'stream_owner=?', $member2->member_id ) );
\IPS\Db::i()->update( 'nexus_billing_agreements', array( 'ba_member' => $member->member_id ), array( 'ba_member=?', $member2->member_id ) );
}
/**
@@ -120,13 +124,26 @@ class _Nexus
\IPS\Db::i()->delete( 'nexus_customer_history', array( 'log_member=?', $member->member_id ) );
\IPS\Db::i()->delete( 'nexus_customers', array( 'member_id=?', $member->member_id ) );
\IPS\Db::i()->delete( 'nexus_referrals', array( 'referred_by=?', $member->member_id ) ); // Don't delete the record for the referrer if this is the referree as that's still relevant for the referree's account
\IPS\Db::i()->delete( 'nexus_alternate_contacts', array( 'main_id=? OR alt_id =?', $member->member_id, $member->member_id ) );
\IPS\Db::i()->delete( 'nexus_support_request_log', array( "rlog_member=?", $member->member_id ) );
\IPS\Db::i()->update( 'nexus_support_requests', array( 'r_staff' => 0 ), array( "r_staff=?", $member->member_id ) );
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_purchases', array( 'ps_member=?', $member->member_id ) ), 'IPS\nexus\Purchase' ) as $purchase )
{
$purchase->delete();
}
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_billing_agreements', array( 'ba_member=?', $member->member_id ) ), '\IPS\nexus\Customer\BillingAgreement' ) as $agreement )
{
try
{
$agreement->cancel();
}
catch ( \Exception $e ) {}
}
\IPS\Db::i()->update( 'nexus_purchases', array( 'ps_pay_to' => 0 ), array( 'ps_pay_to=?', $member->member_id ) );
\IPS\Db::i()->delete( 'nexus_support_streams', array( 'stream_owner=?', $member->member_id ) );
}
/**
@@ -153,4 +170,48 @@ class _Nexus
{
\IPS\nexus\Customer::load( $member->member_id )->log( 'info', array( 'password' => '' ) );
}
}
/**
* Member account has been updated
*
* @param $member \IPS\Member Member updating profile
* @param $changes array The changes
* @return void
*/
public function onProfileUpdate( $member, $changes )
{
$refresh = FALSE;
$adminGroups = array_keys( \IPS\Member::administrators()['g'] );
if ( $member->inGroup( $adminGroups ) )
{
$refresh = TRUE;
}
/* Moving out of an admin group? */
if ( $refresh === FALSE AND ( isset( $changes['member_group_id'] ) OR isset( $changes['mgroup_others'] ) ) )
{
if ( isset( $changes['member_group_id'] ) AND in_array( $changes['member_group_id'], $adminGroups ) )
{
$refresh = TRUE;
}
if ( isset( $changes['mgroup_others'] ) )
{
foreach( explode( ',', $changes['mgroup_others'] ) AS $group )
{
if ( in_array( $group, $adminGroups ) )
{
$refresh = TRUE;
break;
}
}
}
}
if ( $refresh === TRUE )
{
unset( \IPS\Data\Store::i()->supportStaff );
}
}
}
@@ -2,9 +2,10 @@
/**
* @brief Template Plugin - Length
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 20 Oct 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,9 +2,10 @@
/**
* @brief Template Plugin - Money
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 6 Mar 2014
* @version SVN_VERSION_NUMBER
*/
@@ -46,7 +47,7 @@ class _Money
}
else
{
$options['currency'] = "( isset( \$_SESSION['currency'] ) ? \$_SESSION['currency'] : \\IPS\\nexus\\Customer::loggedIn()->defaultCurrency() )";
$options['currency'] = "( ( isset( \$_SESSION['currency'] ) and in_array( \$_SESSION['currency'], \\IPS\\nexus\\Money::currencies() ) ) ? \$_SESSION['currency'] : \\IPS\\nexus\\Customer::loggedIn()->defaultCurrency() )";
}
return 'new \IPS\nexus\Money( ' . $data . ", {$options['currency']} )";
@@ -2,9 +2,10 @@
/**
* @brief Template Plugin - Weight
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 20 Oct 2014
* @version SVN_VERSION_NUMBER
*/
@@ -2,9 +2,9 @@
/**
* @brief Account Credit Increase
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 25 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -90,7 +90,7 @@ class _AccountCreditIncrease extends \IPS\nexus\Invoice\Item\Charge
$credits = $invoice->member->cm_credits;
$oldAmount = $credits[ $this->price->currency ]->amount;
$credits[ $this->price->currency ]->amount += $this->price->amount;
$credits[ $this->price->currency ]->amount = $credits[ $this->price->currency ]->amount->add( $this->price->amount );
$invoice->member->cm_credits = $credits;
$invoice->member->save();
@@ -117,7 +117,7 @@ class _AccountCreditIncrease extends \IPS\nexus\Invoice\Item\Charge
$message = \IPS\Member::loggedIn()->language()->addToStack('account_credit_remove', FALSE, array( 'sprintf' => array( $this->price, $invoice->member->cm_name ) ) );
$credits = $invoice->member->cm_credits;
if ( ( $credits[ $this->price->currency ]->amount - $this->price->amount ) < 0 )
if ( !$credits[ $this->price->currency ]->amount->subtract( $this->price->amount )->isPositive() )
{
$return[] = array( 'message' => $message, 'warning' => \IPS\Member::loggedIn()->language()->addToStack('account_credit_remove_neg') );
}
@@ -141,7 +141,7 @@ class _AccountCreditIncrease extends \IPS\nexus\Invoice\Item\Charge
$credits = $invoice->member->cm_credits;
$oldAmount = $credits[ $this->price->currency ]->amount;
$credits[ $this->price->currency ]->amount -= $this->price->amount;
$credits[ $this->price->currency ]->amount = $credits[ $this->price->currency ]->amount->subtract( $this->price->amount );
$invoice->member->cm_credits = $credits;
$invoice->member->save();
@@ -2,9 +2,9 @@
/**
* @brief Bandwidth
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 11 Sep 2014
* @version SVN_VERSION_NUMBER
@@ -66,7 +66,7 @@ class _Bandwidth extends \IPS\nexus\Invoice\Item\Purchase
try
{
$account = \IPS\nexus\Hosting\Account::load( $purchase->parent );
$account->changeBandWidthLimit( $account->monthlyBandwidthAllowance() + ( $purchase->extra['bwAmount'] * 1000000 ) );
$account->changeBandWidthLimit( ( ( $account->monthlyBandwidthAllowance() / 1048576 / 1.024 ) + $purchase->extra['bwAmount'] ) * 1048576 / 1.024 );
}
catch ( \IPS\nexus\Hosting\Exception $e )
{
@@ -108,7 +108,7 @@ class _Bandwidth extends \IPS\nexus\Invoice\Item\Purchase
try
{
$account = \IPS\nexus\Hosting\Account::load( $purchase->parent );
$account->changeBandWidthLimit( $account->monthlyBandwidthAllowance() - ( $purchase->extra['bwAmount'] * 1000000 ) );
$account->changeBandWidthLimit( ( ( $account->monthlyBandwidthAllowance() / 1048576 / 1.024 ) - $purchase->extra['bwAmount'] ) * 1048576 / 1.024 );
}
catch ( \IPS\nexus\Hosting\Exception $e )
{
@@ -116,4 +116,15 @@ class _Bandwidth extends \IPS\nexus\Invoice\Item\Purchase
}
catch ( \OutOfRangeException $e ) { }
}
/**
* Requires Billing Address
*
* @return bool
* @throws \DomainException
*/
public function requiresBillingAddress()
{
return in_array( 'other', explode( ',', \IPS\Settings::i()->nexus_require_billing ) );
}
}
@@ -2,9 +2,9 @@
/**
* @brief Coupon Discount
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 12 May 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Custom Package
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 07 Aug 2014
* @version SVN_VERSION_NUMBER
@@ -70,12 +70,13 @@ class _CustomPackage extends \IPS\nexus\extensions\nexus\Item\Package
require_once $file->getPathname();
$key = mb_substr( $file, 0, -4 );
$class = 'IPS\nexus\Package\_' . $key;
$autoloadClass = "IPS\\nexus\\Package\\{$key}";
if ( class_exists( $class, FALSE ) and in_array( 'IPS\nexus\Package', class_parents( $class ) ) )
{
$forceShow = TRUE;
$types[ mb_strtolower( $key ) ] = 'p_type_' . $key;
foreach ( $class::acpFormFields( new $class, TRUE ) as $group => $fields )
foreach ( $autoloadClass::acpFormFields( new $autoloadClass, TRUE ) as $group => $fields )
{
foreach ( $fields as $field )
{
@@ -198,7 +199,13 @@ class _CustomPackage extends \IPS\nexus\extensions\nexus\Item\Package
$values['p_images'] = array();
$values['p_group'] = new \StdClass;
$values['p_group']->id = 0;
$renewTerm = $values['p_renews'] ? new \IPS\nexus\Purchase\RenewalTerm( new \IPS\nexus\Money( \IPS\Request::i()->p_renew_options['amount'], \IPS\Request::i()->p_renew_options['currency'] ), new \DateInterval( 'P' . \IPS\Request::i()->p_renew_options['term'] . mb_strtoupper( \IPS\Request::i()->p_renew_options['unit'] ) ), NULL, FALSE ) : NULL;
$renewTerm = $values['p_renews'] ?
new \IPS\nexus\Purchase\RenewalTerm(
new \IPS\nexus\Money( \IPS\Request::i()->p_renew_options['amount'], ( isset( \IPS\Request::i()->p_renew_options['currency'] ) ) ? \IPS\Request::i()->p_renew_options['currency'] : $invoice->currency ),
new \DateInterval( 'P' . \IPS\Request::i()->p_renew_options['term'] . mb_strtoupper( \IPS\Request::i()->p_renew_options['unit'] ) ),
NULL,
FALSE
) : NULL;
$values['p_renew_options'] = array();
/* Save */
@@ -361,7 +368,6 @@ class _CustomPackage extends \IPS\nexus\extensions\nexus\Item\Package
$package = \IPS\nexus\Package::load( $purchase->item_id );
$package->_removeUsergroups( $purchase );
$resetLkey = FALSE;
$updateLkey = FALSE;
$deleteLkey = FALSE;
@@ -402,8 +408,7 @@ class _CustomPackage extends \IPS\nexus\extensions\nexus\Item\Package
$package->page = $values['p_page'];
$package->support = ( $values['p_support'] and $values['p_support_department'] ) ? $values['p_support_department']->id : 0;
$package->save();
$package->_addUsergroups( $purchase );
if ( $resetLkey or $updateLkey or $deleteLkey )
{
if ( $resetLkey or $deleteLkey )
@@ -2,9 +2,9 @@
/**
* @brief Dedicated Server
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 07 Aug 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Domain
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 08 Aug 2014
* @version SVN_VERSION_NUMBER
@@ -128,10 +128,25 @@ class _Domain extends \IPS\nexus\Invoice\Item\Purchase
try
{
$enom->register( $purchase->extra['sld'], $purchase->extra['tld'], $purchase->extra['nameservers'], $invoice->member, $invoice->billaddress );
if ( isset( $purchase->extra['registerTo'] ) )
{
try
{
$account = \IPS\nexus\Hosting\Account::load( $purchase->extra['registerTo'] );
$account->domain = $purchase->extra['sld'] . '.' . $purchase->extra['tld'];
$account->save();
$account->changeDomain( $account->domain );
}
catch ( \Exception $e )
{
\IPS\Log::log( $e, 'domain_assignment' );
}
}
}
catch ( \Exception $e )
{
\IPS\Log::i( \LOG_ERR )->write( 'eNom: ' . $e->getMessage() );
\IPS\Log::log( $e, 'enom' );
}
}
@@ -174,7 +189,36 @@ class _Domain extends \IPS\nexus\Invoice\Item\Purchase
}
catch ( \Exception $e )
{
\IPS\Log::i( \LOG_ERR )->write( 'eNom: ' . $e->getMessage() );
\IPS\Log::log( $e, 'enom' );
}
}
/**
* Requires Billing Address
*
* @return bool
* @throws \DomainException
*/
public function requiresBillingAddress()
{
return in_array( 'domain', explode( ',', \IPS\Settings::i()->nexus_require_billing ) );
}
/**
* Get ACP Page HTML
*
* @return string
*/
public static function acpPage( \IPS\nexus\Purchase $purchase )
{
try
{
$domain = new \IPS\nexus\DomainLookup( $purchase->extra['sld'] . '.' . $purchase->extra['tld'] );
return \IPS\Theme::i()->getTemplate('purchases')->domain( array_unique( $domain->whois ) );
}
catch ( \OutOfRangeException $e )
{
return '';
}
}
}
@@ -2,9 +2,9 @@
/**
* @brief Donation
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Jun 2014
* @version SVN_VERSION_NUMBER
@@ -65,10 +65,12 @@ class _Donation extends \IPS\nexus\Invoice\Item\Charge
try
{
$goal = \IPS\nexus\Donation\Goal::load( $this->id );
$goal->current += $this->price->amount;
$goalAmount = new \IPS\Math\Number( str_replace( \IPS\Member::loggedIn()->Language()->locale['decimal_point'], '.', (string) $goal->current ) );
$goalAmount = $goalAmount->add( $this->price->amount );
$goal->current = (string) $goalAmount;
$goal->save();
}
catch ( \Exception $e ) { }
catch ( \Exception $e ) {}
\IPS\Db::i()->insert( 'nexus_donate_logs', array(
'dl_goal' => $this->id,
@@ -90,4 +92,15 @@ class _Donation extends \IPS\nexus\Invoice\Item\Charge
{
}
/**
* Requires Billing Address
*
* @return bool
* @throws \DomainException
*/
public function requiresBillingAddress()
{
return in_array( 'donation', explode( ',', \IPS\Settings::i()->nexus_require_billing ) );
}
}
@@ -2,9 +2,9 @@
/**
* @brief Gift Voucher
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -121,7 +121,7 @@ class _GiftVoucher extends \IPS\nexus\Invoice\Item\Purchase
*/
public static function createFromForm( array $values, \IPS\nexus\Invoice $invoice )
{
$item = new \IPS\nexus\extensions\nexus\Item\GiftVoucher( \IPS\Member::loggedIn()->language()->get('gift_voucher'), new \IPS\nexus\Money( $values['gift_voucher_amount'], $memberCurrency ) );
$item = new \IPS\nexus\extensions\nexus\Item\GiftVoucher( \IPS\Member::loggedIn()->language()->get('gift_voucher'), new \IPS\nexus\Money( $values['gift_voucher_amount'], $invoice->currency ) );
$item->paymentMethodIds = array_keys( \IPS\nexus\Gateway::roots( NULL, NULL, array( 'm_active=1 AND m_gateway<>?', 'TwoCheckout' ) ) ); // It is against 2CO terms to use them for buying gift vouchers
$item->extra['method'] = $values['gift_voucher_method'];
$item->extra['recipient_email'] = $values['gift_voucher_email'];
@@ -162,7 +162,7 @@ class _GiftVoucher extends \IPS\nexus\Invoice\Item\Purchase
/* Send the email */
if ( $purchase->extra['method'] === 'email' )
{
\IPS\Email::buildFromTemplate( 'nexus', 'giftVoucher', array( $purchase->extra['recipient_name'], new \IPS\nexus\Money( $purchase->extra['amount'], $purchase->extra['currency'] ), $code, $purchase->extra['message'], $purchase->extra['sender'], $purchase->extra['color'] ) )->send( $purchase->extra['recipient_email'] );
\IPS\Email::buildFromTemplate( 'nexus', 'giftVoucher', array( $purchase->extra['recipient_name'], new \IPS\nexus\Money( $purchase->extra['amount'], $purchase->extra['currency'] ), $code, $purchase->extra['message'], $purchase->extra['sender'], $purchase->extra['color'] ), \IPS\Email::TYPE_TRANSACTIONAL )->send( $purchase->extra['recipient_email'] );
}
}
@@ -204,5 +204,16 @@ class _GiftVoucher extends \IPS\nexus\Invoice\Item\Purchase
return;
}
}
/**
* Requires Billing Address
*
* @return bool
* @throws \DomainException
*/
public function requiresBillingAddress()
{
return in_array( 'giftvoucher', explode( ',', \IPS\Settings::i()->nexus_require_billing ) );
}
}
@@ -2,9 +2,9 @@
/**
* @brief Miscellaneous Charge
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 25 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Package
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 29 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -231,7 +231,7 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
}
$field = new \IPS\Helpers\Form\Radio( "renewal_term_{$id}_{$i}", NULL, TRUE, array( 'options' => $options ) );
$field->label = 'renewal_term';
$field->label = \IPS\Member::loggedIn()->language()->addToStack('renewal_term');
$form->add( $field );
}
@@ -290,7 +290,7 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
$associableOptions['existing_purchases'][ "1.{$purchase->id}" ] = $purchase->name;
}
$field = new \IPS\Helpers\Form\Select( "associate_with_{$id}_{$i}", $selected, $package->force_assoc, array( 'options' => $associableOptions ) );
$field->label = 'associate_with';
$field->label = \IPS\Member::loggedIn()->language()->addToStack('associate_with');
$form->add( $field );
}
@@ -345,19 +345,41 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
/* Loop for each qty */
for ( $i = 0; $i < $qty; $i++ )
{
/* Base price */
$price = $package->price( $invoice->member, TRUE, TRUE, TRUE, $initialCount + $i )->amount;
{
/* Custom Fields */
$details = array();
foreach ( $values as $k => $v )
{
if ( preg_match( "/nexus_pfield_(\d+)_{$id}_{$i}/", $k, $matches ) )
{
$details[ $matches[1] ] = $v;
try
{
$field = \IPS\nexus\Package\CustomField::load( $matches[1] );
$class = $field->buildHelper();
$details[ $field->id ] = $class::stringValue( $v );
}
catch ( \Exception $e ) { }
}
}
/* Base price */
$basePrice = $package->price( $invoice->member, TRUE, TRUE, TRUE, $initialCount + $i );
$price = $basePrice->amount;
/* Adjustments based on custom fields */
if ( $package->stock == -2 )
{
try
{
$chosenOption = \IPS\Db::i()->select( '*', 'nexus_product_options', array( 'opt_package=? AND opt_values=?', $package->id, json_encode( $details ) ) )->first();
$basePriceAdjustments = json_decode( $chosenOption['opt_base_price'], TRUE );
if ( isset( $basePrice->currency ) )
{
$price = $price->add( new \IPS\Math\Number( number_format( $basePriceAdjustments[ $basePrice->currency ], \IPS\nexus\Money::numberOfDecimalsForCurrency( $basePrice->currency ), '.', '' ) ) );
}
}
catch ( \UnderflowException $e ) {}
}
/* Work out renewal term */
$renewalTerm = NULL;
@@ -372,12 +394,25 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
{
$chosenRenewOption = $renewOptions[ $values["renewal_term_{$id}_{$i}"] ];
}
$renewalTerm = new \IPS\nexus\Purchase\RenewalTerm( new \IPS\nexus\Money( $chosenRenewOption['cost'][ $invoice->currency ]['amount'], $invoice->currency ), new \DateInterval( 'P' . $chosenRenewOption['term'] . mb_strtoupper( $chosenRenewOption['unit'] ) ), $package->tax ? \IPS\nexus\Tax::load( $package->tax ) : NULL );
$renewalPrice = new \IPS\nexus\Money( $chosenRenewOption['cost'][ $invoice->currency ]['amount'], $invoice->currency );
$renewalAmount = $renewalPrice->amount;
/* Adjustments based on custom fields */
if ( isset( $chosenOption ) )
{
$renewalPriceAdjustments = json_decode( $chosenOption['opt_renew_price'], TRUE );
if ( isset( $renewalPrice->currency ) )
{
$renewalAmount = $renewalAmount->add( new \IPS\Math\Number( number_format( $renewalPriceAdjustments[ $renewalPrice->currency ], \IPS\nexus\Money::numberOfDecimalsForCurrency( $renewalPrice->currency ), '.', '' ) ) );
}
}
$renewalTerm = new \IPS\nexus\Purchase\RenewalTerm( new \IPS\nexus\Money( $renewalAmount, $invoice->currency ), new \DateInterval( 'P' . $chosenRenewOption['term'] . mb_strtoupper( $chosenRenewOption['unit'] ) ), $package->tax ? \IPS\nexus\Tax::load( $package->tax ) : NULL );
if ( $chosenRenewOption['add'] )
{
$price += $renewalTerm->cost->amount;
$price = $price->add( $renewalTerm->cost->amount );
}
}
@@ -402,6 +437,10 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
{
$item->paymentMethodIds = explode( ',', $package->methods );
}
if ( $package->group_renewals )
{
$item->groupWithParent = TRUE;
}
$item->details = $details;
/* Associations */
@@ -624,6 +663,23 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
}
}
/**
* Get ACP Support View HTML
*
* @return string
*/
public static function acpSupportView( \IPS\nexus\Purchase $purchase )
{
try
{
return call_user_func_array( array( \IPS\nexus\Package::load( $purchase->item_id ), 'acpSupportView' ), func_get_args() );
}
catch ( \OutOfRangeException $e )
{
return '';
}
}
/**
* Support Severity
*
@@ -642,6 +698,32 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
}
}
/**
* Get renewal payment methods IDs
*
* @param \IPS\nexus\Purchase $purchase The purchase
* @return array|NULL
*/
public static function renewalPaymentMethodIds( \IPS\nexus\Purchase $purchase )
{
try
{
$package = \IPS\nexus\Package::load( $purchase->item_id );
if ( $package->methods and $package->methods != '*' )
{
return explode( ',', $package->methods );
}
else
{
return NULL;
}
}
catch ( \OutOfRangeException $e )
{
return NULL;
}
}
/**
* On Paid
*
@@ -715,6 +797,28 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
}
}
/**
* Check for member
* If a user initially checks out as a guest and then logs in during checkout, this method
* is ran to check the items they are purchasing can be bought.
* Is expected to throw a DomainException with an error message to display to the user if not valid
*
* @param \IPS\Member $member The new member
* @return void
* @throws \DomainException
*/
public function memberCanPurchase( \IPS\Member $member )
{
try
{
return call_user_func_array( array( \IPS\nexus\Package::load( $this->id ), 'memberCanPurchase' ), func_get_args() );
}
catch ( \OutOfRangeException $e )
{
return NULL;
}
}
/**
* On Purchase Generated
*
@@ -807,6 +911,24 @@ class _Package extends \IPS\nexus\Invoice\Item\Purchase
}
}
/**
* Warning to display to admin when cancelling a purchase
*
* @param \IPS\nexus\Invoice $invoice The invoice
* @return string
*/
public static function onCancelWarning( \IPS\nexus\Purchase $purchase )
{
try
{
return call_user_func_array( array( \IPS\nexus\Package::load( $purchase->item_id ), 'onCancelWarning' ), func_get_args() );
}
catch ( \OutOfRangeException $e )
{
return NULL;
}
}
/**
* On Purchase Deleted
*
@@ -2,9 +2,9 @@
/**
* @brief Invoice Item Class for Shipping Charges
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 20 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Support Charge
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -43,4 +43,15 @@ class _SupportCharge extends \IPS\nexus\Invoice\Item\Purchase
* @brief Title
*/
public static $title = 'support_charge';
/**
* Requires Billing Address
*
* @return bool
* @throws \DomainException
*/
public function requiresBillingAddress()
{
return in_array( 'other', explode( ',', \IPS\Settings::i()->nexus_require_billing ) );
}
}
@@ -2,9 +2,9 @@
/**
* @brief Invoice Item Class for Package Upgrade Charges
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 8 May 2014
* @version SVN_VERSION_NUMBER
+23
View File
@@ -0,0 +1,23 @@
//<?php
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
exit;
}
class nexus_hook_Database extends _HOOK_CLASS_
{
/**
* Constructor
* Gets stores which are always needed to save individual queries
*
*/
public function __construct()
{
$this->initLoad[] = 'nexusPackagesWithReviews';
/* Hand over to normal method */
parent::__construct();
}
}
@@ -1,5 +1,11 @@
//<?php
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
exit;
}
class nexus_hook_allowStoreRegistrationGuests extends _HOOK_CLASS_
{
/**
+11 -13
View File
@@ -1,5 +1,11 @@
//<?php
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
exit;
}
class nexus_hook_clientAreaLink extends _HOOK_CLASS_
{
@@ -12,26 +18,18 @@ public static function hookData() {
array (
'selector' => '#cUserLink',
'type' => 'add_before',
'content' => '{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( \'nexus\', \'store\' ) )}}
{template="cartHeader" app="nexus" group="store" params=""}
'content' => '{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( \'nexus\', \'store\' ) )}}
{template="cartHeader" app="nexus" group="store" params=""}
{{endif}}',
),
2 =>
array (
'selector' => '#elSignInLink',
'type' => 'add_before',
'content' => '{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( \'nexus\', \'store\' ) )}}
{template="cartHeader" app="nexus" group="store" params=""}
'content' => '{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( \'nexus\', \'store\' ) )}}
{template="cartHeader" app="nexus" group="store" params=""}
{{endif}}',
),
3 =>
array (
'selector' => '#elAccountSettingsLink',
'type' => 'add_after',
'content' => '{{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( \'nexus\', \'clients\' ) )}}
<li class=\'ipsMenu_item\'><a href=\'{url="app=nexus&module=clients&controller=splash" seoTemplate="clients" protocol="\IPS\Settings::i()->nexus_https"}\' title=\'{lang="module__nexus_clients"}\'>{lang="module__nexus_clients"}</a></li>
{{endif}}',
),
)
),
), parent::hookData() );
}
@@ -1,5 +1,11 @@
//<?php
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
exit;
}
class nexus_hook_clientAreaLinkLoad extends _HOOK_CLASS_
{
/**
+6
View File
@@ -1,5 +1,11 @@
//<?php
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
exit;
}
class nexus_hook_register extends _HOOK_CLASS_
{
/**
@@ -2,20 +2,21 @@
/**
* @brief Send/Discard handler for pending support replies
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 25 Apr 2014
* @version SVN_VERSION_NUMBER
*/
require_once '../../../../init.php';
\IPS\Dispatcher\Front::i();
try
{
$reply = \IPS\nexus\Support\Reply::load( \IPS\Request::i()->id );
if ( \IPS\Request::i()->key !== md5( $reply->item()->email_key . $reply->date ) )
if ( !\IPS\Login::compareHashes( md5( $reply->item()->email_key . $reply->date ), (string) \IPS\Request::i()->key ) )
{
throw new \OutOfRangeException;
}
@@ -2,9 +2,9 @@
/**
* @brief 2Checkout Gateway
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 18 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -18,17 +18,17 @@ try
if ( $transaction->status !== \IPS\nexus\Transaction::STATUS_PENDING )
{
throw new \OutofRangeException;
throw new \OutOfRangeException();
}
}
catch ( \OutOfRangeException $e )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=payments&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexustransactionid, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=checkout&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexustransactionid, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https ) );
}
$settings = json_decode( $transaction->method->settings, TRUE );
$hash = mb_strtoupper( md5( $settings['word'] . $settings['sid'] . ( \IPS\NEXUS_TEST_GATEWAYS ? 1 : \IPS\Request::i()->order_number ) . number_format( $transaction->amount->amount, 2 ) ) );
if ( $hash !== \IPS\Request::i()->key )
$hash = mb_strtoupper( md5( $settings['word'] . $settings['sid'] . ( \IPS\NEXUS_TEST_GATEWAYS ? 1 : \IPS\Request::i()->order_number ) . number_format( $transaction->amount->amountAsString(), 2 ) ) );
if ( !\IPS\Login::compareHashes( (string) $hash, (string) \IPS\Request::i()->key ) )
{
\IPS\Output::i()->redirect( $transaction->invoice->checkoutUrl()->setQueryString( array( '_step' => 'checkout_pay', 'err' => $transaction->member->language()->get('gateway_err') ) ) );
}
@@ -2,9 +2,9 @@
/**
* @brief Authorize.Net DPM Gateway
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 17 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -29,7 +29,7 @@ try
$settings = json_decode( $gateway->settings, TRUE );
/* Check MD5 hash */
if ( \IPS\Request::i()->x_MD5_Hash != mb_strtoupper( md5( $settings['hash'] . $settings['login'] . \IPS\Request::i()->x_trans_id . \IPS\Request::i()->x_amount ) ) )
if ( !\IPS\Login::compareHashes( mb_strtoupper( md5( $settings['hash'] . $settings['login'] . \IPS\Request::i()->x_trans_id . \IPS\Request::i()->x_amount ) ), \IPS\Request::i()->x_MD5_Hash ) )
{
throw new \Exception( $invoice->member->language()->addToStack('gateway_err') );
}
@@ -2,9 +2,9 @@
/**
* @brief PayPal Gateway
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 07 Mar 2014
* @version SVN_VERSION_NUMBER
@@ -13,6 +13,7 @@
require_once '../../../../init.php';
\IPS\Session\Front::i();
/* Load Transaction */
try
{
$transaction = \IPS\nexus\Transaction::load( \IPS\Request::i()->nexusTransactionId );
@@ -24,15 +25,13 @@ try
}
catch ( \OutOfRangeException $e )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=payments&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexusTransactionId, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=nexus&module=checkout&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexusTransactionId, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https ) );
}
/* Process */
try
{
$response = $transaction->method->api( "payments/payment/{$transaction->gw_id}/execute", array(
'payer_id' => \IPS\Request::i()->PayerID,
) );
/* Check fraud rules */
$maxMind = NULL;
if ( \IPS\Settings::i()->maxmind_key )
{
@@ -40,13 +39,123 @@ try
$maxMind->setTransaction( $transaction );
$maxMind->setTransactionType( 'paypal' );
}
$fraudResult = $transaction->runFraudCheck( $maxMind );
if ( $fraudResult === \IPS\nexus\Transaction::STATUS_REFUSED )
{
$transaction->executeFraudAction( $fraudResult, FALSE );
$transaction->sendNotification();
\IPS\Session::i()->setMember( $transaction->invoice->member ); // This is in case the checkout was a guest, meaning checkFraudRulesAndCapture() may have just created an account. There is no security issue as we have just verified they were just bounced back from PayPal
\IPS\Output::i()->redirect( $transaction->url() );
}
$transaction->checkFraudRulesAndCapture( $maxMind );
/* Billing Agreement */
if ( isset( \IPS\Request::i()->billingAgreement ) )
{
/* Execute */
$response = $transaction->method->api( "payments/billing-agreements/" . \IPS\Request::i()->token . "/agreement-execute" );
$agreementId = $response['id'];
if ( isset( $response['payer'] ) and isset( $response['payer']['status'] ) )
{
$extra = $transaction->extra;
$extra['verified'] = $response['payer']['status'];
$transaction->extra = $extra;
}
/* Create Billing Agreement */
$billingAgreement = new \IPS\nexus\Gateway\PayPal\BillingAgreement;
$billingAgreement->gw_id = $agreementId;
$billingAgreement->method = $transaction->method;
$billingAgreement->member = $transaction->member;
$billingAgreement->started = \IPS\DateTime::create();
$billingAgreement->next_cycle = \IPS\DateTime::create()->add( new \DateInterval( 'P' . $response['plan']['payment_definitions'][0]['frequency_interval'] . mb_substr( $response['plan']['payment_definitions'][0]['frequency'], 0, 1 ) ) );
$billingAgreement->save();
$transaction->billing_agreement = $billingAgreement;
$transaction->save();
/* Get the initial setup transaction if possible */
$haveInitialTransaction = FALSE;
$transactions = $transaction->method->api( "payments/billing-agreements/{$agreementId}/transactions?start_date=" . date( 'Y-m-d', time() - 86400 ) . '&end_date=' . date( 'Y-m-d' ), NULL, 'get' );
foreach ( $transactions['agreement_transaction_list'] as $t )
{
if ( $t['status'] == 'Completed' )
{
$transaction->gw_id = $t['transaction_id'];
$transaction->save();
if ( $fraudResult and $fraudResult !== \IPS\nexus\Transaction::STATUS_PAID )
{
$transaction->executeFraudAction( $fraudResult, TRUE );
}
else
{
$transaction->member->log( 'transaction', array(
'type' => 'paid',
'status' => $transaction::STATUS_PAID,
'id' => $transaction->id,
'invoice_id' => $transaction->invoice->id,
'invoice_title' => $transaction->invoice->title,
) );
$transaction->approve();
}
$transaction->sendNotification();
if ( $transaction->invoice->member->member_id )
{
\IPS\Session::i()->setMember( $transaction->invoice->member );
}
\IPS\Output::i()->redirect( $transaction->url() );
}
}
/* If it hasn't been processed yet (PayPal is a bit flakey), we need to try again in a few minutes */
$transaction->status = \IPS\nexus\Transaction::STATUS_GATEWAY_PENDING;
$transaction->save();
$transaction->sendNotification();
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 1 ), "`key`='gatewayPending'" );
\IPS\Output::i()->redirect( $transaction->url() );
}
/* Normal */
else
{
$response = $transaction->method->api( "payments/payment/{$transaction->gw_id}/execute", array(
'payer_id' => \IPS\Request::i()->PayerID,
) );
$transaction->gw_id = $response['transactions'][0]['related_resources'][0]['authorization']['id']; // Was previously a payment ID. This sets it to the actual transaction ID for the authorization. At capture, it will be updated again to the capture transaction ID
$transaction->auth = \IPS\DateTime::ts( strtotime( $response['transactions'][0]['related_resources'][0]['authorization']['valid_until'] ) );
if ( isset( $response['payer'] ) and isset( $response['payer']['status'] ) )
{
$extra = $transaction->extra;
$extra['verified'] = $response['payer']['status'];
$transaction->extra = $extra;
}
$transaction->save();
}
/* Capture */
if ( $fraudResult )
{
$transaction->executeFraudAction( $fraudResult, TRUE );
}
if ( !$fraudResult or $fraudResult === \IPS\nexus\Transaction::STATUS_PAID )
{
$transaction->captureAndApprove();
}
$transaction->sendNotification();
\IPS\Session::i()->setMember( $transaction->invoice->member ); // This is in case the checkout was a guest, meaning checkFraudRulesAndCapture() may have just created an account. There is no security issue as we have just verified they were just bounced back from PayPal
/* If we checked out as a guest, and captureAndApprove() created an account, we need to log them in. There is no security issue as we have just verified they were just bounced back from PayPal */
if ( $transaction->invoice->member->member_id )
{
\IPS\Session::i()->setMember( $transaction->invoice->member );
}
/* Redirect */
\IPS\Output::i()->redirect( $transaction->url() );
}
catch ( \Exception $e )
{
\IPS\Log::log( $e, 'paypal' );
\IPS\Output::i()->redirect( $transaction->invoice->checkoutUrl()->setQueryString( array( '_step' => 'checkout_pay', 'err' => $e->getMessage() ) ) );
}
@@ -1,64 +0,0 @@
<?php
/**
* @brief SagePay Gateway
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @subpackage Nexus
* @since 19 Mar 2014
* @version SVN_VERSION_NUMBER
*/
require_once '../../../../init.php';
function returnData( $status, $detail, $returnUrl )
{
echo "Status={$status}\r\nStatusDetail={$detail}\r\nRedirectURL={$returnUrl}";
exit;
}
/* Load */
try
{
$transaction = \IPS\nexus\Transaction::load( \IPS\Request::i()->VendorTxCode );
if ( $transaction->status !== \IPS\nexus\Transaction::STATUS_PENDING )
{
throw new \OutofRangeException;
}
}
catch ( \OutOfRangeException $e )
{
returnData( 'ERROR', 'NO_TRANSACTION', \IPS\Settings::i()->base_url );
}
/* Authenticate */
$settings = json_decode( $transaction->method->settings, TRUE );
$extra = $transaction->extra;
if ( \IPS\Request::i()->VPSSignature !== mb_strtoupper( md5( \IPS\Request::i()->VPSTxId . \IPS\Request::i()->VendorTxCode . \IPS\Request::i()->Status . \IPS\Request::i()->TxAuthNo . mb_strtolower( $settings['vendor'] ) . \IPS\Request::i()->AVSCV2 . $extra['sagepaySecurityKey'] . \IPS\Request::i()->AddressResult . \IPS\Request::i()->PostCodeResult . \IPS\Request::i()->CV2Result . \IPS\Request::i()->GiftAid . \IPS\Request::i()->__get('3DSecureStatus') . \IPS\Request::i()->CAVV . \IPS\Request::i()->AddressStatus . \IPS\Request::i()->PayerStatus . \IPS\Request::i()->CardType . \IPS\Request::i()->Last4Digits . \IPS\Request::i()->DeclineCode . \IPS\Request::i()->ExpiryDate . \IPS\Request::i()->FraudResponse . \IPS\Request::i()->BankAuthCode ) ) )
{
returnData( 'INVALID', 'MD5', $transaction->invoice->checkoutUrl()->setQueryString( array( '_step' => 'checkout_pay', 'err' => $transaction->member->language()->get( 'gateway_err' ) ) ) );
}
/* Save the auth code */
$extra['sagepayAuth'] = \IPS\Request::i()->TxAuthNo;
$transaction->extra = $extra;
$transaction->save();
/* Handle */
if ( \IPS\Request::i()->Status === 'OK' )
{
$maxMind = NULL;
if ( \IPS\Settings::i()->maxmind_key )
{
$maxMind = new \IPS\nexus\Fraud\MaxMind\Request;
$maxMind->setTransaction( $transaction );
}
$transaction->checkFraudRulesAndCapture( $maxMind );
$transaction->sendNotification();
}
/* Respond */
returnData( 'OK', 'MD5', $transaction->url() );
Loaded 100 of 2674 files, more files were not shown because too many files have changed in this diff. Show more