Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -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