Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* @brief Post Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Board
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 8 Jan 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -103,6 +103,11 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
|
||||
*/
|
||||
public static $hideLogKey = 'ccs-records';
|
||||
|
||||
/**
|
||||
* @brief Store generated search index titles for efficiency
|
||||
*/
|
||||
protected static $searchIndexTitles = array();
|
||||
|
||||
/**
|
||||
* Return custom where for SQL delete
|
||||
*
|
||||
@@ -113,7 +118,45 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
|
||||
{
|
||||
return array( array( static::$databasePrefix . static::$databaseColumnMap['item'] . '=?', $id ), array( static::$databasePrefix . 'database_id=?', static::$customDatabaseId ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 container. 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?
|
||||
* @param bool $canIgnoreComments Can ignore comments in the result stream? Activity stream can, but search results cannot.
|
||||
* @param array $template Optional custom template
|
||||
* @return string
|
||||
*/
|
||||
public static function searchResult( array $indexData, array $authorData, array $itemData, array $containerData = NULL, array $reputationData, $reviewRating, $iPostedIn, $view, $asItem, $canIgnoreComments=FALSE, $template=NULL )
|
||||
{
|
||||
/* Ensure that the comment title is formatted correctly */
|
||||
try
|
||||
{
|
||||
$databases = \IPS\cms\Databases::databases();
|
||||
|
||||
if ( ! isset( static::$searchIndexTitles[ $itemData['primary_id_field'] ] ) )
|
||||
{
|
||||
$fields = '\IPS\cms\Fields' . static::$customDatabaseId;
|
||||
$titleField = $databases[ static::$customDatabaseId ]->field_title;
|
||||
|
||||
static::$searchIndexTitles[ $itemData['primary_id_field'] ] = $fields::load( $databases[ static::$customDatabaseId ]->field_title )->displayValue( $itemData['field_' . $databases[ static::$customDatabaseId ]->field_title ] );
|
||||
}
|
||||
|
||||
$itemData['field_' . $databases[ static::$customDatabaseId ]->field_title ] = static::$searchIndexTitles[ $itemData['primary_id_field'] ];
|
||||
}
|
||||
catch ( \Exception $ex ) { }
|
||||
|
||||
return parent::searchResult( $indexData, $authorData, $itemData, $containerData, $reputationData, $reviewRating, $iPostedIn, $view, $asItem, $canIgnoreComments, $template );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do stuff after creating (abstracted as comments and reviews need to do different things)
|
||||
*
|
||||
@@ -164,7 +207,7 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
|
||||
* @param string|NULL $action Action
|
||||
* @return \IPS\Http\Url
|
||||
*/
|
||||
public function url( $action=NULL )
|
||||
public function url( $action='find' )
|
||||
{
|
||||
$url = parent::url( $action );
|
||||
|
||||
@@ -172,6 +215,8 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\ReportCenter
|
||||
{
|
||||
$url = $url->setQueryString( 'd', static::$customDatabaseId );
|
||||
}
|
||||
|
||||
$url = $url->setQueryString( 'tab', 'comments' );
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
/**
|
||||
* @brief Forum Post Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 8 April 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -126,7 +127,7 @@ class _CommentTopicSync extends \IPS\cms\Records\Comment
|
||||
$comment->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Edit Comment Contents - Note: does not add edit log
|
||||
*
|
||||
* @param string $newContent New content
|
||||
@@ -138,6 +139,18 @@ class _CommentTopicSync extends \IPS\cms\Records\Comment
|
||||
$comment->editContents( $newContent );
|
||||
}
|
||||
|
||||
/**
|
||||
* Report
|
||||
*
|
||||
* @param string $reportContent Report content message from member
|
||||
* @return \\IPS\core\Reports\Report
|
||||
* @throws \UnexpectedValueException If there is a permission error - you should only call this method after checking canReport
|
||||
*/
|
||||
public function report( $reportContent )
|
||||
{
|
||||
$comment = \IPS\forums\Topic\Post::load( $this->pid );
|
||||
return $comment->report( $reportContent );
|
||||
}
|
||||
|
||||
/**
|
||||
* Addition where needed for fetching comments
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,10 +2,10 @@
|
||||
/**
|
||||
* @brief Post Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @subpackage Board
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 8 Jan 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -107,17 +107,19 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\ReportCenter,
|
||||
/**
|
||||
* Create first comment (created with content item)
|
||||
*
|
||||
* @param \IPS\Content\Item $item The content item just created
|
||||
* @param string $comment The comment
|
||||
* @param bool $first Is the first comment?
|
||||
* @param int $rating The rating (1-5)
|
||||
* @param string $guestName If author is a guest, the name to use
|
||||
* @param \IPS\Member|NULL $member The author of this comment. If NULL, uses currently logged in member.
|
||||
* @param \IPS\DateTime|NULL $time The time
|
||||
* @param \IPS\Content\Item $item The content item just created
|
||||
* @param string $comment The comment
|
||||
* @param bool $first Is the first comment?
|
||||
* @param int $rating The rating (1-5)
|
||||
* @param string $guestName If author is a guest, the name to use
|
||||
* @param \IPS\Member|NULL $member The author of this comment. If NULL, uses currently logged in member.
|
||||
* @param \IPS\DateTime|NULL $time The time
|
||||
* @param string|NULL $ipAddress The IP address or NULL to detect automatically
|
||||
* @param int|NULL $hiddenStatus NULL to set automatically or override: 0 = unhidden; 1 = hidden, pending moderator approval; -1 = hidden (as if hidden by a moderator)
|
||||
* @return static
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function create( $item, $comment, $first=FALSE, $rating=NULL, $guestName=NULL, $member=NULL, \IPS\DateTime $time=NULL )
|
||||
public static function create( $item, $comment, $first=FALSE, $rating=NULL, $guestName=NULL, $member=NULL, \IPS\DateTime $time=NULL, $ipAddress=NULL, $hiddenStatus=NULL )
|
||||
{
|
||||
$review = call_user_func_array( 'parent::create', func_get_args() );
|
||||
|
||||
@@ -179,4 +181,14 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\ReportCenter,
|
||||
$commentIdColumn = static::$databaseColumnId;
|
||||
return array( $this->item()->$idColumn, $this->$commentIdColumn, static::$customDatabaseId . '-review' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Addition where needed for fetching comments
|
||||
*
|
||||
* @return array|NULL
|
||||
*/
|
||||
public static function commentWhere()
|
||||
{
|
||||
return array( 'review_database_id=?', static::$customDatabaseId );
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,10 @@
|
||||
/**
|
||||
* @brief Revisions Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage Content
|
||||
* @since 29 April 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -99,25 +100,14 @@ class _Revisions extends \IPS\Patterns\ActiveRecord
|
||||
$customFields = $fieldsClass::data( 'view' );
|
||||
$conflicts = array();
|
||||
|
||||
require_once \IPS\ROOT_PATH . "/system/3rd_party/Diff/class.Diff.php";
|
||||
|
||||
/* Build up our data set */
|
||||
foreach( $customFields as $id => $field )
|
||||
{
|
||||
$key = 'field_' . $field->id;
|
||||
|
||||
$conflicts[ $key ] = array( 'revision' => $this->get( $key ), 'record' => $record->$key, 'field' => $field, 'diff' => NULL );
|
||||
|
||||
if ( $record->$key AND $this->get( $key ) )
|
||||
if( $justChanged === FALSE OR !\IPS\Login::compareHashes( md5( $record->$key ), md5( $this->get( $key ) ) ) )
|
||||
{
|
||||
if ( md5( $record->$key ) != md5( $this->get( $key ) ) )
|
||||
{
|
||||
$conflicts[ $key ]['diff'] = \Diff::toTable( \Diff::compare( $this->get( $key ), $record->$key ) );
|
||||
}
|
||||
else if ( $justChanged !== FALSE )
|
||||
{
|
||||
unset( $conflicts[ $key ] );
|
||||
}
|
||||
$conflicts[ md5( uniqid() ) ] = array( 'original' => $this->get( $key ), 'current' => $record->$key, 'field' => $field );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user