Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -11,47 +11,62 @@
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\Http\Url;
use IPS\Member;
use IPS\Member\ProfileStep;
use IPS\Node\Controller;
use IPS\Output;
use IPS\Request;
use IPS\Session;
use IPS\Settings;
use IPS\Theme;
use OutOFRangeException;
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;
}
/**
* Profile Completion
*/
class _profilecompletion extends \IPS\Node\Controller
class profilecompletion extends Controller
{
/**
* @brief Has been CSRF-protected
*/
public static $csrfProtected = TRUE;
public static bool $csrfProtected = TRUE;
/**
* Node Class
*/
protected $nodeClass = '\IPS\Member\ProfileStep';
protected string $nodeClass = '\IPS\Member\ProfileStep';
/**
* Show the "add" button in the page root rather than the table root
*/
protected $_addButtonInRoot = FALSE;
protected bool $_addButtonInRoot = FALSE;
/**
* Get Root Buttons
*
* @return array
*/
public function _getRootButtons()
public function _getRootButtons(): array
{
$return = parent::_getRootButtons();
if ( isset( \IPS\Output::i()->sidebar['actions']['add'] ) )
if ( isset( Output::i()->sidebar['actions']['add'] ) )
{
$class = new \IPS\Member\ProfileStep;
$class = new ProfileStep;
if ( ! $class->canAdd() )
{
unset( \IPS\Output::i()->sidebar['actions']['add'] );
unset( Output::i()->sidebar['actions']['add'] );
}
}
@@ -63,9 +78,9 @@ class _profilecompletion extends \IPS\Node\Controller
*
* @return void
*/
public function execute()
public function execute() : void
{
\IPS\Dispatcher::i()->checkAcpPermission( 'profilefields_manage' );
Dispatcher::i()->checkAcpPermission( 'profilefields_manage' );
parent::execute();
}
@@ -74,10 +89,10 @@ class _profilecompletion extends \IPS\Node\Controller
*
* @return void
*/
public function manage()
public function manage() : void
{
$class = new \IPS\Member\ProfileStep;
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'members' )->profileCompleteBlurb( $class->canAdd() );
$class = new ProfileStep;
Output::i()->output = Theme::i()->getTemplate( 'members' )->profileCompleteBlurb( $class->canAdd() );
parent::manage();
}
@@ -86,15 +101,15 @@ class _profilecompletion extends \IPS\Node\Controller
*
* @return void
*/
public function enableQuickRegister()
public function enableQuickRegister() : void
{
\IPS\Session::i()->csrfCheck();
Session::i()->csrfCheck();
\IPS\Settings::i()->changeValues( array( 'quick_register' => 1 ) );
Settings::i()->changeValues( array( 'quick_register' => 1 ) );
\IPS\Session::i()->log( 'acplog__quick_register_enabled' );
Session::i()->log( 'acplog__quick_register_enabled' );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=membersettings&controller=profiles&tab=profilecompletion' ), 'profile_complete_quick_register_off_enabled' );
Output::i()->redirect( Url::internal( 'app=core&module=membersettings&controller=profiles&tab=profilecompletion' ), 'profile_complete_quick_register_off_enabled' );
}
/**
@@ -102,23 +117,23 @@ class _profilecompletion extends \IPS\Node\Controller
*
* @return void
*/
public function form()
public function form() : void
{
$form = new \IPS\Helpers\Form;
if ( isset( \IPS\Request::i()->id ) )
$form = new Form;
if ( isset( Request::i()->id ) )
{
try
{
$step = \IPS\Member\ProfileStep::load( \IPS\Request::i()->id );
$step = ProfileStep::load( Request::i()->id );
}
catch( \OutOFRangeException $e )
catch( OutOFRangeException $e )
{
\IPS\Output::i()->error( 'node_error', '2C360/1', 404, '' );
Output::i()->error( 'node_error', '2C360/1', 404, '' );
}
}
else
{
$step = new \IPS\Member\ProfileStep;
$step = new ProfileStep;
}
$step->form( $form );
@@ -127,27 +142,25 @@ class _profilecompletion extends \IPS\Node\Controller
{
$values = $step->formatFormValues( $values );
$step->extension = \IPS\Member\ProfileStep::findExtensionFromAction( $values['step_completion_act'] );
$step->required = ( isset( $values['step_required'] ) ) ? $values['step_required'] : FALSE;
$extension = ProfileStep::loadExtensionFromAction( $values['step_completion_act'] );
$step->required = ( isset( $values['step_required'] ) ) ? $values['step_required'] : FALSE;
$step->registration = $values['step_registration'];
$step->completion_act = $values['step_completion_act'];
$step->subcompletion_act = isset( $values['step_subcompletion_act'] ) ? $values['step_subcompletion_act'] : NULL;
$step->subcompletion_act = $values['step_subcompletion_act'] ?? NULL;
$step->save();
$step->postSaveForm( $values );
if ( method_exists( $step->extension, 'postAcpSave' ) )
{
$step->extension->postAcpSave( $step, $values );
}
$extension->postAcpSave( $step, $values );
\IPS\Member::updateAllMembers( array( "members_bitoptions2 = members_bitoptions2 & ~" . \IPS\Member::$bitOptions['members_bitoptions']['members_bitoptions2']['profile_completed'] ) );
Member::updateAllMembers( array( "members_bitoptions2 = members_bitoptions2 & ~" . Member::$bitOptions['members_bitoptions']['members_bitoptions2']['profile_completed'] ) );
\IPS\Session::i()->log( 'acplog__profile_step_added', array( "profile_step_title_{$step->id}" => TRUE ) );
Session::i()->log( 'acplog__profile_step_added', array( "profile_step_title_{$step->id}" => TRUE ) );
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=membersettings&controller=profiles&tab=profilecompletion" ), 'saved' );
Output::i()->redirect( Url::internal( "app=core&module=membersettings&controller=profiles&tab=profilecompletion" ), 'saved' );
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( 'profile_completion' );
\IPS\Output::i()->output = $form;
Output::i()->title = Member::loggedIn()->language()->addToStack( 'profile_completion' );
Output::i()->output = $form;
}
}