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

+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 );