Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -79,7 +79,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "vBulletin Blog (3.x/4.x)";
|
||||
return "vBulletin Blog (3.8.x/4.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "vBulletin Calendar (3.x/4.x)";
|
||||
return "vBulletin Calendar (3.8.x/4.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -97,8 +97,8 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
$rows['convertPmAttachments'] = array(
|
||||
'step_method' => 'convertPmAttachments',
|
||||
'step_title' => 'convert_attachments',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments' )->first(),
|
||||
'source_rows' => $this->countRows( static::canConvert()['convertPmAttachments']['table'], static::canConvert()['convertPmAttachments']['where'] ),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_attachments' ),
|
||||
'source_rows' => array( 'table' => static::canConvert()['convertPmAttachments']['table'], 'where' => static::canConvert()['convertPmAttachments']['where'] ),
|
||||
'per_cycle' => 100,
|
||||
'dependencies' => array( 'convertPrivateMessageReplies' ),
|
||||
'link_type' => 'core_attachments',
|
||||
@@ -756,7 +756,7 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
$length = \strlen( $member->conv_password );
|
||||
$providedHash = FALSE;
|
||||
|
||||
@@ -220,7 +220,8 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
'convertReputationLevels',
|
||||
'convertClubs',
|
||||
'convertAttachments',
|
||||
'convertReactions'
|
||||
'convertReactions',
|
||||
'convertProfileFields'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -267,6 +268,32 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'convertProfileFields':
|
||||
$return['convertProfileFields'] = array();
|
||||
|
||||
$options = array();
|
||||
$options['none'] = \IPS\Member::loggedIn()->language()->addToStack( 'none' );
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_pfields_data' ), 'IPS\core\ProfileFields\Field' ) AS $field )
|
||||
{
|
||||
$options[ $field->_id ] = $field->_title;
|
||||
}
|
||||
|
||||
foreach( $this->db->select( '*', 'core_pfields_data' ) AS $field )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words["map_pfield_{$field['pf_id']}"] = $this->getWord( 'core_pfield_' . $field['pf_id'] );
|
||||
\IPS\Member::loggedIn()->language()->words["map_pfield_{$field['pf_id']}_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'map_pfield_desc' );
|
||||
|
||||
$return['convertProfileFields']["map_pfield_{$field['pf_id']}"] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Select',
|
||||
'field_default' => NULL,
|
||||
'field_required' => FALSE,
|
||||
'field_extra' => array( 'options' => $options ),
|
||||
'field_hint' => NULL,
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'convertGroups':
|
||||
$return['convertGroups'] = array();
|
||||
|
||||
@@ -541,7 +568,10 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
$row['pf_name'] = $this->getWord( 'core_pfield_' . $row['pf_id'] );
|
||||
$row['pf_desc'] = $this->getWord( 'core_pfield_' . $row['pf_id'] . '_desc' );
|
||||
|
||||
$libraryClass->convertProfileField( $row );
|
||||
/* Merge with existing field */
|
||||
$merge = ( $this->app->_session['more_info']['convertProfileFields']["map_pfield_{$row['pf_id']}"] != 'none' ) ? $this->app->_session['more_info']['convertProfileFields']["map_pfield_{$row['pf_id']}"] : NULL;
|
||||
|
||||
$libraryClass->convertProfileField( $row, $merge );
|
||||
$libraryClass->setLastKeyValue( $row['pf_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ class _Joomla extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
/* Joomla 3 */
|
||||
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) )
|
||||
|
||||
@@ -1117,7 +1117,7 @@ class _Mybb extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
if ( \IPS\Login::compareHashes( $member->conv_password, md5( md5( $member->misc ) . md5( $password ) ) ) )
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
{
|
||||
$rows['convertBanfilters2'] = $rows['convertBanfilters'];
|
||||
$rows['convertBanfilters2']['step_method'] = 'convertBanfilters2';
|
||||
$rows['convertBanfilters2']['source_rows'] = $this->countRows( static::canConvert()['convertBanfilters2']['table'], static::canConvert()['convertBanfilters2']['where'] );
|
||||
$rows['convertBanfilters2']['source_rows'] = array( 'table' => static::canConvert()['convertBanfilters2']['table'], 'where' => static::canConvert()['convertBanfilters2']['where'] );
|
||||
}
|
||||
|
||||
return $rows;
|
||||
@@ -361,9 +361,37 @@ class _Phpbb extends \IPS\convert\Software
|
||||
/* Convert newlines to <br> tags */
|
||||
$post = nl2br($post);
|
||||
|
||||
/* Preserve code data */
|
||||
$codeboxes = array();
|
||||
preg_match_all( "/\[code(.*?)\](.+?)\[\/code\]/ims", $post, $matches );
|
||||
|
||||
foreach( $matches[0] as $k => $m )
|
||||
{
|
||||
$c = \count( $codeboxes );
|
||||
$codeboxes[ $c ] = $m;
|
||||
|
||||
$replacement = '__CODE_BOX_' . $c . '__';
|
||||
|
||||
$post = str_replace( $m, $replacement, $post );
|
||||
}
|
||||
|
||||
/* Convert HTML entities back into actual entities */
|
||||
$post = html_entity_decode($post, ENT_COMPAT | ENT_HTML401, "UTF-8");
|
||||
|
||||
/* Put codeboxes back */
|
||||
foreach( $codeboxes as $k => $v )
|
||||
{
|
||||
$post = str_replace( '__CODE_BOX_' . $k . '__', $v, $post );
|
||||
}
|
||||
|
||||
/* PhpBB 3.2 */
|
||||
$search = array( '<r>', '<t>', '<s>', '<e>', '<code>', '</r>', '</t>', '</s>', '</e>', '</img>', '</url>', '</quote>', '</link_text>', '</code>' );
|
||||
$post = str_ireplace( $search, '', $post );
|
||||
$post = preg_replace( '/<url url=\"([^\]]+?)"([^>]+?)?>/i', '', $post );
|
||||
$post = preg_replace( '/<img src=\"([^\]]+?)"([^>]+?)?>/i', '', $post );
|
||||
$post = preg_replace( '/<quote author=\"([^\]]+?)"([^>]+?)?>/i', '', $post );
|
||||
$post = preg_replace( '/<link_text text=\"([^\]]+?)"([^>]+?)?>/i', '', $post );
|
||||
|
||||
/* Rework quotes so they'll match our parser style */
|
||||
$post = str_replace( '][quote', "]\n[quote", $post );
|
||||
$post = preg_replace( "#\[quote=(.+)\]#", "[quote name=$1]", $post );
|
||||
@@ -704,7 +732,8 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$filename = array_pop( $filebits );
|
||||
$filepath = implode( '/', $filebits );
|
||||
break;
|
||||
|
||||
|
||||
case 'avatar.driver.local':
|
||||
case 'avatar.driver.gallery':
|
||||
/* I couldn't figure out how to set these up so they are probably wrong */
|
||||
$filepath = $this->app->_session['more_info']['convertMembers']['gallery_location'];
|
||||
@@ -1139,7 +1168,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
$password = html_entity_decode( $password );
|
||||
$success = FALSE;
|
||||
|
||||
@@ -462,7 +462,7 @@ class _Punbb extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
$success = FALSE;
|
||||
|
||||
|
||||
@@ -908,7 +908,7 @@ class _Smf extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
if ( \IPS\Login::compareHashes( $member->conv_password, sha1( mb_strtolower( $member->name ) . html_entity_decode( $password ) ) ) )
|
||||
{
|
||||
|
||||
@@ -148,7 +148,7 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
$rows['convertMembersFollowers'] = array(
|
||||
'step_method' => 'convertMembersFollowers',
|
||||
'step_title' => 'convert_follows',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_follow', array( 'follow_app=? and follow_area=?', 'core', 'member' ) )->first(),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_follow', array( 'follow_app=? and follow_area=?', 'core', 'member' ) ),
|
||||
'source_rows' => $count,
|
||||
'per_cycle' => 500,
|
||||
'dependencies' => array( 'convertMembers' ),
|
||||
@@ -833,7 +833,7 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
$hash = $member->members_pass_hash;
|
||||
$salt = $member->members_pass_salt;
|
||||
|
||||
@@ -531,7 +531,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
'map_user_id' => $row['UserID'],
|
||||
'map_read_time' => static::mysqlToDateTime( $row['DateLastViewed'] ),
|
||||
//'map_folder_id' => TODO: Create a Bookmarks folder for "Bookmarked" conversations?
|
||||
'map_user_active' => (int) ( $row['Deleted'] != '0' ),
|
||||
'map_user_active' => $row['Deleted'] == 0 ? 1 : 0,
|
||||
'map_last_topic_reply' => static::mysqlToDateTime( $row['DateConversationUpdated'] )
|
||||
);
|
||||
}
|
||||
@@ -574,7 +574,7 @@ class _Vanilla extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
/* Vanilla 2.2 */
|
||||
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) OR mb_substr( $member->conv_password, 0, 3 ) == '$P$' )
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -488,8 +488,6 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
*/
|
||||
public static function fixPostData( $post )
|
||||
{
|
||||
//return nl2br( $post ); - I commented this out because it actually causes problems with LegacyParser, and most of what is used by vBulletin is actually handled by LegacyParser just fine, including linebreaks.
|
||||
|
||||
/* Fix Quotes */
|
||||
$post = preg_replace( "#\[quote=([^\];]+?)\]#i", "[quote name='$1']", $post );
|
||||
$post = preg_replace( "#\[quote=([^\];]+?);\d+\]#i", "[quote name='$1']", $post );
|
||||
|
||||
@@ -239,7 +239,7 @@ class _Wordpress extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
$success = FALSE;
|
||||
|
||||
|
||||
@@ -473,41 +473,46 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$post = htmlspecialchars( $post, ENT_DISALLOWED | ENT_QUOTES, 'UTF-8', FALSE );
|
||||
|
||||
// find YouTube ID's and replace.
|
||||
$post = preg_replace( '#\[media=youtube\](.+?)\[/media\]#i', '[media]http://www.youtube.com/watch?v=$1[/media]', $post );
|
||||
|
||||
/* Mentions */
|
||||
preg_match_all( '#\[user=(\d+)\](.+?)\[\/user\]#i', $post, $matches );
|
||||
|
||||
if ( count( $matches ) )
|
||||
$post = preg_replace( '#\[media=youtube\](.+?)\[/media\]#i', 'https://www.youtube.com/watch?v=$1', $post );
|
||||
$post = preg_replace( '#\[media=facebook\](.+?)\[/media\]#i', 'https://www.facebook.com/video.php?v=$1', $post );
|
||||
|
||||
/* Quick check for the presence of user tags */
|
||||
if( mb_stristr( $post, '[user=' ) )
|
||||
{
|
||||
if ( isset( $matches[1] ) )
|
||||
/* Mentions */
|
||||
preg_match_all( '#\[user=(\d+)\](.+?)\[\/user\]#i', $post, $matches );
|
||||
|
||||
if ( count( $matches ) )
|
||||
{
|
||||
$mentions = array();
|
||||
foreach( $matches[1] AS $k => $v )
|
||||
if ( isset( $matches[1] ) AND \count( $matches[1] ) )
|
||||
{
|
||||
if ( isset( $matches[2][ $k ] ) )
|
||||
$mentions = array();
|
||||
foreach ( $matches[1] AS $k => $v )
|
||||
{
|
||||
$name = trim( $matches[2][ $k ], '@' );
|
||||
$mentions[$name] = $v;
|
||||
if ( isset( $matches[2][ $k ] ) )
|
||||
{
|
||||
$name = trim( $matches[2][ $k ], '@' );
|
||||
$mentions[ $name ] = $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 ], '#' );
|
||||
$memberNameEscaped = preg_quote( $member_name, '#' );
|
||||
|
||||
$post = preg_replace( "#\[user={$member_id}\]@?{$memberNameEscaped}\[\/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 );
|
||||
}
|
||||
}
|
||||
|
||||
$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 ], '#' );
|
||||
$memberNameEscaped = preg_quote( $member_name, '#' );
|
||||
|
||||
$post = preg_replace( "#\[user={$member_id}\]@?{$memberNameEscaped}\[\/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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1084,6 +1089,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
'allow_admin_mails' => $row['receive_admin_email'],
|
||||
'member_title' => $row['custom_title'],
|
||||
'member_posts' => $row['message_count'],
|
||||
'signature' => $row['signature']
|
||||
);
|
||||
|
||||
/* Profile Photo */
|
||||
@@ -1513,7 +1519,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
public function login( $member, $password )
|
||||
public static function login( $member, $password )
|
||||
{
|
||||
$password = html_entity_decode( $password );
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class _Expressionengine extends \IPS\convert\Software
|
||||
{
|
||||
$rows['convertOtherPosts'] = $rows['convertForumsPosts'];
|
||||
$rows['convertOtherPosts']['step_method'] = 'convertOtherPosts';
|
||||
$rows['convertOtherPosts']['source_rows'] = $this->countRows( static::canConvert()['convertOtherPosts']['table'], static::canConvert()['convertOtherPosts']['where'] );
|
||||
$rows['convertOtherPosts']['source_rows'] = array( 'table' => static::canConvert()['convertOtherPosts']['table'], 'where' => static::canConvert()['convertOtherPosts']['where'] );
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
@@ -250,8 +250,9 @@ class _Phpbb extends \IPS\convert\Software
|
||||
foreach( $this->fetch( 'topics', 'topic_id' ) AS $row )
|
||||
{
|
||||
$poll = NULL;
|
||||
|
||||
if ( $row['poll_title'] )
|
||||
$pollTitle = str_ireplace( array( '<t>', '</t>' ), '', $row['poll_title'] );
|
||||
|
||||
if ( $pollTitle )
|
||||
{
|
||||
$poll = array();
|
||||
|
||||
@@ -261,16 +262,16 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$search = array(); # make sure we actually assign the vote correctly
|
||||
foreach( $this->db->select( '*', 'poll_options', array( "topic_id=?", $row['topic_id'] ) ) AS $choice )
|
||||
{
|
||||
$choices[$index] = $choice['poll_option_text'];
|
||||
$votes[$index] = $choice['poll_option_total'];
|
||||
$search[$index] = $choice['poll_option_id'];
|
||||
$choices[ $index ] = str_ireplace( array( '<t>', '</t>' ), '', $choice['poll_option_text'] );
|
||||
$votes[ $index ] = $choice['poll_option_total'];
|
||||
$search[ $index ] = $choice['poll_option_id'];
|
||||
$index++;
|
||||
}
|
||||
|
||||
$poll['poll_data'] = array(
|
||||
'pid' => $row['topic_id'],
|
||||
'choices' => array( 1 => array(
|
||||
'question' => $row['poll_title'],
|
||||
'question' => $pollTitle,
|
||||
'multi' => ( $row['poll_max_options'] > 1 ) ? 1 : 0,
|
||||
'choice' => $choices,
|
||||
'votes' => $votes,
|
||||
@@ -291,13 +292,13 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$ourVotes[$vote['vote_user_id']] = array( 'votes' => array() );
|
||||
}
|
||||
|
||||
$ourVotes[$vote['vote_user_id']]['votes'][] = array_search( $vote['poll_option_id'], $search );
|
||||
$ourVotes[$vote['vote_user_id']]['member_id'] = $vote['vote_user_id'];
|
||||
$ourVotes[ $vote['vote_user_id'] ]['votes'][] = array_search( $vote['poll_option_id'], $search );
|
||||
$ourVotes[ $vote['vote_user_id'] ]['member_id'] = $vote['vote_user_id'];
|
||||
}
|
||||
|
||||
foreach( $ourVotes AS $member_id => $vote )
|
||||
{
|
||||
$poll['vote_data'][$member_id] = array(
|
||||
$poll['vote_data'][ $member_id ] = array(
|
||||
'member_id' => $vote['member_id'],
|
||||
'member_choices' => array( 1 => $vote['votes'] ),
|
||||
);
|
||||
@@ -552,6 +553,19 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$types = array( 'forums', 'forums_forums' );
|
||||
$oldId = \IPS\Request::i()->f;
|
||||
}
|
||||
elseif( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'download/file.php' ) !== FALSE )
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( \IPS\Request::i()->id, array( 'attachments', 'core_attachments' ) );
|
||||
|
||||
return \IPS\Http\Url::external( \IPS\Settings::i()->base_url . 'applications/core/interface/file/attachment.php' )->setQueryString( 'id', $data );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if( isset( $class ) )
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ class _Smf extends \IPS\convert\Software
|
||||
{
|
||||
$rows['convertForumsBoards'] = $rows['convertForumsForums'];
|
||||
$rows['convertForumsBoards']['step_method'] = 'convertForumsBoards';
|
||||
$rows['convertForumsBoards']['source_rows'] = $this->countRows( static::canConvert()['convertForumsBoards']['table'], static::canConvert()['convertForumsBoards']['where'] );
|
||||
$rows['convertForumsBoards']['source_rows'] = array( 'table' => static::canConvert()['convertForumsBoards']['table'], 'where' => static::canConvert()['convertForumsBoards']['where'] );
|
||||
|
||||
return $rows;
|
||||
}
|
||||
@@ -540,6 +540,13 @@ class _Smf extends \IPS\convert\Software
|
||||
*/
|
||||
public function checkRedirects()
|
||||
{
|
||||
/* Support SMF friendly URLs ( index.php/topic,1000.0.html ) */
|
||||
$url = \IPS\Request::i()->url();
|
||||
if( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'topic,' ) !== FALSE )
|
||||
{
|
||||
\IPS\Request::i()->topic = (int) explode( ',', $url->data[ \IPS\Http\Url::COMPONENT_PATH ] )[1];
|
||||
}
|
||||
|
||||
if( isset( \IPS\Request::i()->topic ) )
|
||||
{
|
||||
if( mb_strpos( \IPS\Request::i()->topic, '.msg' ) !== FALSE )
|
||||
|
||||
@@ -98,7 +98,7 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
$rows['convertForumsTopicsRatings'] = array(
|
||||
'step_method' => 'convertForumsTopicsRatings',
|
||||
'step_title' => 'convert_ratings',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_ratings' )->first(),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_ratings' ),
|
||||
'source_rows' => $count,
|
||||
'per_cycle' => 1500,
|
||||
'dependencies' => array( 'convertForumsTopics' ),
|
||||
@@ -113,7 +113,7 @@ class _UBBthreads extends \IPS\convert\Software
|
||||
$rows['convertForumsTopicsFollowers'] = array(
|
||||
'step_method' => 'convertForumsTopicsFollowers',
|
||||
'step_title' => 'convert_follows',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_follow' )->first(),
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_follow' ),
|
||||
'source_rows' => $count,
|
||||
'per_cycle' => 1000,
|
||||
'dependencies' => array( 'convertForumsTopics' ),
|
||||
|
||||
@@ -599,22 +599,38 @@ class _Vanilla extends \IPS\convert\Software
|
||||
$url = \IPS\Request::i()->url();
|
||||
|
||||
if( preg_match( '#/discussion/([0-9]+)/#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
{
|
||||
$class = '\IPS\forums\Topic';
|
||||
$types = array( 'topics', 'forums_topics' );
|
||||
$oldId = (int) $matches[1];
|
||||
}
|
||||
elseif( preg_match( '#/discussion/comment/([0-9]+)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
{
|
||||
$class = '\IPS\forums\Topic\Post';
|
||||
$types = array( 'posts', 'forums_posts' );
|
||||
$oldId = $matches[1];
|
||||
}
|
||||
|
||||
if( isset( $class ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( (int) $matches[1], array( 'topics', 'forums_topics' ) );
|
||||
$data = (string) $this->app->getLink( $oldId, $types );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
$data = (string) $this->app->getLink( (int) $matches[1], array( 'topics', 'forums_topics' ), FALSE, TRUE );
|
||||
$data = (string) $this->app->getLink( $oldId, $types, FALSE, TRUE );
|
||||
}
|
||||
$item = \IPS\forums\Topic::load( $data );
|
||||
$item = $class::load( $data );
|
||||
|
||||
if( $item->canView() )
|
||||
if( $item instanceof \IPS\Content )
|
||||
{
|
||||
return $item->url();
|
||||
if( $item->canView() )
|
||||
{
|
||||
return $item->url();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \Exception $e )
|
||||
|
||||
@@ -87,7 +87,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "vBulletin Forums (3.x/4.x)";
|
||||
return "vBulletin Forums (3.8.x/4.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -601,11 +601,13 @@ class _Vbulletin5 extends \IPS\convert\Software
|
||||
|
||||
foreach( $main AS $attachment )
|
||||
{
|
||||
/* This is the first post in the topic */
|
||||
try
|
||||
{
|
||||
$this->app->getLink( $attachment['parentid'], 'forums_topics' );
|
||||
$post_id = $attachment['nodeid'];
|
||||
$post_id = $attachment['parentid'];
|
||||
}
|
||||
/* It isn't the first post in the topic */
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
try
|
||||
|
||||
@@ -303,9 +303,15 @@ class _Photopost extends \IPS\convert\Software
|
||||
|
||||
if( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showgallery.php' ) !== FALSE )
|
||||
{
|
||||
if( !$id = \IPS\Request::i()->cat )
|
||||
{
|
||||
preg_match( '#cat/([0-9]+)#', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches );
|
||||
$id = isset( $matches[1] ) ? $matches[1] : NULL;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( \IPS\Request::i()->cat, 'gallery_categories' );
|
||||
$data = (string) $this->app->getLink( $id, 'gallery_categories' );
|
||||
$item = \IPS\gallery\Category::load( $data );
|
||||
|
||||
if( $item->can('view') )
|
||||
@@ -320,9 +326,15 @@ class _Photopost extends \IPS\convert\Software
|
||||
}
|
||||
elseif( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'showphoto.php' ) !== FALSE )
|
||||
{
|
||||
if( !$id = \IPS\Request::i()->photo )
|
||||
{
|
||||
preg_match( '#photo/([0-9]+)#', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches );
|
||||
$id = isset( $matches[1] ) ? $matches[1] : NULL;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( \IPS\Request::i()->photo, 'gallery_images' );
|
||||
$data = (string) $this->app->getLink( $id, 'gallery_images' );
|
||||
$item = \IPS\gallery\Image::load( $data );
|
||||
|
||||
if( $item->canView() )
|
||||
|
||||
@@ -82,7 +82,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
public static function softwareName()
|
||||
{
|
||||
/* Child classes must override this method */
|
||||
return "vBulletin Gallery (3.x/4.x)";
|
||||
return "vBulletin Gallery (3.8.x/4.x)";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -443,7 +443,7 @@ class _Vbulletin extends \IPS\convert\Software
|
||||
|
||||
try
|
||||
{
|
||||
if( isset( \IPS\Request::i()->albumid ) )
|
||||
if( isset( \IPS\Request::i()->albumid ) AND mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'picture.php' ) === FALSE )
|
||||
{
|
||||
$data = $this->app->getLink( \IPS\Request::i()->albumid, 'gallery_albums' );
|
||||
$item = \IPS\gallery\Album::load( $data );
|
||||
|
||||
@@ -569,8 +569,9 @@ class _Xenforo extends \IPS\convert\Software
|
||||
$libraryClass->setlastKeyValue( $row['media_id'] );
|
||||
continue 2;
|
||||
}
|
||||
|
||||
$description = $em . "<br>" . isset( $row['media_description'] ) ? $row['media_description'] : $row['description'];
|
||||
|
||||
$description = ( isset( $row['media_description'] ) ? $row['media_description'] : $row['description'] );
|
||||
$description = $em . "<br>" . $description;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -702,7 +703,7 @@ class _Xenforo extends \IPS\convert\Software
|
||||
|
||||
$libraryClass::setKey( 'comment_id' );
|
||||
|
||||
foreach( $this->fetch( static::$tablePrefix . 'comment', 'comment_id', array( "content_type=?", 'media' ) ) AS $row )
|
||||
foreach( $this->fetch( static::$tablePrefix . 'comment', 'comment_id', array( "content_type=?", ( static::$isLegacy ? 'media' : 'xfmg_media' ) ) ) AS $row )
|
||||
{
|
||||
/* IP Address */
|
||||
try
|
||||
|
||||
Reference in new issue
Block a user