Version 4.5.0
This commit is contained in:
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 12 July 2017
|
||||
*/
|
||||
|
||||
namespace IPS\convert\Software\Core;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invision Core Converter
|
||||
*/
|
||||
class _Invisioncommunity extends \IPS\convert\Software
|
||||
{
|
||||
/**
|
||||
@@ -30,6 +33,14 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
*/
|
||||
public static $dbNeeded = FALSE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function __construct( \IPS\convert\App $app, $needDB=TRUE )
|
||||
{
|
||||
/* Set filename obscuring flag */
|
||||
@@ -188,6 +199,10 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
'table' => 'core_clubs_memberships',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertClubPages' => array(
|
||||
'table' => 'core_club_pages',
|
||||
'where' => NULL
|
||||
),
|
||||
'convertAttachments' => array(
|
||||
'table' => 'core_attachments',
|
||||
'where' => NULL
|
||||
@@ -491,7 +506,7 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
if( \count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
@@ -592,15 +607,17 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
$this->unsetNonStandardColumns( $row, 'core_members' );
|
||||
|
||||
$profilePhotoName = NULL;
|
||||
if( !in_array( $row['pp_photo_type'], array( 'letter', 'none', 'twitter', 'facebook', 'microsoft', '' ) ) )
|
||||
if( !\in_array( $row['pp_photo_type'], array( 'letter', 'none', 'twitter', 'facebook', 'microsoft', '' ) ) )
|
||||
{
|
||||
$profilePhotoName = array_pop( explode( '/', $row['pp_main_photo'] ) );
|
||||
$bits = explode( '/', $row['pp_main_photo'] );
|
||||
$profilePhotoName = array_pop( $bits );
|
||||
}
|
||||
|
||||
$coverPhotoName = NULL;
|
||||
if( $row['pp_cover_photo'] )
|
||||
{
|
||||
$coverPhotoName = array_pop( explode( '/', $row['pp_cover_photo'] ) );
|
||||
$coverBits = explode( '/', $row['pp_cover_photo'] );
|
||||
$coverPhotoName = array_pop( $coverBits );
|
||||
}
|
||||
|
||||
/* Profile Fields */
|
||||
@@ -620,6 +637,11 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
{
|
||||
$profileFields = array();
|
||||
}
|
||||
|
||||
/* Rename bit options so we can pass them through the conversion method */
|
||||
$row['ips_members_bitoptions'] = $row['members_bitoptions'];
|
||||
$row['ips_members_bitoptions2'] = $row['members_bitoptions2'];
|
||||
unset( $row['members_bitoptions'], $row['members_bitoptions2'] );
|
||||
|
||||
$path = $this->app->_session['more_info']['convertMembers']['upload_path'] . '/profile';
|
||||
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path, NULL, $coverPhotoName, $path );
|
||||
@@ -972,7 +994,7 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
$coverFile = $row['cover_photo'] ? $this->app->_session['more_info']['convertClubs']['upload_path'] . '/' . $row['cover_photo'] : NULL;
|
||||
|
||||
$libraryClass->convertClub( $row, $iconFile, NULL, $coverFile );
|
||||
$libraryClass->setLastKeyValue( $row['id'] );
|
||||
$libraryClass->setLastKeyValue( $row['club_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -996,6 +1018,26 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert club pages
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function convertClubPages()
|
||||
{
|
||||
$libraryClass = $this->getLibrary();
|
||||
$libraryClass::setKey( 'page_id' );
|
||||
|
||||
foreach( $this->fetch( 'core_club_pages', 'page_id' ) AS $row )
|
||||
{
|
||||
/* Remove non-standard columns */
|
||||
$this->unsetNonStandardColumns( $row, 'core_club_pages' );
|
||||
|
||||
$libraryClass->convertClubPage( $row );
|
||||
$libraryClass->setLastKeyValue( $row['page_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert attachments
|
||||
*
|
||||
@@ -1027,7 +1069,39 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
/* Remove non-standard columns */
|
||||
$this->unsetNonStandardColumns( $row, 'core_attachments' );
|
||||
$this->unsetNonStandardColumns( $attachmentMap, 'core_attachments_map' );
|
||||
|
||||
|
||||
/* Attach Types */
|
||||
switch( $attachmentMap['location_key'] )
|
||||
{
|
||||
case 'core_Messaging':
|
||||
$attachmentMap['id1_type'] = 'core_message_topics';
|
||||
$attachmentMap['id2_type'] = 'core_message_posts';
|
||||
$attachmentMap['id2_from_parent'] = FALSE;
|
||||
break;
|
||||
case 'core_Signatures':
|
||||
$attachmentMap['id1_type'] = 'core_members';
|
||||
break;
|
||||
case 'core_CustomField':
|
||||
$attachmentMap['id1_type'] = 'core_members';
|
||||
$attachmentMap['id2_type'] = 'core_pfields_data';
|
||||
$attachmentMap['id2_from_parent'] = FALSE;
|
||||
break;
|
||||
case 'core_ClubPage':
|
||||
$attachmentMap['id1_type'] = 'core_club_page';
|
||||
break;
|
||||
case 'core_Announcement':
|
||||
$attachmentMap['id1_type'] = 'core_announcement';
|
||||
break;
|
||||
default:
|
||||
// Can't convert this type
|
||||
$libraryClass->setLastKeyValue( $row['attach_id'] );
|
||||
continue 2;
|
||||
break;
|
||||
}
|
||||
|
||||
/* This applies to all options */
|
||||
$attachmentMap['id1_from_parent'] = FALSE;
|
||||
|
||||
/* Remap rows */
|
||||
$name = explode( '/', $row['attach_location'] );
|
||||
$row['attach_container'] = isset( $name[1] ) ? $name[0] : NULL;
|
||||
@@ -1066,7 +1140,7 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief default language
|
||||
* @brief Default language
|
||||
*/
|
||||
protected $_defaultLanguage = NULL;
|
||||
|
||||
@@ -1086,14 +1160,14 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief word storage
|
||||
* @brief Word storage
|
||||
*/
|
||||
protected $_words = [];
|
||||
|
||||
/**
|
||||
* Get word from language system
|
||||
*
|
||||
* @param string $key word key
|
||||
* @param string $key Word key
|
||||
* @return string
|
||||
*/
|
||||
public function getWord( $key )
|
||||
@@ -1123,17 +1197,17 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief table schema storage
|
||||
* @brief Table schema storage
|
||||
*/
|
||||
protected $_schemas = array();
|
||||
|
||||
/**
|
||||
* Remove non-standard columns from row data
|
||||
*
|
||||
* @param array $row database result row
|
||||
* @param string $table table name
|
||||
* @param string $app app to check
|
||||
* @return string
|
||||
* @param array $row Database result row
|
||||
* @param string $table Table name
|
||||
* @param string $app App to check
|
||||
* @return void
|
||||
*/
|
||||
public function unsetNonStandardColumns( &$row, $table, $app=NULL )
|
||||
{
|
||||
@@ -1165,14 +1239,20 @@ class _Invisioncommunity extends \IPS\convert\Software
|
||||
* Check if we can redirect the legacy URLs from this software to the new locations
|
||||
*
|
||||
* @return NULL|\IPS\Http\Url
|
||||
* @todo The proxy.php redirection is not validating the hash that XenForo set previously, derived from the globalSalt and the option imageLinkProxyKey. We need
|
||||
* to either validate the hash (there is an open proxy concern), or we need to convert all calls to proxy.php in posted content to prevent broken images in posts.
|
||||
*/
|
||||
public function checkRedirects()
|
||||
{
|
||||
$url = \IPS\Request::i()->url();
|
||||
|
||||
if( preg_match( '#/ips4merge/profile/([0-9]+)-(.+?)#i', $url->data[ \IPS\Http\Url::COMPONENT_PATH ], $matches ) )
|
||||
if( !\stristr( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'ic-merge-' . $this->app->app_id ) )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* account for non-mod_rewrite links */
|
||||
$searchOn = \stristr( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'index.php' ) ? $url->data[ \IPS\Http\Url::COMPONENT_QUERY ] : $url->data[ \IPS\Http\Url::COMPONENT_PATH ];
|
||||
|
||||
if( preg_match( '#/profile/([0-9]+)-(.+?)#i', $searchOn, $matches ) )
|
||||
{
|
||||
/* If we can't access profiles, don't bother trying to redirect */
|
||||
if( !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) )
|
||||
|
||||
Reference in new issue
Block a user