Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+44 -24
View File
@@ -21,9 +21,9 @@ if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Post Model
*/
class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \IPS\Content\Hideable, \IPS\Content\Shareable, \IPS\Content\Searchable, \IPS\Content\Embeddable
class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \IPS\Content\Hideable, \IPS\Content\Shareable, \IPS\Content\Searchable, \IPS\Content\Embeddable, \IPS\Content\Anonymous
{
use \IPS\Content\Reactable, \IPS\Content\Reportable;
use \IPS\Content\Reactable, \IPS\Content\Reportable, \IPS\Content\Recognizable;
/**
* @brief [ActiveRecord] Multiton Store
@@ -75,7 +75,8 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
'edit_member_name' => 'edit_name',
'edit_reason' => 'post_edit_reason',
'hidden' => 'queued',
'first' => 'new_topic'
'first' => 'new_topic',
'is_anon' => 'post_field_t2'
);
/**
@@ -178,25 +179,27 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
* @param \IPS\Member $member The memner
* @return int
*/
public static function memberPostCount( \IPS\Member $member )
public static function memberPostCount( \IPS\Member $member, bool $includeNonPostCountIncreasing = FALSE, bool $includeHiddenAndPendingApproval = TRUE )
{
return \IPS\Db::i()->select( 'COUNT(*)', 'forums_posts', array(
'author_id=? AND forums_topics.forum_id IN(?)',
$member->member_id,
\IPS\Db::i()->select( 'id', 'forums_forums', 'inc_postcount=1' )
) )->join( 'forums_topics', 'tid=topic_id' )->first() ;
}
/**
* Post count for member
*
* @param \IPS\Member $member The memner
* @return int
*/
public static function rawMemberPostCount( \IPS\Member $member )
{
/* Explicitly calling to the parent so we don't filter by forum ID */
return parent::memberPostCount( $member );
$where = [];
$where[] = [ 'author_id=?', $member->member_id ];
if ( !$includeNonPostCountIncreasing )
{
$where[] = [ 'forums_topics.forum_id IN(?)', \IPS\Db::i()->select( 'id', 'forums_forums', 'inc_postcount=1' ) ];
}
if ( !$includeHiddenAndPendingApproval )
{
$where[] = [ 'queued=0' ];
}
$query = \IPS\Db::i()->select( 'COUNT(*)', 'forums_posts', $where );
if ( !$includeNonPostCountIncreasing )
{
$query = $query->join( 'forums_topics', 'tid=topic_id' );
}
return $query->first();
}
/**
@@ -240,7 +243,7 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
* @param array $reactions Reaction Data
* @return string
*/
public static function searchResult( array $indexData, array $authorData, array $itemData, array $containerData = NULL, array $reputationData, $reviewRating, $iPostedIn, $view, $asItem, $canIgnoreComments=FALSE, $template=NULL, $reactions=array() )
public static function searchResult( array $indexData, array $authorData, array $itemData, ?array $containerData, array $reputationData, $reviewRating, $iPostedIn, $view, $asItem, $canIgnoreComments=FALSE, $template=NULL, $reactions=array() )
{
/* Password protected */
if (
@@ -405,6 +408,11 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
*/
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'] )
@@ -424,20 +432,32 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
* @param array|NULL $containerData Basic data about the container. Only includes columns returned by container::basicDataColumns()
* @param \IPS\Lang|NULL $lang The language to use, or NULL for the language of the currently logged in member
* @param array $options Options to pass to \IPS\Lang::addToStack
* @param integer|boolean $count Count of things; if int > 1, uses pluralized version of definite article
* @return string
*/
public static function _definiteArticle( array $containerData = NULL, \IPS\Lang $lang = NULL, $options = array() )
public static function _definiteArticle( array $containerData = NULL, \IPS\Lang $lang = NULL, $options = array(), $count = FALSE )
{
if ( !$containerData )
{
return parent::_definiteArticle( $containerData, $lang, $options );
}
$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'] )
{
$lang = $lang ?: \IPS\Member::loggedIn()->language();
if( \is_int( $count ) )
{
$options['pluralize'] = array( $count );
return $lang->addToStack( '__defart_answer_plural', FALSE, $options );
}
return $lang->addToStack( '__defart_answer', FALSE, $options );
}
else
{
return parent::_definiteArticle( $containerData, $lang, $options );
return parent::_definiteArticle( $containerData, $lang, $options, $count );
}
}