Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -512,7 +512,7 @@ class _Admin extends \IPS\Dispatcher\Standard
|
||||
}
|
||||
catch( \UnderflowException $ex )
|
||||
{
|
||||
$this->acpTabOrder = array( 'core' => array(), 'community' => array(), 'members' => array(), 'nexus' => array(), 'cms' => array(), 'stats' => array(), 'customization' => array(), 'marketplace' => array() );
|
||||
$this->acpTabOrder = array( 'core' => array(), 'community' => array(), 'members' => array(), 'nexus' => array(), 'cms' => array(), 'stats' => array(), 'customization' => array() );
|
||||
}
|
||||
|
||||
\IPS\Request::i()->setCookie( 'acpTabs', json_encode( $this->acpTabOrder ) );
|
||||
|
||||
@@ -147,24 +147,44 @@ abstract class _Controller
|
||||
|
||||
if( \IPS\Request::i()->embedComment )
|
||||
{
|
||||
$commentClass = $class::$commentClass;
|
||||
if ( isset( $class::$archiveClass ) )
|
||||
{
|
||||
$item = $class::load( \IPS\Request::i()->id );
|
||||
if ( $item->isArchived() )
|
||||
{
|
||||
$commentClass = $class::$archiveClass;
|
||||
}
|
||||
}
|
||||
|
||||
$content = $commentClass::load( \IPS\Request::i()->embedComment );
|
||||
$title = $content->item()->mapped('title');
|
||||
|
||||
$commentClass = $class::$commentClass;
|
||||
if ( isset( $class::$archiveClass ) )
|
||||
{
|
||||
$item = $class::load( \IPS\Request::i()->id );
|
||||
if ( $item->isArchived() )
|
||||
{
|
||||
$commentClass = $class::$archiveClass;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
$content = $commentClass::load( \IPS\Request::i()->embedComment );
|
||||
$title = $content->item()->mapped('title');
|
||||
}
|
||||
/* Comment wasn't found, but we can still link to the item */
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$type = $commentClass::$title;
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedCommentUnavailable( $type, $item );
|
||||
goto embedOutput;
|
||||
}
|
||||
}
|
||||
elseif( \IPS\Request::i()->embedReview )
|
||||
{
|
||||
$reviewClass = $class::$reviewClass;
|
||||
$content = $reviewClass::load( \IPS\Request::i()->embedReview );
|
||||
$title = $content->item()->mapped('title');
|
||||
try
|
||||
{
|
||||
$content = $reviewClass::load( \IPS\Request::i()->embedReview );
|
||||
$title = $content->item()->mapped('title');
|
||||
}
|
||||
/* Review wasn't found, but we can still link to the item */
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$type = $reviewClass::$title;
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedCommentUnavailable( $type, $item );
|
||||
goto embedOutput;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -192,6 +212,7 @@ abstract class _Controller
|
||||
$output = \IPS\Theme::i()->getTemplate( 'embed', 'core', 'global' )->embedNoPermission();
|
||||
}
|
||||
}
|
||||
embedOutput:
|
||||
|
||||
/* Make sure our iframe contents get the necessary elements and JS */
|
||||
$js = array(
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -136,6 +136,11 @@ class _GraphQL extends Api
|
||||
}
|
||||
}
|
||||
|
||||
if( !$query )
|
||||
{
|
||||
$this->_respond( json_encode( array( 'errors' => array( array( 'message' => 'NO_QUERY' ) ) ), JSON_PRETTY_PRINT ), 400 );
|
||||
}
|
||||
|
||||
$output = \IPS\Api\GraphQL::execute( $query, $variables );
|
||||
|
||||
\IPS\Member::loggedIn()->language()->parseOutputForDisplay( $output );
|
||||
|
||||
@@ -310,6 +310,11 @@ abstract class _Standard extends \IPS\Dispatcher
|
||||
*/
|
||||
public $destruct = true;
|
||||
|
||||
/**
|
||||
* @brief Flag to check if we are in the destructor
|
||||
*/
|
||||
public bool $inDestructor = false;
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
* Runs tasks
|
||||
@@ -326,6 +331,7 @@ abstract class _Standard extends \IPS\Dispatcher
|
||||
|
||||
if ( $this->runTasks and \IPS\Settings::i()->task_use_cron == 'normal' and !\IPS\Request::i()->isAjax() )
|
||||
{
|
||||
$this->inDestructor = true;
|
||||
try
|
||||
{
|
||||
$task = \IPS\Task::queued();
|
||||
|
||||
Reference in new issue
Block a user