Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -241,7 +241,7 @@ class _File extends \IPS\Content\Item implements
|
||||
*/
|
||||
public function lastReviewPageUrl()
|
||||
{
|
||||
return parent::lastCommentPageUrl()->setQueryString( 'tab', 'reviews' );
|
||||
return parent::lastReviewPageUrl()->setQueryString( 'tab', 'reviews' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1084,7 +1084,7 @@ class _File extends \IPS\Content\Item implements
|
||||
if ( !$this->container()->can( 'download', $member ) )
|
||||
{
|
||||
/* Hold on - if we're a guest and buying means we'll have to register which will put us in a group with permission, we can continue */
|
||||
if ( \IPS\Member::loggedIn()->member_id or !$this->container()->can( 'download', \IPS\Member\Group::load( \IPS\Settings::i()->member_group ) ) )
|
||||
if ( $member->member_id or !$this->container()->can( 'download', \IPS\Member\Group::load( \IPS\Settings::i()->member_group ) ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1152,23 +1152,33 @@ class _File extends \IPS\Content\Item implements
|
||||
}
|
||||
|
||||
/* Paid? */
|
||||
if ( $this->isPaid() and !$member->group['idm_bypass_paid'] and $member->member_id != $this->author()->member_id )
|
||||
if ( $this->isPaid() )
|
||||
{
|
||||
if ( $this->cost )
|
||||
/* Guests can't download paid files */
|
||||
if ( !$member->member_id )
|
||||
{
|
||||
if ( !count( \IPS\downloads\extensions\nexus\Item\File::getPurchases( \IPS\nexus\Customer::load( $member->member_id ), $this->id, FALSE ) ) )
|
||||
throw new \DomainException( $this->container()->message('npd') ?: 'download_no_perm' );
|
||||
}
|
||||
|
||||
if ( !$member->group['idm_bypass_paid'] and $member->member_id != $this->author()->member_id )
|
||||
{
|
||||
if ( $this->cost )
|
||||
{
|
||||
throw new \DomainException( 'file_not_purchased' );
|
||||
if ( !count( \IPS\downloads\extensions\nexus\Item\File::getPurchases( \IPS\nexus\Customer::load( $member->member_id ), $this->id, FALSE ) ) )
|
||||
{
|
||||
throw new \DomainException( 'file_not_purchased' );
|
||||
}
|
||||
}
|
||||
elseif ( $this->nexus )
|
||||
{
|
||||
if ( !count( \IPS\nexus\extensions\nexus\Item\Package::getPurchases( \IPS\nexus\Customer::load( $member->member_id ), explode( ',', $this->nexus ), FALSE ) ) )
|
||||
{
|
||||
throw new \DomainException( 'file_not_purchased' );
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ( $this->nexus )
|
||||
{
|
||||
if ( !count( \IPS\nexus\extensions\nexus\Item\Package::getPurchases( \IPS\nexus\Customer::load( $member->member_id ), explode( ',', $this->nexus ), FALSE ) ) )
|
||||
{
|
||||
throw new \DomainException( 'file_not_purchased' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Minimum posts */
|
||||
if ( $member->member_id and $restrictions['min_posts'] and $restrictions['min_posts'] > $member->member_posts )
|
||||
@@ -1179,7 +1189,7 @@ class _File extends \IPS\Content\Item implements
|
||||
/* Simultaneous downloads */
|
||||
if ( $restrictions['limit_sim'] )
|
||||
{
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'downloads_sessions', $member->member_id ? array( 'dsess_mid=?', $member->member_id ) : array( 'dsess_ip=?', \IPS\Request::i()->ipAddress() ) )->first() >= $restrictions['limit_sim'] )
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'downloads_sessions', array( array( 'dsess_start > ?', time() - ( 60 * 15 ) ), $member->member_id ? array( 'dsess_mid=?', $member->member_id ) : array( 'dsess_ip=?', \IPS\Request::i()->ipAddress() ) ) )->first() >= $restrictions['limit_sim'] )
|
||||
{
|
||||
throw new \DomainException( $member->language()->addToStack( 'max_simultaneous_downloads', FALSE, array( 'pluralize' => array( $restrictions['limit_sim'] ) ) ) );
|
||||
}
|
||||
@@ -1401,19 +1411,16 @@ class _File extends \IPS\Content\Item implements
|
||||
*/
|
||||
public function processForm( $values )
|
||||
{
|
||||
parent::processForm( $values );
|
||||
$new = FALSE;
|
||||
$new = $this->_new;
|
||||
|
||||
if ( $this->_new )
|
||||
{
|
||||
$new = TRUE;
|
||||
}
|
||||
else
|
||||
parent::processForm( $values );
|
||||
|
||||
if ( !$new )
|
||||
{
|
||||
$oldContent = $this->desc;
|
||||
}
|
||||
$this->desc = $values['file_desc'];
|
||||
if ( !$this->_new )
|
||||
if ( !$new )
|
||||
{
|
||||
$this->sendAfterEditNotifications( $oldContent );
|
||||
}
|
||||
@@ -2329,7 +2336,7 @@ class _File extends \IPS\Content\Item implements
|
||||
*/
|
||||
public function embedImage()
|
||||
{
|
||||
return $this->primary_screenshot_thumb ? \IPS\File::get( 'downloads_Screenshots', $this->primary_screenshot_thumb ) : NULL;
|
||||
return $this->primary_screenshot_thumb ?: NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user