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;
}
/**
* Coppermine Gallery Converter
*/
class _Coppermine extends \IPS\convert\Software
{
/**
@@ -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 02 October 2016
*/
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;
}
/**
* Photoplog Gallery Converter
*/
class _Photoplog extends \IPS\convert\Software
{
/**
@@ -105,7 +108,7 @@ class _Photoplog extends \IPS\convert\Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return string Message to display
* @return array Messages to display
*/
public function finish()
{
@@ -235,7 +238,7 @@ class _Photoplog extends \IPS\convert\Software
$album = \unserialize( $row['albumids'] );
$albumId = NULL;
if( is_array( $album ) )
if( \is_array( $album ) )
{
$albumId = $album[0];
}
@@ -250,7 +253,7 @@ class _Photoplog extends \IPS\convert\Software
'image_comments' => $row['num_comments0'] + $row['num_comments1'],
'image_ratings_total' => $row['sum_ratings1'],
'image_ratings_count' => $row['num_ratings1'],
'image_rating' => $row['num_ratings1'] > 0 ? intval( $row['sum_ratings1'] / $row['num_ratings1'] ) : 0,
'image_rating' => $row['num_ratings1'] > 0 ? \intval( $row['sum_ratings1'] / $row['num_ratings1'] ) : 0,
'image_date' => $row['dateline'],
'image_metadata' => json_encode( \unserialize( $row['exifinfo'] ) ),
'image_file_name' => $row['filename'],
@@ -5,7 +5,7 @@
* @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 6 December 2016
* @note Only redirect scripts are supported right now
*/
@@ -13,12 +13,15 @@
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;
}
/**
* Photopost Gallery Converter
*/
class _Photopost extends \IPS\convert\Software
{
/**
@@ -66,7 +69,7 @@ class _Photopost extends \IPS\convert\Software
/**
* Content we can convert from this software.
*
* @return NULL
* @return array
*/
public static function canConvert()
{
@@ -324,7 +327,8 @@ class _Photopost extends \IPS\convert\Software
return NULL;
}
}
elseif( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showphoto.php' ) !== FALSE )
elseif( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showphoto.php' ) !== FALSE OR
mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showfull.php' ) !== FALSE)
{
if( !$id = \IPS\Request::i()->photo )
{
@@ -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;
}
/**
* vBulletin Gallery Converter
*/
class _Vbulletin extends \IPS\convert\Software
{
/**
@@ -33,8 +36,8 @@ class _Vbulletin extends \IPS\convert\Software
/**
* 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
*/
@@ -63,7 +66,7 @@ class _Vbulletin extends \IPS\convert\Software
/* If this is vB4, what is the content type ID for posts? */
if ( static::$imageContentType === NULL AND ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) )
if ( static::$imageContentType === NULL AND ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) ) )
{
static::$imageContentType = $this->db->select( 'contenttypeid', 'contenttype', array( "class=?", 'Album' ) )->first();
}
@@ -161,6 +164,8 @@ class _Vbulletin extends \IPS\convert\Software
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\gallery\Image' ), 3, array( 'class' ) );
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Album', 'count' => 0 ), 4, array( 'class' ) );
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\gallery\Category', 'count' => 0 ), 5, array( 'class' ) );
\IPS\Task::queue( 'convert', 'RebuildNonContent', array( 'app' => $this->app->app_id, 'link' => 'gallery_albums', 'extension' => 'gallery_Albums' ), 2, array( 'app', 'link', 'extension' ) );
/* Caches */
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'gallery_images', 'class' => 'IPS\gallery\Image' ), 3, array( 'app', 'link', 'class' ) );
@@ -171,7 +176,7 @@ class _Vbulletin extends \IPS\convert\Software
/**
* Fix Post Data
*
* @param string Post
* @param string $post Post
* @return string Fixed Posts
*/
public static function fixPostData( $post )
@@ -198,8 +203,8 @@ class _Vbulletin extends \IPS\convert\Software
'field_required' => TRUE,
'field_extra' => array(
'options' => array(
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'conv_store_database' ),
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'conv_store_file_system' ),
),
'userSuppliedInput' => 'file_system',
),
@@ -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 )
{