Version 4.2.0

This commit is contained in:
Neo committed 2025-12-19 05:44:59 -08:00
1 parent 0dc2aee5ed
commit 96997ddd8e
2074 files changed
+125454 -55780

No files matched your search

@@ -2,9 +2,9 @@
/**
* @brief Converter ExpressionEngine Master Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 14 June 2016
*/
@@ -334,13 +334,11 @@ class _Expressionengine extends \IPS\convert\Software
{
if ( $attachId !== FALSE )
{
$ourAttachment = \IPS\File::get( 'core_Signature', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attachId ) )->first() );
$memberId = $this->app->getLink( $row['member_id'], 'core_members' );
$signature = \IPS\Db::i()->select( 'signature', 'core_members', array( "member_id=?", $memberId ) )->first();
$signature .= '<p><a href="<fileStore.core_Signature>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Signature>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
$signature .= '[attachment=' . $attachId . ':name]';
\IPS\Db::i()->update( 'core_members', array( 'signature' => $signature ), array( "member_id=?", $memberId ) );
}
@@ -413,6 +411,15 @@ class _Expressionengine extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $row['group_id'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
@@ -671,13 +678,11 @@ class _Expressionengine extends \IPS\convert\Software
{
if ( $attachId !== FALSE )
{
$ourAttachment = \IPS\File::get( 'core_Attachment', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attachId ) )->first() );
$pmId = $this->app->getLink( $row['message_id'], 'core_message_posts' );
$message = \IPS\Db::i()->select( 'msg_post', 'core_message_posts', array( "msg_id=?", $pmId ) )->first();
$message .= '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
$message .= '[attachment=' . $attachId . ':name]';
\IPS\Db::i()->update( 'core_message_posts', array( 'msg_post' => $message ), array( "msg_id=?", $pmId ) );
}
@@ -2,9 +2,9 @@
/**
* @brief Converter Joomla Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 21 Jan 2015
*/
@@ -169,6 +169,15 @@ class _Joomla extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $row['id'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Converter MyBB Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 21 Jan 2015
*/
@@ -663,6 +663,15 @@ class _Mybb extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $row['gid'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
@@ -2,9 +2,9 @@
/**
* @brief Converter Photopost Core Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 6 December 2016
* @note Only redirect scripts are supported right now
@@ -2,9 +2,9 @@
/**
* @brief Converter phpBB Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 21 Jan 2015
*/
@@ -359,6 +359,9 @@ class _Phpbb extends \IPS\convert\Software
/* Sort out emoticons */
$post = preg_replace("/<!-- s(\S+?) --><img(?:[^<]+?)<!-- (?:\S+?) -->/", '$1', $post);
/* Sort out media */
$post = preg_replace("#<!-- m --><a class=\"postlink\" href=\"([^\]]+?)\"([^>]+?)?>([^\]]+?)</a><!-- m -->#i", "$1", $post);
/* And sort out URLs */
$post = preg_replace("#<a class=\"postlink\" href=\"([^\]]+?)\"([^>]+?)?>([^\]]+?)</a>#i", "[url=$1]$3[/url]", $post);
@@ -523,6 +526,16 @@ class _Phpbb extends \IPS\convert\Software
$merge = ( $this->app->_session['more_info']['convertGroups']["map_group_{$row['group_id']}"] != 'none' ) ? $this->app->_session['more_info']['convertGroups']["map_group_{$row['group_id']}"] : NULL;
$libraryClass->convertGroup( $info, $merge );
$libraryClass->setLastKeyValue( $row['group_id'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
@@ -737,14 +750,25 @@ class _Phpbb extends \IPS\convert\Software
$data = array( 0 => NULL );
}
$libraryClass->convertWarnLog( array(
'wl_id' => $warn['warning_id'],
'wl_member' => $warn['user_id'],
'wl_moderator' => $log['user_id'],
'wl_date' => $warn['warning_time'],
'wl_points' => 1,
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
) );
$warnId = $libraryClass->convertWarnLog( array(
'wl_id' => $warn['warning_id'],
'wl_member' => $warn['user_id'],
'wl_moderator' => $log['user_id'],
'wl_date' => $warn['warning_time'],
'wl_points' => 1,
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
) );
/* Add a member history record for this member */
$libraryClass->convertMemberHistory( array(
'log_id' => 'w' . $warn['warning_id'],
'log_member' => $warn['user_id'],
'log_by' => $log['user_id'],
'log_type' => 'warning',
'log_data' => array( 'wid' => $warnId ),
'log_date' => $warn['warning_time']
)
);
}
$libraryClass->setLastKeyValue( $row['user_id'] );
@@ -2,9 +2,9 @@
/**
* @brief Converter PhpMyForum Core Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 6 December 2016
* @note Only redirect scripts are supported right now
@@ -2,9 +2,9 @@
/**
* @brief Converter Punbb Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 21 Jan 2015
*/
@@ -237,6 +237,15 @@ class _Punbb extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $row['g_id'], $merge );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
@@ -1,8 +1,8 @@
<?php
/**
* @brief Converter Smf Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2015 Invision Power Services, Inc.
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package IPS Social Suite
* @subpackage Converter
* @since 21 Jan 2015
@@ -318,7 +318,7 @@ class _Smf extends \IPS\convert\Software
$post = str_replace( $search, $replace, $post );
// And img tags
$post = preg_replace("#\[img width=(\d+) height=(\d+)\]([a-zA-Z0-9.:\-/]+)\[\/img\]#i", "[img]$3[/img]", $post);
$post = preg_replace("#\[img width=(\d+)(?: height=(\d+))?\]([a-zA-Z0-9.:\-/%\?&_]+)\[\/img\]#i", "[img]$3[/img]", $post);
//Quotes
$post = preg_replace("#\[quote author=(.+?) link=(.+?)=(\d+)\.msg(\d+)(.+?)date=(\d+)\](.+)\[\/quote\]#i", "[quote name=\"$1\" post=\"$4\" timestamp=\"$6\"]$7[/quote]", $post);
@@ -360,7 +360,7 @@ class _Smf extends \IPS\convert\Software
$libraryClass->convertBanfilter( array(
'ban_id' => $row['id_ban'],
'ban_type' => 'email',
'ban_content' => $row['email_address'],
'ban_content' => str_replace( '%' ,'*', $row['email_address'] ),
) );
}
@@ -579,6 +579,15 @@ class _Smf extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $row['id_group'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
@@ -654,7 +663,7 @@ class _Smf extends \IPS\convert\Software
'bday_month' => $bday_month,
'bday_year' => $bday_year,
'mgroup_others' => $row['additional_groups'],
'signature' => $row['signature'],
'signature' => static::fixPostData( $row['signature'] ),
'pp_reputation_points' => $row['karma_good'] - $row['karma_bad'],
'timezone' => $row['time_offset'],
'allow_admin_mails' => $row['notify_announcements'],
@@ -787,7 +796,7 @@ class _Smf extends \IPS\convert\Software
/* Clean filename per legacy SMF requirements */
$cleanName = strtr( $attach['filename'], 'ŠŽšžŸÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
$cleanName = strtr( $cleanName, array( 'Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u' ) );
$cleanName = preg_replace( array( '/s/', '/[^w_.-]/' ), array( '_', '' ), $cleanName );
$cleanName = preg_replace( array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $cleanName );
$location = $attach['id_attach'] . '_' . str_replace( '.', '_', $cleanName ) . md5( $cleanName );
}
@@ -1,8 +1,8 @@
<?php
/**
* @brief Converter UBBthreads Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2015 Invision Power Services, Inc.
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package IPS Social Suite
* @subpackage Converter
* @since 21 Jan 2015
@@ -433,6 +433,15 @@ class _UBBthreads extends \IPS\convert\Software
$libraryClass->convertGroup( $info, $merge );
$libraryClass->setLastKeyValue( $row['GROUP_ID'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
@@ -1,12 +1,11 @@
<?php
/**
* @brief Converter Vanilla Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2015 Invision Power Services, Inc.
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package IPS Social Suite
* @subpackage Converter
* @since 21 Jan 2015
* @version
*/
namespace IPS\convert\Software\Core;
@@ -53,25 +52,68 @@ class _Vanilla extends \IPS\convert\Software
* @param \IPS\convert\App The application to reference for database and other information.
* @throws \InvalidArgumentException
*/
public function __construct( \IPS\convert\App $app )
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
{
$return = parent::__construct( $app );
$return = parent::__construct( $app, $needDB );
/* What is the activity type ID for status updates? */
if ( static::$activityStatusType === NULL )
if ( $needDB )
{
try
/* What is the activity type ID for status updates? */
if ( static::$activityStatusType === NULL )
{
static::$activityStatusType = $this->db->select( 'ActivityTypeID', 'ActivityType',
array( 'Name=?', 'Status' ), NULL, 1
)->first();
try
{
static::$activityStatusType = $this->db->select( 'ActivityTypeID', 'ActivityType',
array( 'Name=?', 'Status' ), NULL, 1
)->first();
}
catch ( \Exception $e ) {}
}
catch ( \Exception $e ) {}
}
return $return;
}
/**
* Can we convert settings?
*
* @return boolean
*/
public static function canConvertSettings()
{
return TRUE;
}
/**
* Settings Map Listing
*
* @return array
*/
public function settingsMapList()
{
$settings = array(
'fluid' => array( 'title' => \IPS\Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ), 'value' => true, 'our_key' => 'use_fluid_view_convert', 'our_title' => \IPS\Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ) )
);
return $settings;
}
/**
* Convert one or more settings
*
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
{
if ( !isset( $settings['use_fluid_view_convert'] ) OR $settings['use_fluid_view_convert'] == FALSE )
{
return;
}
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => 'fluid' ), array( "conf_key=?", 'forums_default_view' ) );
}
/**
* Resolve the filesystem location of a file from a path stored in the database
* There are several different ways Vanilla may store these, including as remote URL's
@@ -154,10 +196,6 @@ class _Vanilla extends \IPS\convert\Software
'table' => 'User',
'where' => NULL,
),
'convertRemoteAvatars' => array(
'table' => NULL,
'where' => NULL,
),
'convertStatuses' => array(
'table' => 'Activity',
'where' => array( 'ActivityTypeId=?', (int) static::$activityStatusType )
@@ -331,6 +369,15 @@ class _Vanilla extends \IPS\convert\Software
$libraryClass->convertGroup( $info, $merge );
$libraryClass->setLastKeyValue( $row['RoleID'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
@@ -470,7 +517,7 @@ class _Vanilla extends \IPS\convert\Software
'mt_date' => static::mysqlToDateTime( $row['DateInserted'] ),
'mt_starter_id' => $row['InsertUserID'],
'mt_last_post_time' => static::mysqlToDateTime( $row['DateUpdated'] ),
'mt_to_count' => $row['CountParticipants'],
'mt_to_count' => ( isset( $row['CountParticipants'] ) ) ? $row['CountParticipants'] : count( \unserialize( $row['Contributors'] ) ),
'mt_replies' => $row['CountMessages'],
);
@@ -490,7 +537,7 @@ class _Vanilla extends \IPS\convert\Software
}
$libraryClass->convertPrivateMessage( $topicInfo, $maps );
$libraryClass->setLastKeyValue( $row['MessageID'] );
$libraryClass->setLastKeyValue( $row['ConversationID'] );
}
}
@@ -2,9 +2,9 @@
/**
* @brief Converter vBulletin 4.x Master Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 21 Jan 2015
*/
@@ -128,6 +128,10 @@ class _Vbulletin extends \IPS\convert\Software
'table' => 'user',
'where' => NULL
),
'convertMemberHistory' => array(
'table' => 'userchangelog',
'where' => NULL
),
'convertStatuses' => array(
'table' => 'visitormessage',
'where' => NULL
@@ -151,6 +155,14 @@ class _Vbulletin extends \IPS\convert\Software
'convertRanks' => array(
'table' => 'usertitle',
'where' => NULL
),
'convertClubs' => array(
'table' => 'socialgroup',
'where' => NULL
),
'convertClubMembers' => array(
'table' => 'socialgroupmember',
'where' => NULL
)
);
}
@@ -244,6 +256,7 @@ class _Vbulletin extends \IPS\convert\Software
'convertProfileFields',
'convertGroups',
'convertMembers',
'convertClubs'
);
}
@@ -419,6 +432,24 @@ class _Vbulletin extends \IPS\convert\Software
);
}
break;
case 'convertClubs':
$return['convertClubs'] = array();
$return['convertClubs']['photo_location'] = array(
'field_class' => 'IPS\\Helpers\\Form\\Radio',
'field_default' => 'database',
'field_required' => TRUE,
'field_extra' => array(
'options' => array(
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
),
'userSuppliedInput' => 'file_system',
),
'field_hint' => NULL,
'field_validation' => function( $value ) { if ( $value != 'database' AND !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
);
break;
}
return ( isset( $return[ $method ] ) ) ? $return[ $method ] : array();
@@ -816,7 +847,6 @@ class _Vbulletin extends \IPS\convert\Software
'g_bitoptions' => array(
'gbw_promote_unit_type' => $gbw_promote_unit, // Type of group promotion to use. 1 is days since joining, 0 is content count. Corresponds to g_promotion
'gbw_no_status_update' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT post status updates
'gbw_soft_delete_own' => $checkpermission( 'forumpermissions', 'candeletepost' ), // Allow users of this group to hide their own submitted content
'gbw_allow_upload_bgimage' => 1, // Can upload a cover photo?
'gbw_view_reps' => $checkpermission( 'genericpermissions2', 'canprofilerep' ), // Can view who gave reputation?
'gbw_no_status_import' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT import status updates from Facebook/Twitter
@@ -825,6 +855,7 @@ class _Vbulletin extends \IPS\convert\Software
'gbw_pm_override_inbox_full'=> $checkpermission( 'pmpermissions', 'canignorequota' ), // 1 means this group can send other members PMs even when that member's inbox is full
'gbw_cannot_be_ignored' => ( ( $checkpermission( 'adminpermissions', 'ismoderator' ) OR $checkpermission( 'adminpermissions', 'cancontrolpanel' ) ) AND $this->_setting( 'ignoremods' ) ), // 1 means they cannot be ignored. 0 means they can
),
'g_hide_own_posts' => $checkpermission( 'forumpermissions', 'candeletepost' ),
'g_pm_flood_mins' => $this->_setting( 'pmfloodtime' ) / 60,
'g_post_polls' => $checkpermission( 'forumpermissions', 'canpostpoll' ) ? 1 : 0,
'g_vote_polls' => $checkpermission( 'forumpermissions', 'canvote' ) ? 1 : 0,
@@ -837,6 +868,81 @@ class _Vbulletin extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $group['usergroupid'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
* @brief Member history type map
*/
protected $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'member_group_id', 'membergroupids' => 'mgroup_others' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'changeid' );
$fixGroups = function( $string )
{
$groups = explode( ',', $string );
$newGroups = array();
array_walk( $groups, function( &$item, $key ) use ( &$newGroups )
{
try
{
$item = $this->app->getLink( $item, 'core_groups' );
$newGroups[] = $item;
}
catch( \OutOfRangeException $e ){}
});
return implode( ',', $newGroups );
};
foreach( $this->fetch( 'userchangelog', 'changeid' ) AS $change )
{
if( !in_array( $change['fieldname'], array_keys( $this->changeLogTypes ) ) )
{
$libraryClass->setLastKeyValue( $change['changeid'] );
continue;
}
/* Any processing we need to do */
switch( $this->changeLogTypes[ $change['fieldname'] ] )
{
case 'member_group_id':
case 'mgroup_others':
$change['oldvalue'] = $fixGroups( $change['oldvalue'] );
$change['newvalue'] = $fixGroups( $change['newvalue'] );
break;
}
$libraryClass->convertMemberHistory( array(
'log_id' => $change['changeid'],
'log_member' => $change['userid'],
'log_by' => $change['adminid'],
'log_type' => $this->changeLogTypes[ $change['fieldname'] ],
'log_data' => array( 'old' => $change['oldvalue'], 'new' => $change['newvalue'] ),
'log_date' => $change['change_time']
)
);
$libraryClass->setLastKeyValue( $change['changeid'] );
}
}
/**
@@ -1152,15 +1258,26 @@ class _Vbulletin extends \IPS\convert\Software
/* And warn logs made on the profile - we'll do content specific later */
foreach( $this->db->select( '*', 'infraction', array( "userid=? AND postid=?", $user['userid'], 0 ) ) AS $warn )
{
$libraryClass->convertWarnLog( array(
'wl_id' => $warn['infractionid'],
'wl_member' => $warn['userid'],
'wl_moderator' => $warn['whoadded'],
'wl_date' => $warn['dateline'],
'wl_points' => $warn['points'],
'wl_note_member' => $warn['note'],
'wl_note_mods' => $warn['customreason'],
) );
$warnId = $libraryClass->convertWarnLog( array(
'wl_id' => $warn['infractionid'],
'wl_member' => $warn['userid'],
'wl_moderator' => $warn['whoadded'],
'wl_date' => $warn['dateline'],
'wl_points' => $warn['points'],
'wl_note_member' => $warn['note'],
'wl_note_mods' => $warn['customreason'],
) );
/* Add a member history record for this member */
$libraryClass->convertMemberHistory( array(
'log_id' => 'w' . $warn['infractionid'],
'log_member' => $warn['userid'],
'log_by' => $warn['whoadded'],
'log_type' => 'warning',
'log_data' => array( 'wid' => $warnId ),
'log_date' => $warn['dateline']
)
);
}
$libraryClass->setLastKeyValue( $user['userid'] );
@@ -1447,6 +1564,109 @@ class _Vbulletin extends \IPS\convert\Software
}
}
/**
* Convert clubs
*
* @return void
*/
public function convertClubs()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'groupid' );
foreach( $this->fetch( 'socialgroup', 'groupid' ) AS $group )
{
switch( $group['type'] )
{
case 'public':
$type = 'public';
break;
case 'moderated':
$type = 'closed';
break;
case 'inviteonly':
$type = 'private';
break;
}
$icon = NULL;
try
{
$icon = $this->db->select( '*', 'socialgroupicon', array( "groupid=?", $group['groupid'] ) )->first();
}
catch( \UnderflowException $e ) {}
$info = array(
'club_id' => $group['groupid'],
'name' => $group['name'],
'type' => $type,
'created' => $group['dateline'],
'members' => $group['members'],
'owner' => $group['creatoruserid'],
'profile_photo' => ( $icon ) ? "clubicon{$group['groupid']}.{$icon['extension']}" : NULL,
'about' => $group['description'],
'last_activity' => $group['lastupdate']
);
$iconpath = NULL;
$icondata = NULL;
if ( $icon )
{
if ( $this->app->_session['more_info']['convertClubs']['photo_location'] == 'database' )
{
$icondata = $icon['filedata'];
}
else
{
$iconpath = $this->app->_session['more_info']['convertClubs']['photo_location'] . "/socialgroupicon_{$icon['groupid']}_{$icon['dateline']}.gif";
}
}
$libraryClass->convertClub( $info, $iconpath, $icondata );
$libraryClass->setLastKeyValue( $group['groupid'] );
}
}
/**
* Convert club members
*
* @return void
*/
public function convertClubMembers()
{
$libraryClass = $this->getLibrary();
foreach( $this->fetch( 'socialgroupmember', 'groupid' ) AS $member )
{
$type = NULL;
try
{
$group = $this->db->select( '*', 'socialgroup', array( "groupid=?", $member['groupid'] ) )->first();
if ( $member['userid'] == $group['creatoruserid'] )
{
$type = 'leader';
}
}
catch( \UnderflowException $e ) {}
if ( $type === NULL )
{
$type = ( $member['type'] === 'moderated' ) ? 'requested' : $member['type'];
}
$libraryClass->convertClubMember( array(
'club_id' => $member['groupid'],
'member_id' => $member['userid'],
'joined' => $member['dateline'],
'status' => $type,
) );
}
}
/* !vBulletin Specific Stuff */
/**
* @brief Silly Bit Options for Groups. Typically we would leave out app specific options (such as Forums here) however we need them for some general permissions, like uploading.
@@ -1626,6 +1846,13 @@ class _Vbulletin extends \IPS\convert\Software
'allowsmilies' => 4,
'parseurl' => 8,
'signature' => 16,
),
'cluboptions' => array(
'owner_mod_queue' => 1,
'join_to_view' => 2,
'enable_group_messages' => 4,
'enable_group_albums' => 8,
'only_owner_discussions' => 16
)
);
@@ -2,9 +2,9 @@
/**
* @brief Converter vBulletin 5.x Master Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 21 Jan 2015
*/
@@ -70,6 +70,10 @@ class _Vbulletin5 extends \IPS\convert\Software
'table' => 'user',
'where' => NULL
),
'convertMemberHistory' => array(
'table' => 'userchangelog',
'where' => NULL
),
'convertIgnoredUsers' => array(
'table' => 'userlist',
'where' => array( "type=?", 'ignore' )
@@ -85,6 +89,14 @@ class _Vbulletin5 extends \IPS\convert\Software
'convertRanks' => array(
'table' => 'usertitle',
'where' => NULL
),
'convertClubs' => array(
'table' => 'node',
'where' => 'clubs'
),
'convertClubMembers' => array(
'table' => 'groupintopic',
'where' => NULL
)
);
}
@@ -115,7 +127,7 @@ class _Vbulletin5 extends \IPS\convert\Software
case 'pm':
try
{
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", 'vbulletin-4ecbdf567f3da8.31769341' ) )->first();
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", static::$guids['private_messages'] ) )->first();
return $this->db->select( 'COUNT(*)', 'privatemessage', array( "privatemessage.msgtype=? AND node.parentid=?", 'message', $node ) )->join( 'node', 'privatemessage.nodeid = node.nodeid' )->first();
}
@@ -125,6 +137,28 @@ class _Vbulletin5 extends \IPS\convert\Software
}
break;
case 'node':
if ( $where === 'clubs' )
{
return count( $this->fetchClubs() );
}
else
{
return parent::countRows( $table, $where, $recache );
}
break;
case 'groupintopic':
$clubs = array();
foreach( $this->fetchClubs() AS $club )
{
$clubs[] = $club['nodeid'];
}
$where = array( $this->db->in( 'nodeid', $clubs ) );
return parent::countRows( $table, $where, $recache );
break;
default:
return parent::countRows( $table, $where, $recache );
break;
@@ -210,6 +244,7 @@ class _Vbulletin5 extends \IPS\convert\Software
'convertProfileFields',
'convertGroups',
'convertMembers',
'convertClubs'
);
}
@@ -385,6 +420,24 @@ class _Vbulletin5 extends \IPS\convert\Software
);
}
break;
case 'convertClubs':
$return['convertClubs'] = array();
$return['convertClubs']['photo_location'] = array(
'field_class' => 'IPS\\Helpers\\Form\\Radio',
'field_default' => 'database',
'field_required' => TRUE,
'field_extra' => array(
'options' => array(
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
),
'userSuppliedInput' => 'file_system',
),
'field_hint' => NULL,
'field_validation' => function( $value ) { if ( $value != 'database' AND !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
);
break;
}
return ( isset( $return[ $method ] ) ) ? $return[ $method ] : array();
@@ -734,7 +787,6 @@ class _Vbulletin5 extends \IPS\convert\Software
'g_bitoptions' => array(
'gbw_promote_unit_type' => $gbw_promote_unit, // Type of group promotion to use. 1 is days since joining, 0 is content count. Corresponds to g_promotion
'gbw_no_status_update' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT post status updates
'gbw_soft_delete_own' => $checkpermission( 'forumpermissions', 'candeletepost' ), // Allow users of this group to hide their own submitted content
'gbw_allow_upload_bgimage' => 1, // Can upload a cover photo?
'gbw_view_reps' => $checkpermission( 'genericpermissions2', 'canprofilerep' ), // Can view who gave reputation?
'gbw_no_status_import' => !$checkpermission( 'visitormessagepermissions', 'canmessageownprofile' ), // Can NOT import status updates from Facebook/Twitter
@@ -743,6 +795,7 @@ class _Vbulletin5 extends \IPS\convert\Software
'gbw_pm_override_inbox_full'=> $checkpermission( 'pmpermissions', 'canignorequota' ), // 1 means this group can send other members PMs even when that member's inbox is full
'gbw_cannot_be_ignored' => ( ( $checkpermission( 'adminpermissions', 'ismoderator' ) OR $checkpermission( 'adminpermissions', 'cancontrolpanel' ) ) AND $this->_setting( 'ignoremods' ) ), // 1 means they cannot be ignored. 0 means they can
),
'g_hide_own_posts' => $checkpermission( 'forumpermissions', 'candeletepost' ),
'g_pm_flood_mins' => $this->_setting( 'pmfloodtime' ) / 60,
'g_post_polls' => $checkpermission( 'forumpermissions', 'canpostpoll' ) ? 1 : 0,
'g_vote_polls' => $checkpermission( 'forumpermissions', 'canvote' ) ? 1 : 0,
@@ -755,6 +808,82 @@ class _Vbulletin5 extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $group['usergroupid'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
* @brief Member history type map
*/
protected $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'member_group_id', 'membergroupids' => 'mgroup_others' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'changeid' );
$fixGroups = function( $string )
{
$groups = explode( ',', $string );
$newGroups = array();
array_walk( $groups, function( &$item, $key ) use ( &$newGroups )
{
try
{
$item = $this->app->getLink( $item, 'core_groups' );
$newGroups[] = $item;
}
catch( \OutOfRangeException $e ){}
});
return implode( ',', $newGroups );
};
foreach( $this->fetch( 'userchangelog', 'changeid' ) AS $change )
{
if( !in_array( $change['fieldname'], array_keys( $this->changeLogTypes ) ) )
{
$libraryClass->setLastKeyValue( $change['changeid'] );
continue;
}
/* Any processing we need to do */
switch( $this->changeLogTypes[ $change['fieldname'] ] )
{
case 'member_group_id':
case 'mgroup_others':
$change['oldvalue'] = $fixGroups( $change['oldvalue'] );
$change['newvalue'] = $fixGroups( $change['newvalue'] );
break;
}
$libraryClass->convertMemberHistory( array(
'log_id' => $change['changeid'],
'log_member' => $change['userid'],
'log_by' => $change['adminid'],
'log_type' => $this->changeLogTypes[ $change['fieldname'] ],
'log_data' => array( 'old' => $change['oldvalue'], 'new' => $change['newvalue'] ),
'log_date' => $change['change_time'],
'log_ip_address' => long2ip( $change['ipaddress'] )
)
);
$libraryClass->setLastKeyValue( $change['changeid'] );
}
}
/**
@@ -894,6 +1023,8 @@ class _Vbulletin5 extends \IPS\convert\Software
'allow_admin_mails' => $checkpermission( 'useroptions', 'adminemail' ),
'members_disable_pm' => !$checkpermission( 'useroptions', 'receivepm' ),
'member_posts' => $user['posts'],
'fb_uid' => $user['fbuserid'],
'fb_token' => $user['fbaccesstoken']
);
/* Profile Fields */
@@ -1076,7 +1207,7 @@ class _Vbulletin5 extends \IPS\convert\Software
continue;
}
$libraryClass->convertWarnLog( array(
$warnId = $libraryClass->convertWarnLog( array(
'wl_id' => $warn['nodeid'],
'wl_member' => $warn['infracteduserid'],
'wl_moderator' => $node['userid'],
@@ -1085,6 +1216,17 @@ class _Vbulletin5 extends \IPS\convert\Software
'wl_note_member' => $node['description'],
'wl_note_mods' => $warn['customreason'],
) );
/* Add a member history record for this member */
$libraryClass->convertMemberHistory( array(
'log_id' => 'w' . $warn['nodeid'],
'log_member' => $warn['infracteduserid'],
'log_by' => $warn['userid'],
'log_type' => 'warning',
'log_data' => array( 'wid' => $warnId ),
'log_date' => $warn['actiondateline']
)
);
}
$libraryClass->setLastKeyValue( $user['userid'] );
@@ -1283,6 +1425,125 @@ class _Vbulletin5 extends \IPS\convert\Software
}
}
/**
* Convert clubs
*
* @return void
*/
public function convertClubs()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'nodeid' );
try
{
$mainNodeId = $this->db->select( 'nodeid', 'channel', array( "guid=?", static::$guids['clubs'] ) )->first();
}
catch( \UnderflowException $e )
{
/* shrug */
throw new \IPS\convert\Software\Exception;
}
$categories = array();
foreach( $this->db->select( 'nodeid', 'node', array( "parentid=?", $mainNodeId ) ) AS $cat )
{
$categories[] = $cat;
}
$checktype = function( $nodeoptions ) {
if ( $nodeoptions & 8 )
{
return 'public';
}
else if ( $nodeoptions & 16 )
{
return 'private';
}
else
{
return 'closed';
}
};
foreach( $this->fetch( 'node', 'nodeid', array( $this->db->in( 'parentid', $categories ) ) ) AS $row )
{
try
{
$channel = $this->db->select( '*', 'channel', array( "nodeid=?", $row['nodeid'] ) )->first();
}
catch( \UnderflowException $e )
{
$channel = array( 'filedataid' => 0 );
}
$filedata = NULL;
if ( $channel['filedataid'] )
{
try
{
$filedata = $this->db->select( '*', 'filedata', array( "filedataid=?", $channel['filedataid'] ) )->first();
}
catch( \UnderflowException $e ) {}
}
$info = array(
'club_id' => $row['nodeid'],
'name' => $row['title'],
'type' => $checktype( $row['nodeoptions'] ),
'created' => $row['publishdate'],
'members' => $this->db->select( 'COUNT(*)', 'groupintopic', array( "nodeid=?", $row['nodeid'] ) )->first(),
'owner' => $row['userid'],
'profile_photo' => ( $filedata ) ? "club{$row['nodeid']}.{$filedata['extension']}" : NULL,
'featured' => $row['sticky'], # I don't know if you can actually pin social groups, but the columns there so... may as well
'about' => $row['description'],
'last_activity' => $row['lastupdate'],
);
$icondata = NULL;
$iconpath = NULL;
if ( $filedata )
{
if ( $this->app->_session['more_info']['convertClubs']['photo_location'] == 'database' )
{
$icondata = $filedata['filedata'];
}
else
{
$folder = preg_split( '//', $filedata['userid'], NULL, PREG_SPLIT_NO_EMPTY );
$folder = implode( '/', $folder );
$iconpath = $this->app->_session['more_info']['convertClubs']['photo_location'] . '/' . $folder . '/' . $filedata['filedataid'] . '.attach';
}
}
$libraryClass->convertClub( $info, $iconpath, $icondata );
$libraryClass->setLastKeyValue( $row['nodeid'] );
}
}
/**
* Convert Club Members
*
* @return void
*/
public function convertClubMembers()
{
$libraryClass = $this->getLibrary();
$clubs = array();
foreach( $this->fetchClubs() AS $club )
{
$clubs[ $club['nodeid'] ] = $club['userid'];
}
foreach( $this->fetch( 'groupintopic', 'nodeid', array( $this->db->in( 'nodeid', array_keys( $clubs ) ) ) ) AS $row )
{
$libraryClass->convertClubMember( array(
'club_id' => $row['nodeid'],
'member_id' => $row['userid'],
'status' => ( $row['userid'] == $clubs[ $row['nodeid'] ] ) ? 'leader' : 'member',
) );
}
}
/* !vBulletin Specific Stuff */
/**
* @brief Silly Bit Options for Groups. Typically we would leave out app specific options (such as Forums here) however we need them for some general permissions, like uploading.
@@ -1522,6 +1783,46 @@ class _Vbulletin5 extends \IPS\convert\Software
return $forums;
}
/**
* @brief Channel GUID Mappins.
* @note As far as I can tell, these are static and not unique per installation. Only the ones that are used are present.
*/
public static $guids = array(
'clubs' => 'vbulletin-4ecbdf567f3a38.99555306',
'private_messages' => 'vbulletin-4ecbdf567f3da8.31769341'
);
/**
* Fetch Clubs
*
* @return array
*/
protected function fetchClubs()
{
$clubs = array();
try
{
/* Get the main social group node ID from the channel GUID. */
$mainNodeId = $this->db->select( 'nodeid', 'channel', array( "guid=?", static::$guids['clubs'] ) )->first();
$categories = array();
foreach( $this->db->select( 'nodeid', 'node', array( "parentid=?", $mainNodeId ) ) AS $cat )
{
$categories[] = $cat;
}
/* The actual clubs are all two levels deep from the main channel node, so we need to sub-query the categories. */
foreach( $this->db->select( '*', 'node', array( $this->db->in( 'parentid', $categories ) ) ) AS $row )
{
$clubs[ $row['nodeid'] ] = $row;
}
}
catch( \UnderflowException $e ) { /* Just in case something goofy happened and there is no main channel */ }
return $clubs;
}
/**
* @brief Types Cache
*/
@@ -2,9 +2,9 @@
/**
* @brief Converter Wordpress Core Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 12 December 2015
*/
@@ -2,9 +2,9 @@
/**
* @brief Converter XenForo 1.x Master Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @package IPS Community Suite
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @since 21 Jan 2015
*/
@@ -84,6 +84,10 @@ class _Xenforo extends \IPS\convert\Software
'table' => 'xf_user',
'where' => NULL
),
'convertMemberHistory' => array(
'table' => 'xf_user_change_log',
'where' => NULL
),
'convertWarnReason' => array(
'table' => 'xf_warning_definition',
'where' => NULL
@@ -374,6 +378,10 @@ class _Xenforo extends \IPS\convert\Software
/* First Post Data */
\IPS\Task::queue( 'convert', 'RebuildConversationFirstIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
/* Rebuild Leaderboard */
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
\IPS\Db::i()->delete('core_reputation_leaderboard_history');
return array( "f_search_index_rebuild", "f_clear_caches", "f_rebuild_pms", "f_signatures_rebuild" );
}
@@ -386,7 +394,7 @@ class _Xenforo extends \IPS\convert\Software
*/
public static function fixPostData( $post )
{
// run everything through htmlspecialchars to prevent XSS ( @see http://community.invisionpower.com/resources/bugs.html/_/ips-extras/converters/possible-xf-converter-xss-vector-r38108 )
// run everything through htmlspecialchars to prevent XSS
$post = htmlspecialchars( $post, \IPS\HTMLENTITIES | ENT_QUOTES, 'UTF-8', FALSE );
// find YouTube ID's and replace.
@@ -424,7 +432,7 @@ class _Xenforo extends \IPS\convert\Software
$maps[$member_name] = preg_quote( $maps[$member_name], '#' );
$member_name = preg_quote( $member_name, '#' );
$post = preg_replace( "#\[user={$member_id}\]\@{$member_name}\[\/user\]#i", "<a contenteditable=\"false\" rel=\"\" href=\"{$urls[$member_name]}\" data-mentionid=\"{$maps[$member_name]}\" data-ipshover-target=\"{$cardUrls[$member_name]}\" data-ipshover=\"\">@{$member_name}</a>", $post );
$post = preg_replace( "#\[user={$member_id}\]@?{$member_name}\[\/user\]#i", "<a contenteditable=\"false\" rel=\"\" href=\"{$urls[$member_name]}\" data-mentionid=\"{$maps[$member_name]}\" data-ipshover-target=\"{$cardUrls[$member_name]}\" data-ipshover=\"\">@{$member_name}</a>", $post );
}
}
}
@@ -487,19 +495,13 @@ class _Xenforo extends \IPS\convert\Software
{
if ( $attachId !== FALSE )
{
$ourAttachment = \IPS\File::get( 'core_Attachment', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attachId ) )->first() );
$messagePostId = $this->app->getLink( $row['content_id'], 'core_message_posts' );
$post = \IPS\Db::i()->select( 'msg_post', 'core_message_posts', array( "msg_id=?", $messagePostId ) )->first();
if ( preg_match( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", $post ) )
{
$post = preg_replace( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>', $post );
}
else
{
$post .= '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attachId . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
$post = preg_replace( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '[attachment=' . $attachId . ':name]', $post );
}
\IPS\Db::i()->update( 'core_message_posts', array( 'msg_post' => $post ), array( "msg_id=?", $messagePostId ) );
@@ -716,6 +718,15 @@ class _Xenforo extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $row['user_group_id'] );
}
/* Now check for group promotions */
if( count( $libraryClass->groupPromotions ) )
{
foreach( $libraryClass->groupPromotions as $groupPromotion )
{
$libraryClass->convertGroupPromotion( $groupPromotion );
}
}
}
/**
@@ -762,6 +773,72 @@ class _Xenforo extends \IPS\convert\Software
$libraryClass->setLastKeyValue( $row['warning_definition_id'] );
}
}
/**
* @brief Member history type map
*/
protected $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'user_group_id' => 'member_group_id', 'secondar_group_ids' => 'mgroup_others' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'log_id' );
$fixGroups = function( $string )
{
$groups = explode( ',', $string );
$newGroups = array();
array_walk( $groups, function( &$item, $key ) use ( &$newGroups )
{
try
{
$item = $this->app->getLink( $item, 'core_groups' );
$newGroups[] = $item;
}
catch( \OutOfRangeException $e ){}
});
return implode( ',', $newGroups );
};
foreach( $this->fetch( 'xf_user_change_log', 'log_id' ) AS $change )
{
if( !in_array( $change['field'], array_keys( $this->changeLogTypes ) ) )
{
$libraryClass->setLastKeyValue( $change['log_id'] );
continue;
}
/* Any processing we need to do */
switch( $this->changeLogTypes[ $change['field'] ] )
{
case 'member_group_id':
case 'mgroup_others':
$change['old_value'] = $fixGroups( $change['old_value'] );
$change['new_value'] = $fixGroups( $change['new_value'] );
break;
}
$libraryClass->convertMemberHistory( array(
'log_id' => $change['log_id'],
'log_member' => $change['user_id'],
'log_by' => ( $change['edit_user_id'] !== $change['user_id'] ) ? $change['edit_user_id'] : null,
'log_type' => $this->changeLogTypes[ $change['field'] ],
'log_data' => array( 'old' => $change['old_value'], 'new' => $change['new_value'] ),
'log_date' => $change['edit_date']
)
);
$libraryClass->setLastKeyValue( $change['log_id'] );
}
}
/**
* Convert members
@@ -785,6 +862,12 @@ class _Xenforo extends \IPS\convert\Software
{
$auth = $this->db->select( 'data', 'xf_user_authenticate', array( "user_id=?", $row['user_id'] ) )->first();
$data = \unserialize( $auth );
if( !isset( $data['hash'] ) )
{
throw new \UnderflowException;
}
$hash = $data['hash'];
/* vB, IPB, etc. */
@@ -990,16 +1073,27 @@ class _Xenforo extends \IPS\convert\Software
/* Warnings */
foreach( $this->db->select( '*', 'xf_warning', array( "content_type=? AND user_id=?", 'user', $row['user_id'] ) ) AS $warning )
{
$libraryClass->convertWarnLog( array(
'wl_id' => $warning['warning_id'],
'wl_member' => $warning['user_id'],
'wl_moderator' => $warning['warning_user_id'],
'wl_date' => $warning['warning_date'],
'wl_reason' => $warning['warning_definition_id'],
'wl_points' => $warning['points'],
'wl_note_mods' => $warning['notes'],
'wl_expire_date' => $warning['expiry_date'],
) );
$warnId = $libraryClass->convertWarnLog( array(
'wl_id' => $warning['warning_id'],
'wl_member' => $warning['user_id'],
'wl_moderator' => $warning['warning_user_id'],
'wl_date' => $warning['warning_date'],
'wl_reason' => $warning['warning_definition_id'],
'wl_points' => $warning['points'],
'wl_note_mods' => $warning['notes'],
'wl_expire_date' => $warning['expiry_date'],
) );
/* Add a member history record for this member */
$libraryClass->convertMemberHistory( array(
'log_id' => 'w' . $warning['warning_id'],
'log_member' => $warning['user_id'],
'log_by' => $warning['warning_user_id'],
'log_type' => 'warning',
'log_data' => array( 'wid' => $warnId ),
'log_date' => $warning['warning_date']
)
);
}
$libraryClass->setLastKeyValue( $row['user_id'] );
@@ -1157,9 +1251,9 @@ class _Xenforo extends \IPS\convert\Software
foreach( $this->fetch( 'xf_user_ignored', 'user_id' ) AS $row )
{
$libraryClass->convertIgnoredUser( array(
'ignore_id' => $row['user_id'] . '-' . $row['ignore_user_id'],
'ignore_id' => $row['user_id'] . '-' . $row['ignored_user_id'],
'ignore_owner_id' => $row['user_id'],
'ignore_ignore_id' => $row['ignore_user_id']
'ignore_ignore_id' => $row['ignored_user_id']
) );
}
}
Whitespace-only changes.