Version 4.7.0
This commit is contained in:
1 parent
517a5e1f70
commit
8ba7d43898
1933 files changed
+65613
-11332
No files matched your search
@@ -152,6 +152,11 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
*/
|
||||
public static $databaseColumnEnabledDisabled = 'open';
|
||||
|
||||
/**
|
||||
* @brief The class of the ACP \IPS\Node\Controller that manages this node type
|
||||
*/
|
||||
protected static $acpController = "IPS\\downloads\\modules\\admin\\downloads\\categories";
|
||||
|
||||
/**
|
||||
* Get SEO name
|
||||
*
|
||||
@@ -309,7 +314,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'cversion_numbers', $this->id ? $this->version_numbers : 1, TRUE, array( 'options' => array( 0 => 'version_numbers_disabled', 1 => 'version_numbers_enabled', 2 => 'version_numbers_required' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cversioning_on', $this->versioning !== 0, FALSE, array( 'togglesOn' => array( 'cversioning', 'crequire_changelog' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'cversioning', $this->versioning === NULL ? -1 : $this->versioning, FALSE, array( 'unlimited' => -1 ), NULL, NULL, NULL, 'cversioning' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'crequire_changelog', $this->require_changelog, FALSE, array( ), NULL, NULL, NULL, 'crequire_changelog' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'crequire_changelog', $this->require_changelog ?: 0, FALSE, array( ), NULL, NULL, NULL, 'crequire_changelog' ) );
|
||||
$form->addHeader( 'category_moderation' );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_moderation', $this->bitoptions['moderation'], FALSE, array( 'togglesOn' => array( 'cbitoptions_moderation_edits' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_moderation_edits', $this->bitoptions['moderation_edits'], FALSE, array(), NULL, NULL, NULL, 'cbitoptions_moderation_edits' ) );
|
||||
@@ -347,7 +352,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
'ctopic_suffix',
|
||||
'cbitoptions_topic_delete',
|
||||
'cbitoptions_topic_screenshot'
|
||||
) ), NULL, NULL, $this->id ? \IPS\Member::loggedIn()->language()->addToStack( 'downloadcategory_topic_rebuild', NULL, array( 'sprintf' => array( $rebuildUrl ) ) ) : NULL ) );
|
||||
) ), NULL, NULL, $this->id ? \IPS\Member::loggedIn()->language()->addToStack( 'downloadcategory_topic_rebuild', FALSE, array( 'sprintf' => array( $rebuildUrl ) ) ) : NULL ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'cforum_id', $this->forum_id ? $this->forum_id : NULL, FALSE, array( 'class' => 'IPS\forums\Forum', 'permissionCheck' => function ( $forum ) { return $forum->sub_can_post and !$forum->redirect_url; } ), function( $val ) {
|
||||
if( \IPS\Request::i()->cforum_on_checkbox AND !$val )
|
||||
{
|
||||
@@ -498,6 +503,26 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
return $this->_data['types'] ? explode( ',', $this->_data['types'] ) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of items
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function get__items()
|
||||
{
|
||||
return (int) $this->files;
|
||||
}
|
||||
/**
|
||||
* Set number of items
|
||||
*
|
||||
* @param int $val Items
|
||||
* @return int
|
||||
*/
|
||||
protected function set__items( $val )
|
||||
{
|
||||
$this->files = (int) $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Custom Field Cache
|
||||
*/
|
||||
@@ -787,7 +812,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
* @param \IPS\Helpers\Form $form Form object
|
||||
* @return void
|
||||
*/
|
||||
public function clubForm( \IPS\Helpers\Form $form )
|
||||
public function clubForm( \IPS\Helpers\Form $form, \IPS\Member\Club $club )
|
||||
{
|
||||
$itemClass = static::$contentItemClass;
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'club_node_name', $this->_id ? $this->_title : \IPS\Member::loggedIn()->language()->addToStack( $itemClass::$title . '_pl' ), TRUE, array( 'maxLength' => 255 ) ) );
|
||||
@@ -797,6 +822,11 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_allowss', $this->id ? $this->bitoptions['allowss'] : TRUE, FALSE, array( 'togglesOn' => array( 'cbitoptions_reqss', 'cmaxss', 'cmaxdims' ) ), NULL, NULL, NULL, 'cbitoptions_allowss' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_reqss', $this->bitoptions['reqss'], FALSE, array(), NULL, NULL, NULL, 'cbitoptions_reqss' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'ctypes', $this->id ? $this->_data['types'] : NULL, FALSE, array( 'autocomplete' => array( 'unique' => 'true', 'lang' => 'files_optional' ), 'nullLang' => 'any_extensions' ), NULL, NULL, NULL, 'ctypes' ) );
|
||||
|
||||
if( $club->type == 'closed' )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'club_node_public', $this->id ? $this->isPublic() : FALSE ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,6 +70,11 @@ class _Field extends \IPS\CustomField
|
||||
*/
|
||||
public static $contentDatabaseTable = 'downloads_ccontent';
|
||||
|
||||
/**
|
||||
* @brief [CustomField] Set to TRUE if uploads fields are capable of holding the submitted content for moderation
|
||||
*/
|
||||
public static $uploadsCanBeModerated = TRUE;
|
||||
|
||||
/**
|
||||
* @brief [Node] ACP Restrictions
|
||||
*/
|
||||
@@ -89,6 +94,12 @@ class _Field extends \IPS\CustomField
|
||||
*/
|
||||
public static $uploadStorageExtension = 'downloads_FileField';
|
||||
|
||||
/**
|
||||
* @brief [CustomField] An array of the 'keys' of the Field types toggles that shouldn't be an option. The main use is for excluding polls
|
||||
*/
|
||||
public static $disabledFieldTypes = array( 'Poll' );
|
||||
|
||||
|
||||
/**
|
||||
* Get topic format
|
||||
*
|
||||
|
||||
@@ -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