Version 4.7.0

This commit is contained in:
Neo committed 2025-12-19 16:00:35 -08:00
1 parent 517a5e1f70
commit 8ba7d43898
1933 files changed
+65613 -11332

No files matched your search

@@ -52,13 +52,17 @@ class _Invisioncommunity extends \IPS\convert\Software
{
static::$dbNeeded = TRUE;
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
/* We're matching against the human version since the long version can change with patches */
if( $version == \IPS\Application::load( 'core')->version )
try
{
static::$versionMatch = TRUE;
$version = $this->db->select( 'app_version', 'core_applications', array( 'app_directory=?', 'core' ) )->first();
/* We're matching against the human version since the long version can change with patches */
if ( $version == \IPS\Application::load( 'core' )->version )
{
static::$versionMatch = TRUE;
}
}
catch( \IPS\Db\Exception $e ) {}
/* Get parent sauce */
$this->parent = $this->app->_parent->getSource();
@@ -404,6 +404,7 @@ class _Mybb extends \IPS\convert\Software
'tag_meta_id' => $row['tid'],
'tag_text' => $prefix,
'tag_member_id' => $row['uid'],
'tag_added' => $row['dateline'],
'tag_prefix' => 1,
) );
}
@@ -471,7 +472,14 @@ class _Mybb extends \IPS\convert\Software
break;
case -1:
$queued = -1;
if( !$row['replyto'] )
{
$queued = 2; // First post in topic
}
else
{
$queued = -1;
}
break;
}
@@ -487,6 +495,12 @@ class _Mybb extends \IPS\convert\Software
'queued' => $queued,
'post_edit_reason' => $row['editreason'],
);
// Flag as first post in topic
if( $queued == 2 )
{
$info['new_topic'] = 1;
}
$libraryClass->convertForumsPost( $info );
@@ -506,6 +506,7 @@ class _Vanilla extends \IPS\convert\Software
'tag_meta_id' => $row['DiscussionID'],
'tag_text' => $spacedTag,
'tag_member_id' => $row['InsertUserID'],
'tag_added' => $info['start_date'],
'tag_prefix' => 0,
) );
}
@@ -565,6 +565,7 @@ class _Vbulletin extends \IPS\convert\Software
'tag_meta_id' => $topic['threadid'],
'tag_text' => $lang['text'],
'tag_member_id' => $topic['postuserid'],
'tag_added' => $info['start_date'],
'tag_prefix' => 1, # key to this whole operation right here
) );
}
@@ -585,6 +586,7 @@ class _Vbulletin extends \IPS\convert\Software
'tag_meta_id' => $topic['threadid'],
'tag_text' => $tag,
'tag_member_id' => $topic['postuserid'],
'tag_added' => $info['start_date'],
'tag_prefix' => 0,
) );
}
@@ -440,8 +440,48 @@ class _Vbulletin5 extends \IPS\convert\Software
);
unset( $poll );
$softDeleted = FALSE;
if ( $topic['deleteuserid'] )
{
$info['approved'] = -1;
$softDeleted = TRUE;
}
$topic_id = $libraryClass->convertForumsTopic( $info );
$topicId = $libraryClass->convertForumsTopic( $info );
/* post conversion things */
if( !empty( $topicId ) )
{
/* Record old vB 2/3/4 ID */
if ( !empty( $topic['oldid'] ) )
{
$this->app->addLink( $topicId, $topic['oldid'], 'forums_topics_old' );
}
/* Need to insert into the SDL? */
if ( $softDeleted )
{
try
{
$softDeleteId = $this->app->getLink( $topic['deleteuserid'], 'core_members', TRUE );
}
/* User link doesn't exist */
catch ( \OutOfRangeException $e )
{
$softDeleteId = 0;
}
\IPS\Db::i()->insert( 'core_soft_delete_log', array(
'sdl_obj_id' => $topicId,
'sdl_obj_key' => 'topic',
'sdl_obj_member_id' => $softDeleteId,
'sdl_obj_date' => $topic['unpublishdate'] ?: time(),
'sdl_obj_reason' => $topic['deletereason'] ?: NULL,
'sdl_locked' => 0
) );
}
}
$libraryClass->setLastKeyValue( $topic['nodeid'] );
}
@@ -560,102 +600,111 @@ LINK;
}
$post_id = $libraryClass->convertForumsPost( $info );
/* Need to insert into the SDL? */
if ( $softDeleted )
if( !empty( $post_id ) )
{
try
/* Record old vB 2/3/4 ID */
if( !empty( $post['oldid'] ) )
{
$softDeleteId = $this->app->getLink( $post['deleteuserid'], 'core_members', TRUE );
}
/* User link doesn't exist */
catch( \OutOfRangeException $e )
{
$softDeleteId = 0;
$this->app->addLink( $post_id, $post['oldid'], 'forums_posts_old' );
}
\IPS\Db::i()->insert( 'core_soft_delete_log', array(
'sdl_obj_id' => $post_id,
'sdl_obj_key' => 'post',
'sdl_obj_member_id' => $softDeleteId,
'sdl_obj_date' => $post['unpublishdate'] ?: time(),
'sdl_obj_reason' => $post['deletereason'] ?: NULL,
'sdl_locked' => 0
) );
}
/* Reputation */
foreach( $this->db->select( '*', 'reputation', array( "nodeid=?", $post['nodeid'] ) ) AS $rep )
{
$libraryClass->convertReputation( array(
'id' => $rep['reputationid'],
'app' => 'forums',
'type' => 'pid',
'type_id' => $post['nodeid'],
'member_id' => $rep['whoadded'],
'member_received' => $rep['userid'],
'rep_date' => $rep['dateline'],
'reaction' => $this->app->_session['more_info']['convertForumsPosts']['rep_like']
) );
}
/* Edit History */
$latestedit = 0;
$reason = NULL;
$name = NULL;
$newText = $post['rawtext'];
foreach( $this->db->select( '*', 'postedithistory', array( "nodeid=?", $post['nodeid'] ) ) AS $edit )
{
$libraryClass->convertEditHistory( array(
'id' => $edit['postedithistoryid'],
'class' => 'IPS\\forums\\Topic\\Post',
'comment_id' => $post['nodeid'],
'member' => $edit['userid'],
'time' => $edit['dateline'],
'old' => $edit['pagetext'],
'new' => $newText
) );
$newText = $edit['pagetext'];
if ( $edit['dateline'] > $latestedit )
/* Need to insert into the SDL? */
if ( $softDeleted )
{
$latestedit = $edit['dateline'];
$reason = $edit['reason'];
$name = $edit['username'];
}
}
/* Warnings */
foreach( $this->db->select( '*', 'infraction', array( "nodeid=?", $post['nodeid'] ) ) AS $warn )
{
$warnId = $libraryClass->convertWarnLog( array(
'wl_id' => $warn['infractionid'],
'wl_member' => $warn['nodeid'],
'wl_moderator' => $warn['whoadded'],
'wl_date' => $warn['dateline'],
'wl_points' => $warn['points'],
'wl_note_member' => $warn['note'],
'wl_note_mods' => $warn['customreason'],
) );
try
{
$softDeleteId = $this->app->getLink( $post['deleteuserid'], 'core_members', TRUE );
}
/* User link doesn't exist */
catch ( \OutOfRangeException $e )
{
$softDeleteId = 0;
}
/* 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']
)
);
}
/* If we have a latest edit, then update the main post - this should really be in the library, as the converters should not be altering data */
if ( $latestedit )
{
\IPS\Db::i()->update( 'forums_posts', array( 'append_edit' => 1, 'edit_time' => $latestedit, 'edit_name' => $name, 'post_edit_reason' => $reason ), array( "pid=?", $post_id ) );
\IPS\Db::i()->insert( 'core_soft_delete_log', array(
'sdl_obj_id' => $post_id,
'sdl_obj_key' => 'post',
'sdl_obj_member_id' => $softDeleteId,
'sdl_obj_date' => $post['unpublishdate'] ?: time(),
'sdl_obj_reason' => $post['deletereason'] ?: NULL,
'sdl_locked' => 0
) );
}
/* Reputation */
foreach ( $this->db->select( '*', 'reputation', array( "nodeid=?", $post['nodeid'] ) ) as $rep )
{
$libraryClass->convertReputation( array(
'id' => $rep['reputationid'],
'app' => 'forums',
'type' => 'pid',
'type_id' => $post['nodeid'],
'member_id' => $rep['whoadded'],
'member_received' => $rep['userid'],
'rep_date' => $rep['dateline'],
'reaction' => $this->app->_session['more_info']['convertForumsPosts']['rep_like']
) );
}
/* Edit History */
$latestedit = 0;
$reason = NULL;
$name = NULL;
$newText = $post['rawtext'];
foreach ( $this->db->select( '*', 'postedithistory', array( "nodeid=?", $post['nodeid'] ) ) as $edit )
{
$libraryClass->convertEditHistory( array(
'id' => $edit['postedithistoryid'],
'class' => 'IPS\\forums\\Topic\\Post',
'comment_id' => $post['nodeid'],
'member' => $edit['userid'],
'time' => $edit['dateline'],
'old' => $edit['pagetext'],
'new' => $newText
) );
$newText = $edit['pagetext'];
if ( $edit['dateline'] > $latestedit )
{
$latestedit = $edit['dateline'];
$reason = $edit['reason'];
$name = $edit['username'];
}
}
/* Warnings */
foreach ( $this->db->select( '*', 'infraction', array( "nodeid=?", $post['nodeid'] ) ) as $warn )
{
$warnId = $libraryClass->convertWarnLog( array(
'wl_id' => $warn['infractionid'],
'wl_member' => $warn['nodeid'],
'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']
)
);
}
/* If we have a latest edit, then update the main post - this should really be in the library, as the converters should not be altering data */
if ( $latestedit )
{
\IPS\Db::i()->update( 'forums_posts', array( 'append_edit' => 1, 'edit_time' => $latestedit, 'edit_name' => $name, 'post_edit_reason' => $reason ), array( "pid=?", $post_id ) );
}
}
$libraryClass->setLastKeyValue( $post['nodeid'] );
@@ -1027,6 +1076,99 @@ LINK;
{
$url = \IPS\Request::i()->url();
if(
( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showthread.php' ) !== FALSE OR
mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showpost.php' ) !== FALSE OR
preg_match( '#/threads/([0-9]+)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ] )
)
AND ( isset( \IPS\Request::i()->p ) OR isset( \IPS\Request::i()->postid ) )
)
{
try
{
$postId = \IPS\Request::i()->postid ?? \IPS\Request::i()->p;
try
{
$data = (string) $this->app->getLink( $postId, array( 'forums_posts_old' ) );
}
catch( \OutOfRangeException $e )
{
/* Try the main table */
$data = (string) $this->app->getLink( $postId, array( 'forums_posts_old' ), FALSE, TRUE );
}
$item = \IPS\forums\Topic\Post::load( $data );
if( $item->canView() )
{
return $item->url();
}
}
catch( \Exception $e )
{
return NULL;
}
}
/* And then topic URLs, same idea */
elseif( ( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showthread.php' ) !== FALSE OR
mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'printthread.php' ) !== FALSE )
AND ( isset( \IPS\Request::i()->t ) OR isset( \IPS\Request::i()->threadid ) )
)
{
/* Topic URLs.
* /showthread.php?t=1
* /printthread.php?t=1
* /showthread.php?threadid=?
* /printthread.php?threadid=?
*/
$path = $url->data[ \IPS\Http\Url::COMPONENT_PATH ];
if( mb_strpos( $path, 'showthread.php' ) !== FALSE OR mb_strpos( $path, 'printthread.php' ) !== FALSE )
{
if( isset( \IPS\Request::i()->t ) )
{
$oldId = \IPS\Request::i()->t;
}
elseif( isset( \IPS\Request::i()->threadid ) )
{
$oldId = \IPS\Request::i()->threadid;
}
elseif( preg_match( '#^(\d+)-[^/]+#i', $url->data[ \IPS\Http\Url::COMPONENT_QUERY ], $matches ) )
{
$oldId = $matches[1];
}
else
{
$queryStringPieces = explode( '-', mb_substr( $path, mb_strpos( $path, 'showthread.php/' ) + mb_strlen( 'showthread.php/' ) ) );
$oldId = $queryStringPieces[0];
}
}
if( isset( $oldId ) )
{
try
{
try
{
$data = (string) $this->app->getLink( $oldId, array( 'forums_topics_old' ) );
}
catch( \OutOfRangeException $e )
{
/* Try the main table */
$data = (string) $this->app->getLink( $oldId, array( 'forums_topics_old' ), FALSE, TRUE );
}
$item = \IPS\forums\Topic::load( $data );
if( $item->canView() )
{
return $item->url();
}
}
catch( \Exception $e )
{
return NULL;
}
}
}
if( preg_match( '#(?<!topic|file|image)/([0-9]+)\-([^/]*?)#', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
{
try
@@ -336,6 +336,7 @@ class _Woltlab extends \IPS\convert\Software
'tag_meta_id' => $row['threadID'],
'tag_text' => $text,
'tag_member_id' => $row['userID'],
'tag_added' => $info['start_date']
) );
}
@@ -271,6 +271,7 @@ class _Wpforo extends \IPS\convert\Software
'tag_meta_id' => $row['topicid'],
'tag_text' => $text,
'tag_member_id' => $row['userid'],
'tag_added' => $info['start_date']
] );
}
@@ -93,7 +93,7 @@ class _Xenforo extends \IPS\convert\Software
public static function softwareName()
{
/* Child classes must override this method */
return "XenForo (1.5.x/2.0.x/2.1.x)";
return "XenForo (1.5.x/2.0.x/2.1.x/2.2.x)";
}
/**
@@ -509,6 +509,7 @@ class _Xenforo extends \IPS\convert\Software
'tag_meta_id' => $row['thread_id'],
'tag_text' => $prefix,
'tag_member_id' => $row['user_id'],
'tag_added' => $row['post_date'],
'tag_prefix' => 1, # key to this whole operation right here
) );
}
@@ -529,6 +530,7 @@ class _Xenforo extends \IPS\convert\Software
'tag_meta_id' => $row['thread_id'],
'tag_text' => $tag['tag'],
'tag_member_id' => $row['user_id'],
'tag_added' => $row['post_date'],
'tag_prefix' => 0
) );
}
@@ -744,9 +746,9 @@ class _Xenforo extends \IPS\convert\Software
$post = \IPS\Db::i()->select( 'post', 'forums_posts', array( "pid=?", $pid ) )->first();
if ( preg_match( "/\[ATTACH([^\]]+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", $post ) )
if ( preg_match( "/\[ATTACH([^\]]+?)?\]" . $row['attachment_id'] . "(\._xfImport)?\[\/ATTACH\]/i", $post ) )
{
$post = preg_replace( "/\[ATTACH([^\]]+?)?\]" . $row['attachment_id'] . "\[\/ATTACH\]/i", '[attachment=' . $attachId . ':name]', $post );
$post = preg_replace( "/\[ATTACH([^\]]+?)?\]" . $row['attachment_id'] . "(\._xfImport)?\[\/ATTACH\]/i", '[attachment=' . $attachId . ':name]', $post );
\IPS\Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
}
}