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

@@ -5,19 +5,22 @@
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @subpackage convert
* @since 21 Jan 2015
*/
namespace IPS\convert\Software\Gallery;
/* 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;
}
/**
* Xenforo Gallery Converter
*/
class _Xenforo extends \IPS\convert\Software
{
/**
@@ -30,11 +33,16 @@ class _Xenforo extends \IPS\convert\Software
*/
public static $tablePrefix = 'xengallery_';
/**
* @brief XF2.1 changed serialized data to json decoded
*/
public static $useJson = FALSE;
/**
* Constructor
*
* @param \IPS\convert\App The application to reference for database and other information.
* @param bool Establish a DB connection
* @param \IPS\convert\App $app The application to reference for database and other information.
* @param bool $needDB Establish a DB connection
* @return void
* @throws \InvalidArgumentException
*/
@@ -49,7 +57,7 @@ class _Xenforo extends \IPS\convert\Software
/* Is this XF1 or XF2 */
if ( static::$isLegacy === NULL )
{
$version = $this->db->select( 'MAX(version_id)', 'xf_template', array( "addon_id=?", 'XF' ) )->first();
$version = $this->db->select( 'MAX(version_id)', 'xf_template', array( \IPS\Db::i()->in( 'addon_id', array( 'XF', 'XenForo' ) ) ) )->first();
if ( $version < 2000010 )
{
@@ -60,6 +68,11 @@ class _Xenforo extends \IPS\convert\Software
static::$tablePrefix = 'xf_mg_';
static::$isLegacy = FALSE;
}
/* Is this XF 2.1 */
if ( $version > 2010010 )
{
static::$useJson = TRUE;
}
}
}
catch( \Exception $e ) {} # If we can't query, we won't be able to do anything anyway
@@ -76,7 +89,7 @@ class _Xenforo extends \IPS\convert\Software
public static function softwareName()
{
/* Child classes must override this method */
return "XenForo Media Gallery (1.5.x/2.0.x)";
return "XenForo Media Gallery (1.5.x/2.0.x/2.1.x)";
}
/**
@@ -251,7 +264,7 @@ class _Xenforo extends \IPS\convert\Software
'field_class' => 'IPS\\Helpers\\Form\\Radio',
'field_default' => NULL,
'field_required' => TRUE,
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions, 'gridspan' => 2 ),
'field_hint' => NULL,
'field_validation' => NULL,
);
@@ -292,7 +305,7 @@ class _Xenforo extends \IPS\convert\Software
{
try
{
$title = ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? $xfTwoTitle : $xfOneTitle;
$title = ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) ) ? $xfTwoTitle : $xfOneTitle;
return $this->db->select( 'phrase_text', 'xf_phrase', array( "title=?", $title ) )->first();
}
catch( \UnderflowException $e )
@@ -319,7 +332,7 @@ class _Xenforo extends \IPS\convert\Software
'category_name' => isset( $row['category_title'] ) ? $row['category_title'] : $row['title'],
'category_desc' => isset( $row['category_description'] ) ? $row['category_description'] : $row['description'],
'category_parent_id' => $row['parent_category_id'],
'category_count_imgs' => isset( $row['category_media_count'] ) ? $row['category_media_count'] : $row['category_media_count'],
'category_count_imgs' => isset( $row['category_media_count'] ) ? $row['category_media_count'] : $row['media_count'],
'category_position' => $row['display_order']
) );
@@ -394,7 +407,7 @@ class _Xenforo extends \IPS\convert\Software
$users = $perm['share_users'];
$socialgroup['members'] = array();
if ( count( $users ) )
if ( \count( $users ) )
{
foreach( $users AS $key => $user )
{
@@ -433,7 +446,7 @@ class _Xenforo extends \IPS\convert\Software
$info = array(
'album_id' => $row['album_id'],
'album_owner_id' => $row['album_user_id'],
'album_owner_id' => isset( $row['album_user_id'] ) ? $row['album_user_id'] : $row['user_id'],
'album_description' => isset( $row['album_description'] ) ? $row['album_description'] : $row['description'],
'album_name' => isset( $row['album_title'] ) ? $row['album_title'] : $row['title'],
'album_type' => $type,
@@ -441,7 +454,7 @@ class _Xenforo extends \IPS\convert\Software
'album_count_comments' => isset( $row['album_comment_count'] ) ? $row['album_comment_count'] : $row['comment_count'],
'album_rating_aggregate' => isset( $row['album_rating_avg'] ) ? $row['album_rating_avg'] : $row['rating_avg'],
'album_rating_count' => isset( $row['album_rating_count'] ) ? $row['album_rating_count'] : $row['rating_count'],
'album_rating_total' => isset( $row['album_rating_sum'] ) ? $row['album_rating_sum'] : $row['ating_sum'],
'album_rating_total' => isset( $row['album_rating_sum'] ) ? $row['album_rating_sum'] : $row['rating_sum'],
);
$category = $this->app->_session['more_info']['convertGalleryAlbums']['members_gallery_category'];
@@ -486,7 +499,7 @@ class _Xenforo extends \IPS\convert\Software
$libraryClass::setKey( 'media_id' );
foreach( $this->fetch( static::$isLegacy ? 'xf_gallery_media' : 'xf_mg_media_item', 'media_id' ) AS $row )
foreach( $this->fetch( static::$isLegacy ? 'xengallery_media' : 'xf_mg_media_item', 'media_id' ) AS $row )
{
/* Exif */
$exif = array();
@@ -500,11 +513,16 @@ class _Xenforo extends \IPS\convert\Software
/* XF2 */
else
{
foreach( json_decode( $row['exif_data'], TRUE ) AS $key => $value )
$exifData = json_decode( $row['exif_data'], TRUE );
if( $exifData )
{
foreach( $value as $subKey => $subValue )
foreach( $exifData AS $key => $value )
{
$exif[ $key . '.' . $subKey ] = $subValue;
foreach( $value as $subKey => $subValue )
{
$exif[ $key . '.' . $subKey ] = $subValue;
}
}
}
}
@@ -561,7 +579,9 @@ class _Xenforo extends \IPS\convert\Software
try
{
$em = \IPS\Text\Parser::embeddableMedia( \IPS\Http\Url::createFromString( $row['media_embed_url'] ) );
$memberId = $this->app->getLink( $row['user_id'], 'core_members', TRUE );
$em = \IPS\Text\Parser::embeddableMedia( \IPS\Http\Url::createFromString( $row['media_embed_url'] ), FALSE, \IPS\Member::load( $memberId ) );
}
catch( \Exception $e )
{
@@ -624,8 +644,15 @@ class _Xenforo extends \IPS\convert\Software
}
/* Reputation */
$likes = \unserialize( $row['like_users'] );
if ( is_array( $likes ) AND count( $likes ) )
if ( !static::$useJson )
{
$likes = \unserialize( $row['like_users'] );
}
else
{
$likes = \json_decode( $row['reaction_score'], TRUE );
}
if ( \is_array( $likes ) AND \count( $likes ) )
{
foreach( $likes AS $like )
{
@@ -672,7 +699,7 @@ class _Xenforo extends \IPS\convert\Software
$tags = \unserialize( $row['tags'] );
}
if ( is_array( $tags ) and count( $tags ) )
if ( \is_array( $tags ) and \count( $tags ) )
{
foreach( $tags AS $k => $tag )
{
@@ -743,8 +770,15 @@ class _Xenforo extends \IPS\convert\Software
) );
/* Reputation */
$likes = \unserialize( $row['like_users'] );
if ( is_array( $likes ) AND count( $likes ) )
if ( !static::$useJson )
{
$likes = \unserialize( $row['like_users'] );
}
else
{
$likes = \json_decode( $row['reaction_score'], TRUE );
}
if ( \is_array( $likes ) AND \count( $likes ) )
{
foreach( $likes AS $like )
{