Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -60,6 +60,24 @@ class _directory extends \IPS\Dispatcher\Controller
|
||||
protected function manage()
|
||||
{
|
||||
$baseUrl = \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' );
|
||||
|
||||
/* Display */
|
||||
$view = \IPS\Settings::i()->clubs_default_view;
|
||||
if ( \IPS\Settings::i()->clubs_allow_view_change )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->view ) and \in_array( \IPS\Request::i()->view, array( 'grid', 'list' ) ) )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Request::i()->setCookie( 'clubs_view', \IPS\Request::i()->view, \IPS\DateTime::create()->add( new \DateInterval('P1Y' ) ) );
|
||||
$view = \IPS\Request::i()->view;
|
||||
|
||||
\IPS\Output::i()->redirect( $baseUrl );
|
||||
}
|
||||
elseif ( isset( \IPS\Request::i()->cookie['clubs_view'] ) and \in_array( \IPS\Request::i()->cookie['clubs_view'], array( 'grid', 'list' ) ) )
|
||||
{
|
||||
$view = \IPS\Request::i()->cookie['clubs_view'];
|
||||
}
|
||||
}
|
||||
|
||||
/* All Clubs: Sort */
|
||||
$sortOption = \IPS\Settings::i()->clubs_default_sort;
|
||||
@@ -74,7 +92,7 @@ class _directory extends \IPS\Dispatcher\Controller
|
||||
$filters = array();
|
||||
$mineOnly = FALSE;
|
||||
$extraWhere = NULL;
|
||||
if ( isset( \IPS\Request::i()->filter ) and \IPS\Request::i()->filter === 'mine' )
|
||||
if ( isset( \IPS\Request::i()->filter ) and \IPS\Request::i()->filter === 'mine' AND \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
$mineOnly = TRUE;
|
||||
$baseUrl = $baseUrl->setQueryString( 'filter', 'mine' );
|
||||
@@ -216,22 +234,7 @@ class _directory extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Display */
|
||||
$view = \IPS\Settings::i()->clubs_default_view;
|
||||
if ( \IPS\Settings::i()->clubs_allow_view_change )
|
||||
{
|
||||
if ( isset( \IPS\Request::i()->view ) and \in_array( \IPS\Request::i()->view, array( 'grid', 'list' ) ) )
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
\IPS\Request::i()->setCookie( 'clubs_view', \IPS\Request::i()->view, \IPS\DateTime::create()->add( new \DateInterval('P1Y' ) ) );
|
||||
$view = \IPS\Request::i()->view;
|
||||
}
|
||||
elseif ( isset( \IPS\Request::i()->cookie['clubs_view'] ) and \in_array( \IPS\Request::i()->cookie['clubs_view'], array( 'grid', 'list' ) ) )
|
||||
{
|
||||
$view = \IPS\Request::i()->cookie['clubs_view'];
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs');
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('clubs')->directory( $featuredClubs, $allClubs, $pagination, $baseUrl, $sortOption, $myClubsActivity, $mapMarkers, $view );
|
||||
}
|
||||
@@ -391,6 +394,11 @@ class _directory extends \IPS\Dispatcher\Controller
|
||||
$club->save();
|
||||
}
|
||||
|
||||
if( $club->approved )
|
||||
{
|
||||
\IPS\Member::loggedIn()->achievementAction( 'core', 'NewClub', $club );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $club->url() );
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class _page extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '12345', 404 );
|
||||
\IPS\Output::i()->error( 'node_error', '2S410/4', 404, '' );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->sidebar['contextual'] = '';
|
||||
|
||||
@@ -527,8 +527,10 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
/* Fetch them */
|
||||
$members = $this->club->members( $statuses, array( $offset, $perPage ), $orderByClause, $this->club->isLeader() ? 5 : 1 );
|
||||
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( $baseUrl, ceil( $members->count(TRUE) / $perPage ), $activePage, $perPage );
|
||||
|
||||
|
||||
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( $baseUrl, ceil( $this->club->members( $statuses, NULL, $orderByClause, 4 ) / $perPage ), $activePage, $perPage );
|
||||
|
||||
|
||||
/* Display */
|
||||
if ( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
@@ -1112,9 +1114,17 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
/* If we're not a member of this club yet, send us back to the join form */
|
||||
if( $this->club->memberStatus( \IPS\Member::loggedIn() ) === NULL AND $referrer = \IPS\Request::i()->referrer() )
|
||||
if( $this->club->memberStatus( \IPS\Member::loggedIn() ) === NULL )
|
||||
{
|
||||
\IPS\Output::i()->redirect( $referrer->setQueryString( 'rulesAcknowledged', 1 ), 'accepted' );
|
||||
if( $referrer = \IPS\Request::i()->referrer() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( $referrer->setQueryString( 'rulesAcknowledged', 1 ), 'accepted' );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->redirect( $this->club->url()->setQueryString( 'rulesAcknowledged', 1 ), 'accepted' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->club->acknowledgeRules( \IPS\Member::loggedIn() );
|
||||
@@ -1150,10 +1160,16 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
|
||||
}
|
||||
|
||||
/* Are there rules that need to be acknowledged which we haven't acknowledged yet? */
|
||||
if( $this->club->rules_required AND !\IPS\Request::i()->rulesAcknowledged )
|
||||
if( $this->club->rules_required AND !$this->club->rulesAcknowledged() AND !\IPS\Request::i()->rulesAcknowledged )
|
||||
{
|
||||
$ref = \IPS\Request::i()->url()->addRef( \IPS\Request::i()->referrer() );
|
||||
\IPS\Output::i()->redirect( $this->club->url()->setQueryString( 'do', 'rules' )->addRef( $ref ) );
|
||||
$rulesUrl = $this->club->url()->setQueryString( 'do', 'rules' );
|
||||
|
||||
if( $referrer = \IPS\Request::i()->referrer() )
|
||||
{
|
||||
$rulesUrl = $rulesUrl->addRef( \IPS\Request::i()->url()->addRef( $referrer ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( $rulesUrl );
|
||||
}
|
||||
|
||||
/* CSRF Check */
|
||||
@@ -1484,6 +1500,8 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$this->club->approved = TRUE;
|
||||
$this->club->save();
|
||||
|
||||
$this->club->owner->achievementAction( 'core', 'NewClub', $this->club );
|
||||
|
||||
\IPS\Output::i()->redirect( $this->club->url() );
|
||||
}
|
||||
|
||||
@@ -1515,7 +1533,7 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
$node = $class::load( \IPS\Request::i()->node );
|
||||
$node = $class::load( (int) \IPS\Request::i()->node );
|
||||
$club = $node->club();
|
||||
if ( !$club or $club->id !== $this->club->id )
|
||||
{
|
||||
@@ -1566,9 +1584,14 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
/* Load */
|
||||
$class = \IPS\Request::i()->type;
|
||||
|
||||
if( !$class instanceof \IPS\Node\Model )
|
||||
{
|
||||
throw new \Exception;
|
||||
}
|
||||
try
|
||||
{
|
||||
$node = $class::load( \IPS\Request::i()->node );
|
||||
$node = $class::load( (int) \IPS\Request::i()->node );
|
||||
$club = $node->club();
|
||||
if ( !$club or $club->id !== $this->club->id )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user