Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Submit
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Blog
|
||||
* @since 10 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog\modules\front\blogs;
|
||||
@@ -24,6 +23,10 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
*/
|
||||
class _submit extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* @brief This blog
|
||||
*/
|
||||
protected $blog = NULL;
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
@@ -31,7 +34,15 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
\IPS\blog\Entry::canCreate( \IPS\Member::loggedIn(), NULL, TRUE );
|
||||
if ( isset( \IPS\Request::i()->id ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->blog = \IPS\blog\Blog::load( \IPS\Request::i()->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e ) {}
|
||||
}
|
||||
\IPS\blog\Entry::canCreate( \IPS\Member::loggedIn(), $this->blog, TRUE );
|
||||
|
||||
parent::execute();
|
||||
}
|
||||
@@ -48,17 +59,33 @@ class _submit extends \IPS\Dispatcher\Controller
|
||||
/* Load Blog */
|
||||
try
|
||||
{
|
||||
/* Can we add to this Blog? */
|
||||
$blog = \IPS\blog\Blog::load( \IPS\Request::i()->id );
|
||||
\IPS\blog\Entry::canCreate( \IPS\Member::loggedIn(), $blog, TRUE );
|
||||
/* Can we add to this Blog? We load the blog in execute, so emulate an OutOfRangeException here if we don't actually have one. */
|
||||
if ( $this->blog === NULL )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
|
||||
$form = \IPS\blog\Entry::create( $blog );
|
||||
\IPS\blog\Entry::canCreate( \IPS\Member::loggedIn(), $this->blog, TRUE );
|
||||
|
||||
$form = \IPS\blog\Entry::create( $this->blog );
|
||||
$formTemplate = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'submit', 'blog' ) ), 'submitFormTemplate' ) );
|
||||
|
||||
\IPS\Session::i()->setLocation( $blog->url(), array(), 'loc_blog_adding_entry', $blog->member_id ? array( $blog->_title => FALSE ) : array( "blogs_blog_{$blog->id}" => TRUE ) );
|
||||
\IPS\Output::i()->breadcrumb[] = array( $blog->url(), $blog->_title );
|
||||
\IPS\Output::i()->sidebar['enabled'] = FALSE;
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'submit' )->submit( $formTemplate );
|
||||
if ( $club = $this->blog->club() )
|
||||
{
|
||||
\IPS\core\FrontNavigation::$clubTabActive = TRUE;
|
||||
\IPS\Output::i()->breadcrumb = array();
|
||||
\IPS\Output::i()->breadcrumb[] = array( \IPS\Http\Url::internal( 'app=core&module=clubs&controller=directory', 'front', 'clubs_list' ), \IPS\Member::loggedIn()->language()->addToStack('module__core_clubs') );
|
||||
\IPS\Output::i()->breadcrumb[] = array( $club->url(), $club->name );
|
||||
|
||||
if ( \IPS\Settings::i()->clubs_header == 'sidebar' )
|
||||
{
|
||||
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate( 'clubs', 'core' )->header( $club, $this->blog, 'sidebar' );
|
||||
}
|
||||
}
|
||||
\IPS\Output::i()->breadcrumb[] = array( $this->blog->url(), $this->blog->_title );
|
||||
|
||||
\IPS\Session::i()->setLocation( $this->blog->url(), array(), 'loc_blog_adding_entry', $this->blog->member_id ? array( $this->blog->_title => FALSE ) : array( "blogs_blog_{$this->blog->id}" => TRUE ) );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'submit' )->submit( $formTemplate, $this->blog );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user