Version 4.7.8

This commit is contained in:
Neo committed 2025-12-19 16:10:42 -08:00
1 parent 7b7404e741
commit fd22d99e69
688 files changed
+19814 -10890

No files matched your search

@@ -248,10 +248,21 @@ class _ContentPromotion extends \IPS\core\Achievements\Actions\AbstractContentAc
break;
case 'core_social_promote':
$promote = \IPS\core\Promote::load( $row['promote_id'] );
$promote->object()->author()->achievementAction( 'core', 'ContentPromotion', [
if( method_exists( $promote->object(), 'author' ) )
{
$promote->object()->author()->achievementAction( 'core', 'ContentPromotion', [
'content' => $promote->object(),
'promotype' => 'promote'
] );
] );
}
else if( method_exists( $promote->object(), 'owner' ) )
{
$promote->object()->owner()->achievementAction( 'core', 'ContentPromotion', [
'content' => $promote->object(),
'promotype' => 'promote'
] );
}
break;
}
}
@@ -337,10 +337,7 @@ class _Zapier
$apiKey->save();
}
}
catch ( \OutOfRangeException $e )
{
}
catch ( \OutOfRangeException $e ) {}
}
}
}
@@ -220,7 +220,7 @@ class _GroupSettings
$form->add( new \IPS\Helpers\Form\WidthHeight( 'g_sig_max_image_size', array( $signatureLimits[2] ?: '', $signatureLimits[3] ?: '' ), FALSE, array( 'unlimited' => array( '', '' ) ), NULL, NULL, NULL, 'g_sig_max_image_size' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_sig_max_urls', ( $signatureLimits[4] OR (int) $signatureLimits[4] === 0 ) ? $signatureLimits[4] : '', FALSE, array( 'unlimited' => '' ), NULL, NULL, NULL, 'g_sig_max_urls' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_sig_max_lines', ( $signatureLimits[5] OR (int) $signatureLimits[5] === 0 ) ? $signatureLimits[5] : '', FALSE, array( 'unlimited' => '' ), NULL, NULL, NULL, 'g_sig_max_lines' ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_sig_max_lines', $signatureLimits[5] ?? '', FALSE, array( 'unlimited' => '', 'min' => 1 ), NULL, NULL, NULL, 'g_sig_max_lines' ) );
}
}
@@ -91,6 +91,8 @@ class _Social
{
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_paid_clubs', $group->g_id ? ( $group->g_bitoptions['gbw_paid_clubs'] ) : FALSE ) );
}
$form->add( new \IPS\Helpers\Form\YesNo( 'gbw_club_manage_indexing', $group->g_id ? ( $group->g_bitoptions['gbw_club_manage_indexing'] ) : FALSE ) );
$form->add( new \IPS\Helpers\Form\Number( 'g_club_limit', $group->g_club_limit ?: -1, FALSE, array( 'unlimited' => -1 ) ) );
@@ -185,7 +187,7 @@ class _Social
$group->g_create_clubs = implode( ',', $values['g_create_clubs'] );
$group->g_club_allowed_nodes = ( \count( $values['g_club_allowed_nodes'] ) === \count( \IPS\Member\Club::availableNodeTypes() ) ) ? '*' : implode( ',', $values['g_club_allowed_nodes'] );
$group->g_club_limit = $values['g_club_limit'] == -1 ? NULL : $values['g_club_limit'];
$bwKeys[] = 'gbw_club_manage_indexing';
if ( \IPS\Application::appIsEnabled( 'nexus' ) and \IPS\Settings::i()->clubs_paid_on )
{
$bwKeys[] = 'gbw_paid_clubs';
@@ -219,4 +221,4 @@ class _Social
}
}
}
}
}
@@ -112,7 +112,7 @@ class _BasicInformation extends \IPS\core\MemberACPProfile\Block
( ( $this->member->isAdmin() AND \IPS\Member::loggedIn()->hasAcpRestriction('core', 'members', 'member_edit_admin' ) ) OR \IPS\Member::loggedIn()->hasAcpRestriction( 'core', 'members', 'member_edit' ) )
)
{
$enabled = $this->member->datalayer_collect_pii;
$enabled = !$this->member->members_bitoptions['datalayer_pii_optout'];
$accountActions[] = array(
'title' => $enabled ? 'datalayer_omit_member_pii' : 'datalayer_collect_member_pii',
'icon' => 'id-card',
@@ -46,7 +46,7 @@ class _GraphQl
if( isset( $response['data']))
{
return "'" . json_encode($response['data'] ) . "'";
return "'" . json_encode($response['data'], JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS ) . "'";
}
}
}
@@ -353,7 +353,7 @@ class _Core
break;
case 'signature':
if ( !static::completedSignature( static::$_member ) )
if ( !static::completedSignature( static::$_member ) AND static::$_member->canEditSignature() )
{
$include['signature'] = $step;
}
@@ -0,0 +1,247 @@
<?php
/**
* @brief Support Clubs in sitemaps
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @license https://www.invisioncommunity.com/legal/standards/
* @package Invision Community
* @since 01 Nov 2022
*/
namespace IPS\core\extensions\core\Sitemap;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Support Clubs in sitemaps
*/
class _Clubs
{
/**
* @brief Recommended Settings
*/
public $recommendedSettings = array(
'sitemap_club_include' => true,
'sitemap_club_count' => -1,
'sitemap_club_priority' => 1
);
/**
* Add settings for ACP configuration to the form
*
* @return array
*/
public function settings(): array
{
$settings = \IPS\Settings::i()->sitemap_club_settings ? json_decode( \IPS\Settings::i()->sitemap_club_settings, TRUE ) : array();
$return = array();
$countToInclude = $settings["sitemap_club_count"] ?? $this->recommendedSettings["sitemap_club_count"];
$return["sitemap_club_include"] = new \IPS\Helpers\Form\YesNo( "sitemap_club_include", $countToInclude != 0, FALSE, array( 'togglesOn' => array( "sitemap_club_count", "sitemap_club_priority" ) ), NULL, NULL, NULL, "sitemap_club_include" );
$return["sitemap_club_include"]->label = \IPS\Member::loggedIn()->language()->addToStack( 'sitemap_include_generic_desc' );
$return["sitemap_club_count"] = new \IPS\Helpers\Form\Number( "sitemap_club_count", $countToInclude, FALSE, array( 'min' => '-1', 'unlimited' => '-1' ), NULL, NULL, NULL, "sitemap_club_count" );
$return["sitemap_club_count"]->label = \IPS\Member::loggedIn()->language()->addToStack( 'sitemap_number_generic' );
$return["sitemap_club_priority"] = new \IPS\Helpers\Form\Select( "sitemap_club_priority", $settings["sitemap_club_priority"] ?? $this->recommendedSettings["sitemap_club_priority"], FALSE, array( 'options' => \IPS\Sitemap::$priorities, 'unlimited' => '-1', 'unlimitedLang' => 'sitemap_dont_include' ), NULL, NULL, NULL, "sitemap_club_priority" );
$return["sitemap_club_priority"]->label = \IPS\Member::loggedIn()->language()->addToStack( 'sitemap_priority_generic' );
return $return;
}
/**
* Save settings for ACP configuration
*
* @param array $values Values
* @return void
*/
public function saveSettings( array $values )
{
if ( $values['sitemap_configuration_info'] )
{
// Store default values for any settings you define
\IPS\Settings::i()->changeValues( array( 'sitemap_club_settings' => json_encode( array() ) ) );
}
else
{
// Store the actual submitted value for any settings you define, from the $values array
$settings = \IPS\Settings::i()->sitemap_club_settings ? json_decode( \IPS\Settings::i()->sitemap_club_settings, TRUE ) : array();
$settings['sitemap_club_count'] = $values['sitemap_club_include'] ? $values['sitemap_club_count'] : 0;
$settings['sitemap_club_priority'] = $values['sitemap_club_priority'];
\IPS\Settings::i()->changeValues( array( 'sitemap_club_settings' => json_encode( $settings ) ) );
}
}
/**
* Get the sitemap filename(s)
*
* @return array
*/
public function getFilenames(): array
{
$settings = \IPS\Settings::i()->sitemap_club_settings ? json_decode( \IPS\Settings::i()->sitemap_club_settings, TRUE ) : array();
$limit = $settings['sitemap_club_count'] ?? -1;
if( $limit == 0 )
{
return array();
}
$visibleClubs = iterator_to_array(
\IPS\Db::i()->select( 'id', 'core_clubs', array( '`type` != ? and approved=?', \IPS\Member\Club::TYPE_PRIVATE, 1 ) )
);
$count = \count( $visibleClubs );
$files = array();
$count = ceil( $count / \IPS\SITEMAP_MAX_PER_FILE );
for( $i=1; $i <= $count; $i++ )
{
$files[] = 'sitemap_clubs_' . $i;
}
/* Skip if we have no visible clubs */
foreach( $visibleClubs as $clubId )
{
$pagesCount = (int)\IPS\Db::i()->select( 'count(page_id)', 'core_club_pages', array( 'page_club=? and page_meta_index=?', $clubId, 1 ) )->first();
$pagesCount = ceil( $pagesCount / \IPS\SITEMAP_MAX_PER_FILE );
for( $i=1; $i <= $pagesCount; $i++ )
{
$files[] = $clubId . '_sitemap_clubs_pages_' . $i;
}
}
return $files;
}
/**
* Generate the sitemap
*
* @param string $filename The sitemap file to build (should be one returned from getFilenames())
* @param \IPS\Sitemap $sitemap Sitemap object reference
* @return mixed
*/
public function generateSitemap( string $filename, \IPS\Sitemap $sitemap ): mixed
{
$entries = array();
$lastId = 0;
$settings = \IPS\Settings::i()->sitemap_club_settings ? json_decode( \IPS\Settings::i()->sitemap_club_settings, TRUE ) : array();
$exploded = explode( '_', $filename );
$block = (int) array_pop( $exploded );
$totalLimit = $settings["sitemap_club_count"] ?? -1;
$offset = ( $block - 1 ) * \IPS\SITEMAP_MAX_PER_FILE;
$limit = \IPS\SITEMAP_MAX_PER_FILE;
if ( ! $totalLimit )
{
return NULL;
}
if ( $totalLimit > -1 and ( $offset + $limit ) > $totalLimit )
{
$limit = $totalLimit - $offset;
}
/* Create limit clause */
$limitClause = array( $offset, $limit );
if( \strpos( $filename, '_pages_' ) !== false )
{
$tmp = explode( '_', $filename );
$clubId = \intval( array_shift( $tmp ) );
$where = array(
array( 'page_club=?', $clubId ),
array( 'page_meta_index=?', 1 )
);
try
{
$lastId = \IPS\Db::i()->select( 'last_id', 'core_sitemap', array( array( 'sitemap=?', implode( '_', $exploded ) . '_' . ( $block - 1 ) ) ) )->first();
if( $lastId > 0 )
{
$where[] = array( 'id > ?', $lastId );
$limitClause = $limit;
}
}
catch( \UnderflowException $e ){}
foreach( new \IPS\Patterns\ActiveRecordIterator(
\IPS\Db::i()->select( '*', 'core_club_pages', $where, 'page_id', $limitClause ),
'IPS\Member\Club\Page'
) as $page )
{
if( !$page->canView( new \IPS\Member ) )
{
continue;
}
$data = array(
'url' => (string)$page->url()
);
$priority = $settings['sitemap_club_priority'] ?? 1;
if ( $priority !== -1 )
{
$data['priority'] = $priority;
}
$entries[] = $data;
$lastId = $page->id;
}
}
else
{
$where = array(
array( '`type` != ?', \IPS\Member\Club::TYPE_PRIVATE ),
array( 'approved=?', 1 )
);
/* Try to fetch the highest ID built in the last sitemap, if it exists */
try
{
$lastId = \IPS\Db::i()->select( 'last_id', 'core_sitemap', array( array( 'sitemap=?', implode( '_', $exploded ) . '_' . ( $block - 1 ) ) ) )->first();
if( $lastId > 0 )
{
$where[] = array( 'id > ?', $lastId );
$limitClause = $limit;
}
}
catch( \UnderflowException $e ){}
foreach( new \IPS\Patterns\ActiveRecordIterator(
\IPS\Db::i()->select( '*', 'core_clubs', $where, 'id', $limitClause ),
'IPS\Member\Club'
) as $club )
{
if( !$club->canView( new \IPS\Member ) )
{
continue;
}
$data = array(
'url' => $club->url(),
'lastmod' => $club->last_activity
);
$priority = $settings['sitemap_club_priority'] ?? 1;
if ( $priority !== -1 )
{
$data['priority'] = $priority;
}
$entries[] = $data;
$lastId = $club->id;
}
}
$sitemap->buildSitemapFile( $filename, $entries, $lastId );
return $lastId;
}
}
@@ -194,7 +194,7 @@ class _Content extends \IPS\Content\ExtensionGenerator
/* Choose which count to use to calculate the number of filess */
$usedCount = ( $requestedCount > $contentItems OR $requestedCount <= 0 ) ? $contentItems : $requestedCount;
$count = ceil( $usedCount / \IPS\Sitemap::MAX_PER_FILE );
$count = ceil( $usedCount / \IPS\SITEMAP_MAX_PER_FILE );
for( $i=1; $i <= $count; $i++ )
{
$files[] = 'sitemap_content_' . str_replace( '\\', '_', mb_substr( $class, 4 ) ) . '_' . $i;
@@ -255,8 +255,8 @@ class _Content extends \IPS\Content\ExtensionGenerator
$exploded = explode( '_', $filename );
$block = (int) array_pop( $exploded );
$totalLimit = ( isset( $settings["sitemap_{$class::$title}_count"] ) AND $settings["sitemap_{$class::$title}_count"] ) ? $settings["sitemap_{$class::$title}_count"] : self::RECOMMENDED_ITEM_LIMIT;
$offset = ( $block - 1 ) * \IPS\Sitemap::MAX_PER_FILE;
$limit = \IPS\Sitemap::MAX_PER_FILE;
$offset = ( $block - 1 ) * \IPS\SITEMAP_MAX_PER_FILE;
$limit = \IPS\SITEMAP_MAX_PER_FILE;
if ( ! $totalLimit )
{
@@ -273,7 +273,7 @@ class _Content extends \IPS\Content\ExtensionGenerator
$where = $class::sitemapWhere();
$direction = ( $totalLimit > \IPS\Sitemap::MAX_PER_FILE ) ? 'ASC' : 'DESC';
$direction = ( $totalLimit > \IPS\SITEMAP_MAX_PER_FILE ) ? 'ASC' : 'DESC';
/* Try to fetch the highest ID built in the last sitemap, if it exists */
try