Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -21,7 +21,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Status Update Model
|
||||
*/
|
||||
class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \IPS\Content\Reputation, \IPS\Content\Lockable, \IPS\Content\Hideable
|
||||
class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \IPS\Content\Reputation, \IPS\Content\Lockable, \IPS\Content\Hideable, \IPS\Content\Searchable
|
||||
{
|
||||
/* !\IPS\Patterns\ActiveRecord */
|
||||
|
||||
@@ -55,6 +55,21 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
|
||||
*/
|
||||
protected static $multitons;
|
||||
|
||||
/**
|
||||
* @brief [Content\Item] Include the ability to search this content item in global site searches
|
||||
*/
|
||||
public static $includeInSiteSearch = FALSE;
|
||||
|
||||
/**
|
||||
* Columns needed to query for search result / stream view
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public static function basicDataColumns()
|
||||
{
|
||||
return '*';
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Changed Columns
|
||||
*
|
||||
@@ -164,6 +179,16 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
|
||||
return strip_tags( $this->mapped('content') );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get container ID for search index
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function searchIndexContainer()
|
||||
{
|
||||
return $this->member_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mapped value
|
||||
*
|
||||
@@ -174,7 +199,8 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
|
||||
{
|
||||
if ( $key === 'title' )
|
||||
{
|
||||
return $this->title;
|
||||
/* We do not want the content (which is mapped to title in $databaseColumnMap) to be added into core_search_index.index_title as the field is only varchar(255) */
|
||||
return mb_substr( $this->title, 0, 85 );
|
||||
}
|
||||
|
||||
return parent::mapped( $key );
|
||||
@@ -204,20 +230,33 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Disabled at the group level? */
|
||||
if( \IPS\Member::loggedIn()->group['gbw_no_status_update'] )
|
||||
|
||||
if ( $member->pp_setting_count_comments === 0 or !\IPS\Settings::i()->profile_comments )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Or at the profile level? */
|
||||
if( \IPS\Member::loggedIn()->members_bitoptions['bw_no_status_update'] )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can a given member reply to a status update?
|
||||
*
|
||||
* @param \IPS\Member $member The member
|
||||
* @param \IPS\Node\Model|NULL $container Container
|
||||
* @param bool $showError If TRUE, rather than returning a boolean value, will display an error
|
||||
* @return bool
|
||||
*/
|
||||
public static function canCreateReply( \IPS\Member $member, \IPS\Node\Model $container=NULL, $showError=FALSE )
|
||||
{
|
||||
/* Can we access the module? */
|
||||
if ( !parent::canCreate( $member, $container, $showError ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !$member->pp_setting_count_comments or !\IPS\Settings::i()->profile_comments )
|
||||
/* We have to be logged in */
|
||||
if ( !$member->member_id )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -249,25 +288,19 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* And not restricted */
|
||||
if ( $member->members_bitoptions['bw_no_status_update'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Is the user being ignored */
|
||||
if ( $profileOwner->isIgnoring( $member, 'messages' ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Disabled at the group level? */
|
||||
if( \IPS\Member::loggedIn()->group['gbw_no_status_update'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Or at the profile level? */
|
||||
if( \IPS\Member::loggedIn()->members_bitoptions['bw_no_status_update'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !$profileOwner->pp_setting_count_comments and $member->member_id != \IPS\Request::i()->id )
|
||||
if ( $profileOwner->pp_setting_count_comments === 0 )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -375,9 +408,9 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cached URLs
|
||||
* @brief Cached URL
|
||||
*/
|
||||
protected $_url = array();
|
||||
protected $_url = NULL;
|
||||
|
||||
/**
|
||||
* Get URL
|
||||
@@ -387,32 +420,31 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
|
||||
*/
|
||||
public function url( $action=NULL )
|
||||
{
|
||||
$_key = md5( $action );
|
||||
|
||||
if( !isset( $this->_url[ $_key ] ) )
|
||||
if( $this->_url === NULL )
|
||||
{
|
||||
$member = \IPS\Member::load( $this->member_id );
|
||||
$this->_url[ $_key ] = \IPS\Http\Url::internal( "app=core&module=members&controller=profile&id={$member->member_id}&status={$this->id}&type=status", 'front', 'profile', array( $member->members_seo_name ) );
|
||||
$this->_url = \IPS\Http\Url::internal( "app=core&module=members&controller=profile&id={$member->member_id}&status={$this->id}&type=status", 'front', 'profile', array( $member->members_seo_name ) );
|
||||
}
|
||||
|
||||
if ( $action )
|
||||
$return = $this->_url;
|
||||
if ( $action )
|
||||
{
|
||||
if ( $action == 'edit' )
|
||||
{
|
||||
if ( $action == 'edit' )
|
||||
{
|
||||
$this->_url[ $_key ] = $this->_url[ $_key ]->setQueryString( 'do', 'editStatus' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_url[ $_key ] = $this->_url[ $_key ]->setQueryString( array( 'do' => $action, 'type' => 'status' ) );
|
||||
}
|
||||
$return = $return->setQueryString( 'do', 'editStatus' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = $return->setQueryString( array( 'do' => $action, 'type' => 'status' ) );
|
||||
}
|
||||
|
||||
if ( $action == 'moderate' AND \IPS\Request::i()->controller == 'feed' )
|
||||
{
|
||||
$this->_url[ $_key ] = $this->_url[ $_key ]->setQueryString( '_fromFeed', 1 );
|
||||
}
|
||||
if ( $action == 'moderate' AND \IPS\Request::i()->controller == 'feed' )
|
||||
{
|
||||
$return = $return->setQueryString( '_fromFeed', 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_url[ $_key ];
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -553,7 +585,33 @@ class _Status extends \IPS\Content\Item implements \IPS\Content\ReportCenter, \I
|
||||
*/
|
||||
public static function contentTableTemplate()
|
||||
{
|
||||
return array( \IPS\Theme::i()->getTemplate( 'profile', 'core' ), 'statusContentRows' );
|
||||
return array( \IPS\Theme::i()->getTemplate( 'statuses', 'core' ), 'statusContentRows' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML for search result display
|
||||
*
|
||||
* @param array $indexData Data from the search index
|
||||
* @param array $authorData Basic data about the author. Only includes columns returned by \IPS\Member::columnsForPhoto()
|
||||
* @param array $itemData Basic data about the item. Only includes columns returned by item::basicDataColumns()
|
||||
* @param array|NULL $containerData Basic data about the author. Only includes columns returned by container::basicDataColumns()
|
||||
* @param array $reputationData Array of people who have given reputation and the reputation they gave
|
||||
* @param int|NULL $reviewRating If this is a review, the rating
|
||||
* @param bool $iPostedIn If the user has posted in the item
|
||||
* @param string $view 'expanded' or 'condensed'
|
||||
* @param bool $asItem Displaying results as items?
|
||||
* @return string
|
||||
*/
|
||||
public static function searchResult( array $indexData, array $authorData, array $itemData, array $containerData = NULL, array $reputationData, $reviewRating, $iPostedIn, $view, $asItem )
|
||||
{
|
||||
$status = static::constructFromData( $itemData );
|
||||
$status->reputation = $reputationData;
|
||||
|
||||
$profileOwner = isset( $itemData['profile'] ) ? $itemData['profile'] : NULL;
|
||||
$profileOwnerData = $profileOwner ?: $authorData;
|
||||
$status->_url = \IPS\Http\Url::internal( "app=core&module=members&controller=profile&id={$profileOwnerData['member_id']}&status={$itemData['status_id']}&type=status", 'front', 'profile', array( $profileOwnerData['members_seo_name'] ) );
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'statuses', 'core', 'front' )->statusContainer( $status, $authorData, $profileOwner, $view == 'condensed' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user