Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

@@ -5,19 +5,22 @@
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
* @copyright (c) Invision Power Services, Inc.
* @package Invision Community
* @subpackage Converter
* @subpackage convert
* @since 21 Jan 2015
*/
namespace IPS\convert\Software\Forums;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* vBulletin Forums Converter
*/
class _Vbulletin extends \IPS\convert\Software
{
/**
@@ -38,8 +41,8 @@ class _Vbulletin extends \IPS\convert\Software
/**
* Constructor
*
* @param \IPS\convert\App The application to reference for database and other information.
* @param bool Establish a DB connection
* @param \IPS\convert\App $app The application to reference for database and other information.
* @param bool $needDB Establish a DB connection
* @return void
* @throws \InvalidArgumentException
*/
@@ -68,7 +71,7 @@ class _Vbulletin extends \IPS\convert\Software
/* If this is vB4, what is the content type ID for posts? */
if ( static::$postContentType === NULL AND ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) )
if ( static::$postContentType === NULL AND ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) ) )
{
static::$postContentType = $this->db->select( 'contenttypeid', 'contenttype', array( "class=?", 'Post' ) )->first();
}
@@ -115,7 +118,12 @@ class _Vbulletin extends \IPS\convert\Software
),
'convertForumsTopics' => array(
'table' => 'thread',
'where' => NULL
'where' => NULL,
'extra_steps' => array( 'convertForumsTopicsFollowers' )
),
'convertForumsTopicsFollowers' => array(
'table' => 'subscribethread',
'where' => NULL,
),
'convertForumsPosts' => array(
'table' => 'post',
@@ -135,11 +143,33 @@ class _Vbulletin extends \IPS\convert\Software
),
'convertAttachments' => array(
'table' => 'attachment',
'where' => ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? array( "contenttypeid=?", static::$postContentType ) : NULL
'where' => ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) ) ? array( "contenttypeid=?", static::$postContentType ) : NULL
)
);
}
/**
* Allows software to add additional menu row options
*
* @return array
*/
public function extraMenuRows()
{
$rows = array();
$rows['convertForumsTopicsFollowers'] = array(
'step_title' => 'convert_forums_topics_followers',
'step_method' => 'convertForumsTopicsFollowers',
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_follow', array( 'follow_app=? AND follow_area=?', 'forums', 'topics' ) ),
'source_rows' => array( 'table' => static::canConvert()['convertForumsTopicsFollowers']['table'], 'where' => static::canConvert()['convertForumsTopicsFollowers']['where'] ),
'per_cycle' => 2000,
'dependencies' => array( 'convertForumsTopics' ),
'link_type' => 'core_follows',
'requires_rebuild' => FALSE
);
return $rows;
}
/**
* Requires Parent
*
@@ -168,11 +198,11 @@ class _Vbulletin extends \IPS\convert\Software
public function finish()
{
/* Content Rebuilds */
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 5, array( 'class' ) );
\IPS\Task::queue( 'core', 'RebuildContainerCounts', array( 'class' => 'IPS\forums\Forum', 'count' => 0 ), 4, array( 'class' ) );
\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( 'core', 'RebuildItemCounts', array( 'class' => 'IPS\forums\Topic' ), 2, array( 'class' ) ); // This must run before the CMS item count task runs.
\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' ) );
\IPS\Task::queue( 'convert', 'DeleteEmptyTopics', array( 'app' => $this->app->app_id ), 5, array( 'app' ) );
/* Rebuild Leaderboard */
\IPS\Task::queue( 'core', 'RebuildReputationLeaderboard', array(), 4 );
@@ -187,7 +217,7 @@ class _Vbulletin extends \IPS\convert\Software
/**
* Fix Post Data
*
* @param string Post
* @param string $post Post
* @return string Fixed Posts
*/
public static function fixPostData( $post )
@@ -234,7 +264,7 @@ class _Vbulletin extends \IPS\convert\Software
'field_class' => 'IPS\\Helpers\\Form\\Radio',
'field_default' => NULL,
'field_required' => TRUE,
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions, 'gridspan' => 2 ),
'field_hint' => NULL,
'field_validation' => NULL,
),
@@ -242,7 +272,7 @@ class _Vbulletin extends \IPS\convert\Software
'field_class' => 'IPS\\Helpers\\Form\\Radio',
'field_default' => NULL,
'field_required' => TRUE,
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions, 'gridspan' => 2 ),
'field_hint' => NULL,
'field_validation' => NULL,
),
@@ -250,7 +280,7 @@ class _Vbulletin extends \IPS\convert\Software
'field_class' => 'IPS\\Helpers\\Form\\Radio',
'field_default' => NULL,
'field_required' => TRUE,
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions ),
'field_extra' => array( 'parse' => 'image', 'options' => $options, 'descriptions' => $descriptions, 'gridspan' => 2 ),
'field_hint' => NULL,
'field_validation' => NULL,
),
@@ -265,8 +295,8 @@ class _Vbulletin extends \IPS\convert\Software
'field_required' => TRUE,
'field_extra' => array(
'options' => array(
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'database' ),
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'file_system' ),
'database' => \IPS\Member::loggedIn()->language()->addToStack( 'conv_store_database' ),
'file_system' => \IPS\Member::loggedIn()->language()->addToStack( 'conv_store_file_system' ),
),
'userSuppliedInput' => 'file_system',
),
@@ -317,7 +347,7 @@ class _Vbulletin extends \IPS\convert\Software
'topics' => $forum['threadcount'],
'posts' => $forum['replycount'],
'last_post' => $forum['lastpost'],
'last_poster_id' => ( static::$isLegacy === FALSE or is_null( static::$isLegacy ) ) ? $forum['lastposterid'] : 0,
'last_poster_id' => ( static::$isLegacy === FALSE or \is_null( static::$isLegacy ) ) ? $forum['lastposterid'] : 0,
'last_poster_name' => $forum['lastposter'],
'parent_id' => $forum['parentid'],
'position' => $forum['displayorder'],
@@ -380,10 +410,11 @@ class _Vbulletin extends \IPS\convert\Software
public function convertForumsTopics()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'threadid' );
foreach( $this->fetch( 'thread', 'threadid' ) AS $topic )
$data = iterator_to_array( $this->fetch( 'thread', 'threadid' ) );
$this->app->preCacheLinks( $data, [ 'forums_forums' => 'forumid', 'core_members' => [ 'postuserid', 'lastposterid' ] ] );
foreach( $data AS $topic )
{
/* Pesky Polls */
$poll = NULL;
@@ -434,7 +465,9 @@ class _Vbulletin extends \IPS\convert\Software
$poll['vote_data'] = array();
$ourVotes = array();
foreach( $this->db->select( '*', 'pollvote', array( "pollid=?", $pollData['pollid'] ) ) AS $vote )
$voteData = iterator_to_array( $this->db->select( '*', 'pollvote', array( "pollid=?", $pollData['pollid'] ) ) );
$this->app->preCacheLinks( $voteData, [ 'core_members' => 'userid' ] );
foreach( $voteData AS $vote )
{
if ( !isset( $ourVotes[$vote['userid']] ) )
{
@@ -464,6 +497,21 @@ class _Vbulletin extends \IPS\convert\Software
catch( \UnderflowException $e ) {} # if the poll is missing, don't bother
}
switch( $topic['visible'] )
{
case 0: // hidden awaiting approval.
$approved = 0;
break;
case 1: // Visible
$approved = 1;
break;
case 2: // Soft Deleted in vBulletin is equivalent to hidden by a moderator in IPS.
$approved = -1;
break;
}
$info = array(
'tid' => $topic['threadid'],
'title' => $topic['title'],
@@ -472,59 +520,26 @@ class _Vbulletin extends \IPS\convert\Software
'posts' => $topic['replycount'],
'starter_id' => $topic['postuserid'],
'start_date' => $topic['dateline'],
'last_poster_id' => ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) ) ? $topic['lastposterid'] : NULL,
'last_poster_id' => ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) ) ? $topic['lastposterid'] : NULL,
'last_post' => $topic['lastpost'],
'starter_name' => $topic['postusername'],
'last_poster_name' => $topic['lastposter'],
'poll_state' => $poll,
'last_vote' => $lastVote,
'views' => $topic['views'],
'approved' => $topic['visible'],
'approved' => $approved,
'pinned' => $topic['sticky'],
'topic_hiddenposts' => $topic['hiddencount'] + $topic['deletedcount']
);
unset( $poll );
$topic_id = $libraryClass->convertForumsTopic( $info );
/* Follows */
foreach( $this->db->select( '*', 'subscribethread', array( "threadid=?", $topic['threadid'] ) ) AS $follow )
{
$frequency = 'none';
switch( $follow['emailupdate'] )
{
case 1:
$frequency = 'immediate';
break;
case 2:
$frequency = 'daily';
break;
case 3:
$frequency = 'weekly';
break;
}
$libraryClass->convertFollow( array(
'follow_app' => 'forums',
'follow_area' => 'topic',
'follow_rel_id' => $topic['threadid'],
'follow_rel_id_type' => 'forums_topics',
'follow_member_id' => $follow['userid'],
'follow_is_anon' => 0,
'follow_added' => time(),
'follow_notify_do' => 1,
'follow_notify_meta' => '',
'follow_notify_freq' => $frequency,
'follow_notify_sent' => 0,
'follow_visible' => 1,
) );
}
$libraryClass->convertForumsTopic( $info );
/* Ratings */
foreach( $this->db->select( '*', 'threadrate', array( "threadid=?", $topic['threadid'] ) ) AS $rating )
$ratingData = iterator_to_array( $this->db->select( '*', 'threadrate', array( "threadid=?", $topic['threadid'] ) ) );
$this->app->preCacheLinks( $ratingData, [ 'core_members' => 'userid' ] );
foreach( $ratingData AS $rating )
{
$libraryClass->convertRating( array(
'id' => $rating['threadrateid'],
@@ -559,7 +574,7 @@ class _Vbulletin extends \IPS\convert\Software
if( $topic['taglist'] !== NULL AND !empty( $topic['taglist'] ) )
{
$tags = explode( ',', $topic['taglist'] );
if ( count( $tags ) )
if ( \count( $tags ) )
{
foreach( $tags AS $tag )
{
@@ -580,6 +595,56 @@ class _Vbulletin extends \IPS\convert\Software
}
}
/**
* Convert topic follows
*
* @return void
*/
public function convertForumsTopicsFollowers()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'subscribethreadid' );
/* Follows */
$followData = iterator_to_array( $this->fetch( 'subscribethread', 'subscribethreadid' ) );
$this->app->preCacheLinks( $followData, [ 'forums_topics' => 'threadid', 'core_members' => 'userid' ] );
foreach( $followData AS $follow )
{
$frequency = 'none';
switch( $follow['emailupdate'] )
{
case 1:
$frequency = 'immediate';
break;
case 2:
$frequency = 'daily';
break;
case 3:
$frequency = 'weekly';
break;
}
$libraryClass->convertFollow( array(
'follow_app' => 'forums',
'follow_area' => 'topic',
'follow_rel_id' => $follow['threadid'],
'follow_rel_id_type' => 'forums_topics',
'follow_member_id' => $follow['userid'],
'follow_is_anon' => 0,
'follow_added' => time(),
'follow_notify_do' => 1,
'follow_notify_meta' => '',
'follow_notify_freq' => $frequency,
'follow_notify_sent' => 0,
'follow_visible' => 1,
) );
$libraryClass->setLastKeyValue( $follow['subscribethreadid'] );
}
}
/**
* Convert posts
*
@@ -588,11 +653,40 @@ class _Vbulletin extends \IPS\convert\Software
public function convertForumsPosts()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'postid' );
foreach( $this->fetch( 'post', 'postid' ) AS $post )
$data = iterator_to_array( $this->fetch( array( 'post', 'p' ), 'p.postid', NULL, 'p.*, t.visible AS topicvisible' )->join( array( 'thread', 't' ), 'p.threadid=t.threadid' ) );
$this->app->preCacheLinks( $data, [ 'forums_topics' => 'threadid', 'core_members' => 'userid' ] );
foreach( $data AS $post )
{
$queued = NULL;
/* If the topic is hidden, mark this post as hidden by the parent topic */
if ( $post['topicvisible'] == 2 )
{
$queued = 2;
}
/* Still here? Topic is fine, so check the post */
if ( $queued === NULL )
{
switch( $post['visible'] )
{
case 0: // hidden pending moderator approval
$queued = 1;
break;
case 1: // Visible
$queued = 0;
break;
case 2: // Hidden by moderator
$queued = -1;
break;
}
}
$info = array(
'pid' => $post['postid'],
'topic_id' => $post['threadid'],
@@ -601,14 +695,27 @@ class _Vbulletin extends \IPS\convert\Software
'author_name' => $post['username'],
'ip_address' => $post['ipaddress'],
'post_date' => $post['dateline'],
'queued' => ( $post['visible'] >= 2 ) ? -1 : ( ( $post['visible'] == 0 ) ? 1 : 0 ),
'post_htmlstate' => ( static::$isLegacy === FALSE AND in_array( $post['htmlstate'], array( 'on', 'on_nl2br' ) ) ) ? 1 : 0,
'queued' => $queued,
'post_htmlstate' => ( static::$isLegacy === FALSE AND \in_array( $post['htmlstate'], array( 'on', 'on_nl2br' ) ) ) ? 1 : 0,
);
/* Edited? */
try
{
$lastEdit = $this->db->select( '*', 'postedithistory', array( 'postid=?', $post['postid'] ), 'postedithistoryid DESC', 1 )->first();
$info['append_edit'] = 1;
$info['edit_time'] = $lastEdit['dateline'];
$info['edit_name'] = $lastEdit['username'];
$info['post_edit_reason'] = $lastEdit['reason'] ?? null;
}
catch( \UnderflowException $e ) {}
$post_id = $libraryClass->convertForumsPost( $info );
$libraryClass->convertForumsPost( $info );
/* Reputation */
foreach( $this->db->select( '*', 'reputation', array( "postid=?", $post['postid'] ) ) AS $rep )
$reputation = iterator_to_array( $this->db->select( '*', 'reputation', array( "postid=?", $post['postid'] ) ) );
$this->app->preCacheLinks( $reputation, [ 'core_members' => [ 'userid', 'whoadded' ] ] );
foreach( $reputation AS $rep )
{
$reaction = ( $rep['reputation'] > 0 ) ?
$this->app->_session['more_info']['convertForumsPosts']['rep_positive'] :
@@ -627,36 +734,32 @@ class _Vbulletin extends \IPS\convert\Software
) );
}
/* Edit History */
$latestedit = 0;
$reason = NULL;
$name = NULL;
$newText = static::fixPostData( $post['pagetext'] );
foreach( $this->db->select( '*', 'postedithistory', array( "postid=?", $post['postid'] ) ) AS $edit )
/* Process edit history if some exists */
if( isset( $info['append_edit'] ) )
{
$libraryClass->convertEditHistory( array(
'id' => $edit['postedithistoryid'],
'class' => 'IPS\\forums\\Topic\\Post',
'comment_id' => $post['postid'],
'member' => $edit['userid'],
'time' => $edit['dateline'],
'old' => static::fixPostData( $edit['pagetext'] ),
'new' => $newText
) );
$newText = static::fixPostData( $edit['pagetext'] );
if ( $edit['dateline'] > $latestedit )
$newText = $info['post'];
foreach ( $this->db->select( '*', 'postedithistory', array( "postid=?", $post['postid'] ), 'postedithistoryid ASC' ) as $edit )
{
$latestedit = $edit['dateline'];
$reason = $edit['reason'];
$name = $edit['username'];
$editHistory = array(
'id' => $edit['postedithistoryid'],
'class' => 'IPS\\forums\\Topic\\Post',
'comment_id' => $post['postid'],
'member' => $edit['userid'],
'time' => $edit['dateline'],
'old' => static::fixPostData( $edit['pagetext'] ),
'new' => $newText
);
$libraryClass->convertEditHistory( $editHistory );
$newText = $editHistory['old'];
}
}
/* Warnings */
foreach( $this->db->select( '*', 'infraction', array( "postid=?", $post['postid'] ) ) AS $warn )
$warnings = iterator_to_array( $this->db->select( '*', 'infraction', array( "postid=?", $post['postid'] ) ) );
$this->app->preCacheLinks( $warnings, [ 'core_members' => 'whoadded' ] );
foreach( $warnings AS $warn )
{
$warnId = $libraryClass->convertWarnLog( array(
'wl_id' => $warn['infractionid'],
@@ -680,12 +783,6 @@ class _Vbulletin extends \IPS\convert\Software
);
}
/* 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['postid'] );
}
}
@@ -704,7 +801,7 @@ class _Vbulletin extends \IPS\convert\Software
$where = NULL;
$column = NULL;
if ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) )
if ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) )
{
$where = array( "contenttypeid=?", static::$postContentType );
$column = 'contentid';
@@ -728,7 +825,7 @@ class _Vbulletin extends \IPS\convert\Software
continue;
}
if ( static::$isLegacy === FALSE OR is_null( static::$isLegacy ) )
if ( static::$isLegacy === FALSE OR \is_null( static::$isLegacy ) )
{
try
{
@@ -787,9 +884,9 @@ class _Vbulletin extends \IPS\convert\Software
$post = \IPS\Db::i()->select( 'post', 'forums_posts', array( "pid=?", $pid ) )->first();
if ( preg_match( "/\[ATTACH(.+?)?\]".$attachment['attachmentid']."\[\/ATTACH\]/i", $post ) )
if ( preg_match( "/\[ATTACH([^\]]+?)?\]".$attachment['attachmentid']."\[\/ATTACH\]/i", $post ) )
{
$post = preg_replace( "/\[ATTACH(.+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '[attachment=' . $attach_id . ':name]', $post );
$post = preg_replace( "/\[ATTACH([^\]]+?)?\]" . $attachment['attachmentid'] . "\[\/ATTACH\]/i", '[attachment=' . $attach_id . ':name]', $post );
\IPS\Db::i()->update( 'forums_posts', array( 'post' => $post ), array( "pid=?", $pid ) );
}
@@ -1058,19 +1155,20 @@ class _Vbulletin extends \IPS\convert\Software
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 )
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( (int) \IPS\Request::i()->p, array( 'posts', 'forums_posts' ) );
$data = (string) $this->app->getLink( (int) $postId, array( 'posts', 'forums_posts' ) );
}
catch( \OutOfRangeException $e )
{
/* Try the main table */
$data = (string) $this->app->getLink( (int) \IPS\Request::i()->p, array( 'posts', 'forums_posts' ), FALSE, TRUE );
$data = (string) $this->app->getLink( (int) $postId, array( 'posts', 'forums_posts' ), FALSE, TRUE );
}
$item = \IPS\forums\Topic\Post::load( $data );
@@ -1085,21 +1183,28 @@ class _Vbulletin extends \IPS\convert\Software
}
}
/* And then topic URLs, same idea */
elseif( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showthread.php' ) !== FALSE )
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 )
{
/* Topic URLs can be in one of 4 formats really...
* /showthread.php/1-name
* /threads/1-name
* /showthread.php?t=1
* /showthread.php?1-name
* /printthread.php?t=1
* /showthread.php?threadid=?
*/
$path = $url->data[ \IPS\Http\Url::COMPONENT_PATH ];
if( mb_strpos( $path, 'showthread.php' ) !== FALSE )
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];
@@ -1169,8 +1274,8 @@ class _Vbulletin extends \IPS\convert\Software
/* And finally, archives */
elseif( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'archive/index.php' ) !== FALSE )
{
$request = str_replace( '/archive/index.php/', '', $_SERVER['REQUEST_URI'] );
$parameters = explode( '-', $request );
$request = explode( '/', $url->data[ \IPS\Http\Url::COMPONENT_PATH ] );
$parameters = explode( '-', array_pop( $request ) );
$parameters[1] = str_replace( '.html', '', $parameters[1] );
try
@@ -1180,11 +1285,11 @@ class _Vbulletin extends \IPS\convert\Software
case 't':
try
{
$data = $this->getLink( (string) $parameters[1], array( 'topics', 'forums_topics' ) );
$data = $this->app->getLink( (string) $parameters[1], array( 'topics', 'forums_topics' ) );
}
catch( \OutOfRangeException $e )
{
$data = $this->getLink( (string) $parameters[1], array( 'topics', 'forums_topics' ), FALSE, TRUE );
$data = $this->app->getLink( (string) $parameters[1], array( 'topics', 'forums_topics' ), FALSE, TRUE );
}
$item = \IPS\forums\Topic::load( $data );
@@ -1210,7 +1315,28 @@ class _Vbulletin extends \IPS\convert\Software
return NULL;
}
}
/* Club Discussions */
elseif( ( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'group.php' ) !== FALSE AND isset( \IPS\Request::i()->discussionid ) ) OR
preg_match( '#/social-groups/(.*)/([0-9]+)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
{
$id = \IPS\Request::i()->discussionid ?? $matches[2];
try
{
$data = (string) $this->app->getLink( 'clubtopic' . $id, array( 'topics', 'forums_topics' ) );
}
catch( \OutOfRangeException $e )
{
return NULL;
}
$item = \IPS\forums\Topic::load( $data );
if( $item->canView() )
{
return $item->url();
}
}
return NULL;
}
}
}