Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Blog 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
|
||||
*/
|
||||
@@ -599,22 +599,15 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$attach_id = $libraryClass->convertAttachment( $info, $map, $path, $data );
|
||||
|
||||
/* Do some re-jiggery on the post itself to make sure attachment displays */
|
||||
$ourAttachment = \IPS\File::get( 'core_Attachment', \IPS\Db::i()->select( 'attach_location', 'core_attachments', array( 'attach_id=?', $attach_id ) )->first() );
|
||||
|
||||
$entry_id = $this->app->getLink( $attachment[ $column ], 'blog_entries' );
|
||||
|
||||
$post = \IPS\Db::i()->select( 'entry_content', 'blog_entries', array( "entry_id=?", $entry_id ) )->first();
|
||||
|
||||
if ( preg_match( "/\[ATTACH(.+?)?\]".$attachment['attachmentid']."\[\/ATTACH\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[ATTACH=(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attach_id . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>', $post );
|
||||
$post = preg_replace( "/\[ATTACH=(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '[attachment=' . $attach_id . ':name]', $post );
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_content' => $post ), array( "entry_id=?", $entry_id ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$post .= '<p><a href="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="' . $attach_id . '" src="<fileStore.core_Attachment>/' . (string) $ourAttachment . '" class="ipsImage ipsImage_thumbnailed" alt=""></a></p>';
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'blog_entries', array( 'entry_content' => $post ), array( "entry_id=?", $entry_id ) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
}
|
||||
|
||||
Whitespace-only changes.
@@ -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
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Calendar 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
|
||||
*/
|
||||
|
||||
Whitespace-only changes.
@@ -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
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Pages 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
|
||||
*/
|
||||
@@ -20,6 +20,16 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
* @brief The schematic for vB3 and vB4 is similar enough that we can make specific concessions in a single converter for either version.
|
||||
*/
|
||||
protected static $isLegacy = NULL;
|
||||
|
||||
/**
|
||||
* @brief Cached article content type
|
||||
*/
|
||||
protected static $_articleContentType = NULL;
|
||||
|
||||
/**
|
||||
* Software Name
|
||||
*
|
||||
@@ -41,6 +51,52 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
/* Child classes must override this method */
|
||||
return "vbulletin";
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
|
||||
{
|
||||
$return = parent::__construct( $app, $needDB );
|
||||
|
||||
/* Is this vB3 or vB4? */
|
||||
try
|
||||
{
|
||||
if ( static::$isLegacy === NULL AND $needDB )
|
||||
{
|
||||
$version = $this->db->select('value', 'setting', array("varname=?", 'templateversion'))->first();
|
||||
|
||||
if (mb_substr($version, 0, 1) == '3') {
|
||||
static::$isLegacy = TRUE;
|
||||
} else {
|
||||
static::$isLegacy = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* If this is vB4, what is the content type ID for the cms? */
|
||||
if ( static::$_articleContentType === NULL AND ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) AND $needDB )
|
||||
{
|
||||
try
|
||||
{
|
||||
static::$_articleContentType = $this->db->select( 'contenttypeid', 'contenttype', array( "class=?", 'Article' ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
static::$_articleContentType = 24; # default
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content we can convert from this software.
|
||||
@@ -70,6 +126,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'table' => 'cms_article',
|
||||
'where' => NULL,
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'attachment',
|
||||
'where' => array( "contenttypeid=?", static::$_articleContentType )
|
||||
)
|
||||
);
|
||||
|
||||
return $return;
|
||||
@@ -101,7 +161,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
case 'database':
|
||||
return 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
return parent::countRows( $table, $where, $recache );
|
||||
break;
|
||||
@@ -355,7 +414,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
{
|
||||
try
|
||||
{
|
||||
$node = $this->db->select( '*', 'cms_node', array( "contenttypeid=? AND contentid=?", $this->_articleContentType(), $row['contentid'] ) )->first();
|
||||
$node = $this->db->select( '*', 'cms_node', array( "contenttypeid=? AND contentid=?", static::$_articleContentType, $row['contentid'] ) )->first();
|
||||
$nodeinfo = $this->db->select( '*', 'cms_nodeinfo', array( "nodeid=?", $node['nodeid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
@@ -436,38 +495,160 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\cms\Categories' . $database, 'count' => 0 ), 5, array( 'class' ) );
|
||||
\IPS\Task::queue( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\cms\Records'. $database ), 3, array( 'class' ) );
|
||||
|
||||
// This converter doesn't support tags at this time, uncomment when it does.
|
||||
//\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
|
||||
// Uncomment this once Tags are implemented for the cms;
|
||||
# \IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'cms_custom_database_' . $database, 'class' => 'IPS\cms\Records' . $database ), 2, array( 'app', 'link', 'class' ) );
|
||||
}
|
||||
|
||||
return array( "f_recount_cms_categories", "f_rebuild_cms_tags" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Cached article content type
|
||||
*/
|
||||
protected $_articleContentType = NULL;
|
||||
|
||||
/**
|
||||
* Return the article content type
|
||||
* Convert attachments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _articleContentType()
|
||||
public function convertAttachments()
|
||||
{
|
||||
if ( $this->_articleContentType === NULL )
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'attachmentid' );
|
||||
|
||||
$where = NULL;
|
||||
$column = NULL;
|
||||
|
||||
if ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) )
|
||||
{
|
||||
$where = array( "contenttypeid=?", static::$_articleContentType );
|
||||
$column = 'contentid';
|
||||
$table = 'attachment';
|
||||
}
|
||||
|
||||
foreach( $this->fetch( $table, 'attachmentid', $where ) as $attachment )
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->_articleContentType = $this->db->select( 'contenttypeid', 'contenttype', array( "class=?", 'Article' ) )->first();
|
||||
{
|
||||
$vbRecordId = $this->db->select( 'contentid', 'cms_article', array( "contentid=?", $attachment[ $column ] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$this->_articleContentType = 24; # default
|
||||
/* Log this so that it's easier to diagnose */
|
||||
$this->app->log( 'attachment_vbcms_missing_parent', __METHOD__, \IPS\convert\App::LOG_WARNING, $attachment['attachmentid'] );
|
||||
|
||||
/* If the record is missing, there isn't much we can do. */
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) )
|
||||
{
|
||||
$filedata = $this->db->select( '*', 'filedata', array( "filedataid=?", $attachment['filedataid'] ) )->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
$filedata = $attachment;
|
||||
$filedata['filedataid'] = $attachment['attachmentid'];
|
||||
}
|
||||
|
||||
$map = array(
|
||||
'id1' => $vbRecordId,
|
||||
'id2' => NULL,
|
||||
'id3' => 1
|
||||
);
|
||||
|
||||
$info = array(
|
||||
'attach_id' => $attachment['attachmentid'],
|
||||
'attach_file' => $attachment['filename'],
|
||||
'attach_date' => $attachment['dateline'],
|
||||
'attach_member_id' => $attachment['userid'],
|
||||
'attach_hits' => $attachment['counter'],
|
||||
'attach_ext' => $filedata['extension'],
|
||||
'attach_filesize' => $filedata['filesize'],
|
||||
);
|
||||
|
||||
if ( $this->app->_session['more_info']['convertAttachments']['file_location'] == 'database' )
|
||||
{
|
||||
/* Simples! */
|
||||
$data = $filedata['filedata'];
|
||||
$path = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = NULL;
|
||||
$path = implode( '/', preg_split( '//', $filedata['userid'], -1, PREG_SPLIT_NO_EMPTY ) );
|
||||
$path = rtrim( $this->app->_session['more_info']['convertAttachments']['file_location'], '/' ) . '/' . $path . '/' . $attachment['filedataid'] . '.attach';
|
||||
}
|
||||
|
||||
$attach_id = $libraryClass->convertAttachment( $info, $map, $path, $data );
|
||||
|
||||
/* Do some re-jiggery on the post itself to make sure attachment displays */
|
||||
/* The database is hardcoded to 1 while the conversion, so we have to use 1 here */
|
||||
$dbId = $this->app->getLink( 1, 'cms_databases' );
|
||||
$dbName = "cms_custom_database_" . $dbId;
|
||||
|
||||
try
|
||||
{
|
||||
$recordId = $this->app->getLink( $attachment[ $column ], 'cms_custom_database_' . $dbId );
|
||||
|
||||
/* Get the database object */
|
||||
$ipsDb = \IPS\cms\Databases::load( $dbId);
|
||||
|
||||
$post = \IPS\Db::i()->select( $ipsDb->field_content, $dbName, array( "primary_id_field=?", $recordId ) )->first();
|
||||
|
||||
if ( preg_match( "/\[ATTACH(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[ATTACH=(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '[attachment=' . $attach_id . ':name]', $post );
|
||||
\IPS\Db::i()->update( $dbName, array( 'field_2' => $post ), array( "primary_id_field=?", $recordId ) );
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e ) { }
|
||||
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
}
|
||||
|
||||
return $this->_articleContentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of conversion methods that require additional information
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array( 'convertAttachments' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get More Information
|
||||
*
|
||||
* @param string $method Conversion method
|
||||
* @return array
|
||||
*/
|
||||
public function getMoreInfo( $method )
|
||||
{
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'file_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();
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Wordpress 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
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo Page Nodes 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
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForoRm 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
|
||||
*/
|
||||
|
||||
Whitespace-only changes.
@@ -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.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo Resource Manager 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
|
||||
*/
|
||||
@@ -101,6 +101,19 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'convertDownloadsReviews'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finish
|
||||
*
|
||||
* @return array Messages to display
|
||||
*/
|
||||
public function finish()
|
||||
{
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'class' => 'IPS\downloads\File', 'link' => 'downloads_files' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'class' => 'IPS\downloads\File\Review', 'link' => 'downloads_reviews' ), 2, array( 'app', 'link', 'class' ) );
|
||||
|
||||
return array( );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get More Information
|
||||
@@ -330,7 +343,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$featured = 1;
|
||||
}
|
||||
catch( \UnderflowExceptioN $e ) {}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
$info = array(
|
||||
'file_id' => $row['resource_id'],
|
||||
@@ -363,30 +376,48 @@ class _Xenforo extends \IPS\convert\Software
|
||||
}
|
||||
else
|
||||
{
|
||||
$file_data = $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'resource_version', $record['resource_version_id'] ) )->join( 'xf_attachment_data', "xf_attachment.data_id = xf_attachment_data.data_id" )->first();
|
||||
$group = floor( $row['user_id'] / 1000 );
|
||||
|
||||
try
|
||||
{
|
||||
$file_data = $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'resource_version', $record['resource_version_id'] ) )->join( 'xf_attachment_data', "xf_attachment.data_id = xf_attachment_data.data_id" )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$this->app->log( 'xenforo_resource_missing_record', __METHOD__, \IPS\convert\App::LOG_WARNING, $record['resource_update_id'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
$group = floor( $file_data['data_id'] / 1000 );
|
||||
|
||||
$records[] = array(
|
||||
'record_id' => $record['resource_update_id'],
|
||||
'record_type' => 'upload',
|
||||
'file_path' => rtrim( $this->app->_session['more_info']['convertDownloadsFiles']['file_location'], '/' ) . '/' . $group . '/' . $file_data['data_id'] . '-' . $file_data['file_hash'] . '.data',
|
||||
'record_time' => $record['release_date']
|
||||
'record_time' => $record['release_date'],
|
||||
'record_realname' => $file_data['filename']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* And now screenshots */
|
||||
foreach( $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'resource_update', $record['resource_update_id'] ) )->join( 'xf_attachment_data', "xf_attachment.data_id = xf_attachment_data.data_id" ) AS $screen )
|
||||
try
|
||||
{
|
||||
$group = floor( $row['user_id'] / 1000 );
|
||||
|
||||
$records[] = array(
|
||||
'record_type' => 'ssupload',
|
||||
'file_path' => rtrim( $this->app->_session['more_info']['convertDownloadsFiles']['file_location'], '/' ) . '/' . $group . '/' . $screen['data_id'] . '-' . $screen['file_hash'] . '.data',
|
||||
'record_time' => $record['release_date']
|
||||
);
|
||||
foreach( $this->db->select( '*', 'xf_attachment', array( "xf_attachment.content_type=? AND xf_attachment.content_id=?", 'resource_update', $record['resource_update_id'] ) )->join( 'xf_attachment_data', "xf_attachment.data_id = xf_attachment_data.data_id" ) AS $screen )
|
||||
{
|
||||
$group = floor( $file_data['data_id'] / 1000 );
|
||||
|
||||
$records[] = array(
|
||||
'record_type' => 'ssupload',
|
||||
'file_path' => rtrim( $this->app->_session['more_info']['convertDownloadsFiles']['file_location'], '/' ) . '/' . $group . '/' . $screen['data_id'] . '-' . $screen['file_hash'] . '.data',
|
||||
'record_time' => $record['release_date'],
|
||||
'record_realname' => $screen['filename']
|
||||
);
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$this->app->log( 'xenforo_resource_missing_screenshot', __METHOD__, \IPS\convert\App::LOG_WARNING, $record['resource_update_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$cfields = array();
|
||||
foreach( $this->db->select( 'field_id, field_value', 'xf_resource_field_value', array( "resource_id=?", $row['resource_id'] ) )->setKeyField( 'field_id' )->setValueField( 'field_value' ) AS $key => $value )
|
||||
{
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Software Exception 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
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter BBPress 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 Nov 2016
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter ExpressionEngine 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 17 June 2016
|
||||
*/
|
||||
@@ -472,7 +472,7 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -97,7 +97,8 @@ class _Mybb extends \IPS\convert\Software
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertAttachments'
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -113,6 +114,36 @@ class _Mybb extends \IPS\convert\Software
|
||||
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertForumsPosts':
|
||||
/* Get our reactions to let the admin map them */
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_reactions' ), 'IPS\Content\Reaction' ) AS $reaction )
|
||||
{
|
||||
$options[ $reaction->id ] = $reaction->_icon->url;;
|
||||
$descriptions[ $reaction->id ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_title_' . $reaction->id ) . '<br>' . $reaction->_description;
|
||||
}
|
||||
|
||||
$return['convertForumsPosts'] = array(
|
||||
'rep_positive' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
'rep_negative' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'attach_location' => array(
|
||||
@@ -144,6 +175,10 @@ class _Mybb extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'convert', 'RebuildFirstPostIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'DeleteEmptyTopics', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
|
||||
/* Rebuild Leaderboard */
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
|
||||
\IPS\Db::i()->delete('core_reputation_leaderboard_history');
|
||||
|
||||
/* Caches */
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'forums_topics', 'class' => 'IPS\forums\Topic' ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
@@ -446,6 +481,8 @@ class _Mybb extends \IPS\convert\Software
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'reputation', array( "pid=?", $row['pid'] ) ) AS $rep )
|
||||
{
|
||||
$reaction = ( $rep['reputation'] > 0 ) ? $this->app->_session['more_info']['convertForumsPosts']['rep_positive'] : $this->app->_session['more_info']['convertForumsPosts']['rep_negative'];
|
||||
|
||||
$libraryClass->convertReputation( array(
|
||||
'id' => $rep['rid'],
|
||||
'app' => 'forums',
|
||||
@@ -454,7 +491,7 @@ class _Mybb extends \IPS\convert\Software
|
||||
'member_id' => $rep['adduid'],
|
||||
'member_received' => $rep['uid'],
|
||||
'rep_date' => $rep['dateline'],
|
||||
'rep_rating' => $rep['reputation']
|
||||
'reaction' => $reaction
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -559,7 +596,7 @@ class _Mybb extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -101,8 +101,8 @@ class _Phpbb extends \IPS\convert\Software
|
||||
{
|
||||
if ( $forum['forum_password'] )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words["forum_password_{$forum['forum_id']}"] = \IPS\Member::loggedIn()->language()->addToStack( 'forum_password', FALSE, array( 'sprintf' => array( $forum['forum_name'] ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words["forum_password_{$forum['forum_id']}_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'forum_password_desc' );
|
||||
\IPS\Member::loggedIn()->language()->words["forum_password_{$forum['forum_id']}"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_forum_password', FALSE, array( 'sprintf' => array( $forum['forum_name'] ) ) );
|
||||
\IPS\Member::loggedIn()->language()->words["forum_password_{$forum['forum_id']}_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'convert_forum_password_desc' );
|
||||
|
||||
$return['convertForumsForums']["forum_password_{$forum['forum_id']}"] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Text',
|
||||
@@ -430,14 +430,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' => $warning['warning_id'],
|
||||
'wl_member' => $warning['user_id'],
|
||||
'wl_moderator' => $log['user_id'],
|
||||
'wl_date' => $warning['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' . $warning['warning_id'],
|
||||
'log_member' => $warning['user_id'],
|
||||
'log_by' => $log['user_id'],
|
||||
'log_type' => 'warning',
|
||||
'log_data' => array( 'wid' => $warnId ),
|
||||
'log_date' => $warning['warning_time']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['post_id'] );
|
||||
@@ -472,7 +483,28 @@ class _Phpbb extends \IPS\convert\Software
|
||||
'attach_filesize' => $row['filesize'],
|
||||
);
|
||||
|
||||
$libraryClass->convertAttachment( $info, $map, rtrim( $this->app->_session['more_info']['convertAttachments']['attach_location'], '/' ) . '/' . $row['physical_filename'] );
|
||||
$attachId = $libraryClass->convertAttachment( $info, $map, rtrim( $this->app->_session['more_info']['convertAttachments']['attach_location'], '/' ) . '/' . $row['physical_filename'] );
|
||||
|
||||
/* Do some re-jiggery on the post itself to make sure attachment displays */
|
||||
if ( $attachId !== FALSE )
|
||||
{
|
||||
try
|
||||
{
|
||||
$pid = $this->app->getLink( $row['post_msg_id'], 'forums_posts' );
|
||||
|
||||
$post = \IPS\Db::i()->select( 'post', 'forums_posts', array( "pid=?", $pid ) )->first();
|
||||
|
||||
$attachmentName = preg_quote( $row['real_filename'], '/' );
|
||||
if ( preg_match( "/\[attachment=(.+?)?\]\<\!\-\- ia0 \-\-\>{$attachmentName}\<\!\-\- ia0 \-\-\>\[\/attachment\]/i", $post ) )
|
||||
{
|
||||
$post = preg_replace( "/\[attachment=(.+?)?\]\<\!\-\- ia0 \-\-\>{$attachmentName}\<\!\-\- ia0 \-\-\>\[\/attachment\]/i", '[attachment=' . $attachId . ':name]', $post );
|
||||
|
||||
\IPS\Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
catch( \OutOfRangeException $e ) {}
|
||||
}
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['attach_id'] );
|
||||
}
|
||||
@@ -499,7 +531,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
{
|
||||
$class = '\IPS\forums\Topic';
|
||||
$types = array( 'topics', 'forums_topics' );
|
||||
$oldId = \IPS\Request::i()->tid;
|
||||
$oldId = \IPS\Request::i()->tid ?: \IPS\Request::i()->t;
|
||||
}
|
||||
}
|
||||
elseif( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'viewforum.php' ) !== FALSE )
|
||||
@@ -523,7 +555,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter PhpMyForum Forums 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
|
||||
*/
|
||||
@@ -334,7 +334,7 @@ class _Punbb extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
/**
|
||||
* @brief Converter SMF 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
|
||||
* @todo SMF supports karma which we should be able to convert to reactions (reputation), but we need a sample database that used karma
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Forums;
|
||||
@@ -69,7 +70,7 @@ class _Smf extends \IPS\convert\Software
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'attachments',
|
||||
'where' => array( "id_msg<>?", 0 )
|
||||
'where' => array( "id_msg<>? AND attachment_type < ?", 0, 3 )
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -438,19 +439,11 @@ class _Smf extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'id_attach' );
|
||||
|
||||
foreach( $this->fetch( 'attachments', 'id_attach' ) AS $row )
|
||||
foreach( $this->fetch( 'attachments', 'id_attach', array( "id_msg<>? AND attachment_type < ?", 0, 3 ) ) AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( $row['id_msg'] AND $row['attachment_type'] < 3 )
|
||||
{
|
||||
$post = $this->db->select( 'id_topic, poster_time', 'messages', array( "id_msg=?", $row['id_msg'] ) )->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Is an avatar or thumbnail */
|
||||
throw new \UnderflowException;
|
||||
}
|
||||
$post = $this->db->select( 'id_topic, poster_time', 'messages', array( "id_msg=?", $row['id_msg'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
@@ -474,13 +467,13 @@ class _Smf extends \IPS\convert\Software
|
||||
/* Clean filename per legacy SMF requirements */
|
||||
$cleanName = strtr( $row['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 = $row['id_attach'] . '_' . str_replace( '.', '_', $cleanName ) . md5( $cleanName );
|
||||
}
|
||||
$location = str_replace( ' ', '_', $location );
|
||||
|
||||
/* Fix File Name */
|
||||
// http://community.invisionpower.com/tracker/issue-21020-smf-attachments-are-crazy/
|
||||
$row['filename'] = str_replace(' ', '_', $row['filename']);
|
||||
$row['filename'] = str_replace('!', '', $row['filename']);
|
||||
$row['filename'] = str_replace('(', '', $row['filename']);
|
||||
@@ -551,9 +544,10 @@ class _Smf extends \IPS\convert\Software
|
||||
}
|
||||
elseif( isset( \IPS\Request::i()->board ) )
|
||||
{
|
||||
$pieces = explode( '.', \IPS\Request::i()->board );
|
||||
$class = '\IPS\forums\Forum';
|
||||
$types = array( 'forums', 'forums_forums' );
|
||||
$oldId = \IPS\Request::i()->board;
|
||||
$oldId = $pieces[0];
|
||||
}
|
||||
|
||||
if( isset( $class ) )
|
||||
@@ -570,7 +564,7 @@ class _Smf extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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\Forums;
|
||||
@@ -139,8 +138,9 @@ class _Vanilla extends \IPS\convert\Software
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertForums',
|
||||
'convertAttachments'
|
||||
'convertForumsForums',
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -156,12 +156,12 @@ class _Vanilla extends \IPS\convert\Software
|
||||
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertForums':
|
||||
$return['convertForums'] = array();
|
||||
case 'convertForumsForums':
|
||||
$return['convertForumsForums'] = array();
|
||||
|
||||
/* Find out where the photos live */
|
||||
\IPS\Member::loggedIn()->language()->words['attach_location_desc'] = \IPS\Member::loggedIn()->language()->addToStack( 'attach_location' );
|
||||
$return['convertForums']['attach_location'] = array(
|
||||
$return['convertForumsForums']['attach_location'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Text',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
@@ -169,6 +169,33 @@ class _Vanilla extends \IPS\convert\Software
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_vanilla_photopath'),
|
||||
);
|
||||
break;
|
||||
case 'convertForumsPosts':
|
||||
/* Get our reactions to let the admin map them */
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_reactions' ), 'IPS\Content\Reaction' ) AS $reaction )
|
||||
{
|
||||
$options[ $reaction->id ] = $reaction->_icon->url;
|
||||
$descriptions[ $reaction->id ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_title_' . $reaction->id ) . '<br>' . $reaction->_description;
|
||||
}
|
||||
|
||||
$return['convertForumsPosts'] = array();
|
||||
|
||||
foreach( $this->db->select( '*', 'action' ) as $reaction )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words['reaction_' . $reaction['ActionID'] ] = $reaction['Name'];
|
||||
\IPS\Member::loggedIn()->language()->words['reaction_' . $reaction['ActionID'] . '_desc' ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_convert_help');
|
||||
|
||||
$return['convertForumsPosts']['reaction_' . $reaction['ActionID'] ] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'attach_location' => array(
|
||||
@@ -200,6 +227,10 @@ class _Vanilla extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'convert', 'RebuildFirstPostIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'DeleteEmptyTopics', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
|
||||
/* Rebuild Leaderboard */
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
|
||||
\IPS\Db::i()->delete('core_reputation_leaderboard_history');
|
||||
|
||||
/* Caches */
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'forums_topics', 'class' => 'IPS\forums\Topic' ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
@@ -293,7 +324,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'c.CategoryID' );
|
||||
|
||||
$uploadsPath = $this->app->_session['more_info']['convertAttachments']['attach_location'];
|
||||
$uploadsPath = $this->app->_session['more_info']['convertForumsForums']['attach_location'];
|
||||
|
||||
$forums = $this->fetch( array( 'Category', 'c' ), 'CategoryID', array( 'c.CategoryID<>?', -1 ),
|
||||
'c.*, lcu.UserID as LastCommentUserID, lcu.Name as LastCommentUserName, ld.Name as LastDiscussionName'
|
||||
@@ -303,7 +334,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
|
||||
foreach( $forums AS $row )
|
||||
{
|
||||
$icon = $row['Icon'] ? VanillaCore::parseMediaLocation( $row['Icon'], $uploadsPath ) : NULL;
|
||||
$icon = ( isset( $row['Icon'] ) AND $row['Icon'] ) ? VanillaCore::parseMediaLocation( $row['Icon'], $uploadsPath ) : NULL;
|
||||
$info = [
|
||||
'id' => $row['CategoryID'],
|
||||
'name' => $row['Name'],
|
||||
@@ -351,7 +382,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
->first();
|
||||
|
||||
$row['DateLastComment'] = $data['DateInserted'];
|
||||
$row['LastCommentUserId'] = $data['InsertUserId'];
|
||||
$row['LastCommentUserID'] = $data['InsertUserId'];
|
||||
$row['LastCommentUserName'] = $data['Name'];
|
||||
}
|
||||
|
||||
@@ -363,7 +394,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
'posts' => $row['CountComments'],
|
||||
'starter_id' => $row['InsertUserID'],
|
||||
'start_date' => VanillaCore::mysqlToDateTime( $row['DateInserted'] ),
|
||||
'last_poster_id' => $row['LastCommentUserId'],
|
||||
'last_poster_id' => $row['LastCommentUserID'],
|
||||
'last_post' => VanillaCore::mysqlToDateTime( $row['DateLastComment'] ),
|
||||
'starter_name' => $row['UserName'],
|
||||
'last_poster_name' => $row['LastCommentUserName'],
|
||||
@@ -440,6 +471,23 @@ class _Vanilla extends \IPS\convert\Software
|
||||
|
||||
$libraryClass->convertForumsPost( $info );
|
||||
$libraryClass->setLastKeyValue( $row['DiscussionID'] );
|
||||
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'reaction', array( "ParentType=? AND ParentID=?", 'comment', $row['DiscussionID'] ) ) AS $rep )
|
||||
{
|
||||
$reaction = $this->app->_session['more_info']['convertForumsPosts']['reaction_' . $rep['ActionID'] ];
|
||||
|
||||
$libraryClass->convertReputation( array(
|
||||
'id' => $rep['ReactionID'],
|
||||
'app' => 'forums',
|
||||
'type' => 'pid',
|
||||
'type_id' => 'fp-' . $row['DiscussionID'],
|
||||
'member_id' => $rep['InsertUserID'],
|
||||
'member_received' => $rep['ParentAuthorID'],
|
||||
'rep_date' => VanillaCore::mysqlToDateTime( $row['DateInserted'] ),
|
||||
'reaction' => $reaction
|
||||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter vBulletin 4.x Forums 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
|
||||
*/
|
||||
@@ -121,6 +121,18 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'table' => 'post',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubForums' => array(
|
||||
'table' => 'socialgroup',
|
||||
'where' => array( \IPS\Db::i()->bitwiseWhere( array( 'options' => static::$bitOptions['cluboptions'] ), 'enable_group_messages' ) )
|
||||
),
|
||||
'convertClubTopics' => array(
|
||||
'table' => 'discussion',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubPosts' => array(
|
||||
'table' => 'groupmessage',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'attachment',
|
||||
'where' => ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? array( "contenttypeid=?", static::$postContentType ) : NULL
|
||||
@@ -162,6 +174,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'convert', 'RebuildFirstPostIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'DeleteEmptyTopics', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
|
||||
/* Rebuild Leaderboard */
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
|
||||
\IPS\Db::i()->delete('core_reputation_leaderboard_history');
|
||||
|
||||
/* Caches */
|
||||
\IPS\Task::queue( 'convert', 'RebuildTagCache', array( 'app' => $this->app->app_id, 'link' => 'forums_topics', 'class' => 'IPS\forums\Topic' ), 3, array( 'app', 'link', 'class' ) );
|
||||
|
||||
@@ -186,7 +202,10 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array( 'convertAttachments' );
|
||||
return array(
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,6 +219,44 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertForumsPosts':
|
||||
/* Get our reactions to let the admin map them */
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_reactions' ), 'IPS\Content\Reaction' ) AS $reaction )
|
||||
{
|
||||
$options[ $reaction->id ] = $reaction->_icon->url;
|
||||
$descriptions[ $reaction->id ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_title_' . $reaction->id ) . '<br>' . $reaction->_description;
|
||||
}
|
||||
|
||||
$return['convertForumsPosts'] = array(
|
||||
'rep_neutral' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
'rep_positive' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
'rep_negative' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'file_location' => array(
|
||||
@@ -425,7 +482,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'views' => $topic['views'],
|
||||
'approved' => $topic['visible'],
|
||||
'pinned' => $topic['sticky'],
|
||||
'topic_open_time' => $topic['dateline'],
|
||||
'topic_hiddenposts' => $topic['hiddencount'] + $topic['deletedcount']
|
||||
);
|
||||
|
||||
@@ -556,6 +612,11 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
/* Reputation */
|
||||
foreach( $this->db->select( '*', 'reputation', array( "postid=?", $post['postid'] ) ) AS $rep )
|
||||
{
|
||||
$reaction = ( $rep['reputation'] > 0 ) ?
|
||||
$this->app->_session['more_info']['convertForumsPosts']['rep_positive'] :
|
||||
( ( $rep['reputation'] == 0 ) ? $this->app->_session['more_info']['convertForumsPosts']['rep_neutral'] :
|
||||
$this->app->_session['more_info']['convertForumsPosts']['rep_negative'] );
|
||||
|
||||
$libraryClass->convertReputation( array(
|
||||
'id' => $rep['reputationid'],
|
||||
'app' => 'forums',
|
||||
@@ -564,7 +625,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'member_id' => $rep['whoadded'],
|
||||
'member_received' => $rep['userid'],
|
||||
'rep_date' => $rep['dateline'],
|
||||
'rep_rating' => $rep['reputation']
|
||||
'reaction' => $reaction
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -572,6 +633,8 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$latestedit = 0;
|
||||
$reason = NULL;
|
||||
$name = NULL;
|
||||
$newText = static::fixPostData( $post['pagetext'] );
|
||||
|
||||
foreach( $this->db->select( '*', 'postedithistory', array( "postid=?", $post['postid'] ) ) AS $edit )
|
||||
{
|
||||
$libraryClass->convertEditHistory( array(
|
||||
@@ -580,9 +643,12 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'comment_id' => $post['postid'],
|
||||
'member' => $edit['userid'],
|
||||
'time' => $edit['dateline'],
|
||||
'old' => $edit['pagetext']
|
||||
'old' => static::fixPostData( $edit['pagetext'] ),
|
||||
'new' => $newText
|
||||
) );
|
||||
|
||||
$newText = static::fixPostData( $edit['pagetext'] );
|
||||
|
||||
if ( $edit['dateline'] > $latestedit )
|
||||
{
|
||||
$latestedit = $edit['dateline'];
|
||||
@@ -724,6 +790,122 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$libraryClass->setLastKeyValue( $attachment['attachmentid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Forums
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubForums()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'groupid' );
|
||||
foreach( $this->fetch( 'socialgroup', 'groupid', array( \IPS\Db::i()->bitwiseWhere( array( 'options' => static::$bitOptions['cluboptions'] ), 'enable_group_messages' ) ) ) AS $row )
|
||||
{
|
||||
$libraryClass->convertClubForum( array(
|
||||
'id' => "clubforum{$row['groupid']}",
|
||||
'name' => "{$row['name']} Topics",
|
||||
'description' => "<p>{$row['description']}</p>",
|
||||
'topics' => $row['discussions'],
|
||||
'club_id' => $row['groupid']
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['groupid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Topics
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubTopics()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'discussionid' );
|
||||
foreach( $this->fetch( 'discussion', 'discussionid' ) AS $row )
|
||||
{
|
||||
try
|
||||
{
|
||||
$firstpost = $this->db->select( '*', 'groupmessage', array( "gmid=?", $row['firstpostid'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $row['discussionid'] );
|
||||
continue;
|
||||
}
|
||||
|
||||
switch( $firstpost['state'] )
|
||||
{
|
||||
case 'visible':
|
||||
$approved = 1;
|
||||
break;
|
||||
|
||||
case 'moderation':
|
||||
$approved = 0;
|
||||
break;
|
||||
|
||||
case 'deleted':
|
||||
$approved = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertClubTopic( array(
|
||||
'tid' => "clubtopic{$row['discussionid']}",
|
||||
'title' => $firstpost['title'],
|
||||
'forum_id' => "clubforum{$row['groupid']}",
|
||||
'state' => 'open',
|
||||
'starter_id' => $row['lastposterid'],
|
||||
'start_date' => $firstpost['dateline'],
|
||||
'last_poster_id' => $row['lastposterid'],
|
||||
'last_post' => $row['lastpost'],
|
||||
'starter_name' => $firstpost['postusername'],
|
||||
'last_poster_name' => $row['lastposter'],
|
||||
'approved' => $approved,
|
||||
) );
|
||||
|
||||
$libraryClass->setLastKeyValue( $row['discussionid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Club Posts
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubPosts()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'gmid' );
|
||||
foreach( $this->fetch( 'groupmessage', 'gmid' ) AS $row )
|
||||
{
|
||||
switch( $row['state'] )
|
||||
{
|
||||
case 'visible':
|
||||
$queued = 0;
|
||||
break;
|
||||
|
||||
case 'moderation':
|
||||
$queued = 1;
|
||||
break;
|
||||
|
||||
case 'deleted':
|
||||
$queued = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
$libraryClass->convertClubPost( array(
|
||||
'pid' => "clubpost{$row['gmid']}",
|
||||
'topic_id' => "clubtopic{$row['discussionid']}",
|
||||
'post' => static::fixPostData( $row['pagetext'] ),
|
||||
'author_id' => $row['postuserid'],
|
||||
'author_name' => $row['postusername'],
|
||||
'post_date' => $row['dateline'],
|
||||
'queued' => $queued,
|
||||
) );
|
||||
$libraryClass->setLastKeyValue( $row['gmid'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* !vBulletin Stuff */
|
||||
|
||||
@@ -755,6 +937,13 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'displaywrt' => 1048576,
|
||||
'canreputation' => 2097152,
|
||||
),
|
||||
'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 Forums 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
|
||||
*/
|
||||
@@ -136,6 +136,10 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
\IPS\Task::queue( 'convert', 'RebuildContent', array( 'app' => $this->app->app_id, 'link' => 'forums_posts', 'class' => 'IPS\forums\Topic\Post' ), 2, array( 'app', 'link', 'class' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildFirstPostIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'DeleteEmptyTopics', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
|
||||
/* Rebuild Leaderboard */
|
||||
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
|
||||
\IPS\Db::i()->delete('core_reputation_leaderboard_history');
|
||||
|
||||
return array( 'f_rebuild_posts', 'f_recounting_forums', 'f_recounting_topics' );
|
||||
}
|
||||
@@ -158,7 +162,10 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
*/
|
||||
public static function checkConf()
|
||||
{
|
||||
return array( 'convertAttachments' );
|
||||
return array(
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -172,6 +179,28 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertForumsPosts':
|
||||
/* Get our reactions to let the admin map them */
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_reactions' ), 'IPS\Content\Reaction' ) AS $reaction )
|
||||
{
|
||||
$options[ $reaction->id ] = $reaction->_icon->url;
|
||||
$descriptions[ $reaction->id ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_title_' . $reaction->id ) . '<br>' . $reaction->_description;
|
||||
}
|
||||
|
||||
$return['convertForumsPosts'] = array(
|
||||
'rep_like' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'file_location' => array(
|
||||
@@ -205,8 +234,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$libraryClass = $this->getLibrary();
|
||||
|
||||
$libraryClass::setKey( 'node.nodeid' );
|
||||
|
||||
foreach( $this->fetch( 'node', 'nodeid', array( "node.nodeid<>? AND closure.parent=? AND node.contenttypeid=?", 2, 2, $this->fetchType( 'Channel' ) ) )->join( 'closure', "closure.child=node.nodeid" ) AS $forum )
|
||||
$clubs = $this->fetchClubs();
|
||||
foreach( $this->fetch( 'node', 'nodeid', array( "node.nodeid<>2 AND ( ( node.parentid=? AND node.contenttypeid=? ) OR " . $this->db->in( 'nodeid', array_keys( $clubs ) ) . " )", $this->fetchType( 'Thread' ), $this->fetchType( 'Channel' ) ) ) AS $forum )
|
||||
{
|
||||
$self = $this;
|
||||
$checkpermission = function( $name, $perm ) use ( $forum, $self )
|
||||
@@ -234,12 +263,13 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'last_post' => $forum['lastcontent'],
|
||||
'last_poster_id' => $forum['lastauthorid'],
|
||||
'last_poster_name' => $forum['lastcontentauthor'],
|
||||
'parent_id' => $forum['parentid'],
|
||||
'parent_id' => ( !array_key_exists( $forum['nodeid'], $clubs ) ) ? $forum['parentid'] : -1,
|
||||
'club_id' => ( array_key_exists( $forum['nodeid'], $clubs ) ) ? $forum['nodeid'] : NULL,
|
||||
'position' => $forum['displayorder'],
|
||||
'preview_posts' => $checkpermission( 'forumoptions', 'moderatenewpost' ),
|
||||
'inc_postcount' => 1,
|
||||
'forum_allow_rating' => 1,
|
||||
'sub_can_post' => ( $forum['parentid'] == 2 ) ? 0 : 1,
|
||||
'sub_can_post' => ( $forum['parentid'] == 2 AND !array_key_exists( $forum['nodeid'], $clubs ) ) ? 0 : 1,
|
||||
);
|
||||
|
||||
$libraryClass->convertForumsForum( $info );
|
||||
@@ -259,7 +289,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'node.nodeid' );
|
||||
|
||||
foreach( $this->fetch( 'node', 'node.nodeid', array( \IPS\Db::i()->in( 'node.parentid', array_keys( $this->fetchForums() ) ) . " AND " . \IPS\Db::i()->in( 'node.contenttypeid', array( $this->fetchType( 'Text' ), $this->fetchType( 'Poll' ), $this->fetchType( 'Gallery' ), $this->fetchType( 'Video' ), $this->fetchType( 'Link' ) ) ) ) )->join( 'text', 'text.nodeid = node.nodeid' ) AS $topic )
|
||||
$clubs = $this->fetchClubs();
|
||||
foreach( $this->fetch( 'node', 'node.nodeid', array( "( " . \IPS\Db::i()->in( 'node.parentid', array_keys( $this->fetchForums() ) ) . " OR " . $this->db->in( 'node.parentid', array_keys( $clubs ) ) . " ) AND " . \IPS\Db::i()->in( 'node.contenttypeid', array( $this->fetchType( 'Text' ), $this->fetchType( 'Poll' ), $this->fetchType( 'Gallery' ), $this->fetchType( 'Video' ), $this->fetchType( 'Link' ) ) ) ) )->join( 'text', 'text.nodeid = node.nodeid' ) AS $topic )
|
||||
{
|
||||
/* Pesky Polls */
|
||||
$poll = NULL;
|
||||
@@ -445,7 +476,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'member_id' => $rep['whoadded'],
|
||||
'member_received' => $rep['userid'],
|
||||
'rep_date' => $rep['dateline'],
|
||||
'rep_rating' => $rep['reputation']
|
||||
'reaction' => $this->app->_session['more_info']['convertForumsPosts']['rep_like']
|
||||
) );
|
||||
}
|
||||
|
||||
@@ -453,6 +484,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$latestedit = 0;
|
||||
$reason = NULL;
|
||||
$name = NULL;
|
||||
$newText = $post['rawtext'];
|
||||
|
||||
foreach( $this->db->select( '*', 'postedithistory', array( "nodeid=?", $post['nodeid'] ) ) AS $edit )
|
||||
{
|
||||
$libraryClass->convertEditHistory( array(
|
||||
@@ -461,9 +494,12 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
'comment_id' => $post['nodeid'],
|
||||
'member' => $edit['userid'],
|
||||
'time' => $edit['dateline'],
|
||||
'old' => $edit['pagetext']
|
||||
'old' => $edit['pagetext'],
|
||||
'new' => $newText
|
||||
) );
|
||||
|
||||
$newText = $edit['pagetext'];
|
||||
|
||||
if ( $edit['dateline'] > $latestedit )
|
||||
{
|
||||
$latestedit = $edit['dateline'];
|
||||
@@ -566,6 +602,19 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
$data = NULL;
|
||||
$path = implode( '/', preg_split( '//', $attachment['userid'], -1, PREG_SPLIT_NO_EMPTY ) );
|
||||
$path = rtrim( $this->app->_session['more_info']['convertAttachments']['file_location'], '/' ) . '/' . $path . '/' . $attachment['filedataid'] . '.attach';
|
||||
|
||||
/* Apparently vBulletin had a bug between 5.0.0 and 5.1.3 where attachments were incorrectly stored in /path/userid/file.attach rather than in the user ID split location */
|
||||
if ( !file_exists( $path ) )
|
||||
{
|
||||
$path = rtrim( $this->app->_session['more_info']['convertAttachments']['file_location'], '/' ) . '/' . $attachment['userid'] . '/' . $attachment['filedataid'] . '.attach';
|
||||
}
|
||||
|
||||
/* Still not there? It might be in the database still */
|
||||
if ( !file_exists( $path ) AND $attachment['filedata'] )
|
||||
{
|
||||
$data = $attachment['filedata'];
|
||||
$path = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
$attach_id = $libraryClass->convertAttachment( $info, $map, $path, $data );
|
||||
@@ -657,8 +706,8 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
protected function fetchForums()
|
||||
{
|
||||
$forums = array();
|
||||
|
||||
foreach( $this->db->select( '*', 'node', array( "node.nodeid<>2 AND closure.parent=? AND node.contenttypeid=?", $this->fetchType( 'Thread' ), $this->fetchType( 'Channel' ) ) )->join( 'closure', "closure.child = node.nodeid" ) AS $node )
|
||||
$clubs = $this->fetchClubs();
|
||||
foreach( $this->db->select( '*', 'node', array( "node.nodeid<>2 AND ( ( closure.parent=? AND node.contenttypeid=? ) OR " . $this->db->in( 'nodeid', array_keys( $clubs ) ) . " )", $this->fetchType( 'Thread' ), $this->fetchType( 'Channel' ) ) )->join( 'closure', "closure.child = node.nodeid" ) AS $node )
|
||||
{
|
||||
$forums[$node['nodeid']] = $node;
|
||||
}
|
||||
@@ -666,6 +715,37 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
return $forums;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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=?", \IPS\convert\Software\Core\Vbulletin5::$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
|
||||
*/
|
||||
@@ -703,7 +783,7 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
{
|
||||
$url = \IPS\Request::i()->url();
|
||||
|
||||
if( preg_match( '#(?<!topic)/([0-9]+)\-([^/]*?)#', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
if( preg_match( '#(?<!topic|file|image)/([0-9]+)\-([^/]*?)#', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo 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
|
||||
*/
|
||||
@@ -102,7 +102,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
public static function checkConf()
|
||||
{
|
||||
return array(
|
||||
'convertAttachments'
|
||||
'convertAttachments',
|
||||
'convertForumsPosts'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,6 +118,28 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$return = array();
|
||||
switch( $method )
|
||||
{
|
||||
case 'convertForumsPosts':
|
||||
/* Get our reactions to let the admin map them */
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_reactions' ), 'IPS\Content\Reaction' ) AS $reaction )
|
||||
{
|
||||
$options[ $reaction->id ] = $reaction->_icon->url;
|
||||
$descriptions[ $reaction->id ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_title_' . $reaction->id ) . '<br>' . $reaction->_description;
|
||||
}
|
||||
|
||||
$return['convertForumsPosts'] = array(
|
||||
'rep_like' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
),
|
||||
);
|
||||
break;
|
||||
|
||||
case 'convertAttachments':
|
||||
$return['convertAttachments'] = array(
|
||||
'attach_location' => array(
|
||||
@@ -523,6 +546,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'type_id' => $row['post_id'],
|
||||
'member_id' => $like['user_id'],
|
||||
'member_received' => $row['user_id'],
|
||||
'reaction' => $this->app->_session['more_info']['convertForumsPosts']['rep_like'],
|
||||
'rep_date' => $row['post_date']
|
||||
) );
|
||||
}
|
||||
}
|
||||
@@ -545,6 +570,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$latestedit = 0;
|
||||
$reason = NULL;
|
||||
$name = NULL;
|
||||
$newText = static::fixPostData( $row['message'] );
|
||||
|
||||
foreach( $this->db->select( '*', 'xf_edit_history', array( "content_type=? AND content_id=?", 'post', $row['post_id'] ) ) AS $edit )
|
||||
{
|
||||
$libraryClass->convertEditHistory( array(
|
||||
@@ -553,8 +580,11 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'comment_id' => $row['post_id'],
|
||||
'member' => $edit['edit_user_id'],
|
||||
'time' => $edit['edit_date'],
|
||||
'old' => $edit['old_text']
|
||||
'old' => static::fixPostData( $edit['old_text'] ),
|
||||
'new' => $newText
|
||||
) );
|
||||
|
||||
$newText = static::fixPostData( $edit['old_text'] );
|
||||
|
||||
if ( $edit['edit_date'] > $latestedit )
|
||||
{
|
||||
@@ -618,22 +648,15 @@ 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() );
|
||||
|
||||
$pid = $this->app->getLink( $row['content_id'], 'forums_posts' );
|
||||
|
||||
$post = \IPS\Db::i()->select( 'post', 'forums_posts', array( "pid=?", $pid ) )->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 );
|
||||
$post = preg_replace( "/\[ATTACH(.+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '[attachment=' . $attachId . ':name]', $post );
|
||||
\IPS\Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
|
||||
}
|
||||
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>';
|
||||
}
|
||||
|
||||
\IPS\Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
@@ -690,7 +713,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
}
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item instanceof \IPS\Content\Item )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
if( $item->canView() )
|
||||
{
|
||||
|
||||
Whitespace-only changes.
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Coppermine Gallery 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
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter PhotoPlog Gallery 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 02 October 2016
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter Photopost Gallery 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 vBulletin 4.x Gallery 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
|
||||
*/
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
/**
|
||||
* @brief Converter XenForo Media Gallery 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
|
||||
*/
|
||||
@@ -157,6 +157,24 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_xf_gal_path'),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
|
||||
/* Get our reactions to let the admin map them */
|
||||
$options = array();
|
||||
$descriptions = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_reactions' ), 'IPS\Content\Reaction' ) AS $reaction )
|
||||
{
|
||||
$options[ $reaction->id ] = $reaction->_icon->url;
|
||||
$descriptions[ $reaction->id ] = \IPS\Member::loggedIn()->language()->addToStack('reaction_title_' . $reaction->id ) . '<br>' . $reaction->_description;
|
||||
}
|
||||
|
||||
$return['convertGalleryImages']['rep_like'] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Radio',
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
|
||||
'field_hint' => NULL,
|
||||
'field_validation' => NULL,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -433,7 +451,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
try
|
||||
{
|
||||
$em = \IPS\Text\Parser::embeddableMedia( $row['media_embed_url'] );
|
||||
$em = \IPS\Text\Parser::embeddableMedia( \IPS\Http\Url::createFromString( $row['media_embed_url'] ) );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
@@ -495,6 +513,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'type_id' => $row['media_id'],
|
||||
'member_id' => $like['user_id'],
|
||||
'member_received' => $row['user_id'],
|
||||
'reaction' => $this->app->_session['more_info']['convertGalleryImages']['rep_like'],
|
||||
'rep_date' => $row['media_date']
|
||||
) );
|
||||
}
|
||||
}
|
||||
@@ -613,6 +633,8 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'type_id' => $row['comment_id'],
|
||||
'member_id' => $like['user_id'],
|
||||
'member_received' => $row['user_id'],
|
||||
'reaction' => $this->app->_session['more_info']['convertGalleryImages']['rep_like'],
|
||||
'rep_date' => $row['comment_date']
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Reference in new issue
Block a user