Version 4.3.6

This commit is contained in:
Neo committed 2025-12-19 05:49:12 -08:00
1 parent fe1acf984a
commit 1a0c7fd3c2
609 files changed
+14707 -5726

No files matched your search

@@ -39,8 +39,8 @@ class _view extends \IPS\Content\Controller
{
$this->file = \IPS\downloads\File::load( \IPS\Request::i()->id );
/* Downloading does not check 'view' permission, as there is a separate download permission already */
if ( !$this->file->canView( \IPS\Member::loggedIn() ) and \IPS\Request::i()->do != 'download' )
/* Downloading and viewing the embed does not need to check the permission, as there is a separate download permission already and embed method need to return it's own error */
if ( !$this->file->canView( \IPS\Member::loggedIn() ) and \IPS\Request::i()->do != 'download' and \IPS\Request::i()->do != 'embed' )
{
\IPS\Output::i()->error( $this->file->container()->message('npv') ?: 'node_error', '2D161/2', 403, '' );
}
@@ -161,7 +161,7 @@ class _view extends \IPS\Content\Controller
\IPS\Output::i()->jsonLd['download']['dateModified'] = \IPS\DateTime::ts( $this->file->updated )->format( \IPS\DateTime::ISO8601 );
}
if( $this->file->container()->bitoptions['reviews'] AND $this->file->reviews )
if( $this->file->container()->bitoptions['reviews'] AND $this->file->reviews AND $this->file->averageReviewRating() )
{
\IPS\Output::i()->jsonLd['download']['aggregateRating'] = array(
'@type' => 'AggregateRating',
@@ -558,15 +558,19 @@ class _view extends \IPS\Content\Controller
{
\IPS\Output::i()->error( 'downloads_no_file', '3D161/G', 404, '' );
}
/* Log session */
$downloadSessionId = \IPS\Login::generateRandomString();
\IPS\Db::i()->insert( 'downloads_sessions', array(
'dsess_id' => $downloadSessionId,
'dsess_mid' => (int) \IPS\Member::loggedIn()->member_id,
'dsess_ip' => \IPS\Request::i()->ipAddress(),
'dsess_file' => $this->file->id,
'dsess_start' => time()
) );
/* Log session (but we don't need to create a new session on subsequent requests) */
if( !isset( $_SERVER['HTTP_RANGE'] ) )
{
$downloadSessionId = \IPS\Login::generateRandomString();
\IPS\Db::i()->insert( 'downloads_sessions', array(
'dsess_id' => $downloadSessionId,
'dsess_mid' => (int) \IPS\Member::loggedIn()->member_id,
'dsess_ip' => \IPS\Request::i()->ipAddress(),
'dsess_file' => $this->file->id,
'dsess_start' => time()
) );
}
/* If a user aborts the connection the shutdown function is not executed, and we need it to be */
ignore_user_abort( true );