Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

+17 -19
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief Group Blogs Controller
* @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 03 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\modules\admin\blogs;
@@ -117,17 +116,17 @@ class _blogs extends \IPS\Node\Controller
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=copy&id=' ) . $row['blog_id'],
'data' => array()
),
'empty' => array(
'icon' => 'trash-o',
'title' => 'empty',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=delete&deleteNode=0&id=' ) . $row['blog_id'],
'content' => array(
'icon' => 'arrow-right',
'title' => 'mass_manage_content',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=massManageContent&id=' ) . $row['blog_id'],
'data' => array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('empty') ),
'hotkey'=> 'd'
'hotkey'=> 'm'
),
'delete' => array(
'icon' => 'times-circle',
'title' => 'delete',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=delete&deleteNode=1&id=' ) . $row['blog_id'],
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=delete&id=' ) . $row['blog_id'],
'data' => ( $blog->getContentItemCount() ) ? array( 'ipsDialog' => '', 'ipsDialog-title' => \IPS\Member::loggedIn()->language()->addToStack('delete') ) : array( 'delete' => '' ),
'hotkey'=> 'd'
)
@@ -135,18 +134,17 @@ class _blogs extends \IPS\Node\Controller
};
/* Root buttons */
$table->rootButtons = array(
'add' => array(
'icon' => 'plus',
'title' => 'add_blog',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=form' ),
'data' => array()
),
\IPS\Output::i()->sidebar['actions']['add'] = array(
'primary' => true,
'icon' => 'plus',
'title' => 'add_blog',
'link' => \IPS\Http\Url::internal( 'app=blog&module=blogs&controller=blogs&do=form' ),
'data' => array()
);
/* Display */
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('blogs');
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'title', (string) $table );
\IPS\Output::i()->output = (string) $table;
}
/**
@@ -1,13 +1,12 @@
<?php
/**
* @brief Blog Settings
* @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 03 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\modules\admin\blogs;
@@ -45,6 +44,7 @@ class _settings extends \IPS\Dispatcher\Controller
$form = new \IPS\Helpers\Form;
$form->add( new \IPS\Helpers\Form\YesNo( 'blog_enable_rating', \IPS\Settings::i()->blog_enable_rating ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'blog_enable_sidebar', \IPS\Settings::i()->blog_enable_sidebar ) );
$form->addHeader('blog_settings_rss');
$form->add( new \IPS\Helpers\Form\YesNo( 'blog_allow_rssimport', \IPS\Settings::i()->blog_allow_rssimport ) );
@@ -1,13 +1,12 @@
<?php
/**
* @brief All Blogs
* @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 03 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\modules\front\blogs;
@@ -1,13 +1,12 @@
<?php
/**
* @brief Create Blog
* @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 24 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\modules\front\blogs;
+141 -6
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief View Blog Entry Controller
* @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 03 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\modules\front\blogs;
@@ -105,8 +104,144 @@ class _entry extends \IPS\Content\Controller
/* Online User Location */
\IPS\Session::i()->setLocation( $this->entry->url(), $this->entry->onlineListPermissions(), 'loc_blog_viewing_entry', array( $this->entry->name => FALSE ) );
/* Add JSON-ld output */
\IPS\Output::i()->jsonLd['blog'] = array(
'@context' => "http://schema.org",
'@type' => "Blog",
'url' => (string) $this->entry->container()->url(),
'name' => htmlspecialchars( $this->entry->container()->_title, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'description' => strip_tags( $this->entry->container()->description ),
'commentCount' => $this->entry->container()->_comments,
'interactionStatistic' => array(
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/ViewAction",
'userInteractionCount' => $this->entry->container()->num_views
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/FollowAction",
'userInteractionCount' => \IPS\blog\Entry::containerFollowerCount( $this->entry->container() )
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/CommentAction",
'userInteractionCount' => $this->entry->container()->_comments
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/WriteAction",
'userInteractionCount' => $this->entry->container()->_items
)
),
'blogPost' => array(
'@context' => "http://schema.org",
'@type' => "BlogPosting",
'url' => (string) $this->entry->url(),
'mainEntityOfPage' => (string) $this->entry->url(),
'name' => htmlspecialchars( $this->entry->mapped('title'), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'headline' => htmlspecialchars( $this->entry->mapped('title'), ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'articleBody' => strip_tags( $this->entry->truncated() ),
'commentCount' => $this->entry->mapped('num_comments'),
'dateCreated' => \IPS\DateTime::ts( $this->entry->date )->format( \IPS\DateTime::ISO8601 ),
'datePublished' => \IPS\DateTime::ts( $this->entry->publish_date )->format( \IPS\DateTime::ISO8601 ),
'author' => array(
'@type' => 'Person',
'name' => htmlspecialchars( \IPS\Member::load( $this->entry->mapped('author') )->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'url' => (string) \IPS\Member::load( $this->entry->mapped('author') )->url(),
'image' => \IPS\Member::load( $this->entry->mapped('author') )->get_photo()
),
'publisher' => array(
'@type' => 'Organization',
'name' => htmlspecialchars( \IPS\Member::load( $this->entry->mapped('author') )->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'url' => (string) \IPS\Member::load( $this->entry->mapped('author') )->url(),
'image' => \IPS\Member::load( $this->entry->mapped('author') )->get_photo(),
'logo' => array(
'@type' => 'ImageObject',
'url' => \IPS\Member::load( $this->entry->mapped('author') )->get_photo(),
)
),
'interactionStatistic' => array(
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/ViewAction",
'userInteractionCount' => $this->entry->views
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/FollowAction",
'userInteractionCount' => \IPS\blog\Entry::containerFollowerCount( $this->entry->container() )
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/CommentAction",
'userInteractionCount' => $this->entry->mapped('num_comments')
)
)
)
);
if( $this->entry->container()->coverPhoto()->file )
{
\IPS\Output::i()->jsonLd['blog']['image'] = (string) $this->entry->container()->coverPhoto()->file->url;
}
if( $this->entry->container()->member_id )
{
\IPS\Output::i()->jsonLd['blog']['author'] = array(
'@type' => 'Person',
'name' => htmlspecialchars( \IPS\Member::load( $this->entry->container()->member_id )->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'url' => (string) \IPS\Member::load( $this->entry->container()->member_id )->url(),
'image' => \IPS\Member::load( $this->entry->container()->member_id )->get_photo()
);
}
if( $this->entry->edit_time )
{
\IPS\Output::i()->jsonLd['blog']['blogPost']['dateModified'] = \IPS\DateTime::ts( $this->entry->edit_time )->format( \IPS\DateTime::ISO8601 );
}
else
{
\IPS\Output::i()->jsonLd['blog']['blogPost']['dateModified'] = \IPS\DateTime::ts( $this->entry->publish_date ?: $this->entry->date )->format( \IPS\DateTime::ISO8601 );
}
$file = NULL;
if( $this->entry->image )
{
$file = \IPS\File::get( 'blog_Blogs', $this->entry->image );
}
elseif( $this->entry->coverPhoto()->file )
{
$file = $this->entry->coverPhoto()->file;
}
elseif( $this->entry->container()->coverPhoto()->file )
{
$file = $this->entry->container()->coverPhoto()->file;
}
if( $file !== NULL )
{
try
{
$dimensions = $file->getImageDimensions();
\IPS\Output::i()->jsonLd['blog']['blogPost']['image'] = array(
'@type' => 'ImageObject',
'url' => (string) $file->url,
'width' => $dimensions[0],
'height' => $dimensions[1]
);
}
/* File does not exist */
catch( \RuntimeException $e ) {}
}
/* Display */
if( \IPS\Settings::i()->blog_enable_sidebar and $this->entry->container()->sidebar )
{
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate('view')->blogSidebar( $this->entry->container()->sidebar );
}
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->entry( $this->entry, $previous, $next );
}
}
@@ -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 )
{
+60 -9
View File
@@ -1,13 +1,12 @@
<?php
/**
* @brief View Blog Entry Controller
* @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 03 Mar 2014
* @version SVN_VERSION_NUMBER
*/
namespace IPS\blog\modules\front\blogs;
@@ -96,6 +95,58 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
\IPS\Output::i()->rssFeeds['blog_rss_title'] = \IPS\Http\Url::internal( "app=blog&module=blogs&controller=view&id={$this->blog->_id}", 'front', 'blogs_rss', array( $this->blog->seo_name ) );
}
/* Add JSON-ld */
\IPS\Output::i()->jsonLd['blog'] = array(
'@context' => "http://schema.org",
'@type' => "Blog",
'url' => (string) $this->blog->url(),
'name' => htmlspecialchars( $this->blog->_title, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'description' => strip_tags( $this->blog->description ),
'commentCount' => $this->blog->_comments,
'interactionStatistic' => array(
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/ViewAction",
'userInteractionCount' => $this->blog->num_views
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/FollowAction",
'userInteractionCount' => \IPS\blog\Entry::containerFollowerCount( $this->blog )
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/CommentAction",
'userInteractionCount' => $this->blog->_comments
),
array(
'@type' => 'InteractionCounter',
'interactionType' => "http://schema.org/WriteAction",
'userInteractionCount' => $this->blog->_items
)
)
);
if( $this->blog->coverPhoto()->file )
{
\IPS\Output::i()->jsonLd['blog']['image'] = (string) $this->blog->coverPhoto()->file->url;
}
if( $this->blog->member_id )
{
\IPS\Output::i()->jsonLd['blog']['author'] = array(
'@type' => 'Person',
'name' => htmlspecialchars( \IPS\Member::load( $this->blog->member_id )->name, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ),
'url' => (string) \IPS\Member::load( $this->blog->member_id )->url(),
'image' => \IPS\Member::load( $this->blog->member_id )->get_photo()
);
}
if( \IPS\Settings::i()->blog_enable_sidebar and $this->blog->sidebar )
{
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate('view')->blogSidebar( $this->blog->sidebar );
}
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_browse.js', 'blog', 'front' ) );
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->view( $this->blog, (string) $table );
\IPS\Output::i()->contextualSearchOptions[ \IPS\Member::loggedIn()->language()->addToStack( 'search_contextual_item_blogs' ) ] = array( 'type' => 'blog_entry', 'nodes' => $this->blog->_id );
@@ -108,7 +159,7 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
*/
protected function editBlog()
{
if( !$this->blog->canEdit() OR $this->blog->groupblog_ids )
if( !$this->blog->canEdit() OR $this->blog->groupblog_ids or $this->blog->club_id )
{
\IPS\Output::i()->error( 'no_module_permission', '2B201/2', 403, '' );
}
@@ -116,7 +167,7 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
\IPS\Session::i()->csrfCheck();
/* Build form */
$form = new \IPS\Helpers\Form;
$form = new \IPS\Helpers\Form( 'form', 'save', $this->blog->url()->setQueryString( array( 'do' => 'editBlog' ) )->csrf() );
$form->class .= 'ipsForm_vertical';
$this->blog->form( $form, TRUE );
@@ -152,7 +203,7 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
{
\IPS\Session::i()->csrfCheck();
if( !$this->blog->canDelete() )
if( !$this->blog->canDelete() or $this->blog->club_id )
{
\IPS\Output::i()->error( 'no_module_permission', '2B201/3', 403, '' );
}
@@ -180,7 +231,7 @@ class _view extends \IPS\Helpers\CoverPhoto\Controller
\IPS\Session::i()->csrfCheck();
/* Do we have permission */
if ( ( $this->blog->pinned and !\IPS\Member::loggedIn()->modPermission('can_unpin_content') ) or ( !$this->blog->pinned and !\IPS\Member::loggedIn()->modPermission('can_pin_content') ) )
if ( ( $this->blog->pinned and !\IPS\Member::loggedIn()->modPermission('can_unpin_content') ) or ( !$this->blog->pinned and !\IPS\Member::loggedIn()->modPermission('can_pin_content') ) or $this->blog->club_id )
{
\IPS\Output::i()->error( 'no_module_permission', '2B201/4', 403, '' );
}