Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

+34 -7
View File
@@ -174,6 +174,11 @@ class _Topic extends \IPS\Content\Item implements
* @brief Setting name for show_meta
*/
public static $showMetaSettingKey = 'forums_topics_show_meta';
/**
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
*/
public $trackSentimentScore = true;
/**
* Callback from \IPS\Http\Url\Inernal::correctUrlFromVerifyClass()
@@ -337,7 +342,7 @@ class _Topic extends \IPS\Content\Item implements
$member = $member ?: \IPS\Member::loggedIn();
$containerClass = static::$containerNodeClass;
if ( $containerClass::hasPasswordForums() )
if ( $containerClass::customPermissionNodes() )
{
$whereString = 'forums_forums.password=? OR ' . \IPS\Db::i()->findInSet( 'forums_forums.password_override', $member->groups );
$whereParams = array( NULL );
@@ -459,6 +464,23 @@ class _Topic extends \IPS\Content\Item implements
{
return parent::contentCount( $container, FALSE, TRUE, $includeReviews, $depth );
}
/**
* Total item, items only \count(including children)
*
* @param \IPS\Node\Model $container The container
* @param bool $includeItems If TRUE, items will be included (this should usually be true)
* @param bool $includeComments If TRUE, comments will be included
* @param bool $includeReviews If TRUE, reviews will be included
* @param int $depth Used to keep track of current depth to avoid going too deep
* @return int|NULL|string When depth exceeds 10, will return "NULL" and initial call will return something like "100+"
* @note This method may return something like "100+" if it has lots of children to avoid exahusting memory. It is intended only for display use
* @note This method includes counts of hidden and unapproved content items as well
*/
public static function contentCountItemsOnly( \IPS\Node\Model $container )
{
return parent::contentCount( $container, TRUE, FALSE, FALSE, 0 );
}
/**
* Get elements for add/edit form
@@ -1059,8 +1081,8 @@ class _Topic extends \IPS\Content\Item implements
\IPS\Db::i()->delete( 'forums_question_ratings', array( 'topic=?', $this->tid ) );
\IPS\Db::i()->delete( 'forums_answer_ratings', array( 'topic=?', $this->tid ) );
/* Delete any moved topic links that point to this topic */
\IPS\Db::i()->delete( 'forums_topics', array( "state=? AND moved_to LIKE CONCAT( ?, '%' )", 'link', $this->tid . '&' ) );
/* Delete any moved topic links that point to this topic - moved_on>? is for query optimisation purposes */
\IPS\Db::i()->delete( 'forums_topics', array( "moved_on>? AND moved_to LIKE CONCAT( ?, '%' ) AND state=?", 0, $this->tid . '&', 'link' ) );
}
/**
@@ -1163,8 +1185,8 @@ class _Topic extends \IPS\Content\Item implements
*/
public function hide( $member, $reason = NULL )
{
/* Hide any moved topic links that point to this topic */
foreach( \IPS\Db::i()->select( '*', 'forums_topics', array( "state=? AND moved_to LIKE CONCAT( ?, '%' )", 'link', $this->tid . '&' ) ) as $link )
/* Hide any moved topic links that point to this topic - moved_on>? is for query optimisation purposes */
foreach( \IPS\Db::i()->select( '*', 'forums_topics', array( "moved_on>? AND moved_to LIKE CONCAT( ?, '%' ) AND state=?", 0, $this->tid . '&', 'link' ) ) as $link )
{
\IPS\forums\Topic::constructFromData( $link )->hide( $member, $reason );
}
@@ -1180,8 +1202,8 @@ class _Topic extends \IPS\Content\Item implements
*/
public function unhide( $member )
{
/* Unhide any moved topic links that point to this topic */
foreach( \IPS\Db::i()->select( '*', 'forums_topics', array( "state=? AND moved_to LIKE CONCAT( ?, '%' )", 'link', $this->tid . '&' ) ) as $link )
/* Unhide any moved topic links that point to this topic - moved_on>? is for query optimisation purposes */
foreach( \IPS\Db::i()->select( '*', 'forums_topics', array( "moved_on>? AND moved_to LIKE CONCAT( ?, '%' ) AND state=?", 0, $this->tid . '&', 'link' ) ) as $link )
{
\IPS\forums\Topic::constructFromData( $link )->unhide( $member );
}
@@ -1541,6 +1563,11 @@ class _Topic extends \IPS\Content\Item implements
*/
public static function _indefiniteArticle( array $containerData = NULL, \IPS\Lang $lang = NULL )
{
if ( !$containerData )
{
return parent::_indefiniteArticle( $containerData, $lang );
}
$bitOptions = ( $containerData['forums_bitoptions'] instanceof \IPS\Patterns\Bitwise ) ? $containerData['forums_bitoptions'] : new \IPS\Patterns\Bitwise( array( 'forums_bitoptions' => $containerData['forums_bitoptions'] ), \IPS\forums\Forum::$bitOptions['forums_bitoptions'] );
if ( $bitOptions['bw_enable_answers'] )