Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -81,6 +81,11 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
|
||||
* @brief [Content] Key for hide reasons
|
||||
*/
|
||||
public static $hideLogKey = 'downloads-files';
|
||||
|
||||
/**
|
||||
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
|
||||
*/
|
||||
public $trackSentimentScore = true;
|
||||
|
||||
/**
|
||||
* Get URL for doing stuff
|
||||
|
||||
@@ -688,10 +688,10 @@ class _File extends \IPS\Content\Item implements
|
||||
public function contentImages( $limit = NULL, $ignorePermissions = FALSE )
|
||||
{
|
||||
$images = parent::contentImages( $limit, $ignorePermissions ) ?: array();
|
||||
$count = 0;
|
||||
$count = \count( $images );
|
||||
foreach( $this->screenshots( 0, FALSE ) as $image )
|
||||
{
|
||||
if ( $count == $limit )
|
||||
if ( $count >= $limit )
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -700,7 +700,7 @@ class _File extends \IPS\Content\Item implements
|
||||
$count++;
|
||||
}
|
||||
|
||||
return \count( $images ) ? $images : NULL;
|
||||
return \count( $images ) ? \array_slice( $images, 0, $limit ) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1655,8 +1655,33 @@ class _File extends \IPS\Content\Item implements
|
||||
}
|
||||
$this->desc = $values['file_desc'];
|
||||
|
||||
$sendFilterNotifications = $this->checkProfanityFilters( FALSE, $new );
|
||||
|
||||
$imageUploads = isset( $values['files'] ) ? $values['files'] : [];
|
||||
$editorLookups = $new ? [ ( isset( $values['_bulkKey'] ) ? $values['_bulkKey'] : '' ) . 'downloads-new-file'] : [ [ $this->id, NULL, 'desc' ] ];
|
||||
if ( isset( $values['screenshots'] ) and $values['screenshots'] )
|
||||
{
|
||||
$imageUploads = array_merge( $imageUploads, $values['screenshots'] );
|
||||
}
|
||||
foreach ( $this->container()->cfields as $field )
|
||||
{
|
||||
$helper = $field->buildHelper( NULL, NULL, $new ? NULL : $this );
|
||||
if ( $helper instanceof \IPS\Helpers\Form\Upload )
|
||||
{
|
||||
if ( \is_array( $values["downloads_field_{$field->id}"] ) )
|
||||
{
|
||||
$imageUploads = array_merge( $imageUploads, $values["downloads_field_{$field->id}"] );
|
||||
}
|
||||
elseif ( $values["downloads_field_{$field->id}"] )
|
||||
{
|
||||
$imageUploads[] = $values["downloads_field_{$field->id}"];
|
||||
}
|
||||
}
|
||||
elseif ( $helper instanceof \IPS\Helpers\Form\Editor )
|
||||
{
|
||||
$editorLookups[] = $new ? md5( 'IPS\downloads\Field-' . ( isset( $values['_bulkKey'] ) ? $values['_bulkKey'] : '' ) . $field->id . '-new' ) : [ $this->id, $field->id, 'fields' ];
|
||||
}
|
||||
}
|
||||
$sendFilterNotifications = $this->checkProfanityFilters( FALSE, !$new, NULL, NULL, 'downloads_Downloads', $editorLookups, $imageUploads );
|
||||
|
||||
if ( !$new AND $sendFilterNotifications === FALSE )
|
||||
{
|
||||
$this->sendAfterEditNotifications( $oldContent );
|
||||
@@ -2002,7 +2027,7 @@ class _File extends \IPS\Content\Item implements
|
||||
'b_filetitle' => $this->name,
|
||||
'b_filedesc' => $this->desc,
|
||||
'b_hidden' => FALSE,
|
||||
'b_backup' => $this->updated,
|
||||
'b_backup' => $this->published,
|
||||
'b_updated' => time(),
|
||||
'b_records' => implode( ',', iterator_to_array( \IPS\Db::i()->select( 'record_id', 'downloads_files_records', array( 'record_file_id=? AND record_backup=0 AND record_hidden=0', $this->id ) ) ) ),
|
||||
'b_version' => $this->version,
|
||||
|
||||
@@ -83,6 +83,11 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
*/
|
||||
public static $hideLogKey = 'downloads-file-pending';
|
||||
|
||||
/**
|
||||
* @brief Used by the dataLayer
|
||||
*/
|
||||
public static $contentType = 'file';
|
||||
|
||||
/**
|
||||
* Can unhide?
|
||||
*
|
||||
@@ -296,7 +301,7 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
public function delete()
|
||||
{
|
||||
$ids = [];
|
||||
foreach( \IPS\Db::i()->select( '*', 'downloads_files_records', array( 'record_file_id=? AND record_hidden=1', $this->file_id ) ) as $record )
|
||||
foreach( \IPS\Db::i()->select( '*', 'downloads_files_records', [ 'record_file_id=? AND record_hidden=1', $this->file_id ], NULL, NULL, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER ) as $record )
|
||||
{
|
||||
switch( $record['record_type'] )
|
||||
{
|
||||
@@ -304,14 +309,15 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
case 'ssupload':
|
||||
$this->file()->deleteRecords( $record['record_id'], $record['record_location'], ( $record['record_type'] == 'ssupload' ) ? 'downloads_Screenshots' : 'downloads_Files' );
|
||||
|
||||
if( $record['record_type'] == 'ssupload' AND !empty( $record['record_thumb'] ) )
|
||||
try
|
||||
{
|
||||
try
|
||||
if( $record['record_type'] == 'ssupload' AND !empty( $record['record_thumb'] )
|
||||
AND !\IPS\Db::i()->select( 'COUNT(record_id)', 'downloads_files_records', [ 'record_id<>? AND record_thumb=?', $record['record_id'], $record['record_thumb'] ] )->first() )
|
||||
{
|
||||
\IPS\File::get( 'downloads_Screenshots', $record['record_thumb'] )->delete();
|
||||
\IPS\File::get( 'downloads_Screenshots', $record['record_thumb'] )->delete();
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
break;
|
||||
case 'link':
|
||||
case 'sslink':
|
||||
@@ -391,6 +397,7 @@ class _PendingVersion extends \IPS\Content\Item implements \IPS\Content\Hideable
|
||||
$file->updated = time();
|
||||
$file->approver = $member->member_id;
|
||||
$file->approvedon = time();
|
||||
$file->published = time();
|
||||
$file->save();
|
||||
|
||||
/* Saved form values for after new version processing */
|
||||
|
||||
@@ -85,6 +85,11 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
|
||||
* @brief [Content] Key for hide reasons
|
||||
*/
|
||||
public static $hideLogKey = 'downloads-files-rev';
|
||||
|
||||
/**
|
||||
* @brief Whether to track the sentiment scores in cloud_sentiment_scores for this content
|
||||
*/
|
||||
public $trackSentimentScore = true;
|
||||
|
||||
/**
|
||||
* Get URL for doing stuff
|
||||
|
||||
Reference in new issue
Block a user