Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -423,9 +423,21 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
|
||||
{
|
||||
$class = static::$contentModel;
|
||||
$item = $class::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
if ( !$item->canEdit() and !\IPS\Request::i()->form_submitted ) // We check if the form has been submitted to prevent the user loosing their content
|
||||
|
||||
// We check if the form has been submitted to prevent the user loosing their content
|
||||
if ( isset( \IPS\Request::i()->form_submitted ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
if ( ! $item->couldEdit() )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! $item->canEdit() )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
}
|
||||
|
||||
$container = NULL;
|
||||
@@ -639,12 +651,23 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$item = $class::loadAndCheckPerms( \IPS\Request::i()->id );
|
||||
if ( !$item->canEditTitle() )
|
||||
{
|
||||
throw new \DomainException;
|
||||
throw new \RuntimeException;
|
||||
}
|
||||
|
||||
$oldTitle = $item->mapped( 'title' );
|
||||
|
||||
$titleField = $item::$databaseColumnMap['title'];
|
||||
|
||||
$maxLength = \IPS\Settings::i()->max_title_length ?: 255;
|
||||
$titleField = $item::$databaseColumnMap['title'];
|
||||
|
||||
if( \strlen( \IPS\Request::i()->newTitle ) > $maxLength )
|
||||
{
|
||||
throw new \LengthException( \IPS\Member::loggedIn()->language()->addToStack( 'form_maxlength', FALSE, array( 'pluralize' => array( $maxLength ) ) ) );
|
||||
}
|
||||
elseif( !trim( \IPS\Request::i()->newTitle ) )
|
||||
{
|
||||
throw new \InvalidArgumentException('form_required');
|
||||
}
|
||||
|
||||
$item->$titleField = \IPS\Request::i()->newTitle;
|
||||
$idField = $item::$databaseColumnId;
|
||||
$item->save();
|
||||
@@ -680,6 +703,10 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
|
||||
|
||||
\IPS\Output::i()->json( 'OK' );
|
||||
}
|
||||
catch( \LogicException $e )
|
||||
{
|
||||
\IPS\Output::i()->error( $e->getMessage(), '2S136/1M', 403, '' );
|
||||
}
|
||||
catch ( \Exception $e )
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2S136/11', 404, '' );
|
||||
@@ -2020,6 +2047,11 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
|
||||
$url = $url->setQueryString( 'showDeleted', 1 );
|
||||
}
|
||||
|
||||
if ( isset( \IPS\Request::i()->_report ) )
|
||||
{
|
||||
$url = $url->setQueryString( '_report', \IPS\Request::i()->_report );
|
||||
}
|
||||
|
||||
/* And redirect */
|
||||
\IPS\Output::i()->redirect( $url->setFragment( $fragment . '-' . $comment->$idColumn ) );
|
||||
}
|
||||
@@ -2333,6 +2365,7 @@ class _Controller extends \IPS\Helpers\CoverPhoto\Controller
|
||||
if ( $item->container() )
|
||||
{
|
||||
$item->container()->setLastComment();
|
||||
$this->container()->setLastReview();
|
||||
$item->container()->save();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user