Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -128,20 +128,20 @@ abstract class _Controller
|
||||
$commentClass = $class::$commentClass;
|
||||
if ( isset( $class::$archiveClass ) )
|
||||
{
|
||||
$item = $class::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
$item = $class::load( \IPS\Request::i()->id );
|
||||
if ( $item->isArchived() )
|
||||
{
|
||||
$commentClass = $class::$archiveClass;
|
||||
}
|
||||
}
|
||||
|
||||
$content = $commentClass::loadAndCheckPerms( \IPS\Request::i()->embedComment );
|
||||
$content = $commentClass::load( \IPS\Request::i()->embedComment );
|
||||
$title = $content->item()->mapped('title');
|
||||
}
|
||||
elseif( \IPS\Request::i()->embedReview )
|
||||
{
|
||||
$reviewClass = $class::$reviewClass;
|
||||
$content = $reviewClass::loadAndCheckPerms( \IPS\Request::i()->embedReview );
|
||||
$content = $reviewClass::load( \IPS\Request::i()->embedReview );
|
||||
$title = $content->item()->mapped('title');
|
||||
}
|
||||
else
|
||||
@@ -154,25 +154,21 @@ abstract class _Controller
|
||||
{
|
||||
$params['do'] = \IPS\Request::i()->embedDo;
|
||||
}
|
||||
|
||||
$content = $class::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
$title = $content instanceof \IPS\Node\Model ? $content->_title : $content->mapped('title');
|
||||
|
||||
$content = $class::load( \IPS\Request::i()->id );
|
||||
$title = $content instanceof \IPS\Node\Model ? $content->_title : $content->mapped( 'title' );
|
||||
}
|
||||
|
||||
if ( !( $content instanceof \IPS\Content\Embeddable ) )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedUnavailable();
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $content->embedContent( $params );
|
||||
}
|
||||
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedNoPermission();
|
||||
}
|
||||
$output = $this->getEmbedOutput( $content, $params );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedUnavailable();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
\IPS\Log::log( $e, 'embed_error' );
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedNoPermission();
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure our iframe contents get the necessary elements and JS */
|
||||
@@ -213,4 +209,30 @@ abstract class _Controller
|
||||
|
||||
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->embedInternal( $output, $js ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content item or the proper error message
|
||||
*
|
||||
* @param \IPS\Content $content
|
||||
* @param array $params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getEmbedOutput( $content, array $params = array() )
|
||||
{
|
||||
if ( !$content->canView() )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedNoPermission();
|
||||
}
|
||||
else if ( !( $content instanceof \IPS\Content\Embeddable ) )
|
||||
{
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedUnavailable();
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = $content->embedContent( $params );
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -39,11 +39,14 @@ class _External extends \IPS\Dispatcher\Standard
|
||||
|
||||
/* Base JS */
|
||||
static::baseJs();
|
||||
|
||||
|
||||
/* Run global init */
|
||||
try
|
||||
{
|
||||
parent::init();
|
||||
|
||||
/* Don't update sessions for this hit as it will wipe location data */
|
||||
\IPS\Session::i()->noUpdate();
|
||||
}
|
||||
catch ( \DomainException $e )
|
||||
{
|
||||
|
||||
@@ -172,15 +172,20 @@ class _Front extends \IPS\Dispatcher\Standard
|
||||
}
|
||||
|
||||
/* Do we need more info from the member or do they need to validate? */
|
||||
if( \IPS\Member::loggedIn()->member_id and $this->controller !== 'language' and $this->controller !== 'theme' and $this->controller !== 'ajax' )
|
||||
|
||||
/* This controllers should always be accessible, no matter if the member is awaiting validation or needs to set up the email or name */
|
||||
$legalControllers = array( 'privacy', 'contact', 'terms' );
|
||||
|
||||
/* Do we need more info from the member or do they need to validate? */
|
||||
if( \IPS\Member::loggedIn()->member_id and $this->controller !== 'language' and $this->controller !== 'theme' and $this->controller !== 'ajax' and !\in_array( $this->controller, $legalControllers ) )
|
||||
{
|
||||
/* Need their name or email... */
|
||||
if( ( \IPS\Member::loggedIn()->real_name === '' or !\IPS\Member::loggedIn()->email ) and $this->controller !== 'register' )
|
||||
{
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=system&controller=register&do=complete' )->setQueryString( 'ref', base64_encode( \IPS\Request::i()->url() ) ) );
|
||||
}
|
||||
/* Need them to validate... */
|
||||
elseif( \IPS\Member::loggedIn()->members_bitoptions['validating'] and $this->controller !== 'register' and $this->controller !== 'login' and $this->controller != 'redirect' and $this->controller !== 'contact' and $this->controller !== 'privacy' )
|
||||
elseif( \IPS\Member::loggedIn()->members_bitoptions['validating'] and $this->controller !== 'register' and $this->controller !== 'login' and $this->controller != 'redirect' )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=system&controller=register&do=validating', 'front', 'register' ) );
|
||||
}
|
||||
@@ -190,7 +195,7 @@ class _Front extends \IPS\Dispatcher\Standard
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=system&controller=register&do=reconfirm', 'front', 'register' )->setQueryString( 'ref', base64_encode( \IPS\Request::i()->url() ) ) );
|
||||
}
|
||||
/* Have required profile actions that need completing */
|
||||
else if ( \IPS\Settings::i()->quick_register AND !\IPS\Member::loggedIn()->members_bitoptions['profile_completed'] AND !in_array( $this->controller, array( 'register', 'login', 'redirect', 'contact', 'privacy', 'ajax', 'settings' ) ) AND $completion = \IPS\Member::loggedIn()->profileCompletion() AND count( $completion['required'] ) )
|
||||
else if ( \IPS\Settings::i()->quick_register AND !\IPS\Member::loggedIn()->members_bitoptions['profile_completed'] AND !in_array( $this->controller, array( 'register', 'login', 'redirect', 'ajax', 'settings' ) ) AND $completion = \IPS\Member::loggedIn()->profileCompletion() AND count( $completion['required'] ) )
|
||||
{
|
||||
foreach( $completion['required'] AS $id => $completed )
|
||||
{
|
||||
@@ -201,7 +206,7 @@ class _Front extends \IPS\Dispatcher\Standard
|
||||
}
|
||||
}
|
||||
/* Need to set up MFA... */
|
||||
elseif ( !in_array( $this->controller, array( 'register', 'login', 'redirect', 'contact', 'privacy', 'ajax', 'settings' ) ) )
|
||||
elseif ( !in_array( $this->controller, array( 'register', 'login', 'redirect', 'ajax', 'settings' ) ) )
|
||||
{
|
||||
$haveAcceptableHandlers = FALSE;
|
||||
$haveConfiguredHandler = FALSE;
|
||||
@@ -416,7 +421,7 @@ class _Front extends \IPS\Dispatcher\Standard
|
||||
}
|
||||
|
||||
/* Which theme? */
|
||||
$theme = isset( \IPS\Request::i()->cookie['theme'] ) ? \IPS\Request::i()->cookie['theme'] : \IPS\Theme::defaultTheme();
|
||||
$theme = isset( \IPS\Request::i()->cookie['theme'] ) ? \IPS\Request::i()->cookie['theme'] : '';
|
||||
|
||||
/* Get cache */
|
||||
try
|
||||
@@ -581,7 +586,7 @@ class _Front extends \IPS\Dispatcher\Standard
|
||||
/* MFA Login? */
|
||||
if ( isset( \IPS\Request::i()->_mfaLogin ) and isset( $_SESSION['processing2FA'] ) and $member = \IPS\Member::load( $_SESSION['processing2FA']['memberId'] ) and $member->member_id )
|
||||
{
|
||||
$device = \IPS\Member\Device::loadOrCreate( $member );
|
||||
$device = \IPS\Member\Device::loadOrCreate( $member, FALSE );
|
||||
if ( $output = \IPS\MFA\MFAHandler::accessToArea( 'core', $device->known ? 'AuthenticateFrontKnown' : 'AuthenticateFront', \IPS\Request::i()->url(), $member ) )
|
||||
{
|
||||
if ( $return )
|
||||
@@ -675,4 +680,4 @@ class _Front extends \IPS\Dispatcher\Standard
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,8 +130,8 @@ class _Setup extends \IPS\Dispatcher
|
||||
require \IPS\ROOT_PATH . '/conf_global.php';
|
||||
if ( isset( $INFO ) and isset( $INFO['installed'] ) )
|
||||
{
|
||||
echo \IPS\Member::loggedIn()->language()->addToStack( 'installer_locked' );
|
||||
exit;
|
||||
$upgradeUrl = new \IPS\Http\Url( \IPS\Settings::i()->base_url . \IPS\CP_DIRECTORY . '/upgrade/' );
|
||||
\IPS\Output::i()->redirect( $upgradeUrl );
|
||||
}
|
||||
}
|
||||
/* Upgrader Checks */
|
||||
|
||||
@@ -36,6 +36,11 @@ abstract class _Standard extends \IPS\Dispatcher
|
||||
* Controller
|
||||
*/
|
||||
public $controller;
|
||||
|
||||
/**
|
||||
* @brief Check access permissions
|
||||
*/
|
||||
public $checkGenericPermissions = TRUE;
|
||||
|
||||
/**
|
||||
* Base CSS
|
||||
@@ -81,10 +86,16 @@ abstract class _Standard extends \IPS\Dispatcher
|
||||
\IPS\Output::i()->jsVars['ipb_url_filter_option'] = \IPS\Settings::i()->ipb_url_filter_option;
|
||||
\IPS\Output::i()->jsVars['url_filter_any_action'] = \IPS\Settings::i()->url_filter_any_action;
|
||||
\IPS\Output::i()->jsVars['bypass_profanity'] = intval( \IPS\Member::loggedIn()->group['g_bypass_badwords'] );
|
||||
\IPS\Output::i()->jsVars['emoji_style'] = \IPS\Settings::i()->getFromConfGlobal('sql_utf8mb4') ? \IPS\Settings::i()->emoji_style : 'disabled';
|
||||
\IPS\Output::i()->jsVars['emoji_style'] = ( \IPS\Settings::i()->getFromConfGlobal('sql_utf8mb4') === TRUE ) ? \IPS\Settings::i()->emoji_style : 'disabled';
|
||||
\IPS\Output::i()->jsVars['emoji_shortcodes'] = \IPS\Settings::i()->emoji_shortcodes;
|
||||
\IPS\Output::i()->jsVars['emoji_ascii'] = \IPS\Settings::i()->emoji_ascii;
|
||||
\IPS\Output::i()->jsVars['emoji_cache'] = \IPS\Settings::i()->emoji_cache;
|
||||
|
||||
/* Load the howler JS package if notifications are enabled */
|
||||
if( !\IPS\Member::loggedIn()->members_bitoptions['disable_notification_sounds'] )
|
||||
{
|
||||
array_unshift( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'howler/howler.core.min.js', 'core', 'interface' )[0] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +197,7 @@ abstract class _Standard extends \IPS\Dispatcher
|
||||
}
|
||||
|
||||
/* Init Application */
|
||||
if( !$this->application->canAccess( \IPS\Member::loggedIn() ) AND $this->controllerLocation != 'admin' )
|
||||
if( $this->checkGenericPermissions === TRUE AND !$this->application->canAccess( \IPS\Member::loggedIn() ) AND $this->controllerLocation != 'admin' )
|
||||
{
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'app.js' ) );
|
||||
$message = $this->application->disabled_message ?: 'generic_offline_message';
|
||||
|
||||
Reference in new issue
Block a user