Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -41,12 +41,14 @@ class _settings extends \IPS\Dispatcher\Controller
|
||||
|
||||
if ( $values = $form->values( TRUE ) )
|
||||
{
|
||||
$this->_saveSettingsForm( $form, $values );
|
||||
$this->_saveSettingsForm( $form, $values, $redirectMessage );
|
||||
|
||||
/* Clear guest page caches */
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
|
||||
\IPS\Session::i()->log( 'acplogs__downloads_settings' );
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=settings' ), $redirectMessage );
|
||||
|
||||
}
|
||||
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('settings');
|
||||
@@ -99,6 +101,13 @@ class _settings extends \IPS\Dispatcher\Controller
|
||||
$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 ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'idm_default_view', \IPS\Settings::i()->idm_default_view, FALSE, array(
|
||||
'options' => array(
|
||||
'table' => 'downloads_default_view_table',
|
||||
'grid' => 'downloads_default_view_grid',
|
||||
),
|
||||
) ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'idm_default_view_choose', \IPS\Settings::i()->idm_default_view_choose ) );
|
||||
|
||||
if ( \IPS\Application::appIsEnabled( 'nexus' ) )
|
||||
{
|
||||
@@ -120,8 +129,9 @@ class _settings extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form The Form Object
|
||||
* @param array $values Values
|
||||
* @param string $redirectMessage Message to show on redirect
|
||||
*/
|
||||
protected function _saveSettingsForm( \IPS\Helpers\Form $form, array $values )
|
||||
protected function _saveSettingsForm( \IPS\Helpers\Form $form, array $values, ?string &$redirectMessage )
|
||||
{
|
||||
/* We can't store '' for idm_nexus_display as it will fall back to the default */
|
||||
if ( \IPS\Application::appIsEnabled( 'nexus' ) and !$values['idm_nexus_display'] )
|
||||
@@ -141,11 +151,11 @@ class _settings extends \IPS\Dispatcher\Controller
|
||||
\IPS\Db::i()->delete( 'core_queue', array( '`app`=? OR `key`=?', 'downloads', 'RebuildScreenshotWatermarks' ) );
|
||||
|
||||
\IPS\Task::queue( 'downloads', 'RebuildScreenshotWatermarks', array( ), 5 );
|
||||
\IPS\Output::i()->inlineMessage = \IPS\Member::loggedIn()->language()->addToStack('download_settings_saved_rebuilding');
|
||||
$redirectMessage = 'download_settings_saved_rebuilding';
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->inlineMessage = \IPS\Member::loggedIn()->language()->addToStack('saved');
|
||||
$redirectMessage ='saved';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,4 +258,24 @@ class _browse extends \IPS\Dispatcher\Controller
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=downloads&module=downloads&controller=browse&do=categories', 'front', 'downloads_categories' ), \IPS\Member::loggedIn()->language()->addToStack('download_categories') );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'browse' )->categories();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the viewing method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setMethod()
|
||||
{
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
$method = ( isset( \IPS\Request::i()->method ) ) ? \IPS\Request::i()->method : \IPS\Settings::i()->idm_default_view;
|
||||
|
||||
\IPS\Request::i()->setCookie( 'idm_category_view', $method, ( new \IPS\DateTime )->add( new \DateInterval( 'P1Y' ) ) );
|
||||
|
||||
if ( \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
\IPS\Db::i()->replace( 'downloads_view_method', array( 'member_id' => \IPS\Member::loggedIn()->member_id, 'method' => $method ) );
|
||||
}
|
||||
\IPS\Output::i()->redirect( \IPS\downloads\Category::load( \IPS\Request::i()->id )->url() );
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class _pending extends \IPS\Content\Controller
|
||||
/**
|
||||
* [Content\Controller] Class
|
||||
*/
|
||||
protected static $contentModel = 'IPS\downloads\File\PendingVersion';
|
||||
protected static $contentModel = \IPS\downloads\File\PendingVersion::class;
|
||||
|
||||
/**
|
||||
* @brief Storage for loaded file
|
||||
@@ -55,7 +55,7 @@ class _pending extends \IPS\Content\Controller
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
|
||||
if ( !$this->version->canUnhide() )
|
||||
if ( !$this->version->canUnhide() AND !$this->version->canDelete())
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2D417/1', 404, '' );
|
||||
}
|
||||
@@ -167,4 +167,23 @@ class _pending extends \IPS\Content\Controller
|
||||
|
||||
return parent::moderate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to allow pending version approval for authors
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function delete()
|
||||
{
|
||||
if( !$this->version->canDelete())
|
||||
{
|
||||
\IPS\Output::i()->error( 'file_version_pending_cannot_delete', '2D417/4', 403, '' ); //TODO error code
|
||||
}
|
||||
/* Make sure the user confirmed the deletion */
|
||||
\IPS\Request::i()->confirmedDelete();
|
||||
|
||||
$this->version->delete();
|
||||
\IPS\Session::i()->modLog( 'modlog__action_deletedpending', array( (string) $this->file->url() => FALSE, $this->file->name => FALSE ), $this->file );
|
||||
\IPS\Output::i()->redirect( $this->file->url() , 'deleted');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user