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

+55 -38
View File
@@ -12,27 +12,44 @@
namespace IPS\core\modules\front\clubs;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Dispatcher\Controller;
use IPS\File;
use IPS\GeoLocation;
use IPS\Helpers\Form;
use IPS\Http\Url;
use IPS\Member;
use IPS\Member\Club;
use IPS\Member\Club\Page as ClubPage;
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;
}
/**
* page
*/
class _page extends \IPS\Dispatcher\Controller
class page extends Controller
{
/**
* @brief Page
*/
protected $page;
protected ?ClubPage $page = null;
/**
* @brief These properties are used to specify datalayer context properties.
*
*/
public static $dataLayerContext = array(
public static array $dataLayerContext = array(
'community_area' => [ 'value' => 'clubs', 'odkUpdate' => 'true']
);
@@ -41,41 +58,41 @@ class _page extends \IPS\Dispatcher\Controller
*
* @return void
*/
public function execute()
public function execute() : void
{
try
{
$this->page = \IPS\Member\Club\Page::loadAndCheckPerms( \IPS\Request::i()->id );
$this->page = ClubPage::loadAndCheckPerms( Request::i()->id );
}
catch( \OutOfRangeException $e )
catch( OutOfRangeException $e )
{
\IPS\Output::i()->error( 'node_error', '2S410/4', 404, '' );
Output::i()->error( 'node_error', '2S410/4', 404, '' );
}
\IPS\Output::i()->sidebar['contextual'] = '';
Output::i()->sidebar['contextual'] = '';
/* Club info in sidebar */
if ( \IPS\Settings::i()->clubs_header == 'sidebar' )
if ( Settings::i()->clubs_header == 'sidebar' )
{
\IPS\Output::i()->sidebar['contextual'] .= \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->header( $this->page->club, NULL, 'sidebar', $this->page );
Output::i()->sidebar['contextual'] .= Theme::i()->getTemplate( 'clubs', 'core' )->header( $this->page->club, NULL, 'sidebar', $this->page );
}
if( ( \IPS\GeoLocation::enabled() and \IPS\Settings::i()->clubs_locations AND $location = $this->page->club->location() ) )
if( ( GeoLocation::enabled() and Settings::i()->clubs_locations AND $location = $this->page->club->location() ) )
{
\IPS\Output::i()->sidebar['contextual'] .= \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->clubLocationBox( $this->page->club, $location );
Output::i()->sidebar['contextual'] .= Theme::i()->getTemplate( 'clubs', 'core' )->clubLocationBox( $this->page->club, $location );
}
if( $this->page->club->type != \IPS\Member\Club::TYPE_PUBLIC AND $this->page->club->canViewMembers() )
if( $this->page->club->type != Club::TYPE_PUBLIC AND $this->page->club->canViewMembers() )
{
\IPS\Output::i()->sidebar['contextual'] .= \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->clubMemberBox( $this->page->club );
Output::i()->sidebar['contextual'] .= Theme::i()->getTemplate( 'clubs', 'core' )->clubMemberBox( $this->page->club );
}
\IPS\Output::i()->breadcrumb[] = array( $this->page->club->url(), $this->page->club->name );
\IPS\Output::i()->breadcrumb[] = array( NULL, $this->page->title );
Output::i()->breadcrumb[] = array( $this->page->club->url(), $this->page->club->name );
Output::i()->breadcrumb[] = array( NULL, $this->page->title );
if( !$this->page->meta_index )
{
\IPS\Output::i()->metaTags['robots'] = 'noindex';
Output::i()->metaTags['robots'] = 'noindex';
}
parent::execute();
@@ -86,15 +103,15 @@ class _page extends \IPS\Dispatcher\Controller
*
* @return void
*/
protected function manage()
protected function manage() : void
{
if ( !$this->page->club->rulesAcknowledged() )
{
\IPS\Http\Url::internal( $this->page->club->url()->setQueryString( 'do', 'rules' ) );
Url::internal( $this->page->club->url()->setQueryString( 'do', 'rules' ) );
}
\IPS\Output::i()->title = $this->page->title;
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'clubs' )->viewPage( $this->page );
Output::i()->title = $this->page->title;
Output::i()->output = Theme::i()->getTemplate( 'clubs' )->viewPage( $this->page );
}
/**
@@ -102,17 +119,17 @@ class _page extends \IPS\Dispatcher\Controller
*
* @return void
*/
public function edit()
public function edit() : void
{
if( !$this->page->canEdit() )
{
\IPS\Output::i()->error( 'node_noperm_edit', '2S410/1', 403, '' );
Output::i()->error( 'node_noperm_edit', '2S410/1', 403, '' );
}
/* Init form */
$form = new \IPS\Helpers\Form;
$form->class = 'ipsForm_vertical';
\IPS\Member\Club\Page::form( $form, $this->page->club, $this->page );
$form = new Form;
$form->class = 'ipsForm--vertical ipsForm--edit-club-page';
ClubPage::form( $form, $this->page->club, $this->page );
/* Form Submission */
if ( $values = $form->values() )
@@ -120,20 +137,20 @@ class _page extends \IPS\Dispatcher\Controller
$this->page->formatFormValues( $values );
$this->page->save();
\IPS\File::claimAttachments( "club-page-{$this->page->id}", $this->page->id );
File::claimAttachments( "club-page-{$this->page->id}", $this->page->id );
if ( \IPS\Request::i()->isAjax() )
if ( Request::i()->isAjax() )
{
\IPS\Output::i()->json( 'OK' );
Output::i()->json( 'OK' );
}
else
{
\IPS\Output::i()->redirect( $this->page->url() );
Output::i()->redirect( $this->page->url() );
}
}
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack( "edit" );
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core' ), 'popupTemplate' ) );
Output::i()->title = Member::loggedIn()->language()->addToStack( "edit" );
Output::i()->output = $form->customTemplate( array( Theme::i()->getTemplate( 'forms', 'core' ), 'popupTemplate' ) );
}
/**
@@ -141,17 +158,17 @@ class _page extends \IPS\Dispatcher\Controller
*
* @return void
*/
public function delete()
public function delete() : void
{
\IPS\Session::i()->csrfCheck();
Session::i()->csrfCheck();
if( !$this->page->canDelete() )
{
\IPS\Output::i()->error( 'node_noperm_delete', '2S410/2', 403, '' );
Output::i()->error( 'node_noperm_delete', '2S410/2', 403, '' );
}
$this->page->delete();
\IPS\Output::i()->redirect( $this->page->club->url(), 'deleted' );
Output::i()->redirect( $this->page->club->url(), 'deleted' );
}
}