Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -23,10 +23,20 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _Forums
|
||||
{
|
||||
/**
|
||||
* @brief ID Field
|
||||
*/
|
||||
public static $idField = "id";
|
||||
|
||||
public static $controllers = array( "forums", "topic" );
|
||||
|
||||
/**
|
||||
* @brief Controller classes
|
||||
*/
|
||||
public static $controllers = array(
|
||||
"IPS\\forums\\modules\\front\\forums\\forums",
|
||||
"IPS\\forums\\modules\\front\\forums\\topic",
|
||||
"IPS\\forums\\modules\\front\\forums\\index"
|
||||
);
|
||||
|
||||
/**
|
||||
* Get Setting Field
|
||||
*
|
||||
|
||||
@@ -49,14 +49,15 @@ class _Forums
|
||||
/**
|
||||
* Permission check for attachments
|
||||
*
|
||||
* @param \IPS\Member $member The member
|
||||
* @param int|null $id1 Primary ID
|
||||
* @param int|null $id2 Secondary ID
|
||||
* @param string|null $id3 Arbitrary data
|
||||
* @param \IPS\Member $member The member
|
||||
* @param int|null $id1 Primary ID
|
||||
* @param int|null $id2 Secondary ID
|
||||
* @param string|null $id3 Arbitrary data
|
||||
* @param array $attachment The attachment data
|
||||
* @param bool $viewOnly If true, just check if the user can see the attachment rather than download it
|
||||
* @return bool
|
||||
*/
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment )
|
||||
public function attachmentPermissionCheck( $member, $id1, $id2, $id3, $attachment, $viewOnly=FALSE )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -77,27 +78,23 @@ class _Forums
|
||||
$post = \IPS\forums\Topic\Post::load( $id2 );
|
||||
}
|
||||
|
||||
/* Check forums attachments permission */
|
||||
if ( $post->container()->can( 'attachments', $member ) )
|
||||
if ( !$post->canView( $member ) )
|
||||
{
|
||||
/* Can we view post? */
|
||||
return $post->canView( $member );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return $viewOnly or $post->container()->can( 'attachments', $member );
|
||||
}
|
||||
else
|
||||
{
|
||||
$topic = \IPS\forums\Topic::load( $id1 );
|
||||
|
||||
/* Check forums attachments permission */
|
||||
if ( $topic->container()->can( 'attachments', $member ) )
|
||||
if ( !$topic->canView( $member ) )
|
||||
{
|
||||
/* Can we view the topic? */
|
||||
return \IPS\forums\Topic::load( $id1 )->canView( $member );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return $viewOnly or $topic->container()->can( 'attachments', $member );
|
||||
}
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
|
||||
Reference in new issue
Block a user