Version 5.0.13

This commit is contained in:
Neo committed 2025-12-19 19:04:57 -08:00
1 parent b89858b2ff
commit 5efe744c5f
1407 files changed
+69690 -30177

No files matched your search

+50 -28
View File
@@ -120,6 +120,7 @@ class Controller extends CoverPhotoController
/* Ensure JS loaded for forms/content functions such as moderation */
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'front_core.js', 'core' ) );
Output::i()->bodyAttributes['contentClass'] = static::$contentModel;
parent::execute();
@@ -152,6 +153,7 @@ class Controller extends CoverPhotoController
try
{
$class = static::$contentModel;
/**@var Content $item */
$item = $class::loadAndCheckPerms( Request::i()->id );
/* Have we moved? If a user has loaded a forum, and a moderator merges two topics leaving a link, then we need to account for this if the
@@ -215,9 +217,8 @@ class Controller extends CoverPhotoController
}
/* Get ready to store data layer info */
$dataLayer = Settings::i()->core_datalayer_enabled;
$dataLayerProperties = array();
if ( $dataLayer )
if ( DataLayer::enabled() )
{
$dataLayerProperties = $item->getDataLayerProperties();
}
@@ -343,9 +344,9 @@ class Controller extends CoverPhotoController
);
/* Data Layer */
if ( $dataLayer )
if ( DataLayer::enabled() )
{
if ( !Request::i()->isAjax() )
if ( !Request::i()->isAjax() and $item::dataLayerEventActive( 'content_view' ) )
{
DataLayer::i()->addEvent( 'content_view', $dataLayerProperties );
}
@@ -414,9 +415,17 @@ class Controller extends CoverPhotoController
{
try
{
if ( ! is_int( Request::i()->id ) )
{
throw new BadMethodCallException( $e );
}
Output::i()->redirect( $class::getRedirectFrom( Request::i()->id )->url() );
}
catch( OutOfRangeException $e ) { }
catch( BadMethodCallException|UnderflowException $e )
{
/* There is no valid redirect, so we will just show an error */
Output::i()->error( 'page_doesnt_exist', '2S136/1Z', 404, '' );
}
return NULL;
}
@@ -460,9 +469,9 @@ class Controller extends CoverPhotoController
/**
* AJAX - check for new replies
*
* @return Item|NULL
* @return void
*/
protected function checkForNewReplies(): Item|NULL
protected function checkForNewReplies(): void
{
Session::i()->csrfCheck();
@@ -1610,7 +1619,7 @@ class Controller extends CoverPhotoController
'blurb' => ( Settings::i()->reaction_count_display == 'count' ) ? '' : Theme::i()->getTemplate( 'global', 'core' )->reactionBlurb( $item )
);
if ( Settings::i()->core_datalayer_enabled )
if ( DataLayer::enabled() )
{
$output['datalayer'] = array_replace( $item->getDataLayerProperties(), ['reaction_type' => $reaction->_title] );
}
@@ -1619,7 +1628,7 @@ class Controller extends CoverPhotoController
}
else
{
if ( Settings::i()->core_datalayer_enabled )
if ( DataLayer::enabled() )
{
DataLayer::i()->addEvent( 'content_react', array_replace( $item->getDataLayerProperties(), [ 'reaction_type' => $reaction->_title ] ) );
}
@@ -1750,10 +1759,12 @@ class Controller extends CoverPhotoController
{
$class = static::$contentModel;
$item = $class::loadAndCheckPerms( Request::i()->id );
$reactionId = isset( Request::i()->reaction ) ? (int) Request::i()->reaction : null;
if ( Request::i()->isAjax() and isset( Request::i()->tooltip ) and isset( Request::i()->reaction ) )
if ( Request::i()->isAjax() and isset( Request::i()->tooltip ) and !empty( $reactionId ) )
{
$reaction = Reaction::load( Request::i()->reaction );
$reaction = Reaction::load( $reactionId );
$numberToShowInPopup = 10;
$where = $item->getReactionWhereClause( $reaction );
@@ -1779,12 +1790,8 @@ class Controller extends CoverPhotoController
$tabs[ $reaction->id ] = array( 'title' => $reaction->_title, 'icon' => $reaction->_icon, 'count' => $blurb[$reaction->id] ?? 0 );
}
}
$activeTab = 'all';
if ( isset( Request::i()->reaction ) )
{
$activeTab = Request::i()->reaction;
}
$activeTab = $reactionId ?: 'all';
$url = $item->url('showReactions');
$url = $url->setQueryString( 'changed', 1 );
@@ -3017,7 +3024,13 @@ class Controller extends CoverPhotoController
/* Moderator log */
Session::i()->modLog( 'modlog__comment_edit', array( $comment->url()->__toString() => FALSE, $item::$title => TRUE, $item->url()->__toString() => FALSE, $item->mapped( 'title' ) => FALSE ), $item );
/* Add a data layer event indicating this was updated */
if ( DataLayer::enabled( 'analytics_full' ) and $comment::dataLayerEventActive( 'content_edit' ) )
{
DataLayer::i()->addEvent( 'content_edit', $comment->getDataLayerProperties() );
}
/* If this is an AJAX request and the comment hidden status has not changed just output the comment HTML */
if ( Request::i()->isAjax() AND $isHidden == $comment->hidden() AND $reloadPage === false )
{
@@ -3117,6 +3130,12 @@ class Controller extends CoverPhotoController
$item->topic_answered_pid = 0;
$item->save();
}
/* This doesn't go through modAction, so we will add the datalayer event here */
if ( $comment and DataLayer::enabled( 'analytics_full' ) and $comment::dataLayerEventActive( 'content_delete' ) )
{
DataLayer::i()->addEvent( 'content_delete', $comment->getDataLayerProperties() );
}
if ( Request::i()->isAjax() )
{
@@ -3239,6 +3258,8 @@ class Controller extends CoverPhotoController
$comment->save();
}
Event::fire( 'onItemSplit', $item, array( $oldItem ) );
}
else
{
@@ -3520,7 +3541,7 @@ class Controller extends CoverPhotoController
'blurb' => ( Settings::i()->reaction_count_display == 'count' ) ? '' : Theme::i()->getTemplate( 'global', 'core' )->reactionBlurb( $comment )
);
if ( Settings::i()->core_datalayer_enabled )
if ( DataLayer::enabled() )
{
$item = $item ?? $comment->item();
$object = ( !isset( $item::$databaseColumnMap['content'] ) AND ( $item::$commentClass ) AND $comment->isFirst() ) ? $item : $comment;
@@ -3533,7 +3554,7 @@ class Controller extends CoverPhotoController
else
{
/* Data Layer Event */
if ( Settings::i()->core_datalayer_enabled )
if ( DataLayer::enabled() )
{
$properties = $comment->getDataLayerProperties();
$properties['reaction_type'] = $reaction->_title;
@@ -3651,10 +3672,11 @@ class Controller extends CoverPhotoController
{
/* @var Comment $commentClass */
$idColumn = $commentClass::$databaseColumnId;
if ( Request::i()->isAjax() and isset( Request::i()->tooltip ) and isset( Request::i()->reaction ) )
$reactionId = isset( Request::i()->reaction ) ? (int) Request::i()->reaction : null;
if ( Request::i()->isAjax() and isset( Request::i()->tooltip ) and !empty( $reactionId ) )
{
$reaction = Reaction::load( Request::i()->reaction );
$reaction = Reaction::load( $reactionId );
$numberToShowInPopup = 10;
$where = $comment->getReactionWhereClause( $reaction );
@@ -3680,11 +3702,7 @@ class Controller extends CoverPhotoController
}
}
$activeTab = 'all';
if ( isset( Request::i()->reaction ) )
{
$activeTab = Request::i()->reaction;
}
$activeTab = $reactionId ?: 'all';
$url = $comment->url('showReactions');
$url = $url->setQueryString( 'changed', 1 );
@@ -3721,6 +3739,10 @@ class Controller extends CoverPhotoController
Session::i()->csrfCheck();
$checkAgainst = Request::i()->modaction;
if( !$checkAgainst )
{
throw new DomainException;
}
$classToCheck = $commentClass;
if( $checkAgainst == 'split' OR $checkAgainst == 'merge' )