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

@@ -12,7 +12,7 @@
namespace IPS\nexus\extensions\core\EditorLocations;
/* 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;
@@ -74,14 +74,20 @@ class _Admin
case 'pkg-pg':
$customer = \IPS\nexus\Customer::load( $member->member_id );
if ( count( \IPS\nexus\extensions\nexus\Item\Package::getPurchases( $customer, $id1, FALSE ) ) )
if ( \count( \IPS\nexus\extensions\nexus\Item\Package::getPurchases( $customer, $id1, FALSE ) ) )
{
$options = array( 'type' => 'attach', 'id' => $attachment['attach_id'], 'name' => $attachment['attach_file'] );
if ( isset( $_SERVER['HTTP_REFERER'] ) )
if ( \IPS\Request::i()->referrer() )
{
try
{
$purchase = \IPS\nexus\Purchase::loadFromUrl( \IPS\Http\Url\Friendly::createFromString( $_SERVER['HTTP_REFERER'] ) );
$purchase = \IPS\nexus\Purchase::loadFromUrl( \IPS\Request::i()->referrer() );
if( !$purchase->can( 'view', $member ) )
{
throw new \LogicException;
}
$options['ps_id'] = $purchase->id;
$options['ps_name'] = $purchase->name;
}
@@ -158,23 +164,22 @@ class _Admin
}
/**
* @brief Store image proxy status ( true = enabled )
* @brief Use the cached image URL instead of the original URL
*/
protected $_imageProxyStatus = null;
protected $proxyUrl = FALSE;
/**
* Rebuild content to add or remove image proxy
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @param bool $status Enable/Disable Image Proxy
* @param bool $proxyUrl Use the cached image URL instead of the original URL
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
public function rebuildImageProxy( $offset, $max, $status=TRUE )
public function rebuildImageProxy( $offset, $max, $proxyUrl = FALSE )
{
$this->_imageProxyStatus = $status;
$this->proxyUrl = $proxyUrl;
return $this->performRebuild( $offset, $max, 'parseImageProxy' );
}
@@ -191,6 +196,27 @@ class _Admin
return $this->performRebuild( $offset, $max, array( 'IPS\Text\LegacyParser', 'parseStatic' ) );
}
/**
* @brief Store lazy loading status ( true = enabled )
*/
protected $_lazyLoadStatus = null;
/**
* Rebuild content to add or remove lazy loading
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @param bool $status Enable/Disable lazy loading
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
public function rebuildLazyLoad( $offset, $max, $status=TRUE )
{
$this->_lazyLoadStatus = $status;
return $this->performRebuild( $offset, $max, 'parseLazyLoad' );
}
/**
* Perform rebuild - abstracted as the call for rebuildContent() and rebuildAttachmentImages() is nearly identical
*
@@ -211,11 +237,15 @@ class _Admin
{
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $word['word_custom'], $this->_imageProxyStatus );
$rebuilt = \IPS\Text\Parser::removeImageProxy( $word['word_custom'], $this->proxyUrl );
}
elseif( $callback == 'parseLazyLoad' )
{
$rebuilt = \IPS\Text\Parser::parseLazyLoad( $word['word_custom'], $this->_lazyLoadStatus );
}
else
{
$rebuilt = call_user_func( $callback, $word['word_custom'] );
$rebuilt = $callback( $word['word_custom'] );
}
}
catch( \InvalidArgumentException $e )
@@ -243,11 +273,15 @@ class _Admin
{
if( $callback == 'parseImageProxy' )
{
$newMessage = \IPS\Text\Parser::parseImageProxy( \IPS\Settings::i()->$k, $this->_imageProxyStatus );
$newMessage = \IPS\Text\Parser::removeImageProxy( \IPS\Settings::i()->$k );
}
elseif( $callback == 'parseLazyLoad' )
{
$newMessage = \IPS\Text\Parser::parseLazyLoad( \IPS\Settings::i()->$k, $this->_lazyLoadStatus );
}
else
{
$newMessage = call_user_func( $callback, \IPS\Settings::i()->$k );
$newMessage = $callback( \IPS\Settings::i()->$k );
}
}
catch( \InvalidArgumentException $e )
@@ -281,11 +315,15 @@ class _Admin
{
if( $callback == 'parseImageProxy' )
{
$rebuild = \IPS\Text\Parser::parseImageProxy( $package['p_page'], $this->_imageProxyStatus );
$rebuilt = \IPS\Text\Parser::removeImageProxy( $package['p_page'] );
}
elseif( $callback == 'parseLazyLoad' )
{
$rebuilt = \IPS\Text\Parser::parseLazyLoad( $package['p_page'], $this->_lazyLoadStatus );
}
else
{
$rebuilt = call_user_func( $callback, $package['p_page'], NULL, FALSE, 'nexus_Admin', $package['p_id'], NULL, 'pkg-pg' );
$rebuilt = $callback( $package['p_page'], NULL, FALSE, 'nexus_Admin', $package['p_id'], NULL, 'pkg-pg' );
}
}
catch( \InvalidArgumentException $e )
@@ -12,7 +12,7 @@
namespace IPS\nexus\extensions\core\EditorLocations;
/* 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;
@@ -118,26 +118,46 @@ class _Customer
}
/**
* @brief Store image proxy status ( true = enabled )
* @brief Use the cached image URL instead of the original URL
*/
protected $_imageProxyStatus = null;
protected $proxyUrl = FALSE;
/**
* Rebuild content to add or remove image proxy
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @param bool $status Enable/Disable Image Proxy
* @param bool $proxyUrl Use the cached image URL instead of the original URL
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
public function rebuildImageProxy( $offset, $max, $status=TRUE )
public function rebuildImageProxy( $offset, $max, $proxyUrl = FALSE )
{
$this->_imageProxyStatus = $status;
$this->proxyUrl = $proxyUrl;
return $this->performRebuild( $offset, $max, 'parseImageProxy' );
}
/**
* @brief Store lazy loading status ( true = enabled )
*/
protected $_lazyLoadStatus = null;
/**
* Rebuild content to add or remove lazy loading
*
* @param int|null $offset Offset to start from
* @param int|null $max Maximum to parse
* @param bool $status Enable/Disable lazy loading
* @return int Number completed
* @note This method is optional and will only be called if it exists
*/
public function rebuildLazyLoad( $offset, $max, $status=TRUE )
{
$this->_lazyLoadStatus = $status;
return $this->performRebuild( $offset, $max, 'parseLazyLoad' );
}
/**
* Perform rebuild - abstracted as the call for rebuildContent() and rebuildAttachmentImages() is nearly identical
*
@@ -158,7 +178,7 @@ class _Customer
$editorFields[] = 'field_' . $field['f_id'];
}
if( !count( $editorFields ) )
if( !\count( $editorFields ) )
{
return $did;
}
@@ -177,11 +197,15 @@ class _Customer
{
if( $callback == 'parseImageProxy' )
{
$rebuilt = \IPS\Text\Parser::parseImageProxy( $member[ $fieldId ], $this->_imageProxyStatus );
$rebuilt = \IPS\Text\Parser::removeImageProxy( $member[ $fieldId ], $this->proxyUrl );
}
elseif( $callback == 'parseLazyLoad' )
{
$rebuilt = \IPS\Text\Parser::parseLazyLoad( $member[ $fieldId ], $this->_lazyLoadStatus );
}
else
{
$rebuilt = call_user_func( $callback, $member[ $fieldId ], \IPS\Member::load( $member['member_id'] ) );
$rebuilt = $callback( $member[ $fieldId ], \IPS\Member::load( $member['member_id'] ) );
}
}
catch( \InvalidArgumentException $e )
@@ -202,7 +226,7 @@ class _Customer
}
}
if( count( $toUpdate ) )
if( \count( $toUpdate ) )
{
\IPS\Db::i()->update( 'nexus_customers', $toUpdate, array( 'member_id=?', $member['member_id'] ) );
}
@@ -226,7 +250,7 @@ class _Customer
$editorFields[] = 'field_' . $field['f_id'];
}
if( !count( $editorFields ) )
if( !\count( $editorFields ) )
{
return 0;
}
@@ -12,7 +12,7 @@
namespace IPS\nexus\extensions\core\EditorLocations;
/* 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;
@@ -72,7 +72,7 @@ class _Purchases
/* If it's in an invoice, we can check that */
if ( mb_substr( $id3, 0, 7 ) == 'invoice' )
{
return \IPS\nexus\Invoice::load( intval( mb_substr( $id3, 7 ) ) )->canView( $member );
return \IPS\nexus\Invoice::load( \intval( mb_substr( $id3, 7 ) ) )->canView( $member );
}
/* If it's in an purchase, we can link to that */
@@ -110,7 +110,7 @@ class _Purchases
/* If it's in an invoice, we can link to that */
if ( mb_substr( $id3, 0, 8 ) == 'invoice-' )
{
$invoice = \IPS\nexus\Invoice::load( intval( mb_substr( $id3, 8 ) ) );
$invoice = \IPS\nexus\Invoice::load( \intval( mb_substr( $id3, 8 ) ) );
return \IPS\Dispatcher::i()->controllerLocation == 'admin' ? $invoice->acpUrl() : $invoice->url();
}
@@ -12,7 +12,7 @@
namespace IPS\nexus\extensions\core\EditorLocations;
/* 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;
@@ -12,7 +12,7 @@
namespace IPS\nexus\extensions\core\EditorLocations;
/* 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;
@@ -34,16 +34,6 @@ class _Support
return NULL;
}
/**
* Only allow local embeds?
*
* @return bool
*/
public function embedLocalOnly()
{
return TRUE;
}
/**
* Can we use attachments in this editor?
*
@@ -102,18 +92,4 @@ class _Support
{
return \IPS\nexus\Support\Reply::load( $id2 );
}
/**
* HTMLPurifier Configuration
*
* @param \HTMLPurifier_Config $config Configuration
* @return void
*/
public function htmlPurifierConfig( \HTMLPurifier_Config $config )
{
$config->set( 'URI.Munge', \IPS\Settings::i()->base_url . 'index.php?app=core&module=system&controller=redirect&url=%s&key=%t&resource=%r' );
$config->set( 'URI.MungeResources', TRUE );
$config->set( 'URI.MungeSecretKey', \IPS\Settings::i()->site_secret_key );
}
}