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\FileStorage;
/* 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;
@@ -96,7 +96,7 @@ class _Ads
{
foreach ( \IPS\Db::i()->select( '*', 'core_advertisements', array( 'ad_member<>0 or ad_member IS NULL' ) ) as $ad )
{
if ( in_array( (string) $file, json_decode( $ad['ad_images'], TRUE ) ) )
if ( \in_array( (string) $file, json_decode( $ad['ad_images'], TRUE ) ) )
{
return TRUE;
}
@@ -12,7 +12,7 @@
namespace IPS\nexus\extensions\core\FileStorage;
/* 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;
@@ -35,7 +35,7 @@ class _Customer
{
$where[] = "field_{$field->id}<>''";
}
if ( !count( $where ) )
if ( !\count( $where ) )
{
return 0;
}
@@ -61,7 +61,7 @@ class _Customer
$ids[] = $field->id;
$where[] = "field_{$field->id}<>''";
}
if ( !count( $where ) )
if ( !\count( $where ) )
{
throw new \Underflowexception;
}
@@ -80,7 +80,7 @@ class _Customer
}
}
if ( count( $update ) )
if ( \count( $update ) )
{
foreach( $update as $k => $v )
{
@@ -90,7 +90,7 @@ class _Customer
}
}
if ( count( $update ) )
if ( \count( $update ) )
{
\IPS\Db::i()->update( 'nexus_customers', $update, array( 'member_id=?', $customer['member_id'] ) );
}
@@ -112,7 +112,7 @@ class _Customer
$ids[] = $field->id;
$where[] = "field_{$field->id}<>''";
}
if ( !count( $where ) )
if ( !\count( $where ) )
{
throw new \Underflowexception;
}
@@ -127,9 +127,9 @@ class _Customer
}
}
if ( count( $update ) )
if ( \count( $update ) )
{
if ( count( $update ) )
if ( \count( $update ) )
{
\IPS\Db::i()->update( 'nexus_customers', $update, array( 'member_id=?', $customer['member_id'] ) );
}
@@ -149,12 +149,12 @@ class _Customer
{
$_where[] = "field_{$field->id}=?";
}
if ( !count( $_where ) )
if ( !\count( $_where ) )
{
return FALSE;
}
$where = array_fill( 0, count( $_where ), (string) $file );
$where = array_fill( 0, \count( $_where ), (string) $file );
array_unshift( $where, implode( ' OR ', $_where ) );
return (bool) \IPS\Db::i()->select( 'COUNT(*)', 'nexus_customers', $where )->first();
@@ -174,7 +174,7 @@ class _Customer
$ids[] = $field->id;
$where[] = "field_{$field->id}<>''";
}
if ( !count( $where ) )
if ( !\count( $where ) )
{
return;
}
@@ -12,7 +12,7 @@
namespace IPS\nexus\extensions\core\FileStorage;
/* 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\FileStorage;
/* 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\FileStorage;
/* 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;
@@ -45,7 +45,7 @@ class _PurchaseFields
public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
{
$customFields = \IPS\nexus\Package\CustomField::roots( NULL, NULL, array( 'cf_type=?', 'upload' ) );
if ( count( $customFields ) )
if ( \count( $customFields ) )
{
$packages = array();
foreach ( $customFields as $field )
@@ -93,7 +93,7 @@ class _PurchaseFields
public function fixUrls( $offset )
{
$customFields = \IPS\nexus\Package\CustomField::roots( NULL, NULL, array( 'cf_type=?', 'upload' ) );
if ( count( $customFields ) )
if ( \count( $customFields ) )
{
$packages = array();
foreach ( $customFields as $field )
@@ -137,9 +137,9 @@ class _PurchaseFields
public function isValidFile( $file )
{
$customFields = \IPS\nexus\Package\CustomField::roots( NULL, NULL, array( 'cf_type=?', 'upload' ) );
if ( count( $customFields ) )
if ( \count( $customFields ) )
{
foreach ( \IPS\Db::i()->select( '*', 'nexus_purchases', array( "ps_custom_fields LIKE ?", "%" . str_replace( '\\', '\\\\', trim( json_encode( (string) $file ), '"' ) . "%" ) ) ) as $purchase )
foreach ( \IPS\Db::i()->select( '*', 'nexus_purchases', array( "ps_custom_fields LIKE ?", "%" . str_replace( '\\', '\\\\\\', trim( json_encode( (string) $file ), '"' ) . "%" ) ) ) as $purchase )
{
$fieldValues = json_decode( $purchase['ps_custom_fields'], TRUE );
foreach ( $customFields as $field )
@@ -162,7 +162,7 @@ class _PurchaseFields
public function delete()
{
$customFields = \IPS\nexus\Package\CustomField::roots( NULL, NULL, array( 'cf_type=?', 'upload' ) );
if ( count( $customFields ) )
if ( \count( $customFields ) )
{
$packages = array();
foreach ( $customFields as $field )
@@ -1,115 +0,0 @@
<?php
/**
* @brief File Storage Extension: Referral Banners
* @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
* @subpackage Nexus
* @since 18 Aug 2014
*/
namespace IPS\nexus\extensions\core\FileStorage;
/* 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;
}
/**
* File Storage Extension: Referral Banners
*/
class _ReferralBanners
{
/**
* Count stored files
*
* @return int
*/
public function count()
{
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_referral_banners', 'rb_upload=1' )->first();
}
/**
* Move stored files
*
* @param int $offset This will be sent starting with 0, increasing to get all files stored by this extension
* @param int $storageConfiguration New storage configuration ID
* @param int|NULL $oldConfiguration Old storage configuration ID
* @throws \Underflowexception When file record doesn't exist. Indicating there are no more files to move
* @return void
*/
public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
{
$record = \IPS\Db::i()->select( '*', 'nexus_referral_banners', 'rb_upload=1', 'rb_id', array( $offset, 1 ) )->first();
try
{
$file = \IPS\File::get( $oldConfiguration ?: 'nexus_ReferralBanners', $record['rb_url'] )->move( $storageConfiguration );
if ( (string) $file != $record['rb_url'] )
{
\IPS\Db::i()->update( 'nexus_referral_banners', array( 'rb_url' => (string) $file ), array( 'rb_id=?', $record['rb_id'] ) );
}
}
catch( \Exception $e )
{
/* Any issues are logged */
}
}
/**
* Fix all URLs
*
* @param int $offset This will be sent starting with 0, increasing to get all files stored by this extension
* @return void
*/
public function fixUrls( $offset )
{
$record = \IPS\Db::i()->select( '*', 'nexus_referral_banners', 'rb_upload=1', 'rb_id', array( $offset, 1 ) )->first();
if ( $new = \IPS\File::repairUrl( $record['rb_url'] ) )
{
\IPS\Db::i()->update( 'nexus_referral_banners', array( 'rb_url' => $new ), array( 'rb_id=?', $record['rb_id'] ) );
}
}
/**
* Check if a file is valid
*
* @param string $file The file path to check
* @return bool
*/
public function isValidFile( $file )
{
try
{
\IPS\Db::i()->select( '*', 'nexus_referral_banners', array( 'rb_url=? and rb_upload=1', (string) $file ) )->first();
return TRUE;
}
catch ( \UnderflowException $e )
{
return FALSE;
}
}
/**
* Delete all stored files
*
* @return void
*/
public function delete()
{
foreach( \IPS\Db::i()->select( '*', 'nexus_referral_banners', 'rb_upload=1' ) as $banner )
{
try
{
\IPS\File::get( 'nexus_ReferralBanners', $banner['rb_url'] )->delete();
}
catch( \Exception $e ){}
}
}
}
@@ -12,7 +12,7 @@
namespace IPS\nexus\extensions\core\FileStorage;
/* 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;
@@ -45,7 +45,7 @@ class _Support
public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
{
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( 'sf_type=?', 'upload' ) );
if ( count( $customFields ) )
if ( \count( $customFields ) )
{
$where = array();
$departments = array();
@@ -99,7 +99,7 @@ class _Support
public function fixUrls( $offset )
{
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( 'sf_type=?', 'upload' ) );
if ( count( $customFields ) )
if ( \count( $customFields ) )
{
$where = array();
$departments = array();
@@ -149,9 +149,9 @@ class _Support
public function isValidFile( $file )
{
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( 'sf_type=?', 'upload' ) );
if ( count( $customFields ) )
if ( \count( $customFields ) )
{
foreach ( \IPS\Db::i()->select( '*', 'nexus_support_requests', array( "r_cfields LIKE ?", "%" . str_replace( '\\', '\\\\', trim( json_encode( (string) $file ), '"' ) . "%" ) ) ) as $request )
foreach ( \IPS\Db::i()->select( '*', 'nexus_support_requests', array( "r_cfields LIKE ?", "%" . str_replace( '\\', '\\\\\\', trim( json_encode( (string) $file ), '"' ) . "%" ) ) ) as $request )
{
$fieldValues = json_decode( $request['r_cfields'], TRUE );
foreach ( $customFields as $field )
@@ -175,7 +175,7 @@ class _Support
public function delete()
{
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( 'sf_type=?', 'upload' ) );
if ( count( $customFields ) )
if ( \count( $customFields ) )
{
$where = array();
$departments = array();