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 );
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user