Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

+18 -11
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Admin CP Dispatcher
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Dispatcher;
@@ -298,11 +297,6 @@ class _Admin extends \IPS\Dispatcher\Standard
{
if ( !$item['restriction'] or \IPS\Member::loggedIn()->hasAcpRestriction( $app, $moduleToCheck, $item['restriction'] ) )
{
if ( !isset( $this->menu['defaults'][ $item['tab'] ] ) )
{
$this->menu['defaults'][ $item['tab'] ] = "app={$app->directory}&module={$moduleKey}&controller={$item['controller']}";
}
$this->menu['tabs'][ $item['tab'] ][ "{$app->directory}_{$moduleKey}" ][ $itemKey ] = "app={$app->directory}&module={$moduleKey}&controller={$item['controller']}" . ( $item['do'] ? "&do={$item['do']}" : '' );
}
}
@@ -342,7 +336,20 @@ class _Admin extends \IPS\Dispatcher\Standard
}
}
}
/* Now set the tab defaults */
foreach( $this->menu['tabs'] as $tab => $menu )
{
if ( !isset( $this->menu['defaults'][ $tab ] ) )
{
foreach( $menu as $group => $submenu )
{
$this->menu['defaults'][ $tab ] = array_values($submenu)[0];
break;
}
}
}
return $this->menu;
}
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief API Dispatcher
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 3 Dec 2015
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Dispatcher;
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Build/Tools Dispatcher
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 2 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Dispatcher;
+29 -8
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Abstract class that Controllers should extend
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Dispatcher;
@@ -175,8 +174,30 @@ abstract class _Controller
}
}
/* Make sure our iframe contents get the necessary elements and JS */
$js = array(
\IPS\Output::i()->js( 'js/commonEmbedHandler.js', 'core', 'interface' ),
\IPS\Output::i()->js( 'js/internalEmbedHandler.js', 'core', 'interface' )
);
\IPS\Output::i()->base = '_parent';
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css' ) );
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core' )->blankTemplate( $output, $title ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
/* We need to keep any embed.css files that have been specified so that we can re-add them after we re-fetch the css framework */
$embedCss = array();
foreach( \IPS\Output::i()->cssFiles as $cssFile )
{
if( \mb_stristr( $cssFile, 'embed.css' ) )
{
$embedCss[] = $cssFile;
}
}
/* We need to reset the included CSS files because by this point the responsive files are already in the output CSS array */
\IPS\Output::i()->cssFiles = array();
\IPS\Output::i()->responsive = FALSE;
\IPS\Dispatcher\Front::baseCss();
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, $embedCss );
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/embeds.css', 'core', 'front' ) );
\IPS\Output::i()->sendOutput( \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->embedInternal( $output, $js ), 200, 'text/html', \IPS\Output::i()->httpHeaders );
}
}
}
+22 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Dispatcher
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS;
@@ -73,6 +72,24 @@ abstract class _Dispatcher
{
$_redirect = TRUE;
}
else if ( !isset( $INFO['installed'] ) OR !$INFO['installed'] )
{
/* This looks weird, but there was a period of time where "installed" was misspelled as "instaled" on Community in the Cloud after install finished. So, if that is present, assume we're okay. */
if ( !isset( $INFO['instaled'] ) )
{
if( isset( $_SERVER['SERVER_PROTOCOL'] ) and \strstr( $_SERVER['SERVER_PROTOCOL'], '/1.0' ) !== false )
{
header( "HTTP/1.0 503 Service Unavailable" );
}
else
{
header( "HTTP/1.1 503 Service Unavailable" );
}
require \IPS\ROOT_PATH . '/' . \IPS\CP_DIRECTORY . '/install/installing.html';
exit;
}
}
}
if( $_redirect === TRUE )
+5 -6
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Front-end Dispatcher
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Dispatcher;
@@ -19,7 +18,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
}
/**
* Dispatcher that doesn't really dispatch but sets things up for external scripts calling IPS4 stuff, like Pages external blocks
* Dispatcher that doesn't really dispatch but sets things up for external scripts like Pages external blocks
*/
class _External extends \IPS\Dispatcher\Standard
{
+58 -14
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Front-end Dispatcher
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 18 Feb 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Dispatcher;
@@ -35,6 +34,9 @@ class _Front extends \IPS\Dispatcher\Standard
*/
public function init()
{
/* Get cached page if available */
$this->checkCached();
/* Set up in progress? */
if ( isset( \IPS\Settings::i()->setup_in_progress ) AND \IPS\Settings::i()->setup_in_progress )
{
@@ -51,9 +53,6 @@ class _Front extends \IPS\Dispatcher\Standard
exit;
}
/* Get cached page if available */
$this->checkCached();
/* Sync stuff when in developer mode */
if ( \IPS\IN_DEV )
{
@@ -139,10 +138,16 @@ class _Front extends \IPS\Dispatcher\Standard
if ( $this->notAllowedBannedPage() )
{
$url = \IPS\Http\Url::internal( 'app=core&module=system&controller=login', 'front', 'login' );
if ( \IPS\Request::i()->url() != \IPS\Settings::i()->base_url )
if ( \IPS\Request::i()->url() != \IPS\Settings::i()->base_url AND !isset( \IPS\Request::i()->_mfaLogin ) )
{
$url = $url->setQueryString( 'ref', base64_encode( \IPS\Request::i()->url() ) );
}
else if ( isset( \IPS\Request::i()->_mfaLogin ) )
{
$url = $url->setQueryString( '_mfaLogin', 1 );
}
\IPS\Output::i()->redirect( $url );
}
}
@@ -175,6 +180,17 @@ 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\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'] ) )
{
foreach( $completion['required'] AS $id => $completed )
{
if ( $completed === FALSE )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=system&controller=register&do=finish", 'front', 'register' ) );
}
}
}
/* Need to set up MFA... */
elseif ( !in_array( $this->controller, array( 'register', 'login', 'redirect', 'contact', 'privacy', 'ajax', 'settings' ) ) )
{
@@ -213,6 +229,10 @@ class _Front extends \IPS\Dispatcher\Standard
/* Permission Check */
if ( !\IPS\Member::loggedIn()->canAccessModule( $this->module ) )
{
if ( !\IPS\Member::loggedIn()->member_id and isset( \IPS\Request::i()->_mfaLogin ) )
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( "app=core&module=system&controller=login", 'front', 'login', NULL, \IPS\Settings::i()->logins_over_https )->setQueryString( '_mfaLogin', 1 ) );
}
\IPS\Output::i()->error( ( \IPS\Member::loggedIn()->member_id ? 'no_module_permission' : 'no_module_permission_guest' ), '2S100/2', 403, 'no_module_permission_admin' );
}
@@ -351,6 +371,12 @@ class _Front extends \IPS\Dispatcher\Standard
*/
protected function checkCached()
{
/* If we are using a caching engine and Database datastore, then avoid checking cache validity because it will hit MySQL to load the cacheKeys. As this is guest caching, we accept that stale data is ok */
if ( \IPS\STORE_METHOD === 'Database' AND \IPS\CACHE_METHOD !== 'None' )
{
\IPS\Data\Store::i()->cacheCheck = false;
}
/* If this is a guest and there's a full cached page, we can serve that */
if( mb_strtolower( $_SERVER['REQUEST_METHOD'] ) == 'get' and !isset( \IPS\Request::i()->csrfKey ) and !isset( \IPS\Request::i()->_mfaLogin ) and !\IPS\Session\Front::loggedIn() and !isset( \IPS\Request::i()->cookie['noCache'] ) and !\IPS\Request::i()->ipAddressIsBanned() and \IPS\CACHE_PAGE_TIMEOUT )
{
@@ -379,9 +405,15 @@ class _Front extends \IPS\Dispatcher\Standard
$cache = \IPS\Data\Cache::i()->getWithExpire( 'page_' . md5( (int) \IPS\Request::i()->isSecure() . ( !empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'] ) . '/' . $_SERVER['REQUEST_URI'] ) . "_{$language}_{$theme}", TRUE );
$sessionId = isset( \IPS\Request::i()->cookie['IPSSessionFront'] ) ? \IPS\Request::i()->cookie['IPSSessionFront'] : \IPS\Session::i()->id;
\IPS\Output::i()->sendOutput( str_replace( '{{csrfKey}}', md5( '&& 0&' . $sessionId ), $cache['output'] ), $cache['code'], $cache['contentType'], $cache['httpHeaders'], FALSE, TRUE );
\IPS\Output::i()->sendOutput( str_replace( '{{csrfKey}}', md5( '& 0&' . $sessionId ), $cache['output'] ), $cache['code'], $cache['contentType'], $cache['httpHeaders'], FALSE, TRUE );
}
catch ( \OutOfRangeException $e ) {}
/* Turn back on cache validation if we are still here */
if ( \IPS\STORE_METHOD === 'Database' AND \IPS\CACHE_METHOD !== 'None' )
{
\IPS\Data\Store::i()->cacheCheck = true;
}
}
}
@@ -449,7 +481,7 @@ class _Front extends \IPS\Dispatcher\Standard
if( count( $widgets ) )
{
if ( \IPS\CACHE_METHOD === 'None' )
if ( \IPS\CACHE_METHOD === 'None' and ! \IPS\Theme::isUsingTemplateDiskCache() )
{
$templateLoad = array();
foreach ( $widgets as $areaKey => $area )
@@ -527,17 +559,29 @@ class _Front extends \IPS\Dispatcher\Standard
/**
* Check MFA to see if we need to supply a code
*
* @param boolean $return Return any HTML (true) or add to Output (false)
*
* @return void
*/
public function checkMfa()
public function checkMfa( $return=FALSE )
{
/* MFA Login? */
if ( isset( \IPS\Request::i()->_mfaLogin ) and isset( $_SESSION['processing2FA'] ) and $member = \IPS\Member::load( $_SESSION['processing2FA']['memberId'] ) and $member->member_id )
{
if ( $output = \IPS\MFA\MFAHandler::accessToArea( 'core', 'AuthenticateFront', \IPS\Http\Url::internal( 'app=core&module=system&controller=login&do=mfa', 'front', 'login' ), $member ) )
$device = \IPS\Member\Device::loadOrCreate( $member );
if ( $output = \IPS\MFA\MFAHandler::accessToArea( 'core', $device->known ? 'AuthenticateFrontKnown' : 'AuthenticateFront', \IPS\Request::i()->url(), $member ) )
{
if ( $return )
{
return $output;
}
\IPS\Output::i()->output .= $output;
}
else
{
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=core&module=system&controller=login&do=mfa', 'front', 'login' ) );
}
}
}
@@ -591,7 +635,7 @@ class _Front extends \IPS\Dispatcher\Standard
if ( !\IPS\Request::i()->isAjax() )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'core.css', 'core', 'front' ) );
if ( \IPS\Theme::i()->settings['responsive'] )
if ( \IPS\Output::i()->responsive and \IPS\Theme::i()->settings['responsive'] )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'core_responsive.css', 'core', 'front' ) );
}
+4 -5
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Installer/Upgrader Dispatcher
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 2 Apr 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Dispatcher;
+13 -8
View File
@@ -1,12 +1,11 @@
<?php
/**
* @brief Standard Dispatcher (For Front-End and ACP)
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 21 Nov 2013
* @version SVN_VERSION_NUMBER
*/
namespace IPS\Dispatcher;
@@ -115,16 +114,22 @@ abstract class _Standard extends \IPS\Dispatcher
/* Force HTTPs and correct domain (e.g. not "www." if that's not in the base URL) */
if ( mb_strtolower( $_SERVER['REQUEST_METHOD'] ) == 'get' )
{
$baseUrl = new \IPS\Http\Url( \IPS\Settings::i()->base_url );
$baseUrl = new \IPS\Http\Url( \IPS\Settings::i()->base_url );
$newUrl = \IPS\Request::i()->url();
if( $baseUrl->data['scheme'] === 'https' and \IPS\Request::i()->url()->data['scheme'] !== 'https' )
{
\IPS\Output::i()->redirect( \IPS\Request::i()->url()->setScheme('https') );
$newUrl = $newUrl->setScheme('https');
}
if( $baseUrl->data['host'] !== \IPS\Request::i()->url()->data['host'] )
{
\IPS\Output::i()->redirect( \IPS\Request::i()->url()->setHost( $baseUrl->data['host'] ) );
$newUrl = $newUrl->setHost( $baseUrl->data['host'] );
}
if( $newUrl != \IPS\Request::i()->url() )
{
\IPS\Output::i()->redirect( $newUrl );
}
}