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,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() )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user