Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,40 +12,53 @@
|
||||
namespace IPS\core\modules\admin\membersettings;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Translatable;
|
||||
use IPS\Helpers\Form\YesNo;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Lang;
|
||||
use IPS\Node\Controller;
|
||||
use IPS\Output;
|
||||
use IPS\Session;
|
||||
use IPS\Settings;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* referralcommission
|
||||
*/
|
||||
class _referralcommission extends \IPS\Node\Controller
|
||||
class referralcommission extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
public static bool $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Node Class
|
||||
*/
|
||||
protected $nodeClass = 'IPS\nexus\CommissionRule';
|
||||
protected string $nodeClass = 'IPS\nexus\CommissionRule';
|
||||
|
||||
/**
|
||||
* Show the "add" button in the page root rather than the table root
|
||||
*/
|
||||
protected $_addButtonInRoot = FALSE;
|
||||
protected bool $_addButtonInRoot = FALSE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : void
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'commission_rules_manage' );
|
||||
Dispatcher::i()->checkAcpPermission( 'commission_rules_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -54,12 +67,12 @@ class _referralcommission extends \IPS\Node\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage()
|
||||
public function manage() : void
|
||||
{
|
||||
\IPS\Output::i()->sidebar['actions'][] = array(
|
||||
Output::i()->sidebar['actions'][] = array(
|
||||
'icon' => 'cog',
|
||||
'title' => 'commission_settings',
|
||||
'link' => \IPS\Http\Url::internal( "app=nexus&module=customers&controller=referrals&do=settings" )
|
||||
'link' => Url::internal( "app=nexus&module=customers&controller=referrals&do=settings" )
|
||||
);
|
||||
|
||||
parent::manage();
|
||||
@@ -70,28 +83,25 @@ class _referralcommission extends \IPS\Node\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function settings()
|
||||
public function settings() : void
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'nexus_com_rules', \IPS\Settings::i()->nexus_com_rules, FALSE, array( 'togglesOff' => array( 'nexus_com_rules_alt' ) ), NULL, NULL, NULL, 'nexus_com_rules' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Translatable( 'nexus_com_rules_alt', NULL, FALSE, array( 'app' => 'nexus', 'key' => 'nexus_com_rules_val', 'editor' => array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'nexus_com_rules_alt', 'attachIds' => array( NULL, NULL, 'nexus_com_rules_alt' ) ) ), NULL, NULL, NULL, 'nexus_com_rules_alt' ) );
|
||||
$form = new Form;
|
||||
$form->add( new YesNo( 'nexus_com_rules', Settings::i()->nexus_com_rules, FALSE, array( 'togglesOff' => array( 'nexus_com_rules_alt' ) ), NULL, NULL, NULL, 'nexus_com_rules' ) );
|
||||
$form->add( new Translatable( 'nexus_com_rules_alt', NULL, FALSE, array( 'app' => 'nexus', 'key' => 'nexus_com_rules_val', 'editor' => array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'nexus_com_rules_alt', 'attachIds' => array( NULL, NULL, 'nexus_com_rules_alt' ) ) ), NULL, NULL, NULL, 'nexus_com_rules_alt' ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
\IPS\Lang::saveCustom( 'nexus', 'nexus_com_rules_val', $values['nexus_com_rules_alt'] );
|
||||
Lang::saveCustom( 'nexus', 'nexus_com_rules_val', $values['nexus_com_rules_alt'] );
|
||||
unset( $values['nexus_com_rules_alt'] );
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
\IPS\Session::i()->log( 'acplog__referral_commission_settings_edited' );
|
||||
Session::i()->log( 'acplog__referral_commission_settings_edited' );
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal('app=nexus&module=customers&controller=referrals'), 'saved' );
|
||||
Output::i()->redirect( Url::internal('app=nexus&module=customers&controller=referrals'), 'saved' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->output = $form;
|
||||
Output::i()->output = $form;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user