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,36 +11,47 @@
|
||||
namespace IPS\core\modules\front\system;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Content;
|
||||
use IPS\core\Followed\Table;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\IPS;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* My followed content
|
||||
*/
|
||||
class _followed extends \IPS\Dispatcher\Controller
|
||||
class followed extends Controller
|
||||
{
|
||||
/**
|
||||
* My followed content
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
protected function manage() : void
|
||||
{
|
||||
/* Guests can't follow things */
|
||||
if( !\IPS\Member::loggedIn()->member_id )
|
||||
if( !Member::loggedIn()->member_id )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission_guest', '2C266/1', 403, '' );
|
||||
Output::i()->error( 'no_module_permission_guest', '2C266/1', 403, '' );
|
||||
}
|
||||
|
||||
/* Get the different types */
|
||||
$types = array();
|
||||
|
||||
foreach ( \IPS\Content::routedClasses( TRUE, FALSE, TRUE ) as $class )
|
||||
foreach ( Content::routedClasses( TRUE, FALSE, TRUE ) as $class )
|
||||
{
|
||||
if( is_subclass_of( $class, 'IPS\Content\Followable' ) )
|
||||
if( IPS::classUsesTrait( $class, 'IPS\Content\Followable' ) )
|
||||
{
|
||||
$types[ $class::$application . '_' . $class::$module ][ mb_strtolower( str_replace( '\\', '_', mb_substr( $class, 4 ) ) ) ] = $class;
|
||||
|
||||
@@ -60,19 +71,19 @@ class _followed extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Don't forget Members - add this on to the end so it never defaults UNLESS we only have apps that do not have followable content */
|
||||
$types['core'] = array( 'core_member' => "\IPS\Member" );
|
||||
$types['core'] = array( 'core_member' => "\IPS\Member", 'core_tag' => "IPS\Content\Tag" );
|
||||
|
||||
/* What type are we looking at? */
|
||||
$currentAppModule = NULL;
|
||||
$currentType = NULL;
|
||||
if ( isset( \IPS\Request::i()->type ) )
|
||||
if ( isset( Request::i()->type ) )
|
||||
{
|
||||
foreach ( $types as $appModule => $_types )
|
||||
{
|
||||
if ( array_key_exists( \IPS\Request::i()->type, $_types ) )
|
||||
if ( array_key_exists( Request::i()->type, $_types ) )
|
||||
{
|
||||
$currentAppModule = $appModule;
|
||||
$currentType = \IPS\Request::i()->type;
|
||||
$currentType = Request::i()->type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -93,26 +104,22 @@ class _followed extends \IPS\Dispatcher\Controller
|
||||
|
||||
$currentClass = $types[ $currentAppModule ][ $currentType ];
|
||||
|
||||
$output = new \IPS\core\Followed\Table( $currentClass, explode( '_', $currentType ) );
|
||||
$output = new Table( $currentClass, explode( '_', $currentType ) );
|
||||
|
||||
/* If we've clicked from the tab section */
|
||||
if ( \IPS\Request::i()->isAjax() && \IPS\Request::i()->change_section )
|
||||
if ( Request::i()->isAjax() && Request::i()->change_section )
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->followedContentSection( $types, $currentAppModule, $currentType, $output );
|
||||
Output::i()->output = Theme::i()->getTemplate( 'system' )->followedContentSection( $types, $currentAppModule, $currentType, $output );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Display */
|
||||
if ( \IPS\Theme::i()->settings['responsive'] )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/followedcontent_responsive.css' ) );
|
||||
}
|
||||
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_system.js', 'core' ) );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu_followed_content');
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, \IPS\Member::loggedIn()->language()->addToStack('menu_followed_content') );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'system' )->followedContent( $types, $currentAppModule, $currentType, $output );
|
||||
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'styles/profiles.css' ) );
|
||||
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js('front_system.js', 'core' ) );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('menu_followed_content');
|
||||
Output::i()->sidebar['enabled'] = FALSE;
|
||||
Output::i()->breadcrumb[] = array( NULL, Member::loggedIn()->language()->addToStack('menu_followed_content') );
|
||||
Output::i()->output = Theme::i()->getTemplate( 'system' )->followedContent( $types, $currentAppModule, $currentType, $output );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user