Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+36 -10
View File
@@ -12,7 +12,7 @@
namespace IPS\cms\Records;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -94,16 +94,39 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
*/
public static $customDatabaseId = NULL;
/**
* @brief [Content] Key for hide reasons
*/
public static $hideLogKey = 'ccs-records';
/**
* @brief Store generated search index titles for efficiency
*/
protected static $searchIndexTitles = array();
/**
* Load Record
*
* @see \IPS\Db::build
* @param int|string $id ID
* @param string $idField The database column that the $id parameter pertains to (NULL will use static::$databaseColumnId)
* @param mixed $extraWhereClause Additional where clause(s) (see \IPS\Db::build for details) - if used will cause multiton store to be skipped and a query always ran
* @return static
* @throws \InvalidArgumentException
* @throws \OutOfRangeException
*/
public static function load( $id, $idField=NULL, $extraWhereClause=NULL )
{
if ( static::commentWhere() !== NULL )
{
if( $extraWhereClause === NULL )
{
$extraWhereClause = array( static::commentWhere() );
}
else
{
$extraWhereClause[] = static::commentWhere();
}
}
return parent::load( $id, $idField, $extraWhereClause );
}
/**
* Post count for member
*
@@ -139,7 +162,9 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
* @param bool $joinContainer If true, will join container data (set to TRUE if your $where clause depends on this data)
* @param bool $joinComments If true, will join comment data (set to TRUE if your $where clause depends on this data)
* @param bool $joinReviews If true, will join review data (set to TRUE if your $where clause depends on this data)
* @return \IPS\Patterns\ActiveRecordIterator|int
* @param bool $countOnly If true will return the count
* @param array|null $joins Additional arbitrary joins for the query
* @return array|NULL|\IPS\Content\Comment If $limit is 1, will return \IPS\Content\Comment or NULL for no results. For any other number, will return an array.
*/
public static function getItemsWithPermission( $where=array(), $order=NULL, $limit=10, $permissionKey='read', $includeHiddenItems=\IPS\Content\Hideable::FILTER_AUTOMATIC, $queryFlags=0, \IPS\Member $member=NULL, $joinContainer=FALSE, $joinComments=FALSE, $joinReviews=FALSE, $countOnly=FALSE, $joins=NULL )
{
@@ -229,7 +254,8 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
{
$template = static::$commentTemplate[1];
static::$commentTemplate[0][0] = $this->item()->database()->template_display;
return call_user_func_array( array( \IPS\cms\Theme::i(), 'getTemplate' ), static::$commentTemplate[0] )->$template( $this->item(), $this );
return \IPS\cms\Theme::i()->getTemplate( static::$commentTemplate[0][0], static::$commentTemplate[0][1], static::$commentTemplate[0][2] )->$template( $this->item(), $this );
}
/**
@@ -262,7 +288,7 @@ class _Comment extends \IPS\Content\Comment implements \IPS\Content\EditHistory,
$item = $this->item();
$idColumn = $item::$databaseColumnId;
$commentIdColumn = static::$databaseColumnId;
return array( $this->item()->$idColumn, $this->$commentIdColumn, static::$customDatabaseId );
return array( $this->item()->$idColumn, $this->$commentIdColumn, static::$customDatabaseId . '-comment' );
}
/**
@@ -12,7 +12,7 @@
namespace IPS\cms\Records;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -147,7 +147,8 @@ class _CommentTopicSync extends \IPS\cms\Records\Comment
$comment = \IPS\forums\Topic\Post::load( $this->pid );
$template = static::$commentTemplate[1];
static::$commentTemplate[0][0] = $this->item()->database()->template_display;
return call_user_func_array( array( \IPS\cms\Theme::i(), 'getTemplate' ), static::$commentTemplate[0] )->$template( $comment->item(), $comment );
return \IPS\cms\Theme::i()->getTemplate( static::$commentTemplate[0][0], static::$commentTemplate[0][1], static::$commentTemplate[0][2] )->$template( $comment->item(), $comment );
}
catch( \OutOfRangeException $e )
{
File diff suppressed because it is too large. Load diff
+37 -7
View File
@@ -12,7 +12,7 @@
namespace IPS\cms\Records;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -95,11 +95,31 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
* @brief Database ID
*/
public static $customDatabaseId = NULL;
/**
* @brief [Content] Key for hide reasons
* Load Record
*
* @see \IPS\Db::build
* @param int|string $id ID
* @param string $idField The database column that the $id parameter pertains to (NULL will use static::$databaseColumnId)
* @param mixed $extraWhereClause Additional where clause(s) (see \IPS\Db::build for details) - if used will cause multiton store to be skipped and a query always ran
* @return static
* @throws \InvalidArgumentException
* @throws \OutOfRangeException
*/
public static $hideLogKey = 'ccs-records-review';
public static function load( $id, $idField=NULL, $extraWhereClause=NULL )
{
if( $extraWhereClause === NULL )
{
$extraWhereClause = array( static::commentWhere() );
}
else
{
$extraWhereClause[] = static::commentWhere();
}
return parent::load( $id, $idField, $extraWhereClause );
}
/**
* Create first comment (created with content item)
@@ -118,10 +138,16 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
*/
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() );
$review = parent::create( $item, $comment, $first, $rating, $guestName, $member, $time, $ipAddress, $hiddenStatus );
$review->database_id = static::$customDatabaseId;
$review->save();
/* Have to do these AFTER database id is set */
$ratingField = $item::$databaseColumnMap['rating'];
$review->item()->$ratingField = $review->item()->averageReviewRating() ?: 0;
$review->item()->save();
return $review;
}
@@ -145,7 +171,9 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
public function html()
{
$template = static::$commentTemplate[1];
return call_user_func_array( array( \IPS\cms\Theme::i(), 'getTemplate' ), static::$commentTemplate[0] )->$template( $this->item(), $this );
static::$commentTemplate[0][0] = $this->item()->database()->template_display;
return \IPS\cms\Theme::i()->getTemplate( static::$commentTemplate[0][0], static::$commentTemplate[0][1], static::$commentTemplate[0][2] )->$template( $this->item(), $this );
}
/**
@@ -153,8 +181,10 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
*
* @param string|NULL $action Action
* @return \IPS\Http\Url
* @throws \BadMethodCallException
* @throws \IPS\Http\Url\Exception
*/
public function url( $action=NULL )
public function url( $action='find' )
{
$url = parent::url( $action );
@@ -12,7 +12,7 @@
namespace IPS\cms\Records;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -121,7 +121,7 @@ class _Revisions extends \IPS\Patterns\ActiveRecord
*/
public function set_data( $value )
{
$this->_data['data'] = ( is_array( $value ) ? json_encode( $value ) : $value );
$this->_data['data'] = ( \is_array( $value ) ? json_encode( $value ) : $value );
}
/**