Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,23 +12,35 @@
|
||||
namespace IPS\blog\modules\front\blogs;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\blog\Blog;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
use IPS\Request;
|
||||
use IPS\Session;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Blog
|
||||
*/
|
||||
class _create extends \IPS\Dispatcher\Controller
|
||||
class create extends Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : void
|
||||
{
|
||||
parent::execute();
|
||||
}
|
||||
@@ -38,18 +50,18 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function manage()
|
||||
protected function manage() : void
|
||||
{
|
||||
if ( !\IPS\blog\Blog::canCreate() )
|
||||
if ( !Blog::canCreate() )
|
||||
{
|
||||
\IPS\Output::i()->error( 'no_module_permission', '2B227/1', 403, '' );
|
||||
Output::i()->error( 'no_module_permission', '2B227/1', 403, '' );
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'select_blog', 'continue' );
|
||||
$form->class = 'ipsForm_vertical';
|
||||
$form = new Form( 'select_blog', 'continue' );
|
||||
$form->class = 'ipsForm--vertical ipsForm--create-blog';
|
||||
|
||||
$blog = new \IPS\blog\Blog;
|
||||
$blog->member_id = \IPS\Member::loggedIn()->member_id;
|
||||
$blog = new Blog;
|
||||
$blog->member_id = Member::loggedIn()->member_id;
|
||||
$blog->form( $form, TRUE );
|
||||
|
||||
if ( $values = $form->values() )
|
||||
@@ -57,21 +69,21 @@ class _create extends \IPS\Dispatcher\Controller
|
||||
$blog->saveForm( $blog->formatFormValues( $values ) );
|
||||
|
||||
/* Redirect */
|
||||
\IPS\Output::i()->redirect( $blog->url() );
|
||||
Output::i()->redirect( $blog->url() );
|
||||
}
|
||||
|
||||
\IPS\Session::i()->setLocation( \IPS\Http\Url::internal( 'app=blog', 'front', 'blogs' ), array(), 'loc_blog_creating' );
|
||||
Session::i()->setLocation( Url::internal( 'app=blog', 'front', 'blogs' ), array(), 'loc_blog_creating' );
|
||||
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_view.js', 'blog', 'front' ) );
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('create_blog');
|
||||
Output::i()->jsFiles = array_merge( Output::i()->jsFiles, Output::i()->js( 'front_view.js', 'blog', 'front' ) );
|
||||
Output::i()->title = Member::loggedIn()->language()->addToStack('create_blog');
|
||||
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
if( Request::i()->isAjax() )
|
||||
{
|
||||
\IPS\Output::i()->output = $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'forms', 'core' ), 'popupTemplate' ) );
|
||||
Output::i()->output = $form->customTemplate( array( Theme::i()->getTemplate( 'forms', 'core' ), 'popupTemplate' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'submit' )->createBlog( $form );
|
||||
Output::i()->output = Theme::i()->getTemplate( 'submit' )->createBlog( $form );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user