Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -45,15 +45,21 @@ class _settings extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$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, FALSE, array( 'class' => '\IPS\nexus\Tax', 'zeroVal' => 'do_not_tax' ), NULL, NULL, NULL, 'idm_nexus_tax' ) );
|
||||
$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', explode( ',', \IPS\Settings::i()->idm_nexus_gateways ), FALSE, array( 'class' => '\IPS\nexus\Gateway', 'zeroVal' => 'no_restriction', 'multiple' => TRUE ), NULL, NULL, NULL, 'idm_nexus_gateways' ) );
|
||||
$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' ) ) ) );
|
||||
}
|
||||
|
||||
if ( $values = $form->values( TRUE ) )
|
||||
{
|
||||
/* We can't store '' for idm_nexus_display as it will fall back to the default */
|
||||
if ( ! $values['idm_nexus_display'] )
|
||||
{
|
||||
$values['idm_nexus_display'] = 'none';
|
||||
}
|
||||
|
||||
$form->saveAsSettings( $values );
|
||||
|
||||
/* Clear guest page caches */
|
||||
|
||||
@@ -50,7 +50,7 @@ class _downloaders extends \IPS\Dispatcher\Controller
|
||||
if ( isset( \IPS\Request::i()->form ) )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'form', 'go' );
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( 'stats_date_range' ) );
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( 'stats_date_range' ), NULL, FALSE, array( 'start' => array( 'max' => new \IPS\DateTime() ), 'end' => array( 'max' => new \IPS\DateTime() ) ));
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
|
||||
@@ -88,6 +88,7 @@ class _member extends \IPS\Dispatcher\Controller
|
||||
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' ) );
|
||||
$downloadsChart->where[] = array( 'dmid=?', $member->member_id );
|
||||
$downloadsChart->availableTypes = array( 'LineChart', 'ColumnChart', 'BarChart', 'Table' );
|
||||
$downloadsChart->tableParsers = array(
|
||||
'dfid' => function( $val )
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ class _submitters extends \IPS\Dispatcher\Controller
|
||||
if ( isset( \IPS\Request::i()->form ) )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'form', 'go' );
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( 'stats_date_range' ) );
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( 'stats_date_range' ), NULL, FALSE, array( 'start' => array( 'max' => new \IPS\DateTime() ), 'end' => array( 'max' => new \IPS\DateTime() ) ) );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ class _browse extends \IPS\Dispatcher\Controller
|
||||
/* Get stuff */
|
||||
$featured = iterator_to_array( \IPS\downloads\File::featured( 4, '_rand' ) );
|
||||
$new = \IPS\downloads\File::getItemsWithPermission( array(), NULL, 14 );
|
||||
$highestRated = \IPS\downloads\File::getItemsWithPermission( array( array( 'file_rating > ?', 0 ) ), 'file_rating DESC', 14 );
|
||||
$highestRated = \IPS\downloads\File::getItemsWithPermission( array( array( 'file_rating > ?', 0 ) ), 'file_rating DESC, file_reviews DESC', 14 );
|
||||
$mostDownloaded = \IPS\downloads\File::getItemsWithPermission( array( array( 'file_downloads > ?', 0 ) ), 'file_downloads DESC', 14 );
|
||||
|
||||
/* Online User Location */
|
||||
@@ -91,7 +91,7 @@ class _browse extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$_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 );
|
||||
|
||||
if( !$_count['cnt'] )
|
||||
if( !$_count )
|
||||
{
|
||||
/* Show a 'no files' template if there's nothing to display */
|
||||
$table = \IPS\Theme::i()->getTemplate( 'browse' )->noFiles( $category );
|
||||
@@ -109,7 +109,7 @@ class _browse extends \IPS\Dispatcher\Controller
|
||||
'file_paid' => "( file_cost<>'' OR file_nexus>0 )",
|
||||
);
|
||||
}
|
||||
$table->title = \IPS\Member::loggedIn()->language()->pluralize( \IPS\Member::loggedIn()->language()->get('download_file_count'), array( $_count['cnt'] ) );
|
||||
$table->title = \IPS\Member::loggedIn()->language()->pluralize( \IPS\Member::loggedIn()->language()->get('download_file_count'), array( $_count ) );
|
||||
}
|
||||
|
||||
/* Online User Location */
|
||||
|
||||
@@ -416,6 +416,22 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
$input->options['autoSaveKey'] .= $key;
|
||||
}
|
||||
|
||||
if ( isset( $input->options['toggles'] ) )
|
||||
{
|
||||
foreach ( $input->options['toggles'] as $trigger => $toggles )
|
||||
{
|
||||
foreach ( $toggles as $k => $v )
|
||||
{
|
||||
$input->options['toggles'][ $trigger ][ $k ] = "{$v}_{$key}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $input->htmlId )
|
||||
{
|
||||
$input->htmlId = "{$input->htmlId}_{$key}";
|
||||
}
|
||||
|
||||
$form->add( $input );
|
||||
}
|
||||
@@ -501,13 +517,15 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
foreach ( $data['files'] as $key => $fileUrl )
|
||||
{
|
||||
/* $values isn't going to work as is here */
|
||||
$save = array(
|
||||
'file_title' => $values["filedata_{$key}_file_title"],
|
||||
'file_desc' => $values["filedata_{$key}_file_desc"],
|
||||
'file_tags' => $values["filedata_{$key}_file_tags"],
|
||||
'file_version' => $values["filedata_{$key}_file_version"],
|
||||
'postKey' => md5( "{$data['postKey']}-{$key}" )
|
||||
);
|
||||
$save = array( 'postKey' => md5( "{$data['postKey']}-{$key}" ) );
|
||||
$len = mb_strlen( "filedata_{$key}_" );
|
||||
foreach ( $values as $k => $v )
|
||||
{
|
||||
if ( mb_substr( $k, 0, $len ) == "filedata_{$key}_" )
|
||||
{
|
||||
$save[ mb_substr( $k, $len ) ] = $v;
|
||||
}
|
||||
}
|
||||
\IPS\downloads\File::createFromForm( $save, $category, FALSE );
|
||||
}
|
||||
|
||||
|
||||
@@ -406,6 +406,13 @@ class _view extends \IPS\Content\Controller
|
||||
/* Print the file, honoring ranges */
|
||||
$ranges = new \IPS\Http\Ranges( $file, (int) \IPS\Member::loggedIn()->group['idm_throttling'] );
|
||||
|
||||
/* If using PHP-FPM, close the request so that __destruct tasks are run after data is flushed to the browser
|
||||
@see http://www.php.net/manual/en/function.fastcgi-finish-request.php */
|
||||
if( function_exists( 'fastcgi_finish_request' ) )
|
||||
{
|
||||
fastcgi_finish_request();
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -669,7 +676,6 @@ class _view extends \IPS\Content\Controller
|
||||
|
||||
/* Output */
|
||||
\IPS\Output::i()->title = $this->file->name;
|
||||
\IPS\Output::i()->breadcrumb[] = array( $this->file->url(), $this->file->name );
|
||||
|
||||
/* Handle submissions */
|
||||
if ( $values = $form->values() )
|
||||
@@ -953,6 +959,7 @@ class _view extends \IPS\Content\Controller
|
||||
\IPS\Output::i()->breadcrumb[] = array( $category->url(), $category->_title );
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
\IPS\Output::i()->breadcrumb[] = array( $this->file->url(), $this->file->name );
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'submit' )->newVersion( $form, $category->versioning !== 0 );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user