Version 4.7.23

This commit is contained in:
Neo committed 2025-12-19 16:21:27 -08:00
1 parent 7124a02564
commit 25ddeb65d6
1791 files changed
+76990 -44452

No files matched your search

+47 -8
View File
@@ -11,6 +11,9 @@
namespace IPS\Dispatcher;
/* To prevent PHP errors (extending class does not exist) revealing path */
use IPS\Request;
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
@@ -27,6 +30,11 @@ class _Front extends \IPS\Dispatcher\Standard
*/
public $controllerLocation = 'front';
/**
* @var int|null $currentPage
*/
public int|null $currentPage = null;
/**
* Init
*
@@ -50,7 +58,7 @@ class _Front extends \IPS\Dispatcher\Standard
header( "{$headerKey}: {$headerValue}" );
}
if ( \IPS\CIC and ! \IPS\Session\Front::loggedIn() and ! \IPS\Session\Front::i()->userAgent->spider )
if ( \IPS\CIC and ! \IPS\Session\Front::loggedIn() and ! \IPS\Session\Front::i()->userAgent->bot )
{
/* The software is unavailable, but the site is up so we do not want to affect our cloud downtime statistics and trigger monitoring alarms
if we are not a search engine */
@@ -61,8 +69,17 @@ class _Front extends \IPS\Dispatcher\Standard
header( "HTTP/{$protocol} 503 Service Unavailable" );
header( "Retry-After: 300"); #5 minutes
}
require \IPS\ROOT_PATH . '/' . \IPS\UPGRADING_PAGE;
/* show the default upgrading page if the custom one doesn#t exist */
if ( !file_exists( \IPS\ROOT_PATH . '/' . \IPS\UPGRADING_PAGE ) )
{
$path = ( \defined( 'CP_DIRECTORY' ) ) ? CP_DIRECTORY . '/upgrade/upgrading.html' : 'admin/upgrade/upgrading.html';
require \IPS\ROOT_PATH . '/' . $path;
}
else
{
require \IPS\ROOT_PATH . '/' . \IPS\UPGRADING_PAGE;
}
exit;
}
@@ -81,6 +98,16 @@ class _Front extends \IPS\Dispatcher\Standard
/* Perform some legacy URL conversions - Need to do this before checking furl in case app name has changed */
static::convertLegacyParameters();
/* Get the current page, if any */
if ( isset( Request::i()->page ) and is_numeric( Request::i()->page ) )
{
$this->currentPage = \IPS\Request::i()->page;
}
else if ( isset( Request::i()->url()->hiddenQueryString['page'] ) and is_numeric( Request::i()->url()->hiddenQueryString['page'] ) and $page = Request::i()->url()->hiddenQueryString['page'] )
{
$this->currentPage = $page;
}
/* Check friendly URL and whether it is correct */
try
{
@@ -100,6 +127,19 @@ class _Front extends \IPS\Dispatcher\Standard
\IPS\Output::i()->error( 'requested_route_404', '1S160/2', 404, '' );
}
/* Check if we're a low quality (no search engine bot) user */
if ( ! \IPS\Member::loggedIn()->member_id and \IPS\Session\Front::i()->userAgent->isLowValue() )
{
/* We want to restrict the number of 301s low quality bots get */
foreach( [ 'findComment', 'findReview', 'getNewComment', 'getLastComment'] as $do )
{
if ( isset( \IPS\Request::i()->do ) and \IPS\Request::i()->do === $do ) // baby shark
{
unset( \IPS\Request::i()->do );
}
}
}
/* Run global init */
try
{
@@ -338,7 +378,7 @@ class _Front extends \IPS\Dispatcher\Standard
/* Check pagination */
if ( $url instanceof \IPS\Http\Url\Friendly and $url->seoPagination and \in_array( 'page', array_keys( $url->queryString ) ) )
{
\IPS\Output::i()->redirect( $url->setPage( 'page', $url->queryString['page'] )->stripQueryString('page'), NULL, 301 );
\IPS\Output::i()->redirect( $url->setPage( 'page', (int) $url->queryString['page'] )->stripQueryString('page'), NULL, 301 );
}
}
@@ -680,7 +720,7 @@ Disallow: {$path}startTopic/
Disallow: {$path}discover/unread/
Disallow: {$path}markallread/
Disallow: {$path}staff/
Disallow: {$path}cookie/
Disallow: {$path}cookies/
Disallow: {$path}online/
Disallow: {$path}discover/
Disallow: {$path}leaderboard/
@@ -690,6 +730,7 @@ Disallow: {$path}*?advancedSearchForm=
Disallow: {$path}register/
Disallow: {$path}lostpassword/
Disallow: {$path}login/
Disallow: {$path}*currency=
# Block faceted pages and 301 redirect pages
Disallow: {$path}*?sortby=
@@ -698,9 +739,7 @@ Disallow: {$path}*?tab=
Disallow: {$path}*?do=
Disallow: {$path}*ref=
Disallow: {$path}*?forumId*
# Block profile pages as these have little unique value, consume a lot of crawl time and contain hundreds of 301 links
Disallow: {$path}profile/
Disallow: {$path}*?&controller=embed
# Sitemap URL
Sitemap: {$sitemapUrl}