Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Category Node
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Downloads
|
||||
* @since 27 Sep 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads;
|
||||
@@ -24,6 +23,8 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
use \IPS\Content\ClubContainer;
|
||||
|
||||
/**
|
||||
* @brief [ActiveRecord] Multiton Store
|
||||
*/
|
||||
@@ -205,6 +206,9 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->massUpdate( static::$contentItemClass, $this->_id, NULL, '' );
|
||||
}
|
||||
|
||||
/* Trash widgets so files in this category are not viewable in widgets */
|
||||
\IPS\Widget::deleteCaches( NULL, 'downloads' );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -722,4 +726,56 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
\IPS\Lang::saveCustom( 'downloads', $langKey, iterator_to_array( \IPS\Db::i()->select( 'word_custom, lang_id', 'core_sys_lang_words', array( 'word_key=?', $oldLangKey ) )->setKeyField( 'lang_id' )->setValueField('word_custom') ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* !Clubs */
|
||||
|
||||
/**
|
||||
* Get acp language string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function clubAcpTitle()
|
||||
{
|
||||
return 'downloads_categories';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set form for creating a node of this type in a club
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form Form object
|
||||
* @return void
|
||||
*/
|
||||
public function clubForm( \IPS\Helpers\Form $form )
|
||||
{
|
||||
$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 ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Editor( 'club_node_description', $this->_id ? \IPS\Member::loggedIn()->language()->get( static::$titleLangPrefix . $this->_id . '_desc' ) : NULL, FALSE, array( 'app' => 'downloads', 'key' => 'Categories', 'autoSaveKey' => ( $this->id ? "downloads-cat-{$this->id}" : "downloads-new-cat" ), 'attachIds' => $this->id ? array( $this->id, NULL, 'description' ) : NULL, 'minimize' => 'cdesc_placeholder' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_comments', $this->id ? $this->bitoptions['comments'] : TRUE, FALSE, array(), NULL, NULL, NULL, 'cbitoptions_comments' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'cbitoptions_reviews', $this->id ? $this->bitoptions['reviews'] : TRUE, FALSE, array( 'togglesOn' => array( 'cbitoptions_reviews_download' ) ) ) );
|
||||
$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' ), 'nullLang' => 'any_extensions' ), NULL, NULL, NULL, 'ctypes' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Class-specific routine when saving club form
|
||||
*
|
||||
* @param \IPS\Member\Club $club The club
|
||||
* @param array $values Values
|
||||
* @return void
|
||||
*/
|
||||
public function _saveClubForm( \IPS\Member\Club $club, $values )
|
||||
{
|
||||
foreach ( array( 'allowss', 'reqss', 'comments', 'reviews' ) as $k )
|
||||
{
|
||||
$this->bitoptions[ $k ] = $values[ 'cbitoptions_' . $k ];
|
||||
}
|
||||
|
||||
$this->types = implode( ',', $values['ctypes'] );
|
||||
|
||||
if ( $values['club_node_name'] )
|
||||
{
|
||||
$this->name_furl = \IPS\Http\Url\Friendly::seoTitle( $values['club_node_name'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Field Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Downloads
|
||||
* @since 3 Oct 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads;
|
||||
@@ -133,8 +132,10 @@ class _Field extends \IPS\CustomField
|
||||
unset( $values['cf_topic'] );
|
||||
}
|
||||
|
||||
$values['search_type'] = ( $values['pf_search_type'] === NULL ) ? '' : $values['pf_search_type'];
|
||||
$values['search_type'] = ( $values['pf_search_type'] === NULL ) ? '' : $values['pf_search_type'];
|
||||
$values['allow_attachments'] = $values['pf_allow_attachments'];
|
||||
unset( $values['pf_search_type'] );
|
||||
unset( $values['pf_allow_attachments'] );
|
||||
|
||||
return parent::formatFormValues( $values );
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief File Comment Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Downloads
|
||||
* @since 11 Oct 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\File;
|
||||
@@ -22,8 +21,10 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* File Comment Model
|
||||
*/
|
||||
class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Reputation, \IPS\Content\Searchable, \IPS\Content\Embeddable
|
||||
class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Searchable, \IPS\Content\Embeddable, \IPS\Content\Shareable
|
||||
{
|
||||
use \IPS\Content\Reactable;
|
||||
|
||||
/**
|
||||
* @brief [ActiveRecord] Multiton Store
|
||||
*/
|
||||
@@ -75,11 +76,6 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
|
||||
*/
|
||||
public static $icon = 'download';
|
||||
|
||||
/**
|
||||
* @brief Reputation Type
|
||||
*/
|
||||
public static $reputationType = 'comment_id';
|
||||
|
||||
/**
|
||||
* @brief [Content] Key for hide reasons
|
||||
*/
|
||||
@@ -119,4 +115,26 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'downloads', 'front' )->searchResultCommentSnippet( $indexData, $screenshot, $url, $reviewRating, $view == 'condensed' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reaction Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function reactionType()
|
||||
{
|
||||
return 'comment_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content for embed
|
||||
*
|
||||
* @param array $params Additional parameters to add to URL
|
||||
* @return string
|
||||
*/
|
||||
public function embedContent( $params )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'downloads', 'front' ) );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'downloads' )->embedFileComment( $this, $this->item(), $this->url()->setQueryString( $params ) );
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief File Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Downloads
|
||||
* @since 8 Oct 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads;
|
||||
@@ -25,7 +24,6 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
class _File extends \IPS\Content\Item implements
|
||||
\IPS\Content\Permissions,
|
||||
\IPS\Content\Tags,
|
||||
\IPS\Content\Reputation,
|
||||
\IPS\Content\Followable,
|
||||
\IPS\Content\ReportCenter,
|
||||
\IPS\Content\ReadMarkers,
|
||||
@@ -33,8 +31,11 @@ class _File extends \IPS\Content\Item implements
|
||||
\IPS\Content\Hideable, \IPS\Content\Featurable, \IPS\Content\Pinnable, \IPS\Content\Lockable,
|
||||
\IPS\Content\Shareable,
|
||||
\IPS\Content\Searchable,
|
||||
\IPS\Content\Embeddable
|
||||
\IPS\Content\Embeddable,
|
||||
\IPS\Content\MetaData
|
||||
{
|
||||
use \IPS\Content\Reactable;
|
||||
|
||||
/**
|
||||
* @brief Application
|
||||
*/
|
||||
@@ -101,7 +102,8 @@ class _File extends \IPS\Content\Item implements
|
||||
'pinned' => 'pinned',
|
||||
'featured' => 'featured',
|
||||
'locked' => 'locked',
|
||||
'ip_address' => 'ipaddress'
|
||||
'ip_address' => 'ipaddress',
|
||||
'meta_data' => 'meta_data'
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -119,11 +121,6 @@ class _File extends \IPS\Content\Item implements
|
||||
*/
|
||||
public static $formLangPrefix = 'file_';
|
||||
|
||||
/**
|
||||
* @brief Reputation Type
|
||||
*/
|
||||
public static $reputationType = 'file_id';
|
||||
|
||||
/**
|
||||
* @brief [Content] Key for hide reasons
|
||||
*/
|
||||
@@ -498,14 +495,6 @@ class _File extends \IPS\Content\Item implements
|
||||
/**
|
||||
* Get screenshots
|
||||
*
|
||||
* This is probably my favourite method so far in IPS4. It will prepare a query,
|
||||
* but not execute it until you begin to iterate. It will cache the results so
|
||||
* even if you iterate more than once, the query is only ran once. And as it
|
||||
* iterates, it will automatically create \IPS\File objects out of the values.
|
||||
* It is programatic beauty.
|
||||
* And if you change one character, I will cut off your fingers.
|
||||
* - Mark
|
||||
*
|
||||
* @param int $type 0 = Normal, 1 = Thumbnails, 2 = No watermark
|
||||
* @param bool $includeLinks If true, will include linked files
|
||||
* @param int|NULL $version If provided, will get the file records for a specific previous version (downloads_filebackup.b_id)
|
||||
@@ -570,7 +559,33 @@ class _File extends \IPS\Content\Item implements
|
||||
$this->$property = $iterator;
|
||||
return $this->$property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content images
|
||||
*
|
||||
* @param int|null $limit Number of attachments to fetch, or NULL for all
|
||||
*
|
||||
* @return array|NULL If array, then array( 'core_Attachment' => 'month_x/foo.gif', ... );
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function contentImages( $limit = NULL )
|
||||
{
|
||||
$images = array();
|
||||
$count = 0;
|
||||
foreach( $this->screenshots() as $image )
|
||||
{
|
||||
if ( $count == $limit )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
$images[] = array( 'downloads_Screenshots' => (string) $image);
|
||||
$count++;
|
||||
}
|
||||
|
||||
return count( $images ) ? $images : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Cached primary screenshot
|
||||
*/
|
||||
@@ -676,7 +691,7 @@ class _File extends \IPS\Content\Item implements
|
||||
|
||||
if( $topic === TRUE AND $this->_fieldData === NULL )
|
||||
{
|
||||
$this->_fieldData = iterator_to_array( \IPS\Db::i()->select( 'cf_id,cf_format', 'downloads_cfields', array( 'cf_topic=?', 1 ) )->setKeyField( 'cf_id' )->setValueField( 'cf_format' ) );
|
||||
$this->_fieldData = iterator_to_array( \IPS\Db::i()->select( '*', 'downloads_cfields', array( 'cf_topic=?', 1 ) )->setKeyField( 'cf_id' ) );
|
||||
}
|
||||
|
||||
try
|
||||
@@ -688,21 +703,25 @@ class _File extends \IPS\Content\Item implements
|
||||
|
||||
foreach ( $this->_customFields as $k => $v )
|
||||
{
|
||||
$fieldId = str_replace( 'field_', '', $k );
|
||||
|
||||
/* If we're getting fields for the topic we need to skip any that are set to not be included */
|
||||
if( $topic === TRUE and !isset( $this->_fieldData[ str_replace( 'field_', '', $k ) ] ) )
|
||||
if( $topic === TRUE and !isset( $this->_fieldData[ $fieldId ] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( array_key_exists( str_replace( 'field_', '', $k ), $fields ) )
|
||||
if ( array_key_exists( $fieldId, $fields ) )
|
||||
{
|
||||
if( $topic === TRUE )
|
||||
{
|
||||
if( isset( $this->_fieldData[ str_replace( 'field_', '', $k ) ] ) )
|
||||
$thisField = \IPS\downloads\Field::constructFromData( $this->_fieldData[ $fieldId ] );
|
||||
|
||||
if( isset( $this->_fieldData[ $fieldId ] ) )
|
||||
{
|
||||
$v = str_replace( '{content}', htmlspecialchars( $v, \IPS\HTMLENTITIES, 'UTF-8', FALSE ), $this->_fieldData[ str_replace( 'field_', '', $k ) ] );
|
||||
$v = str_replace( '{content}', htmlspecialchars( $v, \IPS\HTMLENTITIES, 'UTF-8', FALSE ), $thisField->displayValue( $v ) );
|
||||
$v = str_replace( '{member_id}', \IPS\Member::loggedIn()->member_id, $v );
|
||||
$v = str_replace( '{title}', \IPS\Member::loggedIn()->language()->addToStack( 'downloads_field_' . str_replace( 'field_', '', $k ) ), $v );
|
||||
$v = str_replace( '{title}', \IPS\Member::loggedIn()->language()->addToStack( 'downloads_field_' . $fieldId ), $v );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -729,11 +748,11 @@ class _File extends \IPS\Content\Item implements
|
||||
$tabs = array();
|
||||
if ( $this->container()->bitoptions['reviews'] )
|
||||
{
|
||||
$tabs['reviews'] = \IPS\Member::loggedIn()->language()->pluralize( \IPS\Member::loggedIn()->language()->get( 'file_review_count' ), array( $this->mapped('num_reviews') ) );
|
||||
$tabs['reviews'] = \IPS\Member::loggedIn()->language()->addToStack( 'file_review_count', TRUE, array( 'pluralize' => array( $this->mapped('num_reviews') ) ) );
|
||||
}
|
||||
if ( $this->container()->bitoptions['comments'] )
|
||||
{
|
||||
$tabs['comments'] = \IPS\Member::loggedIn()->language()->pluralize( \IPS\Member::loggedIn()->language()->get( 'file_comment_count' ), array( $this->mapped('num_comments') ) );
|
||||
$tabs['comments'] = \IPS\Member::loggedIn()->language()->addToStack( 'file_comment_count', TRUE, array( 'pluralize' => array( $this->mapped('num_comments') ) ) );
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
@@ -1453,6 +1472,22 @@ class _File extends \IPS\Content\Item implements
|
||||
|
||||
parent::processAfterCreate( $comment, $values );
|
||||
}
|
||||
|
||||
/**
|
||||
* Log for deletion later
|
||||
*
|
||||
* \IPS\Member|NULL $member The member or NULL for currently logged in
|
||||
* @return void
|
||||
*/
|
||||
public function logDelete( $member = NULL )
|
||||
{
|
||||
parent::logDelete( $member );
|
||||
|
||||
if ( $topic = $this->topic() and $this->container()->bitoptions['topic_delete'] )
|
||||
{
|
||||
$topic->logDelete( $member );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Record
|
||||
@@ -1499,6 +1534,15 @@ class _File extends \IPS\Content\Item implements
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
|
||||
foreach ( new \IPS\File\Iterator( \IPS\Db::i()->select( 'record_no_watermark', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_no_watermark IS NOT NULL', $this->id, 'ssupload' ) ), 'downloads_Screenshots' ) as $file )
|
||||
{
|
||||
try
|
||||
{
|
||||
$file->delete();
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
|
||||
\IPS\Db::i()->delete( 'downloads_ccontent', array( 'file_id=?', $this->id ) );
|
||||
\IPS\Db::i()->delete( 'downloads_downloads', array( 'dfid=?', $this->id ) );
|
||||
@@ -1538,27 +1582,43 @@ class _File extends \IPS\Content\Item implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Are comments supported by this class?
|
||||
*
|
||||
* @param \IPS\Member\NULL $member The member to check for or NULL fto not check permission
|
||||
* @return int
|
||||
* @param \IPS\Member|NULL $member The member to check for or NULL to not check permission
|
||||
* @param \IPS\Node\Model|NULL $container The container to check in, or NULL for any container
|
||||
* @return bool
|
||||
*/
|
||||
public static function supportsComments( \IPS\Member $member = NULL )
|
||||
{
|
||||
return parent::supportsComments() and ( !$member or \IPS\downloads\Category::countWhere( 'read', $member, array( 'cbitoptions & 4' ) ) );
|
||||
public static function supportsComments( \IPS\Member $member = NULL, \IPS\Node\Model $container = NULL )
|
||||
{
|
||||
if( $container !== NULL )
|
||||
{
|
||||
return parent::supportsComments() and $container->bitoptions['comments'] AND ( !$member or $container->can( 'read', $member ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::supportsComments() and ( !$member or \IPS\downloads\Category::countWhere( 'read', $member, array( 'cbitoptions & 4' ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Are reviews supported by this class?
|
||||
*
|
||||
* @param \IPS\Member\NULL $member The member to check for or NULL to not check permission
|
||||
* @return int
|
||||
* @param \IPS\Member|NULL $member The member to check for or NULL to not check permission
|
||||
* @param \IPS\Node\Model|NULL $container The container to check in, or NULL for any container
|
||||
* @return bool
|
||||
*/
|
||||
public static function supportsReviews( \IPS\Member $member = NULL )
|
||||
public static function supportsReviews( \IPS\Member $member = NULL, \IPS\Node\Model $container = NULL )
|
||||
{
|
||||
return parent::supportsReviews() and ( !$member or \IPS\downloads\Category::countWhere( 'read', $member, array( 'cbitoptions & 256' ) ) );
|
||||
if( $container !== NULL )
|
||||
{
|
||||
return parent::supportsReviews() and $container->bitoptions['reviews'] AND ( !$member or $container->can( 'read', $member ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return parent::supportsReviews() and ( !$member or \IPS\downloads\Category::countWhere( 'read', $member, array( 'cbitoptions & 256' ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1603,6 +1663,27 @@ class _File extends \IPS\Content\Item implements
|
||||
$file = \IPS\File::get( $file['record_type'] == 'upload' ? 'downloads_Files' : 'downloads_Screenshots', $file['record_location'] )->delete();
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
|
||||
if( $file['record_type'] == 'ssupload' )
|
||||
{
|
||||
if( $file['record_thumb'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$file = \IPS\File::get( 'downloads_Screenshots', $file['record_thumb'] )->delete();
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
|
||||
if( $file['record_no_watermark'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$file = \IPS\File::get( 'downloads_Screenshots', $file['record_no_watermark'] )->delete();
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Db::i()->delete( 'downloads_files_records', \IPS\Db::i()->in( 'record_id', explode( ',', $backUp['b_records'] ) ) );
|
||||
@@ -1966,6 +2047,21 @@ class _File extends \IPS\Content\Item implements
|
||||
|
||||
parent::processAfterEdit( $values );
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to execute when tags are edited
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function processAfterTagUpdate()
|
||||
{
|
||||
parent::processAfterTagUpdate();
|
||||
|
||||
if ( \IPS\Application::appIsEnabled('forums') and $this->topic() )
|
||||
{
|
||||
$this->syncTopic();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move
|
||||
@@ -2166,6 +2262,18 @@ class _File extends \IPS\Content\Item implements
|
||||
return $this->primary_screenshot_thumb ? \IPS\File::get( 'downloads_Screenshots', $this->primary_screenshot_thumb ) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content for embed
|
||||
*
|
||||
* @param array $params Additional parameters to add to URL
|
||||
* @return string
|
||||
*/
|
||||
public function embedContent( $params )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'downloads', 'front' ) );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'downloads' )->embedFile( $this, $this->url()->setQueryString( $params ), $this->embedImage() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get snippet HTML for search result display
|
||||
*
|
||||
@@ -2246,7 +2354,7 @@ class _File extends \IPS\Content\Item implements
|
||||
public function apiOutput( $backup=NULL )
|
||||
{
|
||||
return array(
|
||||
'id' => $this->tid,
|
||||
'id' => $this->id,
|
||||
'title' => $backup ? $backup['b_filetitle'] : $this->name,
|
||||
'category' => $this->container()->apiOutput(),
|
||||
'author' => $this->author()->apiOutput(),
|
||||
@@ -2296,4 +2404,44 @@ class _File extends \IPS\Content\Item implements
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* !Reactions */
|
||||
|
||||
/**
|
||||
* Reaction Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function reactionType()
|
||||
{
|
||||
return 'file_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported Meta Data Types
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function supportedMetaDataTypes()
|
||||
{
|
||||
return array( 'core_FeaturedComments', 'core_ContentMessages' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Give a content item the opportunity to filter similar content
|
||||
*
|
||||
* @note Intentionally blank but can be overridden by child classes
|
||||
* @return array|NULL
|
||||
*/
|
||||
public function similarContentFilter()
|
||||
{
|
||||
if( $this->topicid )
|
||||
{
|
||||
return array(
|
||||
array( '!(tag_meta_app=? and tag_meta_area=? and tag_meta_id=?)', 'forums', 'forums', $this->topicid )
|
||||
);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief File Record Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Downloads
|
||||
* @since 9 Dec 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\File;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief File Review Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Downloads
|
||||
* @since 4 Nov 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\File;
|
||||
@@ -22,8 +21,10 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* File Review Model
|
||||
*/
|
||||
class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Reputation, \IPS\Content\Searchable, \IPS\Content\Embeddable
|
||||
class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \IPS\Content\ReportCenter, \IPS\Content\Hideable, \IPS\Content\Searchable, \IPS\Content\Embeddable
|
||||
{
|
||||
use \IPS\Content\Reactable;
|
||||
|
||||
/**
|
||||
* @brief [ActiveRecord] Multiton Store
|
||||
*/
|
||||
@@ -79,11 +80,6 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
|
||||
*/
|
||||
public static $icon = 'download';
|
||||
|
||||
/**
|
||||
* @brief Reputation Type
|
||||
*/
|
||||
public static $reputationType = 'review_id';
|
||||
|
||||
/**
|
||||
* @brief [Content] Key for hide reasons
|
||||
*/
|
||||
@@ -117,4 +113,26 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
|
||||
{
|
||||
return \IPS\downloads\File\Comment::searchResultSnippet( $indexData, $authorData, $itemData, $containerData, $reputationData, $reviewRating, $view );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reaction type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function reactionType()
|
||||
{
|
||||
return 'review_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content for embed
|
||||
*
|
||||
* @param array $params Additional parameters to add to URL
|
||||
* @return string
|
||||
*/
|
||||
public function embedContent( $params )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'downloads', 'front' ) );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'downloads' )->embedFileReview( $this, $this->item(), $this->url()->setQueryString( $params ) );
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Form helper class for linked screenshots
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Downloads
|
||||
* @since 13 Nov 2015
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\downloads\Form;
|
||||
|
||||
Reference in new issue
Block a user