Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -165,7 +165,7 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
|
||||
*
|
||||
* @param \IPS\Node\Model|NULL $container Container
|
||||
* @return void
|
||||
* @see \IPS\Topic\Post::incrementPostCount()
|
||||
* @see \IPS\forums\Topic\Post::incrementPostCount()
|
||||
*/
|
||||
public static function incrementPostCount( \IPS\Node\Model $container = NULL )
|
||||
{
|
||||
@@ -181,14 +181,14 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
|
||||
public static function memberPostCount( \IPS\Member $member )
|
||||
{
|
||||
return \IPS\Db::i()->select( 'COUNT(*)', 'forums_posts', array(
|
||||
'author_id=? AND forum_id IN(?)',
|
||||
'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() ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get items with permisison check
|
||||
* Get items with permission check
|
||||
*
|
||||
* @param array $where Where clause
|
||||
* @param string $order MySQL ORDER BY clause (NULL to order by date)
|
||||
@@ -479,4 +479,36 @@ class _Post extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \I
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'forums', 'front' ) );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'forums' )->embedPost( $this, $this->item(), $this->url()->setQueryString( $params ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Moderator Permission
|
||||
*
|
||||
* @param string $type 'edit', 'hide', 'unhide', 'delete', etc.
|
||||
* @param \IPS\Member|NULL $member The member to check for or NULL for the currently logged in member
|
||||
* @param \IPS\Node\Model|NULL $container The container
|
||||
* @return bool
|
||||
*/
|
||||
public static function modPermission( $type, \IPS\Member $member = NULL, \IPS\Node\Model $container = NULL )
|
||||
{
|
||||
/* If this is called from a gateway script, i.e. email piping, just return false as we are a "guest" */
|
||||
if( $member === NULL AND !\IPS\Dispatcher::hasInstance() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( \in_array( $type, array( 'edit', 'hide', 'unhide', 'delete' ) ) )
|
||||
{
|
||||
/* Load Member */
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
|
||||
/* Post related permission */
|
||||
if ( $member->modPermission( "can_{$type}_post" ) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::modPermission($type, $member, $container );
|
||||
|
||||
}
|
||||
}
|
||||
@@ -242,7 +242,7 @@ class _Topic extends \IPS\Content\Item implements
|
||||
*
|
||||
* @param \IPS\Node\Model|NULL $container Container
|
||||
* @return void
|
||||
* @see \IPS\Topic\Post::incrementPostCount()
|
||||
* @see \IPS\forums\Topic\Post::incrementPostCount()
|
||||
*/
|
||||
public static function incrementPostCount( \IPS\Node\Model $container = NULL )
|
||||
{
|
||||
@@ -310,7 +310,7 @@ class _Topic extends \IPS\Content\Item implements
|
||||
|
||||
$whereString = 'forums_forums.password=? OR ' . \IPS\Db::i()->findInSet( 'forums_forums.password_override', $member->groups );
|
||||
$whereParams = array( NULL );
|
||||
if ( $member === \IPS\Member::loggedIn() )
|
||||
if ( \IPS\Dispatcher::hasInstance() AND $member === \IPS\Member::loggedIn() )
|
||||
{
|
||||
foreach ( \IPS\Request::i()->cookie as $k => $v )
|
||||
{
|
||||
@@ -964,6 +964,18 @@ class _Topic extends \IPS\Content\Item implements
|
||||
|
||||
parent::move( $container, $keepLink );
|
||||
\IPS\Db::i()->update( 'forums_question_ratings', array( 'forum' => $container->_id ), array( 'topic=?', $this->tid ) );
|
||||
|
||||
/* While you can't normally move archived topics, when you mass manage content from the AdminCP by using the menu next to the forum,
|
||||
this still allows topics to be moved. If we don't update the archive forum database the forum counts will be off */
|
||||
if( $this->isArchived() )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\forums\Topic\ArchivedPost::db()->update( 'forums_archive_posts', array( 'archive_forum_id' => $container->_id ), array( 'archive_topic_id=?', $this->tid ) );
|
||||
}
|
||||
/* catch db exceptions if e.g. if the connection credentials didn't work or if the database doesn't exist anymore */
|
||||
catch ( \IPS\Db\Exception $e ){}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user