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
@@ -11,30 +11,47 @@
|
||||
namespace IPS\core\modules\admin\settings;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\CheckboxSet;
|
||||
use IPS\Helpers\Form\Radio;
|
||||
use IPS\Helpers\Form\YesNo;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Member\Group;
|
||||
use IPS\Output;
|
||||
use IPS\Session;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* contactus
|
||||
*/
|
||||
class _contactus extends \IPS\Dispatcher\Controller
|
||||
class contactus extends Controller
|
||||
{
|
||||
/**
|
||||
* @brief Has been CSRF-protected
|
||||
*/
|
||||
public static $csrfProtected = TRUE;
|
||||
public static bool $csrfProtected = TRUE;
|
||||
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : void
|
||||
{
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'contactus_manage' );
|
||||
Dispatcher::i()->checkAcpPermission( 'contactus_manage' );
|
||||
parent::execute();
|
||||
}
|
||||
|
||||
@@ -43,11 +60,11 @@ class _contactus extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
protected function manage() : void
|
||||
{
|
||||
$form = $this->_getConfigForm();
|
||||
|
||||
if ( $values = $form->values( true ) )
|
||||
if ( $values = $form->values(true) )
|
||||
{
|
||||
/* If we unselect 'everyone' and save, an empty string is passed through, so the default value is picked up in Settings::changeValues(),
|
||||
which is the 'everyone' preference...the end result is that everyone gets rechecked when you uncheck it. To counter that, we'll store an invalid
|
||||
@@ -59,33 +76,30 @@ class _contactus extends \IPS\Dispatcher\Controller
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__contactus_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=settings&controller=contactus' ), 'saved' );
|
||||
Session::i()->log( 'acplogs__contactus_settings' );
|
||||
Output::i()->redirect( Url::internal( 'app=core&module=settings&controller=contactus' ), 'saved' );
|
||||
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'r__contactus' );
|
||||
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global' )->block( '', $form );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack( 'r__contactus' );
|
||||
Output::i()->output .= Theme::i()->getTemplate( 'global' )->block( '', $form );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the configuration form
|
||||
*
|
||||
* @return \IPS\Helpers\Form
|
||||
* @return Form
|
||||
*/
|
||||
protected function _getConfigForm()
|
||||
protected function _getConfigForm() : Form
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
$form = new Form;
|
||||
$options = array();
|
||||
$toggles = array();
|
||||
$disabled = array();
|
||||
$formFields = array();
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'contact_access', ( \IPS\Settings::i()->contact_access == '*' ) ? '*' : explode( ',', \IPS\Settings::i()->contact_access ), FALSE, array(
|
||||
'options' => array_combine( array_keys( \IPS\Member\Group::groups() ), array_map( function( $_group ) { return (string) $_group; }, \IPS\Member\Group::groups() ) ),
|
||||
$form->add( new CheckboxSet( 'contact_access', ( Settings::i()->contact_access == '*' ) ? '*' : explode( ',', Settings::i()->contact_access ), FALSE, array(
|
||||
'options' => array_combine( array_keys( Group::groups() ), array_map( function( $_group ) { return (string) $_group; }, Group::groups() ) ),
|
||||
'multiple' => true,
|
||||
'unlimited' => '*',
|
||||
'unlimitedLang' => 'everyone',
|
||||
@@ -93,14 +107,14 @@ class _contactus extends \IPS\Dispatcher\Controller
|
||||
), NULL, NULL, NULL, 'contact_access' ) );
|
||||
|
||||
/* Get extensions */
|
||||
$extensions = \IPS\Application::allExtensions( 'core', 'ContactUs', FALSE, 'core', 'InternalEmail', TRUE );
|
||||
$extensions = Application::allExtensions( 'core', 'ContactUs', FALSE, 'core', 'InternalEmail', TRUE );
|
||||
|
||||
foreach ( $extensions as $k => $class )
|
||||
{
|
||||
$class->process( $form, $formFields, $options, $toggles, $disabled );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'contact_type', \IPS\Settings::i()->contact_type, FALSE, array(
|
||||
$form->add( new Radio( 'contact_type', Settings::i()->contact_type, FALSE, array(
|
||||
'options' => $options,
|
||||
'toggles' => $toggles,
|
||||
'disabled' => $disabled
|
||||
@@ -111,7 +125,7 @@ class _contactus extends \IPS\Dispatcher\Controller
|
||||
$form->add( $field );
|
||||
}
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'contact_email_verify', \IPS\Settings::i()->contact_email_verify, TRUE ) );
|
||||
$form->add( new YesNo( 'contact_email_verify', Settings::i()->contact_email_verify, TRUE ) );
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user