Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -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
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user