Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _autoresolve extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Manage
|
||||
*
|
||||
@@ -48,7 +53,7 @@ class _autoresolve extends \IPS\Dispatcher\Controller
|
||||
$form->addSeparator();
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'nexus_autoresolve_departments', \IPS\Settings::i()->nexus_autoresolve_departments === '*' ? 0 : explode( ',', \IPS\Settings::i()->nexus_autoresolve_departments ), FALSE, array( 'class' => 'IPS\nexus\Support\Department', 'multiple' => TRUE, 'zeroVal' => 'any' ), NULL, NULL, NULL, 'nexus_autoresolve_departments' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'nexus_autoresolve_applicable', \IPS\Settings::i()->nexus_autoresolve_applicable, FALSE, array( 'class' => 'IPS\nexus\Support\Status', 'multiple' => TRUE ), NULL, NULL, NULL, 'nexus_autoresolve_applicable' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'nexus_autoresolve_days', \IPS\Settings::i()->nexus_autoresolve_days, FALSE, array(), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('days'), 'nexus_autoresolve_days' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Interval( 'nexus_autoresolve_days', \IPS\Settings::i()->nexus_autoresolve_days, FALSE, array( 'valueAs' => \IPS\Helpers\Form\Interval::DAYS ), NULL, NULL, NULL, 'nexus_autoresolve_days' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'nexus_autoresolve_status', \IPS\Settings::i()->nexus_autoresolve_status, FALSE, array( 'class' => 'IPS\nexus\Support\Status' ), NULL, NULL, NULL, 'nexus_autoresolve_status' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'nexus_autoresolve_notify', \IPS\Settings::i()->nexus_autoresolve_notify, FALSE, array( 'unlimited' => 0, 'unlimitedLang' => 'never' ), NULL, NULL, \IPS\Member::loggedIn()->language()->addToStack('hours_before_resolving'), 'nexus_autoresolve_notify' ) );
|
||||
|
||||
@@ -63,7 +68,7 @@ class _autoresolve extends \IPS\Dispatcher\Controller
|
||||
unset( $values['nexus_autoresolve_on'] );
|
||||
|
||||
$values['nexus_autoresolve_departments'] = $values['nexus_autoresolve_departments'] ? implode( ',' , array_keys( $values['nexus_autoresolve_departments'] ) ) : '*';
|
||||
$values['nexus_autoresolve_applicable'] = is_array( $values['nexus_autoresolve_applicable'] ) ? implode( ',', array_keys( $values['nexus_autoresolve_applicable'] ) ) : $values['nexus_autoresolve_applicable'];
|
||||
$values['nexus_autoresolve_applicable'] = \is_array( $values['nexus_autoresolve_applicable'] ) ? implode( ',', array_keys( $values['nexus_autoresolve_applicable'] ) ) : $values['nexus_autoresolve_applicable'];
|
||||
$values['nexus_autoresolve_status'] = $values['nexus_autoresolve_status']->id;
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _customerfeedback extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Manage
|
||||
*
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _departments extends \IPS\Node\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _fields extends \IPS\Node\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _incomingemail extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -110,7 +115,7 @@ class _incomingemail extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$task = \IPS\Db::i()->select( '*', 'core_tasks', array( 'app=? AND `key`=? AND enabled=1', 'core', 'pop' ) )->first();
|
||||
$pop3Form = $this->_pop3();
|
||||
$pop3Form->addButton( 'disable_pop3', 'link', \IPS\Http\Url::internal( 'app=nexus&module=support&controller=incomingemail&do=disablePop3' ), '', array( 'data-confirm' => '' ) );
|
||||
$pop3Form->addButton( 'disable_pop3', 'link', \IPS\Http\Url::internal( 'app=nexus&module=support&controller=incomingemail&do=disablePop3' )->csrf(), '', array( 'data-confirm' => '' ) );
|
||||
$content = \IPS\Theme::i()->getTemplate('incomingemailsetup')->usingpop3( $pop3Form, (string) $table );
|
||||
}
|
||||
catch ( \UnderflowException $e ) { }
|
||||
@@ -130,6 +135,7 @@ class _incomingemail extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
protected function disablePop3()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Settings::i()->changeValues( array( 'pop3_server' => '', 'pop3_port' => '', 'pop3_user' => '', 'pop3_password' => '' ) );
|
||||
\IPS\Session::i()->log( 'acplogs__pop3_settings' );
|
||||
\IPS\Db::i()->update( 'core_tasks', array( 'enabled' => 0 ), array( 'app=? AND `key`=?', 'core', 'pop' ) );
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _outgoingemail extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Manage
|
||||
*
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _reports extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace IPS\nexus\modules\admin\support;
|
||||
use \IPS\nexus\Support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -24,6 +24,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _request extends \IPS\nexus\modules\front\support\view
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -92,7 +97,35 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
|
||||
if ( $action->message )
|
||||
{
|
||||
$data['message'] = $action->message;
|
||||
/* Do we have default content? */
|
||||
try
|
||||
{
|
||||
$defaultContent = \IPS\Db::i()->select( 'content', 'nexus_support_staff_preferences', array( 'staff_id=?', \IPS\Member::loggedIn()->member_id ) )->first();
|
||||
|
||||
/* If we aren't using the {default_content} tag then we just want the stock reply returned */
|
||||
if( mb_strpos( $defaultContent, '{default_content}' ) === FALSE )
|
||||
{
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
|
||||
$data['message'] = str_replace(
|
||||
array( '{customer_first_name}', '{customer_last_name}', '{customer_full_name}', '{department_name}', '{department_email}', '{default_content}' ),
|
||||
array(
|
||||
( $this->request->supportAuthor() instanceof \IPS\nexus\Support\Author\Member ) ? \IPS\nexus\Customer::load( $this->request->author()->member_id )->cm_first_name : '',
|
||||
( $this->request->supportAuthor() instanceof \IPS\nexus\Support\Author\Member ) ? \IPS\nexus\Customer::load( $this->request->author()->member_id )->cm_last_name : '',
|
||||
$this->request->supportAuthor()->name(),
|
||||
$action->department ? $action->department->_title : $this->request->department->_title,
|
||||
$action->department ? $action->department->email : $this->request->department->email,
|
||||
/* We want to strip the wrapping <p></p> because where we insert it into our default content will already be wrapped, so we will have double line breaks otherwise */
|
||||
preg_replace( "/^<p>(.+?)<\/p>$/is", "$1", trim( $action->message ) )
|
||||
),
|
||||
$defaultContent
|
||||
);
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
$data['message'] = $action->message;
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->json( $data );
|
||||
@@ -122,7 +155,9 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
/* Setting Order? */
|
||||
if ( isset( \IPS\Request::i()->order ) )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Request::i()->setCookie( 'support_replies_order', \IPS\Request::i()->order, \IPS\DateTime::create()->add( new \DateInterval('P1Y') ) );
|
||||
\IPS\Output::i()->redirect( $this->request->acpUrl() );
|
||||
}
|
||||
|
||||
/* Views */
|
||||
@@ -144,7 +179,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
'icon' => 'tag',
|
||||
'title' => $this->request->status->_title,
|
||||
'menu' => array(),
|
||||
'menuClass' => 'ipsMenu_selectable ipsMenu_narrow',
|
||||
'menuClass' => 'ipsMenu_selectable ipsMenu_narrow',
|
||||
'data' => array( 'role' => 'statusMenu', 'controller' => 'nexus.admin.support.metamenu' ),
|
||||
'tooltip' => \IPS\Member::loggedIn()->language()->addToStack('keyboard_shortcut_status')
|
||||
),
|
||||
@@ -152,7 +187,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
'icon' => 'exclamation',
|
||||
'title' => $this->request->severity->_title,
|
||||
'menu' => array(),
|
||||
'menuClass' => 'ipsMenu_selectable',
|
||||
'menuClass' => 'ipsMenu_selectable',
|
||||
'data' => array( 'role' => 'severityMenu', 'controller' => 'nexus.admin.support.metamenu' ),
|
||||
'tooltip' => \IPS\Member::loggedIn()->language()->addToStack('keyboard_shortcut_severity')
|
||||
),
|
||||
@@ -160,7 +195,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
'icon' => 'folder',
|
||||
'title' => $this->request->department->_title,
|
||||
'menu' => array(),
|
||||
'menuClass' => 'ipsMenu_selectable ipsMenu_narrow',
|
||||
'menuClass' => 'ipsMenu_selectable ipsMenu_narrow',
|
||||
'data' => array( 'role' => 'departmentMenu', 'controller' => 'nexus.admin.support.metamenu' ),
|
||||
'tooltip' => \IPS\Member::loggedIn()->language()->addToStack('keyboard_shortcut_department')
|
||||
),
|
||||
@@ -171,17 +206,17 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
array(
|
||||
'class' => $trackLang === 'not_tracking' ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => 'not_tracking',
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'track', 'track' => 0 ) )
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'track', 'track' => 0 ) )->csrf()
|
||||
),
|
||||
array(
|
||||
'class' => $trackLang === 'tracking_no_notify' ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => 'tracking_no_notify',
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'track', 'track' => 1, 'notify' => 0 ) )
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'track', 'track' => 1, 'notify' => 0 ) )->csrf()
|
||||
),
|
||||
array(
|
||||
'class' => $trackLang === 'tracking_notify' ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => 'tracking_notify',
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'track', 'track' => 1, 'notify' => 1 ) )
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'track', 'track' => 1, 'notify' => 1 ) )->csrf()
|
||||
)
|
||||
),
|
||||
'menuClass' => 'ipsMenu_selectable',
|
||||
@@ -204,12 +239,12 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$requestActions['status']['menu'][] = array(
|
||||
'class' => $status->id === $this->request->status->id ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => $status->_title,
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'status', 'status' => $status->id ) )
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'status', 'status' => $status->id ) )->csrf()
|
||||
);
|
||||
}
|
||||
|
||||
/* Populate severities */
|
||||
if ( count( Support\Severity::roots() ) < 2 )
|
||||
if ( \count( Support\Severity::roots() ) < 2 )
|
||||
{
|
||||
unset( \IPS\Output::i()->sidebar['actions']['severity'] );
|
||||
}
|
||||
@@ -220,7 +255,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$requestActions['severity']['menu'][] = array(
|
||||
'class' => $severity->id === $this->request->severity->id ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => $severity->_title,
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'severity', 'severity' => $severity->id ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'severity', 'severity' => $severity->id ) )->csrf(),
|
||||
'data' => array( 'group' => 'severities' ),
|
||||
);
|
||||
}
|
||||
@@ -231,13 +266,13 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$requestActions['severity']['menu'][] = array(
|
||||
'class' => !$this->request->author()->cm_no_sev ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => \IPS\Member::loggedIn()->language()->addToStack( 'cm_no_sev_off', FALSE, array( 'sprintf' => array( $this->request->supportAuthor()->name() ) ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'noSev', 'no_sev' => 0 ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'noSev', 'no_sev' => 0 ) )->csrf(),
|
||||
'data' => array( 'group' => 'no_sev', 'noSet' => 'true' ),
|
||||
);
|
||||
$requestActions['severity']['menu'][] = array(
|
||||
'class' => $this->request->author()->cm_no_sev ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => \IPS\Member::loggedIn()->language()->addToStack( 'cm_no_sev_on', FALSE, array( 'sprintf' => array( $this->request->supportAuthor()->name() ) ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'noSev', 'no_sev' => 1 ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'noSev', 'no_sev' => 1 ) )->csrf(),
|
||||
'data' => array( 'group' => 'no_sev', 'noSet' => 'true' ),
|
||||
);
|
||||
}
|
||||
@@ -249,7 +284,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$requestActions['department']['menu'][] = array(
|
||||
'class' => $department->id === $this->request->department->id ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => $department->_title,
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'department', 'department' => $department->id ) )
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'department', 'department' => $department->id ) )->csrf()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -259,27 +294,27 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$requestActions['staff']['menu'][] = array(
|
||||
'class' => ( $this->request->staff and $id === $this->request->staff->member_id ) ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => $name,
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'staff', 'staff' => $id ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'staff', 'staff' => $id ) )->csrf(),
|
||||
'data' => array( 'group' => 'staff', 'id' => $id ),
|
||||
);
|
||||
}
|
||||
$requestActions['staff']['menu'][] = array(
|
||||
'class' => !$this->request->staff ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => 'unassigned',
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'staff', 'staff' => 0 ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'staff', 'staff' => 0 ) )->csrf(),
|
||||
'data' => array( 'group' => 'staff', 'id' => 0 ),
|
||||
);
|
||||
$requestActions['staff']['menu'][] = array( 'hr' => TRUE );
|
||||
$requestActions['staff']['menu'][] = array(
|
||||
'class' => $this->request->staff_lock ? 'ipsMenu_itemChecked' : '',
|
||||
'title' => \IPS\Member::loggedIn()->language()->addToStack( 'request_staff_lock_on' ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'staffLock', 'lock' => 1 ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'staffLock', 'lock' => 1 ) )->csrf(),
|
||||
'data' => array( 'group' => 'staff_lock', 'noSet' => 'true' ),
|
||||
);
|
||||
$requestActions['staff']['menu'][] = array(
|
||||
'class' => !$this->request->staff_lock ? 'ipsMenu_itemChecked' : '',
|
||||
'title' =>\IPS\Member::loggedIn()->language()->addToStack( 'request_staff_lock_off' ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'staffLock', 'lock' => 0 ) ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( array( 'do' => 'staffLock', 'lock' => 0 ) )->csrf(),
|
||||
'data' => array( 'group' => 'staff_lock', 'noSet' => 'true' ),
|
||||
);
|
||||
|
||||
@@ -289,18 +324,21 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
\IPS\Output::i()->sidebar['actions']['delete'] = array(
|
||||
'icon' => 'times-circle',
|
||||
'title' => 'delete',
|
||||
'link' => $this->request->acpUrl()->setQueryString( 'do', 'delete' ),
|
||||
'link' => $this->request->acpUrl()->setQueryString( 'do', 'delete' )->csrf(),
|
||||
'data' => array( 'confirm' => '' )
|
||||
);
|
||||
}
|
||||
|
||||
\IPS\Output::i()->sidebar['actions']['purchase'] = array(
|
||||
'icon' => 'cube',
|
||||
'title' => 'associate_purchase',
|
||||
'link' => $this->request->acpUrl()->setQueryString( 'do', 'associate' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('associate'), 'ipsDialog-size' => 'narrow', 'role' => 'associatePurchaseMenu' ),
|
||||
'tooltip' => \IPS\Member::loggedIn()->language()->addToStack('keyboard_shortcut_purchase')
|
||||
);
|
||||
if( \IPS\Member::loggedIn()->hasAcpRestriction( \IPS\Application::load('nexus'), \IPS\Application\Module::get( 'nexus', 'customers' ), 'purchases_view' ) )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions']['purchase'] = array(
|
||||
'icon' => 'cube',
|
||||
'title' => 'associate_purchase',
|
||||
'link' => $this->request->acpUrl()->setQueryString( 'do', 'associate' ),
|
||||
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('associate'), 'ipsDialog-size' => 'narrow', 'role' => 'associatePurchaseMenu' ),
|
||||
'tooltip' => \IPS\Member::loggedIn()->language()->addToStack('keyboard_shortcut_purchase')
|
||||
);
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'support' )->request( $this->request, $requestActions );
|
||||
|
||||
@@ -408,7 +446,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$page = ceil( $commentPosition / \IPS\nexus\Support\Request::getCommentsPerPage() );
|
||||
if ( $page != 1 )
|
||||
{
|
||||
$url = $url->setQueryString( 'page', $page );
|
||||
$url = $url->setPage( 'page', $page );
|
||||
}
|
||||
$url = $url->setFragment( "reply-{$unreadComment->id}" );
|
||||
|
||||
@@ -429,7 +467,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$lastPage = $request->commentPageCount();
|
||||
if ( $lastPage != 1 )
|
||||
{
|
||||
$url = $url->setQueryString( 'page', $lastPage );
|
||||
$url = $url->setPage( 'page', $lastPage );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,7 +518,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$page = ceil( $commentPosition / \IPS\nexus\Support\Request::getCommentsPerPage() );
|
||||
if ( $page != 1 )
|
||||
{
|
||||
$url = $url->setQueryString( 'page', $page );
|
||||
$url = $url->setPage( 'page', $page );
|
||||
}
|
||||
$url = $url->setFragment( "reply-{$comment->id}" );
|
||||
\IPS\Output::i()->redirect( $url );
|
||||
@@ -492,7 +530,9 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
* @return void
|
||||
*/
|
||||
protected function pending()
|
||||
{
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$message = Support\Reply::loadAndCheckPerms( \IPS\Request::i()->response );
|
||||
@@ -589,7 +629,12 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$form = new \IPS\Helpers\Form;
|
||||
foreach ( $request->department->customFields() as $field )
|
||||
{
|
||||
$form->add( $field->buildHelper( isset( $customFieldValues[ $field->id ] ) ? $customFieldValues[ $field->id ] : NULL ) );
|
||||
if ( $field->type === 'Editor' )
|
||||
{
|
||||
$field::$editorOptions = array_merge( $field::$editorOptions, array( 'attachIds' => array( $request->id, $field->id, 'fields' ) ) );
|
||||
}
|
||||
$helper = $field->buildHelper( isset( $customFieldValues[ $field->id ] ) ? $customFieldValues[ $field->id ] : NULL );
|
||||
$form->add( $helper );
|
||||
}
|
||||
|
||||
if ( $values = $form->values( TRUE ) )
|
||||
@@ -619,6 +664,8 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
*/
|
||||
protected function status()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
/* Init */
|
||||
@@ -680,6 +727,8 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
*/
|
||||
protected function severity()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$request = Support\Request::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
@@ -709,6 +758,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
protected function noSev()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'requests_block_sev' );
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -734,6 +784,8 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
*/
|
||||
protected function staffLock()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$request = Support\Request::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
@@ -758,6 +810,8 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
*/
|
||||
protected function department()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$request = Support\Request::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
@@ -809,6 +863,8 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
*/
|
||||
protected function staff()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$request = Support\Request::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
@@ -839,6 +895,8 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
*/
|
||||
protected function track()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
$request = Support\Request::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
@@ -884,7 +942,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
$form = new \IPS\Helpers\Form;
|
||||
|
||||
$parentContacts = \IPS\nexus\Customer::load( $request->author()->member_id )->parentContacts();
|
||||
if ( count( $parentContacts ) )
|
||||
if ( \count( $parentContacts ) )
|
||||
{
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$options = array();
|
||||
@@ -932,7 +990,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
\IPS\Output::i()->redirect( $request->acpUrl() );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'forms', 'core', 'front' ) ), 'popupTemplate' ) );
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core', 'front' ), 'popupTemplate' ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
@@ -948,6 +1006,7 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
protected function merge()
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'requests_merge' );
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1171,4 +1230,4 @@ class _request extends \IPS\nexus\modules\front\support\view
|
||||
}
|
||||
return $defaultAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _requests extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -51,7 +56,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
/* Can we access anything? */
|
||||
if ( !count( \IPS\nexus\Support\Department::departmentsWithPermission() ) )
|
||||
if ( !\count( \IPS\nexus\Support\Department::departmentsWithPermission() ) )
|
||||
{
|
||||
if ( \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'support', 'departments_manage' ) )
|
||||
{
|
||||
@@ -62,55 +67,83 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->error( 'err_no_departments_with_perm2', '1X261/2', 403, '' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Permissions */
|
||||
$where = array();
|
||||
$where[] = array( "( dpt_staff='*' OR " . \IPS\Db::i()->findInSet( 'dpt_staff', \IPS\nexus\Support\Department::staffDepartmentPerms() ) . ')' );
|
||||
|
||||
/* Get my stream */
|
||||
$stream = NULL;
|
||||
if ( isset( \IPS\Request::i()->cookie['support_stream'] ) or isset( \IPS\Request::i()->stream ) or isset( \IPS\Request::i()->member ) )
|
||||
|
||||
/* Get stream - can set new... */
|
||||
if ( ( isset( \IPS\Request::i()->stream ) and \IPS\Request::i()->stream !== 'custom' ) or isset( \IPS\Request::i()->member ) or isset( \IPS\Request::i()->email ) )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->member ) )
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
/* Specific stream */
|
||||
if ( isset( \IPS\Request::i()->stream ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$customer = \IPS\nexus\Customer::load( \IPS\Request::i()->member );
|
||||
|
||||
$stream = \IPS\nexus\Support\Stream::customer( $customer );
|
||||
$stream->temporary = TRUE;
|
||||
$stream->owner = \IPS\Member::loggedIn()->member_id;
|
||||
$stream->save();
|
||||
|
||||
\IPS\Request::i()->setCookie( 'support_stream', $stream->id, \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
\IPS\Db::i()->delete( 'nexus_support_streams', array( 'stream_owner=? AND stream_temporary=1 AND stream_id<>?', \IPS\Member::loggedIn()->member_id, $stream->id ) );
|
||||
$stream = \IPS\nexus\Support\Stream::load( \IPS\Request::i()->stream );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2X261/4', 404, '' );
|
||||
}
|
||||
}
|
||||
/* Temporary stream */
|
||||
else
|
||||
{
|
||||
$streamId = isset( \IPS\Request::i()->stream ) ? \IPS\Request::i()->stream : \IPS\Request::i()->cookie['support_stream'];
|
||||
try
|
||||
if( isset( \IPS\Request::i()->member ) )
|
||||
{
|
||||
$stream = \IPS\nexus\Support\Stream::load( $streamId );
|
||||
|
||||
if ( isset( \IPS\Request::i()->stream ) )
|
||||
{
|
||||
\IPS\Request::i()->setCookie( 'support_stream', $streamId, \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
\IPS\Db::i()->delete( 'nexus_support_streams', array( 'stream_owner=? AND stream_temporary=1 AND stream_id<>?', \IPS\Member::loggedIn()->member_id, $streamId ) );
|
||||
}
|
||||
$customer = \IPS\nexus\Customer::load( \IPS\Request::i()->member );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
else
|
||||
{
|
||||
$customer = \IPS\nexus\Customer::constructFromData( array( 'email' => \IPS\Request::i()->email ) );
|
||||
}
|
||||
$stream = \IPS\nexus\Support\Stream::customer( $customer );
|
||||
$stream->temporary = TRUE;
|
||||
$stream->owner = \IPS\Member::loggedIn()->member_id;
|
||||
$stream->save();
|
||||
}
|
||||
|
||||
/* Set the cookie */
|
||||
\IPS\Request::i()->setCookie( 'support_stream', $stream->id, \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
|
||||
/* Delete previously stored temporary streams */
|
||||
$where = array(
|
||||
array( 'stream_owner=?', \IPS\Member::loggedIn()->member_id ),
|
||||
array( 'stream_temporary=?', 1 )
|
||||
);
|
||||
if ( !\in_array( $stream->id, array( 'open', 'assigned', 'tracked' ) ) )
|
||||
{
|
||||
$where[] = array( 'stream_id<>?', $stream->id );
|
||||
}
|
||||
\IPS\Db::i()->delete( 'nexus_support_streams', $where );
|
||||
|
||||
/* If this isn't an AJAX request, redirect to it to stop the CSRF key hanging around in the address bar */
|
||||
if ( !\IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=support&controller=requests' ) );
|
||||
}
|
||||
}
|
||||
$stream = $stream ?: \IPS\nexus\Support\Stream::load('open');
|
||||
/* ... or use preferred stream */
|
||||
elseif ( isset( \IPS\Request::i()->cookie['support_stream'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$stream = \IPS\nexus\Support\Stream::load( \IPS\Request::i()->cookie['support_stream'] );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$stream = \IPS\nexus\Support\Stream::load('open');
|
||||
}
|
||||
}
|
||||
/* ... or just use the default */
|
||||
else
|
||||
{
|
||||
$stream = \IPS\nexus\Support\Stream::load('open');
|
||||
}
|
||||
|
||||
/* Are we grouping by department? */
|
||||
if ( isset( \IPS\Request::i()->groupByDepartment ) )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
if ( \IPS\Request::i()->groupByDepartment )
|
||||
{
|
||||
\IPS\Request::i()->setCookie( 'support_dpt_group', 1, \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
@@ -119,21 +152,40 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Request::i()->setCookie( 'support_dpt_group', 0, \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
}
|
||||
if ( !\IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=support&controller=requests' ) );
|
||||
}
|
||||
}
|
||||
$groupByDepartment = ( isset( \IPS\Request::i()->cookie['support_dpt_group'] ) and \IPS\Request::i()->cookie['support_dpt_group'] );
|
||||
|
||||
/* What's our order? */
|
||||
if ( \IPS\Request::i()->sortBy )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Request::i()->setCookie( 'support_sort', \IPS\Request::i()->sortBy, \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
if ( !\IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=support&controller=requests' ) );
|
||||
}
|
||||
}
|
||||
if ( \IPS\Request::i()->sortDir )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Request::i()->setCookie( 'support_order', \IPS\Request::i()->sortDir, \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
if ( !\IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=support&controller=requests' ) );
|
||||
}
|
||||
}
|
||||
if ( isset( \IPS\Request::i()->honorSeverities ) )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Request::i()->setCookie( 'support_honor_severities', \IPS\Request::i()->honorSeverities, \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
if ( !\IPS\Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=support&controller=requests' ) );
|
||||
}
|
||||
}
|
||||
$order = array();
|
||||
if ( $groupByDepartment )
|
||||
@@ -146,8 +198,8 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$order[] = 'sev_position ASC';
|
||||
}
|
||||
$sortBy = ( isset( \IPS\Request::i()->cookie['support_sort'] ) and in_array( \IPS\Request::i()->cookie['support_sort'], array( 'r_started', 'r_last_new_reply', 'r_last_reply', 'r_last_staff_reply' ) ) ) ? \IPS\Request::i()->cookie['support_sort'] : 'r_last_new_reply';
|
||||
$sortDir = ( isset( \IPS\Request::i()->cookie['support_order'] ) and in_array( \IPS\Request::i()->cookie['support_order'], array( 'ASC', 'DESC' ) ) ) ? \IPS\Request::i()->cookie['support_order'] : 'ASC';
|
||||
$sortBy = ( isset( \IPS\Request::i()->cookie['support_sort'] ) and \in_array( \IPS\Request::i()->cookie['support_sort'], array( 'r_started', 'r_last_new_reply', 'r_last_reply', 'r_last_staff_reply' ) ) ) ? \IPS\Request::i()->cookie['support_sort'] : 'r_last_new_reply';
|
||||
$sortDir = ( isset( \IPS\Request::i()->cookie['support_order'] ) and \in_array( \IPS\Request::i()->cookie['support_order'], array( 'ASC', 'DESC' ) ) ) ? \IPS\Request::i()->cookie['support_order'] : 'ASC';
|
||||
$order[] = $sortBy . ' ' . $sortDir;
|
||||
$order = implode( ', ', $order );
|
||||
|
||||
@@ -155,7 +207,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$perPage = 25;
|
||||
$count = $stream->count( \IPS\Member::loggedIn() );
|
||||
$numberOfPages = ceil( $count / $perPage );
|
||||
$page = ( isset( \IPS\Request::i()->page ) and \IPS\Request::i()->page <= $numberOfPages ) ? intval( \IPS\Request::i()->page ) : 1;
|
||||
$page = ( isset( \IPS\Request::i()->page ) and \IPS\Request::i()->page <= $numberOfPages ) ? \intval( \IPS\Request::i()->page ) : 1;
|
||||
$results = $stream->results( \IPS\Member::loggedIn(), $order, $page, $perPage );
|
||||
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( \IPS\Http\Url::internal('app=nexus&module=support&controller=requests'), $numberOfPages, $page, $perPage );
|
||||
|
||||
@@ -172,14 +224,14 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
\IPS\Db::i()->delete( 'nexus_support_streams', array( 'stream_owner=? AND stream_temporary=1', \IPS\Member::loggedIn()->member_id ) );
|
||||
$stream = \IPS\nexus\Support\Stream::createFromForm( $values );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=support&controller=requests&stream=') . $stream->id );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=support&controller=requests&stream=' . $stream->id )->csrf() );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Request::i()->setCookie( 'support_stream', $values['stream'], \IPS\DateTime::create()->add( new \DateInterval( 'P1Y') ), FALSE );
|
||||
}
|
||||
}
|
||||
$form = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'support' ) ), 'filterForm' ) );
|
||||
$form = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'support' ), 'filterForm' ) );
|
||||
|
||||
/* Display */
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
@@ -230,7 +282,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
protected function filters()
|
||||
{
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__nexus_support_requests');
|
||||
\IPS\Output::i()->output = \IPS\nexus\Support\Stream::load('open')->form( NULL, \IPS\Http\Url::internal('app=nexus&module=support&controller=requests') )->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'support' ) ), 'filterForm' ) );
|
||||
\IPS\Output::i()->output = \IPS\nexus\Support\Stream::load('open')->form( NULL, \IPS\Http\Url::internal('app=nexus&module=support&controller=requests') )->customTemplate( array( \IPS\Theme::i()->getTemplate( 'support' ), 'filterForm' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,6 +294,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->stream_title ) )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Db::i()->update( 'nexus_support_streams', array(
|
||||
'stream_title' => \IPS\Request::i()->stream_title,
|
||||
'stream_temporary' => 0
|
||||
@@ -293,11 +346,11 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$stream->title = $values['stream_title'];
|
||||
$stream->updateFromForm( $values );
|
||||
$stream->save();
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=support&controller=requests&stream=' . $stream->id ) );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=support&controller=requests&stream=' . $stream->id )->csrf() );
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'support' ) ), 'filterForm' ) );
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'support' ), 'filterForm' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,10 +490,11 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Editor( 'nexus_default_support_content', $preferences ? $preferences['content'] : NULL, FALSE, array( 'app' => 'nexus', 'key' => 'Support', 'autoSaveKey' => 'default_content', 'tags' => array(
|
||||
'{customer_first_name}' => \IPS\Member::loggedIn()->language()->addToStack('customer_first_name'),
|
||||
'{customer_last_name}' => \IPS\Member::loggedIn()->language()->addToStack('customer_first_name'),
|
||||
'{customer_last_name}' => \IPS\Member::loggedIn()->language()->addToStack('customer_last_name'),
|
||||
'{customer_full_name}' => \IPS\Member::loggedIn()->language()->addToStack('customer_full_name'),
|
||||
'{department_name}' => \IPS\Member::loggedIn()->language()->addToStack('department_name'),
|
||||
'{department_email}' => \IPS\Member::loggedIn()->language()->addToStack('department_email'),
|
||||
'{default_content}' => \IPS\Member::loggedIn()->language()->addToStack('default_content'),
|
||||
) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'nexus_default_support_action', $preferences ? $preferences['action'] : '', FALSE, array( 'options' => array(
|
||||
'' => 'reply_remember_last',
|
||||
@@ -499,7 +553,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
|
||||
foreach ( $types as $k => $t )
|
||||
{
|
||||
if ( $values[ $k ] === 0 or count( $values[ $k ] ) )
|
||||
if ( $values[ $k ] === 0 or \count( $values[ $k ] ) )
|
||||
{
|
||||
\IPS\Db::i()->insert( 'nexus_support_notify', array(
|
||||
'staff_id' => \IPS\Member::loggedIn()->member_id,
|
||||
@@ -585,7 +639,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Stock Actions */
|
||||
$stockActions = \IPS\nexus\Support\StockAction::roots();
|
||||
if ( count( $stockActions ) )
|
||||
if ( \count( $stockActions ) )
|
||||
{
|
||||
$steps['stock_action'] = function( $data ) use ( $stockActions, $url )
|
||||
{
|
||||
@@ -651,12 +705,12 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Custom Fields */
|
||||
$customFields = \IPS\nexus\Support\CustomField::roots();
|
||||
if ( count( $customFields ) )
|
||||
if ( \count( $customFields ) )
|
||||
{
|
||||
$steps['custom_support_fields'] = function( $data ) use ( $url )
|
||||
{
|
||||
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( "sf_departments='*' OR " . \IPS\Db::i()->findInSet( 'sf_departments', array( $data['department'] ) ) ) );
|
||||
if ( count( $customFields ) )
|
||||
if ( \count( $customFields ) )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'custom_fields', 'continue', $url->setQueryString( '_step', 'custom_support_fields' ) );
|
||||
foreach ( $customFields as $field )
|
||||
@@ -692,21 +746,22 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$owner = isset( $data['member'] ) ? \IPS\nexus\Customer::load( $data['member'] ) : NULL;
|
||||
|
||||
$defaultContent = \IPS\Db::i()->select( 'content', 'nexus_support_staff_preferences', array( 'staff_id=?', \IPS\Member::loggedIn()->member_id ) )->first();
|
||||
$defaultContent = str_replace(
|
||||
array( '{customer_first_name}', '{customer_last_name}', '{customer_full_name}', '{department_name}', '{department_email}' ),
|
||||
$defaultContent = $defaultContent ? str_replace(
|
||||
array( '{customer_first_name}', '{customer_last_name}', '{customer_full_name}', '{department_name}', '{department_email}', '{default_content}' ),
|
||||
array(
|
||||
$owner ? $owner->cm_first_name : '',
|
||||
$owner ? $owner->cm_last_name : '',
|
||||
$owner ? $owner->cm_name : $data['email'],
|
||||
$department->_title,
|
||||
$department->email
|
||||
$department->email,
|
||||
$stockAction ? $stockAction->message : ''
|
||||
),
|
||||
$defaultContent
|
||||
);
|
||||
) : ( $stockAction ? $stockAction->message : '' );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
$defaultContent = NULL;
|
||||
$defaultContent = $stockAction ? $stockAction->message : NULL;
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'your_message', 'save', $url->setQueryString( '_step', 'your_message' ) );
|
||||
@@ -714,7 +769,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$form->add( new \IPS\Helpers\Form\Email( 'to', isset( $data['member'] ) ? \IPS\Member::load( $data['member'] )->email : $data['email'], NULL, array(), NULL, NULL, NULL, 'support_create_to' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'cc', array(), FALSE, array( 'autocomplete' => array( 'unique' => TRUE, 'forceLower' => TRUE ) ), array( 'IPS\nexus\Support\Request', '_validateEmail' ), NULL, NULL, 'support_create_cc' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'bcc', array(), FALSE, array( 'autocomplete' => array( 'unique' => TRUE, 'forceLower' => TRUE ) ), array( 'IPS\nexus\Support\Request', '_validateEmail' ), NULL, NULL, 'support_create_bcc' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Editor( 'message', $stockAction ? $stockAction->message : $defaultContent, TRUE, array( 'app' => 'nexus', 'key' => 'Support', 'autoSaveKey' => "new-req-message", 'defaultIfNoAutoSave' => TRUE ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Editor( 'message', $defaultContent, TRUE, array( 'app' => 'nexus', 'key' => 'Support', 'autoSaveKey' => "new-req-message", 'defaultIfNoAutoSave' => TRUE ) ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$request = new \IPS\nexus\Support\Request;
|
||||
@@ -856,7 +911,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('create_support_request');
|
||||
\IPS\Output::i()->output = new \IPS\Helpers\Wizard( $steps, $url, TRUE, $initialData );
|
||||
\IPS\Output::i()->output = (string) new \IPS\Helpers\Wizard( $steps, $url, TRUE, $initialData );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -891,7 +946,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$yesterday = $yesterday->sub( new \DateInterval('P1D') );
|
||||
|
||||
/* What page are we on? */
|
||||
$page = isset( \IPS\Request::i()->page ) ? intval( \IPS\Request::i()->page ) : 1;
|
||||
$page = isset( \IPS\Request::i()->page ) ? \intval( \IPS\Request::i()->page ) : 1;
|
||||
$perPage = 25;
|
||||
|
||||
/* Get our replies */
|
||||
@@ -906,7 +961,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
array( ( $page - 1 ) * $perPage, $perPage ),
|
||||
NULL,
|
||||
NULL,
|
||||
\IPS\Db::SELECT_SQL_CALC_FOUND_ROWS + \IPS\Db::SELECT_MULTIDIMENSIONAL_JOINS
|
||||
\IPS\Db::SELECT_MULTIDIMENSIONAL_JOINS
|
||||
)
|
||||
->join( 'nexus_support_requests', 'r_id=reply_request' )
|
||||
->join( 'nexus_support_departments', 'dpt_id=r_department' )
|
||||
@@ -915,7 +970,11 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
);
|
||||
|
||||
/* Work out pagination */
|
||||
$count = $replies->count( TRUE );
|
||||
$count = \IPS\Db::i()->select( 'COUNT(*)', 'nexus_support_replies', $replyWhere )
|
||||
->join( 'nexus_support_requests', 'r_id=reply_request' )
|
||||
->join( 'nexus_support_departments', 'dpt_id=r_department' )
|
||||
->join( 'nexus_support_ratings', 'reply_id=rating_reply' )
|
||||
->first();
|
||||
$numberOfPages = ceil( $count / $perPage );
|
||||
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( \IPS\Http\Url::internal( 'app=nexus&module=support&controller=requests&do=history&date=' . $date->getTimestamp() ), $numberOfPages, $page, $perPage );
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,9 +23,16 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _settings extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Call
|
||||
*
|
||||
* @param string $method Method called
|
||||
* @param array $args Arguments
|
||||
* @return void
|
||||
*/
|
||||
public function __call( $method, $args )
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _severities extends \IPS\Node\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
@@ -50,6 +55,7 @@ class _severities extends \IPS\Node\Controller
|
||||
|
||||
if ( isset( \IPS\Request::i()->nexus_severities ) )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Settings::i()->changeValues( array( 'nexus_severities' => \IPS\Request::i()->nexus_severities ) );
|
||||
\IPS\Session::i()->log( 'acplogs__severity_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=support&controller=settings&tab=severities') );
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\modules\admin\support;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -23,6 +23,11 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _volume extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -48,7 +53,7 @@ class _volume extends \IPS\Dispatcher\Controller
|
||||
'colors' => array( '#10967e', '#ea7963', '#de6470', '#6b9dde', '#b09be4', '#eec766', '#9fc973', '#e291bf', '#55c1a6', '#5fb9da' ),
|
||||
'hAxis' => array( 'gridlines' => array( 'color' => '#f5f5f5' ) ),
|
||||
'lineWidth' => 1,
|
||||
'areaOpacity' => 0.4,
|
||||
'areaOpacity' => 0.4
|
||||
),
|
||||
'AreaChart'
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user