Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
+40
-53
@@ -317,6 +317,8 @@ abstract class _Comment extends \IPS\Content
|
||||
}
|
||||
else
|
||||
{
|
||||
$item->save();
|
||||
|
||||
if ( $item->containerWrapper() AND !$item->approvedButHidden() AND $item->container()->_unapprovedComments !== NULL )
|
||||
{
|
||||
$item->container()->_unapprovedComments = $item->container()->_unapprovedComments + 1;
|
||||
@@ -503,7 +505,7 @@ abstract class _Comment extends \IPS\Content
|
||||
}
|
||||
catch ( \BadMethodCallException $e ) { }
|
||||
|
||||
return ( !$this->isFirst() and ( static::modPermission( 'hide', $member, $container ) or ( $member->member_id == $this->author()->member_id and $member->group['gbw_soft_delete_own'] ) ) );
|
||||
return ( !$this->isFirst() and ( static::modPermission( 'hide', $member, $container ) or ( $member->member_id and $member->member_id == $this->author()->member_id and $member->group['gbw_soft_delete_own'] ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -665,7 +667,7 @@ abstract class _Comment extends \IPS\Content
|
||||
*/
|
||||
public function editLine()
|
||||
{
|
||||
if ( $this instanceof \IPS\Content\EditHistory and $this->mapped('edit_time') and ( $this->mapped('edit_show') or \IPS\Member::loggedIn()->modPermission('can_view_editlog') ) )
|
||||
if ( $this instanceof \IPS\Content\EditHistory and $this->mapped('edit_time') and ( $this->mapped('edit_show') or \IPS\Member::loggedIn()->modPermission('can_view_editlog') ) and \IPS\Settings::i()->edit_log )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'core' )->commentEditLine( $this, ( isset( static::$databaseColumnMap['edit_reason'] ) and $this->mapped('edit_reason') ) );
|
||||
}
|
||||
@@ -675,7 +677,7 @@ abstract class _Comment extends \IPS\Content
|
||||
/**
|
||||
* Get edit history
|
||||
*
|
||||
* @param bool $staff Set true for moderators who have permission to view the full log which will show edits not made by the autor and private edits
|
||||
* @param bool $staff Set true for moderators who have permission to view the full log which will show edits not made by the author and private edits
|
||||
* @return \IPS\Db\Select
|
||||
*/
|
||||
public function editHistory( $staff=FALSE )
|
||||
@@ -699,17 +701,7 @@ abstract class _Comment extends \IPS\Content
|
||||
$template = static::$commentTemplate[1];
|
||||
return call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), static::$commentTemplate[0] )->$template( $this->item(), $this );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML for search result display
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function searchResultHtml()
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'search', 'core', 'front' )->contentComment( $this );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Users to receieve immediate notifications
|
||||
*
|
||||
@@ -728,7 +720,7 @@ abstract class _Comment extends \IPS\Content
|
||||
$memberFollowers
|
||||
);
|
||||
|
||||
return \IPS\Db::i()->union( $unions, 'follow_added', $limit, 'follow_member_id', FALSE, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );
|
||||
return \IPS\Db::i()->union( $unions, 'follow_added', $limit, 'follow_member_id, follow_id, follow_app, follow_area, follow_rel_id, follow_added, follow_is_anon, follow_notify_do, follow_notify_meta, follow_notify_freq, follow_notify_sent, follow_visible', FALSE, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -756,6 +748,15 @@ abstract class _Comment extends \IPS\Content
|
||||
{
|
||||
$item = $this->item();
|
||||
|
||||
/* Remove any notifications */
|
||||
$idColumn = static::$databaseColumnId;
|
||||
\IPS\Db::i()->delete( 'core_notifications', array( 'item_sub_class=? AND item_sub_id=?', (string) get_called_class(), (int) $this->$idColumn ) );
|
||||
|
||||
$item->resyncCommentCounts();
|
||||
$item->resyncLastComment();
|
||||
$item->save();
|
||||
|
||||
/* We have to do this *after* updating the last comment data for the item, because that uses the cached data from the item (i.e. topic) */
|
||||
try
|
||||
{
|
||||
if ( $item->container()->_comments !== NULL )
|
||||
@@ -765,14 +766,6 @@ abstract class _Comment extends \IPS\Content
|
||||
$item->container()->save();
|
||||
}
|
||||
} catch ( \BadMethodCallException $e ) {}
|
||||
|
||||
$item->resyncCommentCounts();
|
||||
|
||||
/* Remove any notifications */
|
||||
$idColumn = static::$databaseColumnId;
|
||||
\IPS\Db::i()->delete( 'core_notifications', array( 'item_sub_class=? AND item_sub_id=?', (string) get_called_class(), (int) $this->$idColumn ) );
|
||||
|
||||
$item->resyncLastComment();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -810,7 +803,12 @@ abstract class _Comment extends \IPS\Content
|
||||
catch( \BadMethodCallException $e ) { }
|
||||
|
||||
}
|
||||
|
||||
$item->resyncCommentCounts();
|
||||
$item->resyncLastComment();
|
||||
$item->save();
|
||||
|
||||
/* We have to do this *after* updating the last comment data for the item, because that uses the cached data from the item (i.e. topic) */
|
||||
try
|
||||
{
|
||||
if ( $item->container()->_comments !== NULL )
|
||||
@@ -820,9 +818,6 @@ abstract class _Comment extends \IPS\Content
|
||||
$item->container()->save();
|
||||
}
|
||||
} catch ( \BadMethodCallException $e ) {}
|
||||
|
||||
$item->resyncCommentCounts();
|
||||
$item->resyncLastComment();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -969,6 +964,7 @@ abstract class _Comment extends \IPS\Content
|
||||
{
|
||||
$this->item()->container()->_reviews = ( $this->item()->container()->_reviews - 1 );
|
||||
$this->item()->resyncLastReview();
|
||||
$this->item()->save();
|
||||
$this->item()->container()->setLastReview();
|
||||
}
|
||||
if ( $this->item()->container()->_unapprovedReviews !== NULL )
|
||||
@@ -987,6 +983,7 @@ abstract class _Comment extends \IPS\Content
|
||||
}
|
||||
|
||||
$this->item()->resyncLastComment();
|
||||
$this->item()->save();
|
||||
$this->item()->container()->setLastComment();
|
||||
}
|
||||
if ( $this->item()->container()->_unapprovedComments !== NULL and $this->hidden() === 1 )
|
||||
@@ -1031,6 +1028,7 @@ abstract class _Comment extends \IPS\Content
|
||||
/* Last comment */
|
||||
$this->item()->resyncLastComment();
|
||||
$this->item()->resyncLastReview();
|
||||
$this->item()->save();
|
||||
if ( $container = $this->item()->containerWrapper() )
|
||||
{
|
||||
$container->setLastComment();
|
||||
@@ -1171,6 +1169,15 @@ abstract class _Comment extends \IPS\Content
|
||||
}
|
||||
}
|
||||
|
||||
if ( $joinContainer )
|
||||
{
|
||||
$containerClass = $itemClass::$containerNodeClass;
|
||||
$joins[] = array(
|
||||
'from' => $containerClass::$databaseTable,
|
||||
'where' => array_merge( array( array( $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['container'] . '=' . $containerClass::$databaseTable . '.' . $containerClass::$databasePrefix . $containerClass::$databaseColumnId ) ), $containerWhere )
|
||||
);
|
||||
}
|
||||
|
||||
/* Build the select clause */
|
||||
if( $countOnly )
|
||||
{
|
||||
@@ -1214,14 +1221,7 @@ abstract class _Comment extends \IPS\Content
|
||||
$select = \IPS\Db::i()->select( $selectClause, static::$databaseTable, $where, $order, $limit, NULL, NULL, $queryFlags )
|
||||
->join( $itemClass::$databaseTable, array_merge( array( array( static::$databaseTable . "." . static::$databasePrefix . static::$databaseColumnMap['item'] . "=" . $itemClass::$databaseTable . "." . $itemClass::$databasePrefix . $itemClass::$databaseColumnId ) ), $itemWhere ), 'STRAIGHT_JOIN' );
|
||||
}
|
||||
|
||||
|
||||
if ( $joinContainer )
|
||||
{
|
||||
$containerClass = $itemClass::$containerNodeClass;
|
||||
$select->join( $containerClass::$databaseTable, array_merge( array( array( $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['container'] . '=' . $containerClass::$databaseTable . '.' . $containerClass::$databasePrefix . $containerClass::$databaseColumnId ) ), $containerWhere ) );
|
||||
}
|
||||
|
||||
|
||||
if ( count( $joins ) )
|
||||
{
|
||||
foreach( $joins as $join )
|
||||
@@ -1277,7 +1277,7 @@ abstract class _Comment extends \IPS\Content
|
||||
*/
|
||||
public function canShare()
|
||||
{
|
||||
return ( \IPS\Member::loggedIn()->member_id and in_array( 'IPS\Content\Shareable', class_implements( get_called_class() ) ) );
|
||||
return ( $this->canView( \IPS\Member::load( 0 ) ) and in_array( 'IPS\Content\Shareable', class_implements( get_called_class() ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1287,27 +1287,14 @@ abstract class _Comment extends \IPS\Content
|
||||
*/
|
||||
public function sharelinks()
|
||||
{
|
||||
$item = $this->item();
|
||||
if( !count( $this->sharelinks ) )
|
||||
{
|
||||
/* If the item is shareable, we need to initiate the share services */
|
||||
if ( $this instanceof Shareable )
|
||||
if ( $this instanceof Shareable and $this->canShare() )
|
||||
{
|
||||
$shareService = 'IPS\core\ShareLinks\Service';
|
||||
|
||||
foreach( $shareService::shareLinks() as $node )
|
||||
{
|
||||
if( $node->enabled and ( $node->groups === "*" or \IPS\Member::loggedIn()->inGroup( explode( ',', $node->groups ) ) ) )
|
||||
{
|
||||
if( file_exists( \IPS\ROOT_PATH . '/system/Content/ShareServices/' . ucwords( $node->key ) . '.php' ) )
|
||||
{
|
||||
$className = "IPS\\Content\\ShareServices\\" . ucwords( $node->key );
|
||||
$idColumn = static::$databaseColumnId;
|
||||
$url = $this->url( 'find' )->setQueryString( 'comment', $this->$idColumn );
|
||||
$this->sharelinks[ $node->key ] = new $className( $url, $item->mapped('title') );
|
||||
}
|
||||
}
|
||||
}
|
||||
$idColumn = static::$databaseColumnId;
|
||||
$shareUrl = $this->url( 'find' )->setQueryString( 'comment', $this->$idColumn );
|
||||
|
||||
$this->sharelinks = \IPS\core\ShareLinks\Service::getAllServices( $shareUrl, $this->item()->mapped('title') );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user