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 Entry Model
|
||||
* @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 3 Mar 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\blog;
|
||||
@@ -33,11 +32,13 @@ class _Entry extends \IPS\Content\Item implements
|
||||
\IPS\Content\Polls,
|
||||
\IPS\Content\Ratings,
|
||||
\IPS\Content\EditHistory,
|
||||
\IPS\Content\Reputation,
|
||||
\IPS\Content\Searchable,
|
||||
\IPS\Content\Embeddable,
|
||||
\IPS\Content\FuturePublishing
|
||||
{
|
||||
\IPS\Content\FuturePublishing,
|
||||
\IPS\Content\MetaData
|
||||
{
|
||||
use \IPS\Content\Reactable;
|
||||
|
||||
/**
|
||||
* @brief Multiton Store
|
||||
*/
|
||||
@@ -91,6 +92,7 @@ class _Entry extends \IPS\Content\Item implements
|
||||
'is_future_entry' => 'is_future_entry',
|
||||
'future_date' => 'publish_date',
|
||||
'status' => 'status',
|
||||
'meta_data' => 'meta_data',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -133,11 +135,6 @@ class _Entry extends \IPS\Content\Item implements
|
||||
'reply' => 4,
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Reputation Type
|
||||
*/
|
||||
public static $reputationType = 'entry_id';
|
||||
|
||||
/**
|
||||
* @brief [Content] Key for hide reasons
|
||||
*/
|
||||
@@ -242,6 +239,15 @@ class _Entry extends \IPS\Content\Item implements
|
||||
{
|
||||
$return = TRUE;
|
||||
}
|
||||
|
||||
/* Club blog */
|
||||
if ( $club = $this->container()->club() )
|
||||
{
|
||||
if ( !$club->canRead( $member ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Private blog */
|
||||
if( $this->container()->social_group != 0 AND $this->container()->owner() != $member )
|
||||
@@ -296,10 +302,12 @@ class _Entry extends \IPS\Content\Item implements
|
||||
if ( $member->member_id )
|
||||
{
|
||||
$where[] = array( '( blog_blogs.blog_member_id=' . $member->member_id . ' OR ( ' . \IPS\Content::socialGroupGetItemsWithPermissionWhere( 'blog_blogs.blog_social_group', $member ) . ' ) OR blog_blogs.blog_social_group IS NULL )' );
|
||||
$where[] = array( '( blog_blogs.blog_club_id IS NULL OR ' . \IPS\Db::i()->in( 'blog_blogs.blog_club_id', \IPS\Member::loggedIn()->clubs() ) . ' )' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = array( "(" . \IPS\Content::socialGroupGetItemsWithPermissionWhere( 'blog_blogs.blog_social_group', $member ) . " OR blog_blogs.blog_social_group IS NULL )" );
|
||||
$where[] = array( 'blog_blogs.blog_club_id IS NULL' );
|
||||
}
|
||||
}
|
||||
return parent::getItemsWithPermission( $where, $order, $limit, $permissionKey, $includeHiddenItems, $queryFlags, $member, $joinContainer, $joinComments, $joinReviews, $countOnly, $joins, $skipPermission, $joinTags, $joinAuthor, $joinLastCommenter, $showMovedLinks );
|
||||
@@ -318,10 +326,12 @@ class _Entry extends \IPS\Content\Item implements
|
||||
if ( \IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
$where = array( array( '( blog_blogs.blog_social_group IS NULL OR blog_blogs.blog_member_id=' . \IPS\Member::loggedIn()->member_id . ' OR ( ' . \IPS\Content::socialGroupGetItemsWithPermissionWhere( 'blog_blogs.blog_social_group', \IPS\Member::loggedIn() ) . ' ) )' ) );
|
||||
$where[] = array( '( blog_blogs.blog_club_id IS NULL OR ' . \IPS\Db::i()->in( 'blog_blogs.blog_club_id', \IPS\Member::loggedIn()->clubs() ) . ' )' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where = array( \IPS\Content::socialGroupGetItemsWithPermissionWhere( 'blog_blogs.blog_social_group', \IPS\Member::loggedIn() ) );
|
||||
$where[] = array( 'blog_blogs.blog_club_id IS NULL' );
|
||||
}
|
||||
|
||||
return array_merge( parent::followWhere( $joinContainer, $joins ), $where );
|
||||
@@ -439,7 +449,12 @@ class _Entry extends \IPS\Content\Item implements
|
||||
|
||||
if ( $container )
|
||||
{
|
||||
if ( !in_array( $container->id, array_keys( $blogs ) ) )
|
||||
if ( $club = $container->club() )
|
||||
{
|
||||
$return = $club->isModerator( $member );
|
||||
$error = 'no_module_permission';
|
||||
}
|
||||
elseif ( !in_array( $container->id, array_keys( $blogs ) ) )
|
||||
{
|
||||
$return = FALSE;
|
||||
$error = 'no_module_permission';
|
||||
@@ -664,4 +679,107 @@ class _Entry extends \IPS\Content\Item implements
|
||||
'rating' => $this->averageRating(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reaction Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function reactionType()
|
||||
{
|
||||
return 'entry_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported Meta Data Types
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function supportedMetaDataTypes()
|
||||
{
|
||||
return array( 'core_FeaturedComments', 'core_ContentMessages' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Can perform an action on a message
|
||||
*
|
||||
* @param string The action
|
||||
* @param \IPS\Member|NULL The member, or NULL for currently logged in
|
||||
* @return bool
|
||||
* @todo Mod Log
|
||||
*/
|
||||
public function canOnMessage( $action, \IPS\Member $member = NULL )
|
||||
{
|
||||
$return = parent::canOnMessage( $action, $member );
|
||||
|
||||
if ( $return === FALSE )
|
||||
{
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
|
||||
if ( $member->member_id AND $member->member_id === $this->author()->member_id AND $member->group['g_blog_allowownmod'] )
|
||||
{
|
||||
$return = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can Feature a Comment
|
||||
*
|
||||
* @param \IPS\Member|NULL The member, or NULL for currently logged in
|
||||
* @return bool
|
||||
*/
|
||||
public function canFeatureComment( \IPS\Member $member = NULL )
|
||||
{
|
||||
$return = parent::canFeatureComment( $member );
|
||||
|
||||
if ( $return === FALSE )
|
||||
{
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
|
||||
if ( $member->member_id AND $member->member_id === $this->author()->member_id AND $member->group['g_blog_allowownmod'] )
|
||||
{
|
||||
$return = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can Unfeature a Comment
|
||||
*
|
||||
* @param \IPS\Member|NULL The member, or NULL for currently logged in
|
||||
* @return bool
|
||||
*/
|
||||
public function canUnfeatureComment( \IPS\Member $member = NULL )
|
||||
{
|
||||
$return = parent::canUnfeatureComment( $member );
|
||||
|
||||
if ( $return === FALSE )
|
||||
{
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
|
||||
if ( $member->member_id AND $member->member_id === $this->author()->member_id AND $member->group['g_blog_allowownmod'] )
|
||||
{
|
||||
$return = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content for embed
|
||||
*
|
||||
* @param array $params Additional parameters to add to URL
|
||||
* @return string
|
||||
*/
|
||||
public function embedContent( $params )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'blog', 'front' ) );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'blog' )->embedEntry( $this, $this->container(), $this->url()->setQueryString( $params ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user