Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -29,7 +29,12 @@ 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 Flag to indicate the post data has been fixed during conversion, and we only need to use Legacy Parser
|
||||
*/
|
||||
public static $contentFixed = TRUE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -82,7 +87,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "vBulletin (3.x/4.x)";
|
||||
return "vBulletin (3.8.x/4.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -542,8 +547,6 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$post = str_replace( ">", ">", $post );
|
||||
$post = str_replace( "'", "'", $post );
|
||||
|
||||
$post = nl2br( $post );
|
||||
|
||||
$post = preg_replace( "#\[quote=([^\];]+?)\]#i", "[quote name='$1']", $post );
|
||||
$post = preg_replace( "#\[quote=([^\];]+?);\d+\]#i", "[quote name='$1']", $post );
|
||||
$post = preg_replace( "#\[quote=([^\];]+?);n\d+\]#i", "[quote name='$1']", $post );
|
||||
@@ -553,37 +556,41 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
|
||||
/* This is not a core feature in vBulletin, but is a popular addon and the code was supplied below.
|
||||
Addon URL: https://www.dragonbyte-tech.com/store/product/20-advanced-user-tagging/ */
|
||||
preg_match_all( '#\[MENTION=(\d+)\](.+?)\[\/MENTION\]#i', $post, $matches );
|
||||
|
||||
if ( count( $matches ) )
|
||||
if( mb_stristr( $post, '[mention=' ) )
|
||||
{
|
||||
if ( isset( $matches[1] ) )
|
||||
{
|
||||
$mentions = array();
|
||||
foreach( $matches[1] AS $k => $v )
|
||||
{
|
||||
if ( isset( $matches[2][$k] ) )
|
||||
{
|
||||
$mentions[ $matches[2][$k] ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$maps = array();
|
||||
$urls = array();
|
||||
$cardUrls = array();
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array( \IPS\Db::i()->in( 'name', array_keys( $mentions ) ) ) ), 'IPS\Member' ) AS $member )
|
||||
{
|
||||
$maps[$member->name] = $member->member_id;
|
||||
$urls[$member->name] = $member->url();
|
||||
$cardUrls[$member->name] = $member->url()->setQueryString( 'do', 'hovercard' );
|
||||
}
|
||||
|
||||
foreach( $mentions AS $member_name => $member_id )
|
||||
{
|
||||
$maps[$member_name] = preg_quote( $maps[$member_name], '#' );
|
||||
$member_name = preg_quote( $member_name, '#' );
|
||||
preg_match_all( '#\[MENTION=(\d+)\](.+?)\[\/MENTION\]#i', $post, $matches );
|
||||
|
||||
$post = preg_replace( "#\[MENTION={$member_id}\]{$member_name}\[\/MENTION\]#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 );
|
||||
if ( count( $matches ) )
|
||||
{
|
||||
/* Make sure we actually have mention data */
|
||||
if ( isset( $matches[1] ) AND \count( $matches[1] ) )
|
||||
{
|
||||
$mentions = array();
|
||||
foreach ( $matches[1] AS $k => $v )
|
||||
{
|
||||
if ( isset( $matches[2][ $k ] ) )
|
||||
{
|
||||
$mentions[ $matches[2][ $k ] ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$maps = array();
|
||||
$urls = array();
|
||||
$cardUrls = array();
|
||||
foreach ( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_members', array(\IPS\Db::i()->in( 'name', array_keys( $mentions ) )) ), 'IPS\Member' ) AS $member )
|
||||
{
|
||||
$maps[ $member->name ] = $member->member_id;
|
||||
$urls[ $member->name ] = $member->url();
|
||||
$cardUrls[$member->name] = $member->url()->setQueryString( 'do', 'hovercard' );
|
||||
}
|
||||
|
||||
foreach ( $mentions AS $member_name => $member_id )
|
||||
{
|
||||
$maps[ $member_name ] = preg_quote( $maps[ $member_name ], '#' );
|
||||
$member_name = preg_quote( $member_name, '#' );
|
||||
|
||||
$post = preg_replace( "#\[MENTION={$member_id}\]{$member_name}\[\/MENTION\]#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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -859,7 +866,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$g_signature_limits[] = ( $group['sigmaxlines'] > 0 ) ? $group['sigmaxlines'] : '';
|
||||
}
|
||||
|
||||
/* Let's disect all of these bit options */
|
||||
/* Let's dissect all of these bit options */
|
||||
$info = array(
|
||||
'g_id' => $group['usergroupid'],
|
||||
'g_name' => $group['title'],
|
||||
@@ -987,13 +994,16 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
};
|
||||
|
||||
/* Fetch our last warning */
|
||||
$warn_lastwarn = 0;
|
||||
try
|
||||
$warnings = iterator_to_array( $this->db->select( '*', 'infraction', array( "userid=?", $user['userid'] ), "dateline ASC" ) );
|
||||
$lastWarning = 0;
|
||||
|
||||
/* If there are warnings, get the last warning */
|
||||
if( \count( $warnings ) )
|
||||
{
|
||||
$warn_lastwarn = $this->db->select( 'dateline', 'infraction', array( "userid=?", $user['userid'] ), "dateline DESC", 1 )->first();
|
||||
$lastWarning = end( $warnings );
|
||||
reset( $warnings );
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
|
||||
/* Birthday */
|
||||
if ( $user['birthday'] )
|
||||
{
|
||||
@@ -1050,7 +1060,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'joined' => $user['joindate'],
|
||||
'ip_address' => $user['ipaddress'],
|
||||
'warn_level' => ( $user['ipoints'] > 2147483647 ) ? 2147483647 : $user['ipoints'],
|
||||
'warn_lastwarn' => $warn_lastwarn,
|
||||
'warn_lastwarn' => $lastWarning['dateline'],
|
||||
'bday_day' => $bday_day,
|
||||
'bday_month' => $bday_month,
|
||||
'bday_year' => $bday_year,
|
||||
@@ -1138,6 +1148,8 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
$firstTable = 'customprofilepic';
|
||||
$secondTable = 'customavatar';
|
||||
}
|
||||
$filedata = NULL;
|
||||
$filename = NULL;
|
||||
if ( $this->app->_session['more_info']['convertMembers']['photo_location'] == 'database' )
|
||||
{
|
||||
try
|
||||
@@ -1246,7 +1258,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
}
|
||||
}
|
||||
|
||||
$libraryClass->convertMember( $info, $profileFields, $filename, $filepath );
|
||||
$libraryClass->convertMember( $info, $profileFields, $filename, $filepath, $filedata );
|
||||
|
||||
/* Any friends need converting to followers? */
|
||||
foreach( $this->db->select( '*', 'userlist', array( "type=? AND friend=? AND userid=?", 'buddy', 'yes', $user['userid'] ) ) AS $follower )
|
||||
@@ -1259,30 +1271,39 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'follow_member_id' => $follower['userid'],
|
||||
) );
|
||||
}
|
||||
|
||||
/* 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 )
|
||||
|
||||
/* Skip this if we know that the user doesn't have any warnings */
|
||||
if( \count( $warnings ) )
|
||||
{
|
||||
$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'],
|
||||
/* And warn logs made on the profile - we'll do content specific later */
|
||||
foreach ( $warnings AS $warn )
|
||||
{
|
||||
if( $warn['postid'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$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']
|
||||
)
|
||||
);
|
||||
/* 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'] );
|
||||
@@ -1323,7 +1344,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
'status_id' => $status['vmid'],
|
||||
'status_member_id' => $status['userid'],
|
||||
'status_date' => $status['dateline'],
|
||||
'status_content' => $status['pagetext'],
|
||||
'status_content' => static::fixPostData( $status['pagetext'] ),
|
||||
'status_author_id' => $status['postuserid'],
|
||||
'status_author_ip' => $status['ipaddress'],
|
||||
'status_approved' => $approved
|
||||
@@ -1499,6 +1520,23 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
|
||||
/* Use stored author ids */
|
||||
$toUsers = \unserialize( $pm['touserarray'] );
|
||||
if( isset( $toUsers['cc'] ) )
|
||||
{
|
||||
foreach( array_keys( $toUsers['cc'] ) as $id )
|
||||
{
|
||||
$authors[ $id ] = $id;
|
||||
}
|
||||
}
|
||||
elseif( \count( $toUsers ) AND isset( $toUsers['cc'] ) AND isset( $toUsers['bcc'] ) )
|
||||
{
|
||||
foreach( array_keys( $toUsers ) as $id )
|
||||
{
|
||||
$authors[ $id ] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
$maps = array();
|
||||
|
||||
|
||||
Reference in new issue
Block a user