Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief Categories
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 27 Sep 2013
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief fields
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 03 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Settings
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 09 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -33,24 +33,7 @@ class _settings extends \IPS\Dispatcher\Controller
{
\IPS\Dispatcher::i()->checkAcpPermission( 'settings_manage' );
$form = new \IPS\Helpers\Form;
$form->addTab('basic_settings');
$form->add( new \IPS\Helpers\Form\Upload( 'idm_watermarkpath', \IPS\Settings::i()->idm_watermarkpath ? \IPS\File::get( 'core_Theme', \IPS\Settings::i()->idm_watermarkpath ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Theme' ) ) );
$form->add( new \IPS\Helpers\Form\Stack( 'idm_link_blacklist', explode( ',', \IPS\Settings::i()->idm_link_blacklist ), FALSE, array( 'placeholder' => 'example.com' ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_antileech', \IPS\Settings::i()->idm_antileech ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_rss', \IPS\Settings::i()->idm_rss ) );
if ( \IPS\Application::appIsEnabled( 'nexus' ) )
{
$form->addTab( 'paid_file_settings' );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_nexus_on', \IPS\Settings::i()->idm_nexus_on, FALSE, array( 'togglesOn' => array( 'idm_nexus_tax', 'idm_nexus_percent', 'idm_nexus_transfee' ) ) ) );
$form->add( new \IPS\Helpers\Form\Node( 'idm_nexus_tax', \IPS\Settings::i()->idm_nexus_tax ?:0, FALSE, array( 'class' => '\IPS\nexus\Tax', 'zeroVal' => 'do_not_tax' ), NULL, NULL, NULL, 'idm_nexus_tax' ) );
$form->add( new \IPS\Helpers\Form\Number( 'idm_nexus_percent', \IPS\Settings::i()->idm_nexus_percent, FALSE, array( 'min' => 0, 'max' => 100 ), NULL, NULL, '%', 'idm_nexus_percent' ) );
$form->add( new \IPS\nexus\Form\Money( 'idm_nexus_transfee', json_decode( \IPS\Settings::i()->idm_nexus_transfee, TRUE ), FALSE, array(), NULL, NULL, NULL, 'idm_nexus_transfee' ) );
$form->add( new \IPS\Helpers\Form\Node( 'idm_nexus_gateways', ( \IPS\Settings::i()->idm_nexus_gateways ) ? explode( ',', \IPS\Settings::i()->idm_nexus_gateways ) : 0, FALSE, array( 'class' => '\IPS\nexus\Gateway', 'zeroVal' => 'no_restriction', 'multiple' => TRUE ), NULL, NULL, NULL, 'idm_nexus_gateways' ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'idm_nexus_display', explode( ',', \IPS\Settings::i()->idm_nexus_display ), FALSE, array( 'options' => array( 'purchases' => 'idm_purchases', 'downloads' => 'downloads' ) ) ) );
}
$form = $this->getForm();
if ( $values = $form->values( TRUE ) )
{
@@ -71,6 +54,36 @@ class _settings extends \IPS\Dispatcher\Controller
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('settings');
\IPS\Output::i()->output = $form;
}
/**
* Build and return the settings form
*
* @note Abstracted to allow third party devs to extend easier
* @return \IPS\Helpers\Form
*/
protected function getForm()
{
$form = new \IPS\Helpers\Form;
$form->addTab('basic_settings');
$form->add( new \IPS\Helpers\Form\Upload( 'idm_watermarkpath', \IPS\Settings::i()->idm_watermarkpath ? \IPS\File::get( 'core_Theme', \IPS\Settings::i()->idm_watermarkpath ) : NULL, FALSE, array( 'image' => TRUE, 'storageExtension' => 'core_Theme' ) ) );
$form->add( new \IPS\Helpers\Form\Stack( 'idm_link_blacklist', explode( ',', \IPS\Settings::i()->idm_link_blacklist ), FALSE, array( 'placeholder' => 'example.com' ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_antileech', \IPS\Settings::i()->idm_antileech ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_rss', \IPS\Settings::i()->idm_rss ) );
if ( \IPS\Application::appIsEnabled( 'nexus' ) )
{
$form->addTab( 'paid_file_settings' );
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_nexus_on', \IPS\Settings::i()->idm_nexus_on, FALSE, array( 'togglesOn' => array( 'idm_nexus_tax', 'idm_nexus_percent', 'idm_nexus_transfee' ) ) ) );
$form->add( new \IPS\Helpers\Form\Node( 'idm_nexus_tax', \IPS\Settings::i()->idm_nexus_tax ?:0, FALSE, array( 'class' => '\IPS\nexus\Tax', 'zeroVal' => 'do_not_tax' ), NULL, NULL, NULL, 'idm_nexus_tax' ) );
$form->add( new \IPS\Helpers\Form\Number( 'idm_nexus_percent', \IPS\Settings::i()->idm_nexus_percent, FALSE, array( 'min' => 0, 'max' => 100 ), NULL, NULL, '%', 'idm_nexus_percent' ) );
$form->add( new \IPS\nexus\Form\Money( 'idm_nexus_transfee', json_decode( \IPS\Settings::i()->idm_nexus_transfee, TRUE ), FALSE, array(), NULL, NULL, NULL, 'idm_nexus_transfee' ) );
$form->add( new \IPS\Helpers\Form\Node( 'idm_nexus_gateways', ( \IPS\Settings::i()->idm_nexus_gateways ) ? explode( ',', \IPS\Settings::i()->idm_nexus_gateways ) : 0, FALSE, array( 'class' => '\IPS\nexus\Gateway', 'zeroVal' => 'no_restriction', 'multiple' => TRUE ), NULL, NULL, NULL, 'idm_nexus_gateways' ) );
$form->add( new \IPS\Helpers\Form\CheckboxSet( 'idm_nexus_display', explode( ',', \IPS\Settings::i()->idm_nexus_display ), FALSE, array( 'options' => array( 'purchases' => 'idm_purchases', 'downloads' => 'downloads' ) ) ) );
}
return $form;
}
/**
* Rebuild Watermarks
@@ -84,6 +97,8 @@ class _settings extends \IPS\Dispatcher\Controller
\IPS\Output::i()->output = new \IPS\Helpers\MultipleRedirect( \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=settings&do=rebuildWatermarks' ), function( $doneSoFar ) use( $watermark, $perGo )
{
$doneSoFar = intval( $doneSoFar );
$where = array( array( 'record_type=?', 'ssupload' ) );
if ( !$watermark )
{
@@ -2,9 +2,9 @@
/**
* @brief Top Downloaders
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 17 Dec 2013
* @version SVN_VERSION_NUMBER
@@ -77,7 +77,20 @@ class _downloaders extends \IPS\Dispatcher\Controller
$page = 1;
}
$select = \IPS\Db::i()->select( 'dmid, COUNT(*) as downloads, core_members.*', 'downloads_downloads', $where, 'downloads DESC', array( ( $page - 1 ) * static::PER_PAGE, static::PER_PAGE ), 'dmid', NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS )->join( 'core_members', 'core_members.member_id=downloads_downloads.dmid' );
$select = \IPS\Db::i()->select( 'dmid, COUNT(*) as downloads', 'downloads_downloads', $where, 'downloads DESC', array( ( $page - 1 ) * static::PER_PAGE, static::PER_PAGE ), 'dmid', NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );
$mids = array();
foreach( $select as $row )
{
$mids[] = $row['dmid'];
}
$members = array();
if ( count( $mids ) )
{
$members = iterator_to_array( \IPS\Db::i()->select( '*', 'core_members', array( \IPS\Db::i()->in( 'member_id', $mids ) ) )->setKeyField('member_id') );
}
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination(
\IPS\Http\Url::internal( 'app=downloads&module=stats&controller=downloaders' )->setQueryString( $values ),
@@ -96,7 +109,7 @@ class _downloaders extends \IPS\Dispatcher\Controller
)
);
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('stats')->downloadsTable( $select, $pagination );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('stats')->downloadsTable( $select, $pagination, $members );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__downloads_stats_downloaders');
}
}
@@ -2,9 +2,9 @@
/**
* @brief Downloads Statistics
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 16 Dec 2013
* @version SVN_VERSION_NUMBER
@@ -2,9 +2,9 @@
/**
* @brief Member Stats
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 13 Dec 2013
* @version SVN_VERSION_NUMBER
@@ -50,40 +50,41 @@ class _member extends \IPS\Dispatcher\Controller
$fileCount = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files', array( 'file_submitter=?', $member->member_id ) )->first();
$diskspaceUsed = \IPS\Db::i()->select( 'SUM(file_size)', 'downloads_files', array( 'file_submitter=?', $member->member_id ) )->first();
$numberOfDownloads = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_downloads', array( 'dmid=?', $member->member_id ) )->first();
$totalDownloads = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_downloads' )->first();
$bandwidthUsed = \IPS\Db::i()->select( 'SUM(dsize)', 'downloads_downloads', array( 'dmid=?', $member->member_id ) )->first();
$allFiles = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_files' )->first();
$totalFileSize = \IPS\Db::i()->select( 'SUM(file_size)', 'downloads_files' )->first();
$totalDownloadSize = \IPS\Db::i()->select( 'SUM(dsize)', 'downloads_downloads' )->first();
$activeTabContents = \IPS\Theme::i()->getTemplate( 'stats' )->information( \IPS\Theme::i()->getTemplate( 'global', 'core' )->definitionTable( array(
'files_submitted' =>
\IPS\Member::loggedIn()->language()->addToStack('downloads_stat_of_total', FALSE, array( 'sprintf' => array(
\IPS\Member::loggedIn()->language()->formatNumber( $fileCount ),
\IPS\Member::loggedIn()->language()->formatNumber( ( ( $allFiles ? ( 100 / $allFiles ) : 0 ) * $fileCount ), 2 ) ) )
),
'diskspace_used' =>
'files_submitted' =>
\IPS\Member::loggedIn()->language()->addToStack('downloads_stat_of_total', FALSE, array( 'sprintf' => array(
\IPS\Output\Plugin\Filesize::humanReadableFilesize( $diskspaceUsed ),
\IPS\Member::loggedIn()->language()->formatNumber( ( ( $totalFileSize ? ( 100 / $totalFileSize ) : 0 ) * $diskspaceUsed ), 2 ) ) )
),
\IPS\Member::loggedIn()->language()->formatNumber( $fileCount ),
\IPS\Member::loggedIn()->language()->formatNumber( ( ( $allFiles ? ( 100 / $allFiles ) : 0 ) * $fileCount ), 2 ) ) )
),
'diskspace_used' =>
\IPS\Member::loggedIn()->language()->addToStack('downloads_stat_of_total', FALSE, array( 'sprintf' => array(
\IPS\Output\Plugin\Filesize::humanReadableFilesize( $diskspaceUsed ),
\IPS\Member::loggedIn()->language()->formatNumber( ( ( $totalFileSize ? ( 100 / $totalFileSize ) : 0 ) * $diskspaceUsed ), 2 ) ) )
),
'average_filesize_downloads' =>
\IPS\Member::loggedIn()->language()->addToStack('downloads_stat_average', FALSE, array( 'sprintf' => array(
\IPS\Output\Plugin\Filesize::humanReadableFilesize( \IPS\Db::i()->select( 'AVG(file_size)', 'downloads_files', array( 'file_submitter=?', $member->member_id ) )->first() ),
\IPS\Output\Plugin\Filesize::humanReadableFilesize( \IPS\Db::i()->select( 'AVG(file_size)', 'downloads_files' )->first() ) ))
),
'number_of_downloads' =>
\IPS\Output\Plugin\Filesize::humanReadableFilesize( \IPS\Db::i()->select( 'AVG(file_size)', 'downloads_files', array( 'file_submitter=?', $member->member_id ) )->first() ),
\IPS\Output\Plugin\Filesize::humanReadableFilesize( \IPS\Db::i()->select( 'AVG(file_size)', 'downloads_files' )->first() ) ))
),
'number_of_downloads' =>
\IPS\Member::loggedIn()->language()->addToStack('downloads_stat_of_total', FALSE, array( 'sprintf' => array(
\IPS\Member::loggedIn()->language()->formatNumber( $numberOfDownloads ),
\IPS\Member::loggedIn()->language()->formatNumber( ( ( $allFiles ? ( 100 / $allFiles ) : 0 ) * $fileCount ), 2 ) ) )
),
'downloads_bandwidth_used' =>
\IPS\Member::loggedIn()->language()->formatNumber( $numberOfDownloads ),
\IPS\Member::loggedIn()->language()->formatNumber( ( ( $totalDownloads ? ( 100 / $totalDownloads ) : 0 ) * $numberOfDownloads ), 2 ) ) )
),
'downloads_bandwidth_used' =>
\IPS\Member::loggedIn()->language()->addToStack('downloads_stat_of_total', FALSE, array( 'sprintf' => array(
\IPS\Output\Plugin\Filesize::humanReadableFilesize( $bandwidthUsed ),
\IPS\Member::loggedIn()->language()->formatNumber( ( ( $totalDownloadSize ? ( 100 / $totalDownloadSize ) : 0 ) * $bandwidthUsed ), 2 ) ) )
)
\IPS\Output\Plugin\Filesize::humanReadableFilesize( $bandwidthUsed ),
\IPS\Member::loggedIn()->language()->formatNumber( ( ( $totalDownloadSize ? ( 100 / $totalDownloadSize ) : 0 ) * $bandwidthUsed ), 2 ) ) )
)
) ) );
break;
break;
case 'downloads':
$downloadsChart = new \IPS\Helpers\Chart\Dynamic( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=member&do=downloads&id={$member->member_id}&tab=downloads&_graph=1" ), 'downloads_downloads', 'dtime', '', array(), 'ColumnChart', 'monthly', array( 'start' => 0, 'end' => 0 ), array( 'dfid', 'dtime', 'dsize', 'dua', 'dip' ) );
@@ -125,14 +126,13 @@ class _member extends \IPS\Dispatcher\Controller
break;
case 'bandwidth_use':
$bandwidthChart = new \IPS\Helpers\Chart\Dynamic( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=member&do=downloads&id={$member->member_id}&tab=bandwidth_use&_graph=1" ), 'downloads_downloads', 'dtime', '', array( 'vAxis' => array( 'title' => '(kB)' ) ) );
$bandwidthChart = new \IPS\Helpers\Chart\Dynamic( \IPS\Http\Url::internal( "app=downloads&module=stats&controller=member&do=downloads&id={$member->member_id}&tab=bandwidth_use&_graph=1" ), 'downloads_downloads', 'dtime', '', array( 'vAxis' => array( 'title' => '(' . \IPS\Member::loggedIn()->language()->addToStack( 'filesize_raw_k' ) . ')' ) ) );
$bandwidthChart->where[] = array( 'dmid=?', $member->member_id );
$bandwidthChart->addSeries( \IPS\Member::loggedIn()->language()->addToStack('bandwidth_use'), 'number', 'ROUND((SUM(dsize)/1024),2)', FALSE );
$activeTabContents = ( \IPS\Request::i()->isAjax() and isset( \IPS\Request::i()->_graph ) ) ? (string) $bandwidthChart : \IPS\Theme::i()->getTemplate( 'stats' )->graphs( (string) $bandwidthChart );
break;
}
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('member_downloads_chart', FALSE, array( 'sprintf' => array( $member->name ) ) );
if( \IPS\Request::i()->isAjax() )
@@ -2,9 +2,9 @@
/**
* @brief Top Submitters
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 17 Dec 2013
* @version SVN_VERSION_NUMBER
@@ -77,7 +77,20 @@ class _submitters extends \IPS\Dispatcher\Controller
$page = 1;
}
$select = \IPS\Db::i()->select( 'file_submitter, COUNT(*) as files, core_members.*', 'downloads_files', $where, 'files DESC', array( ( $page - 1 ) * static::PER_PAGE, static::PER_PAGE ), 'file_submitter', NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS )->join( 'core_members', 'core_members.member_id=downloads_files.file_submitter' );
$select = \IPS\Db::i()->select( 'file_submitter, COUNT(*) as files', 'downloads_files', $where, 'files DESC', array( ( $page - 1 ) * static::PER_PAGE, static::PER_PAGE ), 'file_submitter', NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS )->join( 'core_members', 'core_members.member_id=downloads_files.file_submitter' );
$mids = array();
foreach( $select as $row )
{
$mids[] = $row['file_submitter'];
}
$members = array();
if ( count( $mids ) )
{
$members = iterator_to_array( \IPS\Db::i()->select( '*', 'core_members', array( \IPS\Db::i()->in( 'member_id', $mids ) ) )->setKeyField('member_id') );
}
$pagination = \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination(
\IPS\Http\Url::internal( 'app=downloads&module=stats&controller=submitters' )->setQueryString( $values ),
@@ -96,7 +109,7 @@ class _submitters extends \IPS\Dispatcher\Controller
)
);
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('stats')->submittersTable( $select, $pagination );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate('stats')->submittersTable( $select, $pagination, $members );
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('menu__downloads_stats_submitters');
}
}
@@ -2,9 +2,9 @@
/**
* @brief Browse Files Controller
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 08 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -89,10 +89,17 @@ class _browse extends \IPS\Dispatcher\Controller
*/
protected function _category( $category )
{
$_count = \IPS\downloads\File::getItemsWithPermission( array( array( \IPS\downloads\File::$databasePrefix . \IPS\downloads\File::$databaseColumnMap['container'] . '=?', $category->_id ) ), NULL, 1, 'read', NULL, 0, NULL, FALSE, FALSE, FALSE, TRUE );
$_count = \IPS\downloads\File::getItemsWithPermission( array( array( \IPS\downloads\File::$databasePrefix . \IPS\downloads\File::$databaseColumnMap['container'] . '=?', $category->_id ) ), NULL, 1, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, FALSE, FALSE, FALSE, TRUE );
if( !$_count )
{
/* Set breadcrumb */
foreach ( $category->parents() as $parent )
{
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
}
\IPS\Output::i()->breadcrumb[] = array( NULL, $category->_title );
/* Show a 'no files' template if there's nothing to display */
$table = \IPS\Theme::i()->getTemplate( 'browse' )->noFiles( $category );
}
@@ -101,6 +108,12 @@ class _browse extends \IPS\Dispatcher\Controller
/* Build table */
$table = new \IPS\Helpers\Table\Content( 'IPS\downloads\File', $category->url(), NULL, $category );
$table->classes = array( 'ipsDataList_large' );
$table->sortOptions = array_merge( $table->sortOptions, array( 'file_downloads' => 'file_downloads' ) );
if ( $table->sortBy === 'file_name' )
{
$table->sortDirection = 'asc';
}
if ( \IPS\Application::appIsEnabled( 'nexus' ) and \IPS\Settings::i()->idm_nexus_on )
{
@@ -119,7 +132,7 @@ class _browse extends \IPS\Dispatcher\Controller
/* Output */
\IPS\Output::i()->title = $category->_title;
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( 'category' ) ) ) ) ] = array( 'type' => 'downloads_file', 'nodes' => $category->_id );
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item_downloads_categories' ) ] = array( 'type' => 'downloads_file', 'nodes' => $category->_id );
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate( 'browse' )->indexSidebar( \IPS\downloads\Category::canOnAny('add'), $category );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->category( $category, (string) $table );
}
@@ -2,9 +2,9 @@
/**
* @brief Submit File Controller
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 08 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -49,7 +49,7 @@ class _submit extends \IPS\Dispatcher\Controller
{
$form = new \IPS\Helpers\Form( 'select_category', 'continue' );
$form->class = 'ipsForm_vertical ipsForm_noLabels';
$form->add( new \IPS\Helpers\Form\Node( 'category', isset( $data['category'] ) ? $data['category'] : NULL, TRUE, array(
$form->add( new \IPS\Helpers\Form\Node( 'select_category', isset( \IPS\Request::i()->category ) ? \IPS\Request::i()->category : NULL, TRUE, array(
'url' => \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=submit', 'front', 'downloads_submit' ),
'class' => 'IPS\downloads\Category',
'permissionCheck' => 'add',
@@ -62,7 +62,7 @@ class _submit extends \IPS\Dispatcher\Controller
if ( $values = $form->values() )
{
$url = \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=submit&do=submit', 'front', 'downloads_submit' )->setQueryString( 'category', $values['category']->_id );
$url = \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=submit&do=submit', 'front', 'downloads_submit' )->setQueryString( 'category', $values['select_category']->_id );
if ( isset( $values['bulk'] ) AND $values['bulk'] )
{
$url = $url->setQueryString( 'bulk', '1' );
@@ -168,16 +168,22 @@ class _submit extends \IPS\Dispatcher\Controller
if ( $category->bitoptions['allowss'] )
{
$image = TRUE;
if ( $category->maxdims )
{
$maxDims = explode( 'x', $category->maxdims );
$image = array( 'maxWidth' => $maxDims[0], 'maxHeight' => $maxDims[1] );
}
$form->add( new \IPS\Helpers\Form\Upload( 'screenshots', $screenshots, ( $category->bitoptions['reqss'] and !\IPS\Member::loggedIn()->group['idm_linked_files'] ), array(
'storageExtension' => 'downloads_Screenshots',
'image' => $category->maxssdims ? explode( 'x', $category->maxssdims ) : TRUE,
'image' => $image,
'maxFileSize' => $category->maxss ? ( $category->maxss / 1024 ) : NULL,
'multiple' => TRUE,
'template' => "downloads.submit.screenshot",
) ) );
if ( \IPS\Member::loggedIn()->group['idm_linked_files'] )
{
$form->add( new \IPS\Helpers\Form\Stack( 'url_screenshots', isset( $data['url_screenshots'] ) ? $data['url_screenshots'] : array(), FALSE, array( 'stackFieldType' => 'Url' ), array( 'IPS\downloads\File', 'blacklistCheck' ) ) );
$form->add( new \IPS\downloads\Form\LinkedScreenshots( 'url_screenshots', isset( $data['url_screenshots'] ) ? array( 'values' => $data['url_screenshots'] ) : array(), FALSE, array( 'stackFieldType' => 'Url' ), array( 'IPS\downloads\File', 'blacklistCheck' ) ) );
}
}
@@ -192,7 +198,7 @@ class _submit extends \IPS\Dispatcher\Controller
}
if ( $values = $form->values() )
{
{
/* Check */
if ( empty( $values['files'] ) and empty( $values['url_files'] ) and empty( $values['import_files'] ) )
{
@@ -298,7 +304,7 @@ class _submit extends \IPS\Dispatcher\Controller
'record_location' => (string) $file,
'record_thumb' => (string) $file->thumbnail( 'downloads_Screenshots' ),
'record_realname' => $file->originalFilename,
'record_size' => \strlen( $file->contents() ),
'record_size' => $file->filesize(),
'record_time' => time(),
'record_no_watermark' => $noWatermark,
'record_default' => ( \IPS\Request::i()->screenshots_primary_screenshot AND \IPS\Request::i()->screenshots_primary_screenshot == $_key ) ? 1 : 0
@@ -309,7 +315,7 @@ class _submit extends \IPS\Dispatcher\Controller
}
if ( isset( $values['url_screenshots'] ) )
{
foreach ( $values['url_screenshots'] as $url )
foreach ( $values['url_screenshots'] as $_key => $url )
{
$linkedScreenshots[] = (string) $url;
if ( !isset( $existing[ (string) $url ] ) )
@@ -322,6 +328,7 @@ class _submit extends \IPS\Dispatcher\Controller
'record_realname' => NULL,
'record_size' => 0,
'record_time' => time(),
'record_default' => ( \IPS\Request::i()->screenshots_primary_screenshot AND \IPS\Request::i()->screenshots_primary_screenshot == $_key ) ? 1 : 0
) );
}
unset( $existing[ (string) $url ] );
@@ -486,7 +493,7 @@ class _submit extends \IPS\Dispatcher\Controller
'record_location' => (string) $file,
'record_thumb' => (string) $file->thumbnail( 'downloads_Screenshots' ),
'record_realname' => $file->originalFilename,
'record_size' => \strlen( $file->contents() ),
'record_size' => $file->filesize(),
'record_time' => time(),
'record_no_watermark' => $noWatermark
) );
@@ -2,9 +2,9 @@
/**
* @brief View File Controller
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Downloads
* @since 10 Oct 2013
* @version SVN_VERSION_NUMBER
@@ -40,6 +40,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.
@see https://invisionpower.com/4bugtrack/archived-reports/4092-cant-download-files-when-files-disallowed-to-view-by-any-group-r6975/ */
if ( !$this->file->canView( \IPS\Member::loggedIn() ) and \IPS\Request::i()->do != 'download' )
{
\IPS\Output::i()->error( $this->file->container()->message('npv') ?: 'node_error', '2D161/2', 403, '' );
@@ -84,7 +86,12 @@ 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 );
$previousVersions = iterator_to_array( \IPS\Db::i()->select( '*', 'downloads_filebackup', array( "b_fileid=?", $this->file->id ), 'b_backup DESC' )->setKeyField( 'b_id' ) );
$versionWhere = array( array( "b_fileid=?", $this->file->id ) );
if ( !\IPS\downloads\File::canViewHiddenItems( NULL, $this->file->container() ) )
{
$versionWhere[] = array( 'b_hidden=0' );
}
$previousVersions = iterator_to_array( \IPS\Db::i()->select( '*', 'downloads_filebackup', $versionWhere, 'b_backup DESC' )->setKeyField( 'b_id' ) );
if ( isset( \IPS\Request::i()->changelog ) and isset( $previousVersions[ \IPS\Request::i()->changelog ] ) )
{
$versionData = $previousVersions[ \IPS\Request::i()->changelog ];
@@ -172,6 +179,10 @@ class _view extends \IPS\Content\Controller
/* Create the item */
$price = $this->file->price();
if ( !$price )
{
\IPS\Output::i()->error( 'file_no_price_for_currency', '1D161/H', 403, '' );
}
$item = new \IPS\downloads\extensions\nexus\Item\File( $this->file->name, $price );
$item->id = $this->file->id;
try
@@ -186,13 +197,14 @@ class _view extends \IPS\Content\Controller
$item->renewalTerm = $this->file->renewalTerm();
$item->payTo = $this->file->author();
$item->commission = \IPS\Settings::i()->idm_nexus_percent;
if ( $fees = json_decode( \IPS\Settings::i()->idm_nexus_transfee, TRUE ) )
if ( $fees = json_decode( \IPS\Settings::i()->idm_nexus_transfee, TRUE ) and isset( $fees[ $price->currency ] ) )
{
$item->fee = new \IPS\nexus\Money( $fees[ $price->currency ]['amount'], $price->currency );
}
/* Generate the invoice */
$invoice = new \IPS\nexus\Invoice;
$invoice->currency = ( isset( $_SESSION['currency'] ) and in_array( $_SESSION['currency'], \IPS\nexus\Money::currencies() ) ) ? $_SESSION['currency'] : \IPS\nexus\Customer::loggedIn()->defaultCurrency();
$invoice->member = \IPS\nexus\Customer::loggedIn();
$invoice->addItem( $item );
$invoice->return_uri = "app=downloads&module=downloads&controller=view&id={$this->file->id}";
@@ -324,19 +336,17 @@ class _view extends \IPS\Content\Controller
}
/* Log */
if ( $category->log !== 0 )
$_log = true;
if( isset( $_SERVER['HTTP_RANGE'] ) )
{
$_log = true;
if( isset( $_SERVER['HTTP_RANGE'] ) )
if( !\IPS\Http\Ranges::isStartOfFile() )
{
if( !\IPS\Http\Ranges::isStartOfFile() )
{
$_log = false;
}
$_log = false;
}
if( $_log )
}
if( $_log )
{
if ( $category->log !== 0 )
{
\IPS\Db::i()->insert( 'downloads_downloads', array(
'dfid' => $this->file->id,
@@ -348,10 +358,10 @@ class _view extends \IPS\Content\Controller
'dbrowsers' => \IPS\Session::i()->userAgent->useragentKey,
'dos' => ''
) );
$this->file->downloads++;
$this->file->save();
}
$this->file->downloads++;
$this->file->save();
}
if ( \IPS\Application::appIsEnabled( 'nexus' ) and \IPS\Settings::i()->idm_nexus_on and ( $this->file->cost or $this->file->nexus ) )
{
@@ -391,7 +401,7 @@ class _view extends \IPS\Content\Controller
\IPS\Output::i()->error( 'downloads_no_file', '3D161/G', 404, '' );
}
/* Log session */
$downloadSessionId = md5( uniqid( microtime(), true ) );
$downloadSessionId = \IPS\Login::generateRandomString();
\IPS\Db::i()->insert( 'downloads_sessions', array(
'dsess_id' => $downloadSessionId,
'dsess_mid' => (int) \IPS\Member::loggedIn()->member_id,
@@ -402,6 +412,12 @@ class _view extends \IPS\Content\Controller
register_shutdown_function( function() use( $downloadSessionId ) {
\IPS\Db::i()->delete( 'downloads_sessions', array( 'dsess_id=?', $downloadSessionId ) );
} );
/* If it's an AWS file just redirect to it */
if ( $file instanceof \IPS\File\Amazon )
{
\IPS\Output::i()->redirect( $file->generateTemporaryDownloadUrl() );
}
/* Print the file, honoring ranges */
$ranges = new \IPS\Http\Ranges( $file, (int) \IPS\Member::loggedIn()->group['idm_throttling'] );
@@ -428,6 +444,8 @@ class _view extends \IPS\Content\Controller
{
\IPS\Output::i()->error( 'no_module_permission', '2D161/5', 403, '' );
}
\IPS\Session::i()->csrfCheck();
/* Load the desired version */
try
@@ -503,6 +521,8 @@ class _view extends \IPS\Content\Controller
{
\IPS\Output::i()->error( 'no_module_permission', '2D161/8', 403, '' );
}
\IPS\Session::i()->csrfCheck();
/* Load the desired version */
try
@@ -536,6 +556,11 @@ class _view extends \IPS\Content\Controller
{
\IPS\Output::i()->error( 'no_module_permission', '2D161/9', 403, '' );
}
\IPS\Session::i()->csrfCheck();
/* Make sure the user confirmed the deletion */
\IPS\Request::i()->confirmedDelete();
/* Load the desired version */
try
@@ -546,9 +571,26 @@ class _view extends \IPS\Content\Controller
{
\IPS\Output::i()->error( 'node_error', '2D161/A', 404, '' );
}
/* Base file iterator */
$fileIterator = function( $recordType, $storageExtension ) use( $version )
{
return new \IPS\File\Iterator(
\IPS\Db::i()->select(
'record_location', 'downloads_files_records', array(
array( 'record_type=?', $recordType ),
\IPS\Db::i()->in( 'record_id', explode( ',', $version['b_records'] ) ),
array( 'record_location NOT IN (?)', \IPS\Db::i()->select(
'record_location', 'downloads_files_records', array( 'record_type=?', $recordType ), NULL,
NULL, 'record_location', 'COUNT(*) > 1'
) )
)
), $storageExtension
);
};
/* Delete */
foreach ( new \IPS\File\Iterator( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( array( 'record_type=?', 'upload' ), \IPS\Db::i()->in( 'record_id', explode( ',', $version['b_records'] ) ) ) ), 'downloads_Files' ) as $file )
foreach ( $fileIterator( 'upload', 'downloads_Files' ) as $file )
{
try
{
@@ -556,7 +598,8 @@ class _view extends \IPS\Content\Controller
}
catch ( \Exception $e ) { }
}
foreach ( new \IPS\File\Iterator( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( array( 'record_type=?', 'ssupload' ), \IPS\Db::i()->in( 'record_id', explode( ',', $version['b_records'] ) ) ) ), 'downloads_Screenshots' ) as $file )
foreach ( $fileIterator( 'ssupload', 'downloads_Screenshots' ) as $file )
{
try
{
@@ -624,7 +667,7 @@ class _view extends \IPS\Content\Controller
}
$form->add( new \IPS\Helpers\Form\Text( 'file_version', $this->file->version, ( $category->versioning !== 0 ), array( 'maxLength' => 32 ) ) );
$form->add( new \IPS\Helpers\Form\Editor( 'file_changelog', $this->file->changelog, FALSE, array( 'app' => 'downloads', 'key' => 'Downloads', 'autoSaveKey' => "downloads-{$this->file->id}-changelog", 'attachIds' => array( $this->file->id ) ) ) );
$form->add( new \IPS\Helpers\Form\Editor( 'file_changelog', $this->file->changelog, FALSE, array( 'app' => 'downloads', 'key' => 'Downloads', 'autoSaveKey' => "downloads-{$this->file->id}-changelog") ) );
$form->addHeader( 'upload_files' );
$form->add( new \IPS\Helpers\Form\Upload( 'files', iterator_to_array( $this->file->files( NULL, FALSE ) ), ( !\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' => TRUE, 'retainDeleted' => TRUE ) ) );
@@ -670,7 +713,12 @@ class _view extends \IPS\Content\Controller
if ( \IPS\Member::loggedIn()->group['idm_linked_files'] )
{
$form->add( new \IPS\Helpers\Form\Stack( 'url_screenshots', iterator_to_array( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=0', $this->file->id, 'sslink' ) ) ), FALSE, array( 'stackFieldType' => 'Url' ), array( 'IPS\downloads\File', 'blacklistCheck' ) ) );
//iterator_to_array( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=0', $this->file->id, 'sslink' ) ) )
//
$form->add( new \IPS\downloads\Form\LinkedScreenshots( 'url_screenshots', array(
'values' => iterator_to_array( \IPS\Db::i()->select( 'record_id, record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=0', $this->file->id, 'sslink' ) )->setKeyField('record_id')->setValueField('record_location') ),
'default' => $this->file->_primary_screenshot
), FALSE, array( 'IPS\downloads\File', 'blacklistCheck' ) ) );
}
}
@@ -679,7 +727,7 @@ class _view extends \IPS\Content\Controller
/* Handle submissions */
if ( $values = $form->values() )
{
{
/* Check */
if ( empty( $values['files'] ) and empty( $values['url_files'] ) and empty( $values['import_files'] ) )
{
@@ -701,51 +749,14 @@ class _view extends \IPS\Content\Controller
$existingScreenshotLinks = array();
if ( $category->versioning !== 0 and ( !\IPS\Member::loggedIn()->group['idm_bypass_revision'] or $values['file_save_revision'] ) )
{
/* Move the old details into a backup record */
\IPS\Db::i()->insert( 'downloads_filebackup', array(
'b_fileid' => $this->file->id,
'b_filetitle' => $this->file->name,
'b_filedesc' => $this->file->desc,
'b_hidden' => FALSE,
'b_backup' => $this->file->updated,
'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', $this->file->id ) ) ) ),
'b_version' => $this->file->version,
'b_changelog' => $this->file->changelog,
) );
/* Set the old records to be backups */
\IPS\Db::i()->update( 'downloads_files_records', array( 'record_backup' => TRUE ), array( 'record_file_id=? AND record_backup=0', $this->file->id ) );
/* Delete any old versions we no longer keep */
if ( $category->versioning !== NULL )
{
$count = \IPS\Db::i()->select( 'COUNT(*)', 'downloads_filebackup', array( 'b_fileid=?', $this->file->id ) )->first();
if ( ( $count - $category->versioning + 1 ) > 0 )
{
foreach ( \IPS\Db::i()->select( '*', 'downloads_filebackup', array( 'b_fileid=?', $this->file->id ), 'b_backup ASC', $count - $category->versioning + 1 ) as $backUp )
{
foreach ( \IPS\Db::i()->select( '*', 'downloads_files_records', \IPS\Db::i()->in( 'record_id', explode( ',', $backUp['b_records'] ) ) ) as $k => $file )
{
try
{
$file = \IPS\File::get( $file['record_type'] == 'upload' ? 'downloads_Files' : 'downloads_Screenshots', $file['record_location'] )->delete();
}
catch ( \Exception $e ) { }
}
\IPS\Db::i()->delete( 'downloads_files_records', \IPS\Db::i()->in( 'record_id', explode( ',', $backUp['b_records'] ) ) );
\IPS\Db::i()->delete( 'downloads_filebackup', array( 'b_id=?', $backUp['b_id'] ) );
}
}
}
$this->file->saveVersion();
}
else
{
$existingRecords = array_unique( iterator_to_array( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=?', $this->file->id, 'upload' ) ) ) );
$existingScreenshots = array_unique( iterator_to_array( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=?', $this->file->id, 'ssupload' ) ) ) );
$existingLinks = array_unique( iterator_to_array( \IPS\Db::i()->select( 'record_id, record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=?', $this->file->id, 'link' ) )->setKeyField('record_id')->setValueField('record_location') ) );
$existingScreenshotLinks = array_unique( iterator_to_array( \IPS\Db::i()->select( 'record_id, record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=?', $this->file->id, 'sslink' ) )->setKeyField('record_id')->setValueField('record_location') ) );
$existingRecords = array_unique( iterator_to_array( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=?', $this->file->id, 'upload', 0 ) ) ) );
$existingScreenshots = array_unique( iterator_to_array( \IPS\Db::i()->select( 'record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=?', $this->file->id, 'ssupload', 0 ) ) ) );
$existingLinks = array_unique( iterator_to_array( \IPS\Db::i()->select( 'record_id, record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=?', $this->file->id, 'link', 0 ) )->setKeyField('record_id')->setValueField('record_location') ) );
$existingScreenshotLinks = array_unique( iterator_to_array( \IPS\Db::i()->select( 'record_id, record_location', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=?', $this->file->id, 'sslink', 0 ) )->setKeyField('record_id')->setValueField('record_location') ) );
}
/* Insert the new records */
@@ -831,6 +842,10 @@ class _view extends \IPS\Content\Controller
$key = array_search( (string) $file, $existingScreenshots );
if ( $key !== FALSE )
{
\IPS\Db::i()->update( 'downloads_files_records', array(
'record_default' => ( \IPS\Request::i()->screenshots_primary_screenshot AND \IPS\Request::i()->screenshots_primary_screenshot == $_key ) ? 1 : 0
), array( 'record_id=?', $_key ) );
unset( $existingScreenshots[ $key ] );
}
else
@@ -866,11 +881,14 @@ class _view extends \IPS\Content\Controller
if ( isset( $values['url_screenshots'] ) )
{
foreach ( $values['url_screenshots'] as $url )
foreach ( $values['url_screenshots'] as $_key => $url )
{
$key = array_search( (string) $file, $existingScreenshotLinks );
if ( $key !== FALSE )
{
\IPS\Db::i()->update( 'downloads_files_records', array(
'record_default' => ( \IPS\Request::i()->screenshots_primary_screenshot AND \IPS\Request::i()->screenshots_primary_screenshot == $_key ) ? 1 : 0
), array( 'record_id=?', $_key ) );
unset( $existingScreenshotLinks[ $key ] );
}
else
@@ -882,6 +900,7 @@ class _view extends \IPS\Content\Controller
'record_realname' => NULL,
'record_size' => 0,
'record_time' => time(),
'record_default' => ( \IPS\Request::i()->screenshots_primary_screenshot AND \IPS\Request::i()->screenshots_primary_screenshot == $_key ) ? 1 : 0
) );
}
}
@@ -925,7 +944,7 @@ class _view extends \IPS\Content\Controller
/* Work out the new primary screenshot */
try
{
$this->file->primary_screenshot = \IPS\Db::i()->select( 'record_id', 'downloads_files_records', array( 'record_file_id=? AND record_type=? AND record_backup=0', $this->file->id, 'ssupload' ), 'record_default DESC, record_id ASC' )->first();
$this->file->primary_screenshot = \IPS\Db::i()->select( 'record_id', 'downloads_files_records', array( 'record_file_id=? AND ( record_type=? OR record_type=? ) AND record_backup=0', $this->file->id, 'ssupload', 'sslink' ), 'record_default DESC, record_id ASC' )->first();
}
catch ( \UnderflowException $e ) { }
@@ -945,6 +964,8 @@ class _view extends \IPS\Content\Controller
$this->file->sendUpdateNotifications();
}
$this->file->processAfterNewVersion( $values );
/* Boink */
\IPS\Output::i()->redirect( $this->file->url() );
}