Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

@@ -143,7 +143,7 @@ class _downloaders extends \IPS\Dispatcher\Controller
FALSE
);
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('stats')->downloadsTable( $select, $pagination, $members );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('stats')->downloadsTable( $select, $pagination, $members, $total );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__downloads_stats_downloaders');
}
else
@@ -144,7 +144,7 @@ class _submitters extends \IPS\Dispatcher\Controller
);
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate( 'global', 'core' )->message( \IPS\Member::loggedIn()->language()->addToStack( 'stats_include_hidden_content' ), 'info' );
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('stats')->submittersTable( $select, $pagination, $members );
\IPS\Output::i()->output .= \IPS\Theme::i()->getTemplate('stats')->submittersTable( $select, $pagination, $members, $total );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__downloads_stats_submitters');
}
else
@@ -101,7 +101,7 @@ class _browse extends \IPS\Dispatcher\Controller
if ( \IPS\Member::loggedIn()->member_id )
{
$key = md5( ( \IPS\Member::loggedIn()->members_pass_hash ?: \IPS\Member::loggedIn()->email ) . \IPS\Member::loggedIn()->members_pass_salt );
$key = \IPS\Member::loggedIn()->getUniqueMemberHash();
\IPS\Output::i()->rssFeeds['idm_rss_title'] = \IPS\Output::i()->rssFeeds['idm_rss_title']->setQueryString( array( 'member' => \IPS\Member::loggedIn()->member_id , 'key' => $key ) );
}
@@ -50,6 +50,11 @@ class _pending extends \IPS\Content\Controller
$this->file = \IPS\downloads\File::load( \IPS\Request::i()->file_id );
$this->version = \IPS\downloads\File\PendingVersion::load( \IPS\Request::i()->id );
if( $this->file->id !== $this->version->file()->id )
{
throw new \OutOfRangeException;
}
if ( !$this->version->canUnhide() )
{
\IPS\Output::i()->error( 'node_error', '2D417/1', 404, '' );
@@ -67,6 +72,7 @@ class _pending extends \IPS\Content\Controller
}
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_view.js', 'downloads', 'front' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_pending.js', 'downloads', 'front' ) );
parent::execute();
}
@@ -138,4 +144,19 @@ class _pending extends \IPS\Content\Controller
$file->printFile();
exit;
}
/**
* Moderate
*
* @return void
*/
protected function moderate()
{
if( $this->file->hidden() === 1 AND \IPS\Request::i()->action == 'unhide' )
{
\IPS\Output::i()->error( 'file_version_pending_cannot_approve', '2D417/4', 403, '' );
}
return parent::moderate();
}
}
@@ -238,27 +238,31 @@ class _submit extends \IPS\Dispatcher\Controller
$linkedScreenshots = array();
/* Files may not be an array since we have an option to limit to a single upload */
if( !\is_array( $values['files'] ) )
{
$values['files'] = [ $values['files'] ];
}
foreach ( $values['files'] as $file )
if( $values['files'] !== NULL )
{
$files[ $k ] = (string) $file;
if ( !isset( $existing[ (string) $file ] ) )
if ( !\is_array( $values['files'] ) )
{
\IPS\Db::i()->insert( 'downloads_files_records', array(
'record_post_key' => isset( \IPS\Request::i()->bulk ) ? md5( \IPS\Request::i()->postKey . "-{$k}" ) : \IPS\Request::i()->postKey,
'record_type' => 'upload',
'record_location' => (string) $file,
'record_realname' => $file->originalFilename,
'record_size' => $file->filesize(),
'record_time' => time(),
) );
$values['files'] = [ $values['files'] ];
}
foreach ( $values['files'] as $file )
{
$files[ $k ] = (string) $file;
if ( !isset( $existing[ (string) $file ] ) )
{
\IPS\Db::i()->insert( 'downloads_files_records', array(
'record_post_key' => isset( \IPS\Request::i()->bulk ) ? md5( \IPS\Request::i()->postKey . "-{$k}" ) : \IPS\Request::i()->postKey,
'record_type' => 'upload',
'record_location' => (string) $file,
'record_realname' => $file->originalFilename,
'record_size' => $file->filesize(),
'record_time' => time(),
) );
}
$k++;
unset( $existing[ (string) $file ] );
}
$k++;
unset( $existing[ (string) $file ] );
}
if ( isset( $values['import_files'] ) )
{
@@ -85,7 +85,7 @@ class _view extends \IPS\Content\Controller
}
/* Any previous versions? */
$versionData = array( 'b_version' => $this->file->version, 'b_changelog' => $this->file->changelog, 'b_backup' => $this->file->updated );
$versionData = array( 'b_version' => $this->file->version, 'b_changelog' => $this->file->changelog, 'b_backup' => $this->file->published );
$versionWhere = array( array( "b_fileid=?", $this->file->id ) );
if ( !\IPS\downloads\File::canViewHiddenItems( NULL, $this->file->container() ) )
{
@@ -554,7 +554,22 @@ class _view extends \IPS\Content\Controller
{
\IPS\nexus\Customer::loggedIn()->log( 'download', array( 'type' => 'idm', 'id' => $this->file->id, 'name' => $this->file->name ) );
}
$this->file->author()->achievementAction( 'downloads', 'DownloadFile', [
'file' => $this->file,
'downloader' => \IPS\Member::loggedIn()
] );
/* Data Layer Event */
if ( \IPS\Settings::i()->core_datalayer_enabled )
{
$properties = $this->file->getDataLayerProperties();
$properties['file_name'] = $data['record_realname'] ?: $file->originalFilename;
\IPS\core\DataLayer::i()->addEvent( 'file_download', $properties );
\IPS\core\DataLayer::i()->cache();
}
/* Download */
if ( $data['record_type'] === 'link' )
{
@@ -912,7 +927,7 @@ class _view extends \IPS\Content\Controller
$defaultFiles = array_pop( $defaultFiles );
}
$fileField = new \IPS\Helpers\Form\Upload( 'files', $defaultFiles, ( !\IPS\Member::loggedIn()->group['idm_linked_files'] and !\IPS\Member::loggedIn()->group['idm_import_files'] ), array( 'storageExtension' => 'downloads_Files', 'allowedFileTypes' => $category->types, 'maxFileSize' => $category->maxfile ? ( $category->maxfile / 1024 ) : NULL, 'multiple' => $category->multiple_files, 'retainDeleted' => TRUE ) );
$fileField = new \IPS\Helpers\Form\Upload( 'files', $defaultFiles, ( !\IPS\Member::loggedIn()->group['idm_linked_files'] and !\IPS\Member::loggedIn()->group['idm_import_files'] ), array( 'storageExtension' => 'downloads_Files', 'allowedFileTypes' => $category->types, 'maxFileSize' => $category->maxfile ? ( $category->maxfile / 1024 ) : NULL, 'multiple' => $category->multiple_files, 'retainDeleted' => TRUE, 'canBeModerated' => TRUE ) );
$fileField->label = \IPS\Member::loggedIn()->language()->addToStack('downloads_file');
$form->add( $fileField );
@@ -967,6 +982,7 @@ class _view extends \IPS\Content\Controller
'multiple' => TRUE,
'retainDeleted' => TRUE,
'template' => "downloads.submit.screenshot",
'canBeModerated' => TRUE,
) ) );
if ( \IPS\Member::loggedIn()->group['idm_linked_files'] )
@@ -1006,6 +1022,17 @@ class _view extends \IPS\Content\Controller
return (string) $form;
}
/* Filters */
$imageUploads = isset( $values['files'] ) ? $values['files'] : [];
if ( isset( $values['screenshots'] ) )
{
$imageUploads = array_merge( $imageUploads, $values['screenshots'] );
}
if ( $this->file->shouldTriggerProfanityFilters( FALSE, FALSE, $values['file_changelog'], $values['file_version'], 'downloads_Downloads', ["downloads-{$this->file->id}-changelog"], $imageUploads ) )
{
$requireApproval = TRUE;
}
/* Versioning */
if( $requireApproval )
{
@@ -1017,12 +1044,15 @@ class _view extends \IPS\Content\Controller
else
{
$fileObj = $this->file;
$fileObj->published = time();
}
$existingRecords = array();
$existingScreenshots = array();
$existingThumbnails = array();
$existingLinks = array();
$existingScreenshotLinks = array();
$existingThumbnails = array();
if ( $category->versioning !== 0 and ( !\IPS\Member::loggedIn()->group['idm_bypass_revision'] or $values['file_save_revision'] ) )
{
$fileObj->saveVersion();
@@ -1397,4 +1427,4 @@ class _view extends \IPS\Content\Controller
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->notifyBlurb( $this->file, $options );
}
}
}