Version 5.0.0 beta 11.1
This commit is contained in:
1 parent
264eeb97e0
commit
90e8c7e903
466 files changed
+7796
-2394
No files matched your search
+27
-24
@@ -3618,36 +3618,39 @@ abstract class Item extends Content
|
||||
|
||||
$count = $this->mapped('num_reviews');
|
||||
|
||||
if( $this->canViewHiddenReviews() )
|
||||
if( IPS::classUsesTrait( $this, Hideable::class ) )
|
||||
{
|
||||
if ( isset( static::$databaseColumnMap['hidden_reviews'] ) )
|
||||
if( $this->canViewHiddenReviews() )
|
||||
{
|
||||
$count += $this->mapped('hidden_reviews');
|
||||
if ( isset( static::$databaseColumnMap['hidden_reviews'] ) )
|
||||
{
|
||||
$count += $this->mapped('hidden_reviews');
|
||||
}
|
||||
if ( isset( static::$databaseColumnMap['unapproved_reviews'] ) )
|
||||
{
|
||||
$count += $this->mapped('unapproved_reviews');
|
||||
}
|
||||
}
|
||||
if ( isset( static::$databaseColumnMap['unapproved_reviews'] ) )
|
||||
elseif ( isset( static::$databaseColumnMap['unapproved_reviews'] ) and Member::loggedIn()->member_id and $this->mapped('unapproved_reviews') )
|
||||
{
|
||||
$count += $this->mapped('unapproved_reviews');
|
||||
$idColumn = static::$databaseColumnId;
|
||||
$class = static::$reviewClass;
|
||||
/* @var $databaseColumnMap array */
|
||||
$authorCol = $class::$databasePrefix . $class::$databaseColumnMap['author'];
|
||||
$where = array( array( $class::$databasePrefix . $class::$databaseColumnMap['item'] . '=?', $this->$idColumn ) );
|
||||
if ( isset( $class::$databaseColumnMap['approved'] ) )
|
||||
{
|
||||
$col = $class::$databasePrefix . $class::$databaseColumnMap['approved'];
|
||||
$where[] = array( "{$col}=0 AND {$authorCol}=" . Member::loggedIn()->member_id );
|
||||
}
|
||||
elseif( isset( $class::$databaseColumnMap['hidden'] ) )
|
||||
{
|
||||
$col = $class::$databasePrefix . $class::$databaseColumnMap['hidden'];
|
||||
$where[] = array( "{$col}=1 AND {$authorCol}=" . Member::loggedIn()->member_id );
|
||||
}
|
||||
$count += Db::i()->select( 'COUNT(*)', $class::$databaseTable, $where )->first();
|
||||
}
|
||||
}
|
||||
elseif ( isset( static::$databaseColumnMap['unapproved_reviews'] ) and Member::loggedIn()->member_id and $this->mapped('unapproved_reviews') )
|
||||
{
|
||||
$idColumn = static::$databaseColumnId;
|
||||
$class = static::$reviewClass;
|
||||
/* @var $databaseColumnMap array */
|
||||
$authorCol = $class::$databasePrefix . $class::$databaseColumnMap['author'];
|
||||
$where = array( array( $class::$databasePrefix . $class::$databaseColumnMap['item'] . '=?', $this->$idColumn ) );
|
||||
if ( isset( $class::$databaseColumnMap['approved'] ) )
|
||||
{
|
||||
$col = $class::$databasePrefix . $class::$databaseColumnMap['approved'];
|
||||
$where[] = array( "{$col}=0 AND {$authorCol}=" . Member::loggedIn()->member_id );
|
||||
}
|
||||
elseif( isset( $class::$databaseColumnMap['hidden'] ) )
|
||||
{
|
||||
$col = $class::$databasePrefix . $class::$databaseColumnMap['hidden'];
|
||||
$where[] = array( "{$col}=1 AND {$authorCol}=" . Member::loggedIn()->member_id );
|
||||
}
|
||||
$count += Db::i()->select( 'COUNT(*)', $class::$databaseTable, $where )->first();
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user