Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

@@ -253,6 +253,69 @@ class _Reply extends \IPS\Content\Comment implements \IPS\Content\Hideable
return FALSE;
}
/**
* Get comments based on some arbitrary parameters
*
* @param array $where Where clause
* @param string $order MySQL ORDER BY clause (NULL to order by date)
* @param int|array $limit Limit clause
* @param string|NULL $permissionKey A key which has a value in the permission map (either of the container or of this class) matching a column ID in core_permission_index, or NULL to ignore permissions
* @param mixed $includeHiddenComments Include hidden comments? NULL to detect if currently logged in member has permission, -1 to return public content only, TRUE to return unapproved content and FALSE to only return unapproved content the viewing member submitted
* @param int $queryFlags Select bitwise flags
* @param \IPS\Member $member The member (NULL to use currently logged in member)
* @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)
* @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', $includeHiddenComments=\IPS\Content\Hideable::FILTER_AUTOMATIC, $queryFlags=0, \IPS\Member $member=NULL, $joinContainer=FALSE, $joinComments=FALSE, $joinReviews=FALSE, $countOnly=FALSE, $joins=NULL )
{
/* Get customer object */
if ( !$member )
{
$member = \IPS\nexus\Customer::loggedIn();
}
elseif ( !( $member instanceof \IPS\nexus\Customer ) )
{
$member = \IPS\nexus\Customer::load( $member->member_id );
}
$extraClause = array( 'r_member=?', $member->member_id );
/* Work out the clause for parent alternative contacts */
$alternativeContactWhere = array();
foreach ( $member->parentContacts() as $contact )
{
if ( $contact->support )
{
$alternativeContactWhere[] = '( r_member=' . $contact->main_id->member_id . ' )';
}
else
{
$alternativeContactWhere[] = '( r_member=' . $contact->main_id->member_id . ' AND ' . \IPS\Db::i()->in( 'r_purchase', $contact->purchaseIds() ) . ' )';
}
}
if ( count( $alternativeContactWhere ) )
{
$extraClause[0] = '( ' . $extraClause[0] . ' OR ( ' . implode( ' OR ', $alternativeContactWhere ) . ' ) )';
}
/* Work out the clause for admins */
if ( ( !\IPS\Dispatcher::hasInstance() or \IPS\Dispatcher::i()->controllerLocation === 'admin' ) and $member->isAdmin() )
{
$extraClause[0] = '( ' . $extraClause[0] . " OR dpt_staff='*' OR " . \IPS\Db::i()->findInSet( 'dpt_staff', Department::staffDepartmentPerms( $member ) ) . ' )';
$joins[] = array(
'from' => 'nexus_support_departments',
'where' => 'dpt_id=r_department'
);
}
/* Do it */
$where[] = $extraClause;
return parent::getItemsWithPermission( $where, $order, $limit, $permissionKey, $includeHiddenComments, $queryFlags, $member, $joinContainer, $joinComments, $joinReviews, $countOnly, $joins );
}
/**
* Send if it's pending
*
@@ -263,6 +326,7 @@ class _Reply extends \IPS\Content\Comment implements \IPS\Content\Hideable
if ( $this->type === static::REPLY_PENDING )
{
$this->type = static::REPLY_STAFF;
$this->hidden = 0;
$this->save();
$defaultRecipients = $this->item()->getDefaultRecipients();