Version 4.7.13

This commit is contained in:
Neo committed 2025-12-19 16:14:56 -08:00
1 parent fd22d99e69
commit 7124a02564
954 files changed
+29277 -59308

No files matched your search

+134 -49
View File
@@ -104,6 +104,16 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
catch( \OutOfRangeException $e ) { }
}
}
if( is_subclass_of( $class, 'IPS\Content\FuturePublishing' ) and isset( $class::$databaseColumnMap['is_future_entry'] ) AND isset( $class::$databaseColumnMap['future_date'] ) )
{
$futureColumn = $class::$databaseColumnMap['future_date'];
$futureEntry = $class::$databaseColumnMap['is_future_entry'];
if ( $item->$futureEntry == 1 and $item->$futureColumn <= time() )
{
$item->publish();
}
}
/* If this is an AJAX request (like the topic hovercard), we don't want to do any of the below like update views and mark read */
if ( \IPS\Request::i()->isAjax() and !$this->updateViewsAndMarkersOnAjax )
@@ -117,27 +127,33 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
/* We also want to update the views if we have a page parameter */
if( $item instanceof \IPS\Content\ReadMarkers AND isset( \IPS\Request::i()->page ) AND \IPS\Request::i()->page )
{
$idColumn = $class::$databaseColumnId;
if ( \in_array( 'IPS\Content\Views', class_implements( $class ) ) AND isset( $class::$databaseColumnMap['views'] ) )
if ( \IPS\IPS::classUsesTrait( $class, 'IPS\Content\ViewUpdates' ) )
{
$countUpdated = false;
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and ( \IPS\CACHE_CONFIG or \IPS\REDIS_CONFIG ) )
$item->updateViews();
}
else
{
$idColumn = $class::$databaseColumnId;
if ( \in_array( 'IPS\Content\Views', class_implements( $class ) ) AND isset( $class::$databaseColumnMap['views'] ) )
{
try
$countUpdated = false;
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and ( \IPS\CACHE_CONFIG or \IPS\REDIS_CONFIG ) )
{
\IPS\Redis::i()->zIncrBy( 'topic_views', 1, $class .'__' . $item->$idColumn );
$countUpdated = true;
try
{
\IPS\Redis::i()->zIncrBy( 'topic_views', 1, $class .'__' . $item->$idColumn );
$countUpdated = true;
}
catch( \Exception $e ) {}
}
if ( ! $countUpdated )
{
\IPS\Db::i()->insert( 'core_view_updates', array(
'classname' => $class,
'id' => $item->$idColumn
) );
}
catch( \Exception $e ) {}
}
if ( ! $countUpdated )
{
\IPS\Db::i()->insert( 'core_view_updates', array(
'classname' => $class,
'id' => $item->$idColumn
) );
}
}
}
@@ -231,36 +247,43 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
/* Update Views */
$idColumn = $class::$databaseColumnId;
if ( \in_array( 'IPS\Content\Views', class_implements( $class ) ) AND isset( $class::$databaseColumnMap['views'] ) )
if ( \IPS\IPS::classUsesTrait( $class, 'IPS\Content\ViewUpdates' ) )
{
$countUpdated = false;
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and ( \IPS\CACHE_CONFIG or \IPS\REDIS_CONFIG ) )
$item->updateViews();
}
else
{
if ( \in_array( 'IPS\Content\Views', class_implements( $class ) ) AND isset( $class::$databaseColumnMap['views'] ) )
{
try
$countUpdated = false;
if ( \IPS\REDIS_ENABLED and \IPS\CACHE_METHOD == 'Redis' and ( \IPS\CACHE_CONFIG or \IPS\REDIS_CONFIG ) )
{
\IPS\Redis::i()->zIncrBy( 'topic_views', 1, $class .'__' . $item->$idColumn );
$countUpdated = true;
try
{
\IPS\Redis::i()->zIncrBy( 'topic_views', 1, $class .'__' . $item->$idColumn );
$countUpdated = true;
}
catch( \Exception $e ) {}
}
catch( \Exception $e ) {}
}
if( \IPS\Application::appIsEnabled( 'cloud' ) and \IPS\cloud\Realtime::i()->isEnabled('trending') and $class::$includeInTrending )
{
try
if( \IPS\Application::appIsEnabled( 'cloud' ) and \IPS\cloud\Realtime::i()->isEnabled('trending') and $class::$includeInTrending )
{
/* Score by timestamp for trending */
\IPS\Redis::i()->zIncrBy( 'trending', time() * 0.1, $class .'__' . $item->$idColumn );
try
{
/* Score by timestamp for trending */
\IPS\Redis::i()->zIncrBy( 'trending', time() * 0.1, $class .'__' . $item->$idColumn );
}
catch( \BadMethodCallException | \RedisException $e ) {}
}
if ( ! $countUpdated )
{
\IPS\Db::i()->insert( 'core_view_updates', array(
'classname' => $class,
'id' => $item->$idColumn
) );
}
catch( \RedisException $e ) {}
}
if ( ! $countUpdated )
{
\IPS\Db::i()->insert( 'core_view_updates', array(
'classname' => $class,
'id' => $item->$idColumn
) );
}
}
@@ -361,7 +384,7 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
\IPS\Output::i()->redirect( $class::getRedirectFrom( \IPS\Request::i()->id )->url(), '', 301 );
}
catch( \OutOfRangeException $e ) { }
return NULL;
}
}
@@ -1000,6 +1023,7 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
}
else
{
\IPS\Output::i()->bypassCsrfKeyCheck = TRUE;
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core' ), 'popupTemplate' ) );
return;
}
@@ -1628,7 +1652,7 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
}
/**
* Moderator Log
* Moderation Log
*
* @return void
*/
@@ -1643,11 +1667,65 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
{
$class = static::$contentModel;
$item = $class::loadAndCheckPerms( \IPS\Request::i()->id );
/* Set up some stuff so we're not doing too much logic / assignment in the template */
$modlog = $item->moderationTable();
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->modLog( $item, $modlog );
}
catch ( \OutOfRangeException $e )
{
\IPS\Output::i()->error( 'node_error', '2S136/T', 404, '' );
}
catch( \DomainException $e )
{
\IPS\Output::i()->error( 'no_module_permission', '2S136/U', 403, '' );
}
}
/**
* Moderation Log
*
* @return void
*/
protected function analytics()
{
if( !\IPS\Member::loggedIn()->modPermission( 'can_view_moderation_log' ) )
{
\IPS\Output::i()->error( 'no_module_permission', '2S136/1F', 403, '' );
}
try
{
$class = static::$contentModel;
$item = $class::loadAndCheckPerms( \IPS\Request::i()->id );
/* Set up some stuff so we're not doing too much logic / assignment in the template */
$lastCommenter = $members = $busy = $reacted = $images = NULL;
try
{
$lastCommenter = $item->lastCommenter();
if ( !$lastCommenter->member_id )
{
$lastCommenter = NULL;
}
}
catch( \BadMethodCallException $e ) { }
if ( \IPS\IPS::classUsesTrait( $item, 'IPS\Content\Statistics' ) )
{
$members = $item->topPosters();
$busy = $item->popularDays();
$reacted = $item->topReactedPosts();
$images = $item->imageAttachments();
}
/* Set navigation */
$this->_setBreadcrumbAndTitle( $item );
\IPS\Output::i()->output = $item->moderationTable();
\IPS\Output::i()->breadcrumb[] = array( NULL, \IPS\Member::loggedIn()->language()->addToStack( 'analytics_and_stats' ) );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core', 'front' )->analytics( $item, $lastCommenter, $members, $busy, $reacted, $images );
}
catch ( \OutOfRangeException $e )
{
@@ -1967,9 +2045,11 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
if ( $values = $form->values() )
{
$review->author_response = $values['reviewResponse'];
$review->save();
$review->setResponse( $values['reviewResponse'] );
/* Claim attachments and clear the editor */
\IPS\File::claimAttachments( 'reviewResponse-' . $class::$application . '/' . $class::$module . '-' . \IPS\Request::i()->review, \IPS\Request::i()->id, \IPS\Request::i()->review, \get_class( $item ) );
\IPS\Output::i()->redirect( $review->url() );
}
@@ -4008,9 +4088,14 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
return NULL;
}
$class = static::$contentModel;
if( !\is_subclass_of( $class, 'IPS\Content\Item' ) )
{
return NULL;
}
try
{
$class = static::$contentModel;
$item = $class::loadAndCheckPerms( \IPS\Request::i()->id );
$items = [];