Version 5.0.0 beta 4

This commit is contained in:
Neo committed 2025-12-19 16:57:00 -08:00
1 parent e86153356a
commit 2f24f9de48
276 files changed
+8614 -6044

No files matched your search

@@ -49,9 +49,9 @@ class Expressionengine extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
return "Expression Engine";
}
@@ -59,9 +59,9 @@ class Expressionengine extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
return 'expressionengine';
}
@@ -69,9 +69,9 @@ class Expressionengine extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertProfileFields' => array(
@@ -109,9 +109,9 @@ class Expressionengine extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertPmAttachments'] = array(
@@ -130,9 +130,9 @@ class Expressionengine extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -140,9 +140,9 @@ class Expressionengine extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return FALSE;
}
@@ -150,9 +150,9 @@ class Expressionengine extends Software
/**
* List of Conversion Methods that require more information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertAttachments',
@@ -166,9 +166,9 @@ class Expressionengine extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -179,10 +179,10 @@ class Expressionengine extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -311,9 +311,9 @@ class Expressionengine extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -344,7 +344,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -389,8 +389,7 @@ class Expressionengine extends Software
Db::i()->update( 'core_members', array( 'signature' => $signature ), array( "member_id=?", $memberId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['member_id'] );
}
@@ -401,7 +400,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -432,7 +431,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -473,7 +472,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -579,7 +578,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -635,7 +634,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -662,7 +661,7 @@ class Expressionengine extends Software
*
* @return void
*/
public function convertPmAttachments()
public function convertPmAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -708,8 +707,7 @@ class Expressionengine extends Software
Db::i()->update( 'core_message_posts', array( 'msg_post' => $message ), array( "msg_id=?", $pmId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['attachment_id'] );
}
@@ -718,9 +716,9 @@ class Expressionengine extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -753,7 +751,7 @@ class Expressionengine extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$length = strlen( $member->conv_password );
$providedHash = FALSE;
@@ -778,6 +776,6 @@ class Expressionengine extends Software
break;
}
return ( Login::compareHashes( $member->conv_password, $providedHash ) ) ? TRUE : FALSE;
return Login::compareHashes( $member->conv_password, $providedHash );
}
}
@@ -26,6 +26,7 @@ use IPS\convert\Software;
use IPS\Data\Cache;
use IPS\Data\Store;
use IPS\Db;
use IPS\Db\Exception as DbException;
use IPS\File;
use IPS\Http\Url;
use IPS\Member;
@@ -52,12 +53,12 @@ class Invisioncommunity extends Software
/**
* @brief Whether the versions of IPS4 match
*/
public static $versionMatch = FALSE;
public static bool $versionMatch = FALSE;
/**
* @brief Whether the database has been required
*/
public static $dbNeeded = FALSE;
public static bool $dbNeeded = FALSE;
/**
* Constructor
@@ -67,12 +68,12 @@ class Invisioncommunity extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
/* Set filename obscuring flag */
Library::$obscureFilenames = FALSE;
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if( $needDB )
{
@@ -88,18 +89,16 @@ class Invisioncommunity extends Software
static::$versionMatch = TRUE;
}
}
catch( \IPS\Db\Exception $e ) {}
catch( DbException $e ) {}
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return 'Invision Community (' . Application::load( 'core' )->version . ')';
@@ -108,9 +107,9 @@ class Invisioncommunity extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "invisioncommunity";
@@ -119,9 +118,9 @@ class Invisioncommunity extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
if( !static::$versionMatch AND static::$dbNeeded )
{
@@ -239,9 +238,9 @@ class Invisioncommunity extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -249,9 +248,9 @@ class Invisioncommunity extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -268,10 +267,10 @@ class Invisioncommunity extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -288,7 +287,7 @@ class Invisioncommunity extends Software
$return[ $method ] = array(
'upload_path' => array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => isset( $this->app->_session['more_info']['convertEmoticons']['upload_path'] ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] : NULL,
'field_default' => $this->app->_session['more_info']['convertEmoticons']['upload_path'] ?? NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => Member::loggedIn()->language()->addToStack('convert_invision_upload_path'),
@@ -365,9 +364,9 @@ class Invisioncommunity extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -450,7 +449,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAcronyms()
public function convertAcronyms() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'a_id' );
@@ -471,7 +470,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -491,14 +490,14 @@ class Invisioncommunity extends Software
/* Remap rows */
$name = explode( '/', $row['image'] );
$row['filename'] = isset( $name[1] ) ? $name[1] : $name[0];
$row['filename'] = $name[1] ?? $name[0];
$path = ( isset( $name[1] ) ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] . "/{$name[0]}" : $this->app->_session['more_info']['convertEmoticons']['upload_path'];
$path2 = NULL;
if( $row['image_2x'] )
{
$name2 = explode( '/', $row['image_2x'] );
$row['filenamex2'] = isset( $name2[1] ) ? $name2[1] : $name2[0];
$row['filenamex2'] = $name2[1] ?? $name2[0];
$path2 = ( isset( $name2[1] ) ) ? $this->app->_session['more_info']['convertEmoticons']['upload_path'] . "/{$name2[0]}" : $this->app->_session['more_info']['convertEmoticons']['upload_path'];
}
@@ -543,7 +542,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertBanFilters()
public function convertBanFilters() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ban_id' );
@@ -563,7 +562,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'g_id' );
@@ -598,7 +597,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pf_group_id' );
@@ -621,7 +620,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pf_id' );
@@ -648,7 +647,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'member_id' );
@@ -706,7 +705,7 @@ class Invisioncommunity extends Software
unset( $row['members_bitoptions'], $row['members_bitoptions2'] );
$path = $this->app->_session['more_info']['convertMembers']['upload_path'] . '/';
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path . ( isset( $bits[0] ) ? $bits[0] : '' ), NULL, $coverPhotoName, $path . ( isset( $coverBits[0] ) ? $coverBits[0] : '' ) );
$libraryClass->convertMember( $row, $profileFields, $profilePhotoName, $path . ( $bits[0] ?? '' ), NULL, $coverPhotoName, $path . ( $coverBits[0] ?? '' ) );
/* Any friends need converting to followers? */
foreach( $this->db->select( '*', 'core_follow', array( 'follow_app=? AND follow_area=? AND follow_rel_id=?', 'core', 'member', $row['member_id'] ) ) as $follow )
@@ -748,7 +747,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'wid' );
@@ -768,7 +767,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertQuestionAndAnswers()
public function convertQuestionAndAnswers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'qa_id' );
@@ -793,7 +792,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertReputationLevels()
public function convertReputationLevels() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'level_id' );
@@ -819,7 +818,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertReactions()
public function convertReactions() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'reaction_id' );
@@ -834,7 +833,7 @@ class Invisioncommunity extends Software
/* Remap rows */
$name = explode( '/', $row['reaction_icon'] );
$row['filename'] = isset( $name[1] ) ? $name[1] : $name[0];
$row['filename'] = $name[1] ?? $name[0];
$path = ( isset( $name[1] ) ) ? $this->app->_session['more_info']['convertReactions']['upload_path'] . "/{$name[0]}" : $this->app->_session['more_info']['convertReactions']['upload_path'];
/* We'll figure this out later */
@@ -851,7 +850,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'wr_id' );
@@ -874,7 +873,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'announce_id' );
@@ -894,7 +893,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertDnameChanges()
public function convertDnameChanges() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'log_id' );
@@ -915,7 +914,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ignore_id' );
@@ -935,7 +934,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'mt_id' );
@@ -957,7 +956,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'msg_id' );
@@ -977,7 +976,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertModerators()
public function convertModerators() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -997,7 +996,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'id' );
@@ -1025,7 +1024,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'club_id' );
@@ -1045,7 +1044,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertClubPages()
public function convertClubPages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'page_id' );
@@ -1065,12 +1064,12 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'attach_id' );
$mapTypes = array_keys( Application::load('core')->extensions( 'core', 'EditorLocations', FALSE, FALSE ) );
$mapTypes = array_keys( Application::load('core')->extensions( 'core', 'EditorLocations', FALSE ) );
array_walk( $mapTypes, function( &$value )
{
$value = 'core_' . $value;
@@ -1118,7 +1117,6 @@ class Invisioncommunity extends Software
// Can't convert this type
$libraryClass->setLastKeyValue( $row['attach_id'] );
continue 2;
break;
}
/* This applies to all options */
@@ -1146,7 +1144,7 @@ class Invisioncommunity extends Software
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'log_id' );
@@ -1165,14 +1163,14 @@ class Invisioncommunity extends Software
/**
* @brief Default language
*/
protected $_defaultLanguage = NULL;
protected ?int $_defaultLanguage = NULL;
/**
* Get default language id
*
* @return int
*/
protected function _defaultLanguage()
protected function _defaultLanguage() : int
{
if( $this->_defaultLanguage !== NULL )
{
@@ -1185,7 +1183,7 @@ class Invisioncommunity extends Software
/**
* @brief Word storage
*/
protected $_words = [];
protected array $_words = [];
/**
* Get word from language system
@@ -1193,7 +1191,7 @@ class Invisioncommunity extends Software
* @param string $key Word key
* @return string
*/
public function getWord( $key )
public function getWord( string $key ) : string
{
if( isset( $this->_words[ $key ] ) )
{
@@ -1202,7 +1200,7 @@ class Invisioncommunity extends Software
try
{
$result = $this->_words[ $key ] = $this->db->select( 'word_custom, word_default', 'core_sys_lang_words', array( 'word_key=? AND lang_id=?', $key, $this->_defaultLanguage() ) )->first();
$result = $this->db->select( 'word_custom, word_default', 'core_sys_lang_words', array( 'word_key=? AND lang_id=?', $key, $this->_defaultLanguage() ) )->first();
}
/* Can't find the word, so return the original string */
catch( UnderflowException $e )
@@ -1222,17 +1220,17 @@ class Invisioncommunity extends Software
/**
* @brief Table schema storage
*/
protected $_schemas = array();
protected array $_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
* @param string|null $app App to check
* @return void
*/
public function unsetNonStandardColumns( &$row, $table, $app=NULL )
public function unsetNonStandardColumns( array &$row, string $table, ?string $app=NULL ) : void
{
if( $app === NULL )
{
@@ -1261,9 +1259,9 @@ class Invisioncommunity extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -40,9 +40,9 @@ class Joomla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Joomla";
@@ -51,9 +51,9 @@ class Joomla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "joomla";
@@ -62,9 +62,9 @@ class Joomla extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertGroups' => array(
@@ -81,9 +81,9 @@ class Joomla extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -91,9 +91,9 @@ class Joomla extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertGroups'
@@ -103,10 +103,10 @@ class Joomla extends Software
/**
* Get More Information
*
* @param string $method Method name
* @return array
* @param string $method Method name
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -144,9 +144,9 @@ class Joomla extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -166,7 +166,7 @@ class Joomla extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -202,7 +202,7 @@ class Joomla extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -254,14 +254,14 @@ class Joomla extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* 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 ) )
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
return $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
return $ph->CheckPassword( $password, $member->conv_password );
}
/* Joomla 2 */
@@ -51,9 +51,9 @@ class Mybb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "MyBB 1.8.x";
@@ -62,9 +62,9 @@ class Mybb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "mybb";
@@ -73,9 +73,9 @@ class Mybb extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertBanfilters' => array(
@@ -132,9 +132,9 @@ class Mybb extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -142,9 +142,9 @@ class Mybb extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -157,10 +157,10 @@ class Mybb extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -286,9 +286,9 @@ class Mybb extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -318,9 +318,9 @@ class Mybb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -342,7 +342,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
@@ -369,7 +369,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -408,7 +408,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -448,7 +448,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertWarnActions()
public function convertWarnActions() : void
{
$libraryClass = $this->getLibrary();
@@ -475,7 +475,6 @@ class Mybb extends Software
}
else
{
$suspend_unit = 'h';
$suspend = floor( $action['length'] / 3600 );
}
break;
@@ -489,7 +488,6 @@ class Mybb extends Software
}
else
{
$rpa_unit = 'h';
$rpa = floor( $action['length'] / 3600 );
}
break;
@@ -503,7 +501,6 @@ class Mybb extends Software
}
else
{
$mq_unit = 'h';
$mq = floor( $action['length'] / 3600 );
}
break;
@@ -529,7 +526,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
@@ -553,7 +550,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -597,31 +594,28 @@ class Mybb extends Software
* @param string $type MyBB Type
* @return string IPS Type
*/
protected function _fieldMap( $type )
protected function _fieldMap( string $type ) : string
{
switch( $type )
{
case 'text':
return 'Text';
break;
case 'textarea':
return "TextArea";
break;
case 'select':
case 'multiselect':
return 'Select';
break;
case 'checkbox':
return 'CheckboxSet';
break;
case 'radio':
return 'Radio';
break;
}
return '';
}
/**
@@ -629,7 +623,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -656,7 +650,6 @@ class Mybb extends Software
/* Bubble up */
throw new UnderflowException;
}
$promotion_unit = 0;
$promotion_data = array( $promotion['newusergroup'], $promotion['posts'] );
break;
@@ -665,7 +658,6 @@ class Mybb extends Software
{
throw new UnderflowException;
}
$promotion_unit = 0;
$promotion_data = array( $promotion['newusergroup'], $promotion['registered'] );
break;
}
@@ -674,8 +666,8 @@ class Mybb extends Software
/* Username Styles */
$style = explode( '{username}', $row['namestyle'] );
$prefix = isset( $style[0] ) ? $style[0] : '';
$suffix = isset( $style[1] ) ? $style[1] : '';
$prefix = $style[0] ?? '';
$suffix = $style[1] ?? '';
$info = array(
'g_id' => $row['gid'],
@@ -729,7 +721,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -982,7 +974,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1025,7 +1017,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1051,7 +1043,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -1074,7 +1066,7 @@ class Mybb extends Software
*
* @return void
*/
public function convertQuestionAndAnswers()
public function convertQuestionAndAnswers() : void
{
$libraryClass = $this->getLibrary();
@@ -1094,9 +1086,9 @@ class Mybb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -1129,7 +1121,7 @@ class Mybb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, md5( md5( $member->misc ) . md5( $password ) ) ) )
{
@@ -44,9 +44,9 @@ class Photopost extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Photopost (8.x)";
@@ -55,9 +55,9 @@ class Photopost extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "photopost";
@@ -66,9 +66,9 @@ class Photopost extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertGroups' => array(
@@ -85,9 +85,9 @@ class Photopost extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertGroups',
@@ -98,10 +98,10 @@ class Photopost extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -173,9 +173,9 @@ class Photopost extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -199,7 +199,7 @@ class Photopost extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -233,7 +233,7 @@ class Photopost extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -307,9 +307,9 @@ class Photopost extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -54,9 +54,9 @@ class Phpbb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "phpBB (3.1.x/3.2.x/3.3.x)";
@@ -65,9 +65,9 @@ class Phpbb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "phpbb";
@@ -76,9 +76,9 @@ class Phpbb extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertEmoticons' => array(
@@ -128,9 +128,9 @@ class Phpbb extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$rows['convertBanfilters2'] = array(
@@ -149,13 +149,13 @@ class Phpbb extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -172,20 +172,18 @@ class Phpbb extends Software
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
return $count;
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -193,9 +191,9 @@ class Phpbb extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_phpbb_preconvert';
}
@@ -203,9 +201,9 @@ class Phpbb extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -218,10 +216,10 @@ class Phpbb extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
switch( $method )
{
@@ -349,9 +347,9 @@ class Phpbb extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -384,7 +382,7 @@ class Phpbb extends Software
* @note PHPBB does bbcode like '[b:lsu27ljs]Bold text here[/b:lsu27ljs]' so we need to strip these uids to parse properly
* @return string
*/
public static function stripUid( $post, $uid )
public static function stripUid( string $post, string $uid ) : string
{
return str_replace( ":" . $uid . "]", "]", $post );
}
@@ -392,9 +390,9 @@ class Phpbb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -463,7 +461,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -493,7 +491,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -537,11 +535,6 @@ class Phpbb extends Software
$default = json_encode( $options );
break;
case 'googleplus':
case 'string':
$type = 'Text';
break;
case 'int':
$type = 'Number';
break;
@@ -553,7 +546,9 @@ class Phpbb extends Software
case 'url':
$type = 'Url';
break;
case 'googleplus':
case 'string':
default:
$type = 'Text';
break;
@@ -586,7 +581,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -634,14 +629,14 @@ class Phpbb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'user_id' );
try
{
/* Try to auto detect the salt */
/* Try to auto-detect the salt */
$avatarSalt = $this->db->select( 'config_value', 'config', array( 'config_name=?', 'avatar_salt' ) )->first();
if( empty( $avatarSalt ) )
@@ -735,7 +730,7 @@ class Phpbb extends Software
'last_activity' => $row['user_lastmark'],
'mgroup_others' => $groups,
'timezone' => $timezone,
'allow_admin_mails' => ( $row['user_allow_massemail'] ) ? TRUE : FALSE,
'allow_admin_mails' => (bool)$row['user_allow_massemail'],
'members_disable_pm' => ( $row['user_allow_pm'] ) ? 0 : 1,
'member_posts' => $row['user_posts'],
'member_last_post' => $row['user_lastpost_time'],
@@ -864,7 +859,7 @@ class Phpbb extends Software
'wl_moderator' => $log['user_id'],
'wl_date' => $warn['warning_time'],
'wl_points' => 1,
'wl_note_member' => isset( $data[0] ) ? $data[0] : NULL,
'wl_note_member' => $data[0] ?? NULL,
) );
/* Add a member history record for this member */
@@ -888,7 +883,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -914,7 +909,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -938,7 +933,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -980,7 +975,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertBanfilters2()
public function convertBanfilters2() : void
{
$libraryClass = $this->getLibrary();
@@ -1004,7 +999,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1064,7 +1059,7 @@ class Phpbb extends Software
'map_user_id' => $to['user_id'],
'map_is_starter' => 0,
'map_last_topic_reply' => $row['message_time'],
'map_folder_id' => ( $to['folder_id'] > 0 ) ? $this->_getPmFolder( $to['user_id'], $to['folder_id'] ) : FALSE
'map_folder_id' => $to['folder_id'] > 0 and $this->_getPmFolder( $to['user_id'], $to['folder_id'] )
);
}
@@ -1079,7 +1074,7 @@ class Phpbb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1103,9 +1098,9 @@ class Phpbb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -1134,12 +1129,12 @@ class Phpbb extends Software
/**
* @brief Lookup cache
*/
protected static $pmFolders = array();
protected static array $pmFolders = array();
/**
* @brief PhpBB Source Folders
*/
protected static $phpBbFolders = NULL;
protected static ?array $phpBbFolders = NULL;
/**
* Get array key for the folder
@@ -1148,7 +1143,7 @@ class Phpbb extends Software
* @param string $folderId Folder Name
* @return boolean
*/
protected function _getPmFolder( $user, $folderId )
protected function _getPmFolder( int $user, string $folderId ) : bool
{
/* Check for cached folder info */
if( isset( static::$pmFolders[ $user ][ $folderId ] ) )
@@ -1170,7 +1165,7 @@ class Phpbb extends Software
throw new OutOfRangeException;
}
$member = Member::load( $this->app->getLink( (int) $user, 'core_members' ) );
$member = Member::load( $this->app->getLink( $user, 'core_members' ) );
$filters = json_decode( $member->pconversation_filters, TRUE );
/* No PM Folders or it's a guest */
@@ -1195,7 +1190,7 @@ class Phpbb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$password = html_entity_decode( $password );
$success = FALSE;
@@ -1206,7 +1201,7 @@ class Phpbb extends Software
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
$success = $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
$success = $ph->CheckPassword( $password, $member->conv_password );
}
$hashLibrary = new HashCryptPrivate;
@@ -1218,18 +1213,18 @@ class Phpbb extends Software
if ( strlen( $hash ) == 34 )
{
$success = ( Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) );
}
else
{
$success = ( Login::compareHashes( $hash, $single_md5_pass ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $hash, $single_md5_pass );
}
}
/* phpBB2 */
if ( !$success )
{
$success = ( Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $single_md5_pass, $hash, $itoa64 ) ) ) ? TRUE : FALSE ;
$success = Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $single_md5_pass, $hash, $itoa64 ) );
}
/* Fallback to password_verify(), this applies to PhpBB 3.3+ where Argon may be used */
@@ -36,9 +36,9 @@ class Phpmyforum extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PhpMyForum";
@@ -47,9 +47,9 @@ class Phpmyforum extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "phpmyforum";
@@ -58,9 +58,9 @@ class Phpmyforum extends Software
/**
* Content we can convert from this software.
*
* @return NULL
* @return array|NULL
*/
public static function canConvert()
public static function canConvert(): ?array
{
return NULL;
}
@@ -68,9 +68,9 @@ class Phpmyforum extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -44,9 +44,9 @@ class Punbb extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "PunBB (1.x)";
@@ -55,9 +55,9 @@ class Punbb extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "punbb";
@@ -66,9 +66,9 @@ class Punbb extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertGroups' => array(
@@ -93,9 +93,9 @@ class Punbb extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -103,9 +103,9 @@ class Punbb extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertGroups',
@@ -116,10 +116,10 @@ class Punbb extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -179,9 +179,9 @@ class Punbb extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -206,9 +206,9 @@ class Punbb extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -224,7 +224,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -254,7 +254,7 @@ class Punbb extends Software
$libraryClass->convertGroup( $info );
$libraryClass->setLastKeyValue( $row['g_id'], $merge );
$libraryClass->setLastKeyValue( $row['g_id'] );
}
/* Now check for group promotions */
@@ -272,7 +272,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -343,7 +343,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -394,7 +394,7 @@ class Punbb extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -419,9 +419,9 @@ class Punbb extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -454,7 +454,7 @@ class Punbb extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$success = FALSE;
@@ -49,9 +49,9 @@ class Smf extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Simple Machines Forum (2.0.x)";
@@ -60,9 +60,9 @@ class Smf extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "smf";
@@ -71,9 +71,9 @@ class Smf extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertBanfilters' => array(
@@ -114,9 +114,9 @@ class Smf extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -124,9 +124,9 @@ class Smf extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -139,13 +139,13 @@ class Smf extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -162,21 +162,19 @@ class Smf extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -306,9 +304,9 @@ class Smf extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -337,9 +335,9 @@ class Smf extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -364,7 +362,7 @@ class Smf extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -406,7 +404,7 @@ class Smf extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -435,7 +433,7 @@ class Smf extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -493,7 +491,7 @@ class Smf extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -518,7 +516,7 @@ class Smf extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -580,7 +578,7 @@ class Smf extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -627,7 +625,7 @@ class Smf extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -866,7 +864,7 @@ class Smf extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -900,10 +898,10 @@ class Smf extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
* @note Current profile URL format: /index.php?action=profile;u=123
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -954,7 +952,7 @@ class Smf extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, sha1( mb_strtolower( $member->name ) . html_entity_decode( $password ) ) ) )
{
@@ -17,6 +17,7 @@ use Exception;
use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\Software;
use IPS\convert\Software\Exception as SoftwareException;
use IPS\core\Ignore;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -48,25 +49,25 @@ class UBBthreads extends Software
* @brief Emoticons WHERE statement
* @see convertEmoticons()
*/
protected static $emoticonsWhere = 'GRAEMLIN_IS_ACTIVE=1';
protected static string $emoticonsWhere = 'GRAEMLIN_IS_ACTIVE=1';
/**
* @brief Groups WHERE statement
* @see convertGroups()
*/
protected static $groupsWhere = 'GROUP_IS_DISABLED=0';
protected static string $groupsWhere = 'GROUP_IS_DISABLED=0';
/**
* @brief Ignored users WHERE statement
* @see convertIgnoredUsers()
*/
protected static $ignoredUsersWhere = "USER_IGNORE_LIST IS NOT NULL AND USER_IGNORE_LIST NOT IN ( '', '-' )";
protected static string $ignoredUsersWhere = "USER_IGNORE_LIST IS NOT NULL AND USER_IGNORE_LIST NOT IN ( '', '-' )";
/**
* @brief Members WHERE statement
* @see convertMembers()
*/
protected static $membersWhere = array( 'u.USER_LOGIN_NAME<>?', '**DONOTDELETE**' );
protected static array $membersWhere = array( 'u.USER_LOGIN_NAME<>?', '**DONOTDELETE**' );
/**
* This is.. kind of hacky, but it's used so we can try and support non-exact profanity matches without converting
@@ -75,7 +76,7 @@ class UBBthreads extends Software
* @brief Profanity filters WHERE statement
* @see convertProfanityFilters()
*/
protected static $profanityFiltersWhere = '(
protected static string $profanityFiltersWhere = '(
CENSOR_WORD NOT LIKE "%(.*)%" AND (
CENSOR_WORD NOT LIKE "%(.*?)%" OR (
CENSOR_WORD LIKE "%(.*?)" AND CENSOR_WORD NOT LIKE "%(.*?)%(.*?)"
@@ -86,9 +87,9 @@ class UBBthreads extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "UBBthreads";
@@ -97,9 +98,9 @@ class UBBthreads extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "ubbthreads";
@@ -108,9 +109,9 @@ class UBBthreads extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertEmoticons' => array(
@@ -156,9 +157,9 @@ class UBBthreads extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$count = $this->countRows( static::canConvert()['convertMembersFollowers']['table'], static::canConvert()['convertMembersFollowers']['where'] );
@@ -182,9 +183,9 @@ class UBBthreads extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -192,13 +193,13 @@ class UBBthreads extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch ( $table )
{
@@ -214,9 +215,9 @@ class UBBthreads extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -231,7 +232,7 @@ class UBBthreads extends Software
* @param string $date Date to try to convert
* @return DateTime|null
*/
protected function stringToDateTime( $date )
protected function stringToDateTime( string $date ) : ?DateTime
{
try
{
@@ -246,10 +247,10 @@ class UBBthreads extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -347,9 +348,9 @@ class UBBthreads extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -379,9 +380,9 @@ class UBBthreads extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -398,7 +399,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertBanfilters()
public function convertBanfilters() : void
{
$libraryClass = $this->getLibrary();
@@ -432,7 +433,7 @@ class UBBthreads extends Software
) );
}
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
/**
@@ -440,7 +441,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -474,7 +475,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'GROUP_ID' );
@@ -508,7 +509,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'USER_ID' );
@@ -547,7 +548,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'u.USER_ID' );
@@ -635,7 +636,7 @@ class UBBthreads extends Software
}
$fieldColumn = 'USER_' . strtoupper( $pseudo );
$pfields[ $pseudo ] = isset( $row[ $fieldColumn ] ) ? $row[ $fieldColumn ] : NULL;
$pfields[ $pseudo ] = $row[$fieldColumn] ?? NULL;
}
/* Profile photo */
@@ -670,7 +671,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertMembersFollowers()
public function convertMembersFollowers() : void
{
$libraryClass = $this->getLibrary();
@@ -692,7 +693,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'TOPIC_ID' );
@@ -735,7 +736,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -761,7 +762,7 @@ class UBBthreads extends Software
*
* @return void
*/
public function convertProfanityFilters()
public function convertProfanityFilters() : void
{
$libraryClass = $this->getLibrary();
@@ -783,15 +784,15 @@ class UBBthreads extends Software
) );
}
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -829,7 +830,7 @@ class UBBthreads extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$hash = $member->members_pass_hash;
$salt = $member->members_pass_salt;
@@ -14,10 +14,7 @@ namespace IPS\convert\Software\Core;
use DateTimeZone;
use erusev\Parsedown;
use Exception;
use InvalidArgumentException;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -51,9 +48,9 @@ class Vanilla extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "Vanilla (3.x)";
@@ -62,9 +59,9 @@ class Vanilla extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vanilla";
@@ -73,9 +70,9 @@ class Vanilla extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -83,9 +80,9 @@ class Vanilla extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array(
'fluid' => array( 'title' => Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ), 'value' => true, 'our_key' => 'use_fluid_view_convert', 'our_title' => Member::loggedIn()->language()->addToStack( 'use_fluid_view_convert' ) )
@@ -100,9 +97,9 @@ class Vanilla extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
if ( !isset( $settings['use_fluid_view_convert'] ) OR $settings['use_fluid_view_convert'] == FALSE )
if ( !isset( $settings['use_fluid_view_convert'] ) OR !$settings['use_fluid_view_convert'] )
{
return;
}
@@ -116,9 +113,9 @@ class Vanilla extends Software
*
* @param string $location File location retrieved from the database
* @param string $uploadsPath Configured uploads path
* @return Url|string|void
* @return Url|string|null
*/
public static function parseMediaLocation( $location, $uploadsPath )
public static function parseMediaLocation( string $location, string $uploadsPath ) : Url|string|null
{
$uploadsPath = str_replace( '\\', '/', $uploadsPath );
@@ -148,7 +145,7 @@ class Vanilla extends Software
{
if ( !isset( $parts['path'], $parts['host'] ) )
{
return;
return null;
}
// This is a url in the format type:://domain/path.
@@ -173,7 +170,7 @@ class Vanilla extends Software
* @param string $date Date(Time) string
* @return DateTime Timestamp on successful conversion, otherwise NULL
*/
public static function mysqlToDateTime( $date )
public static function mysqlToDateTime( string $date ) : DateTime
{
return DateTime::ts( strtotime( $date ) ?: time() );
}
@@ -181,9 +178,9 @@ class Vanilla extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertGroups' => array(
@@ -208,9 +205,9 @@ class Vanilla extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -218,9 +215,9 @@ class Vanilla extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vanilla_preconvert';
}
@@ -228,9 +225,9 @@ class Vanilla extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertGroups',
@@ -241,10 +238,10 @@ class Vanilla extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
switch( $method )
{
@@ -294,9 +291,9 @@ class Vanilla extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -325,14 +322,14 @@ class Vanilla extends Software
/**
* @brief Store parsedown object
*/
protected static $_parseDown = NULL;
protected static ?Parsedown $_parseDown = NULL;
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -419,7 +416,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'r.RoleID' );
@@ -454,7 +451,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'u.UserID' );
@@ -542,7 +539,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ConversationID' );
@@ -569,14 +566,14 @@ class Vanilla extends Software
$maps = array();
$rows = iterator_to_array( $this->db->select( '*', 'UserConversation', array( 'ConversationID=?', $row['ConversationID'] ) ) );
$this->app->preCacheLinks( $rows, [ 'core_members' => 'UserID' ] );
foreach ( $rows as $row )
foreach ( $rows as $r )
{
$maps[ $row['UserID'] ] = array(
'map_user_id' => $row['UserID'],
'map_read_time' => static::mysqlToDateTime( $row['DateLastViewed'] ),
$maps[ $r['UserID'] ] = array(
'map_user_id' => $r['UserID'],
'map_read_time' => static::mysqlToDateTime( $r['DateLastViewed'] ),
//'map_folder_id' => TODO: Create a Bookmarks folder for "Bookmarked" conversations?
'map_user_active' => $row['Deleted'] == 0 ? 1 : 0,
'map_last_topic_reply' => static::mysqlToDateTime( $row['DateConversationUpdated'] )
'map_user_active' => $r['Deleted'] == 0 ? 1 : 0,
'map_last_topic_reply' => static::mysqlToDateTime( $r['DateConversationUpdated'] )
);
}
@@ -590,7 +587,7 @@ class Vanilla extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'MessageID' );
@@ -626,14 +623,14 @@ class Vanilla extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* 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$' )
{
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( 8, TRUE );
return $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
return $ph->CheckPassword( $password, $member->conv_password );
}
if ( Login::compareHashes( $member->conv_password, md5( md5( str_replace( '&#39;', "'", html_entity_decode( $password ) ) ) . $member->misc ) ) )
@@ -62,17 +62,17 @@ class Vbulletin extends Software
/**
* @brief vBulletin 4 Stores all attachments under one table - this will store the content type for the forums app.
*/
protected static $postContentType = NULL;
protected static ?string $postContentType = NULL;
/**
* @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;
protected static ?bool $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;
public static bool $contentFixed = TRUE;
/**
* Constructor
@@ -82,9 +82,9 @@ class Vbulletin extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -113,16 +113,14 @@ class Vbulletin extends Software
}
catch( \Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin (3.8.x/4.x)";
@@ -131,9 +129,9 @@ class Vbulletin extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin";
@@ -142,9 +140,9 @@ class Vbulletin extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertEmoticons' => array(
@@ -210,9 +208,9 @@ class Vbulletin extends Software
/**
* Allows software to add additional menu row options
*
* @return array
* @return array
*/
public function extraMenuRows()
public function extraMenuRows(): array
{
$rows = array();
$count = $this->countRows( static::canConvert()['convertMembersFollowers']['table'], static::canConvert()['convertMembersFollowers']['where'] );
@@ -236,13 +234,13 @@ class Vbulletin extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -255,7 +253,6 @@ class Vbulletin extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
case 'pm':
try
@@ -276,20 +273,18 @@ class Vbulletin extends Software
}
return parent::countRows( $table, $where, $recache );
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -297,9 +292,9 @@ class Vbulletin extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -307,9 +302,9 @@ class Vbulletin extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'bbtitle' => 'board_name',
@@ -319,9 +314,9 @@ class Vbulletin extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -353,9 +348,9 @@ class Vbulletin extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vb4_preconvert';
}
@@ -363,9 +358,9 @@ class Vbulletin extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -380,10 +375,10 @@ class Vbulletin extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -587,9 +582,9 @@ class Vbulletin extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -623,9 +618,9 @@ class Vbulletin extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -695,7 +690,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -758,7 +753,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -792,7 +787,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -887,7 +882,7 @@ class Vbulletin extends Software
* @param string $type The vB Field Type
* @return string The IPS Field Type
*/
protected static function _pfieldMap( $type )
protected static function _pfieldMap( string $type ) : string
{
switch( mb_strtolower( $type ) )
{
@@ -895,20 +890,16 @@ class Vbulletin extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'select_multiple':
return 'Select';
break;
/* Just do Text as default */
default:
return 'Text';
break;
}
}
@@ -917,7 +908,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -929,7 +920,7 @@ class Vbulletin extends Software
$self = $this;
$checkpermission = function ( $name, $perm ) use ( $group, $self )
{
if ( $group[$name] & $self::$bitOptions[$name][$perm] )
if ( $group[$name] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1054,14 +1045,14 @@ class Vbulletin extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'changeid' );
@@ -1092,14 +1083,14 @@ class Vbulletin extends Software
/**
* @brief default pseudo fields to convert
*/
protected static $pseudoFields = [ 'homepage', 'icq', 'aim', 'yahoo', 'msn', 'skype', 'user_title' ];
protected static array $pseudoFields = [ 'homepage', 'icq', 'aim', 'yahoo', 'msn', 'skype', 'user_title' ];
/**
* Convert members
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'user.userid' );
@@ -1131,7 +1122,7 @@ class Vbulletin extends Software
$key = $name;
}
if ( $user[$key] & $self::$bitOptions[$name][$perm] )
if ( $user[$key] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1462,8 +1453,8 @@ class Vbulletin extends Software
'vid' => md5( $activation['activationid'] . $activation['useractivationid'] ),
'member_id' => $memberId,
'entry_date' => $activation['dateline'],
'new_reg' => ( $activation['emailchange'] == 0 ? TRUE : FALSE ),
'email_chg' => ( $activation['emailchange'] == 1 ? TRUE : FALSE ),
'new_reg' => $activation['emailchange'] == 0,
'email_chg' => $activation['emailchange'] == 1,
'user_verified' => FALSE,
'ip_address' => $user['ipaddress'],
'email_sent' => $activation['dateline']
@@ -1513,7 +1504,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertMembersFollowers()
public function convertMembersFollowers() : void
{
$libraryClass = $this->getLibrary();
@@ -1536,11 +1527,11 @@ class Vbulletin extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[$ours] ) OR $values[$ours] == FALSE )
if ( !isset( $settings[$ours] ) OR !$settings[$ours] )
{
continue;
}
@@ -1563,7 +1554,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1589,7 +1580,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertCustomBbcode()
public function convertCustomBbcode() : void
{
$libraryClass = $this->getLibrary();
@@ -1615,7 +1606,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertAnnouncements()
public function convertAnnouncements() : void
{
$libraryClass = $this->getLibrary();
@@ -1643,7 +1634,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1669,7 +1660,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1706,7 +1697,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
@@ -1773,7 +1764,7 @@ class Vbulletin extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
foreach( $this->fetch( 'socialgroupmember', 'groupid' ) AS $member )
@@ -1996,7 +1987,7 @@ class Vbulletin extends Software
/**
* @brief Fetched Settings Cache
*/
protected $settingsCache = array();
protected array $settingsCache = array();
/**
* Get Setting Value - useful for global settings that need to be translated to group or member settings
@@ -2004,7 +1995,7 @@ class Vbulletin extends Software
* @param string $key The setting key
* @return mixed
*/
protected function _setting( $key )
protected function _setting( string $key ) : mixed
{
if ( isset( $this->settingsCache[$key] ) )
{
@@ -2036,9 +2027,9 @@ class Vbulletin extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -2148,7 +2139,7 @@ class Vbulletin extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
if ( Login::compareHashes( $member->conv_password, md5( md5( str_replace( '&#39;', "'", html_entity_decode( $password ) ) ) . $member->conv_password_extra ) ) )
{
@@ -2167,7 +2158,7 @@ class Vbulletin extends Software
* @param $pm array
* @return mixed
*/
protected function _convertPm( Library $libraryClass, array $pm )
protected function _convertPm( Library $libraryClass, array $pm ) : mixed
{
try
{
@@ -2242,7 +2233,7 @@ class Vbulletin extends Software
return $libraryClass->convertPrivateMessage( $topic, $maps );
}
protected $_avatars = array();
protected array $_avatars = array();
/**
* Fetch Avatar from Avatar Gallery
@@ -2250,7 +2241,7 @@ class Vbulletin extends Software
* @param int $id Avatar ID
* @return array|bool Array of data/name or FALSE
*/
protected function _getFromAvatarGallery( int $id )
protected function _getFromAvatarGallery( int $id ) : array|bool
{
if( isset( $this->_avatars[ $id ] ) )
{
@@ -20,6 +20,7 @@ use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Software\Exception as SoftwareException;
use IPS\core\Ignore;
use IPS\Data\Cache;
use IPS\Data\Store;
@@ -55,7 +56,7 @@ class Vbulletin5 extends Software
/**
* @brief is vB 5.5.3 or newer
*/
protected static $skipCustomProfilePic = NULL;
protected static ?bool $skipCustomProfilePic = NULL;
/**
* Constructor
@@ -65,9 +66,9 @@ class Vbulletin5 extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -82,16 +83,14 @@ class Vbulletin5 extends Software
}
catch( Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "vBulletin (5.x)";
@@ -100,9 +99,9 @@ class Vbulletin5 extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "vbulletin5";
@@ -111,9 +110,9 @@ class Vbulletin5 extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertEmoticons' => array(
@@ -166,9 +165,9 @@ class Vbulletin5 extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -176,13 +175,13 @@ class Vbulletin5 extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -201,7 +200,6 @@ class Vbulletin5 extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
case 'node':
if ( $where === 'clubs' )
@@ -212,7 +210,6 @@ class Vbulletin5 extends Software
{
return parent::countRows( $table, $where, $recache );
}
break;
case 'groupintopic':
$clubs = array();
@@ -223,7 +220,6 @@ class Vbulletin5 extends Software
$where = array( $this->db->in( 'nodeid', $clubs ) );
return parent::countRows( $table, $where, $recache );
break;
case 'userchangelog':
try
@@ -234,20 +230,18 @@ class Vbulletin5 extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -255,9 +249,9 @@ class Vbulletin5 extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'bbtitle' => 'board_name',
@@ -267,9 +261,9 @@ class Vbulletin5 extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -301,9 +295,9 @@ class Vbulletin5 extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_vb5_preconvert';
}
@@ -311,9 +305,9 @@ class Vbulletin5 extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertEmoticons',
@@ -328,10 +322,10 @@ class Vbulletin5 extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -525,9 +519,9 @@ class Vbulletin5 extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -559,9 +553,9 @@ class Vbulletin5 extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post The post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -651,7 +645,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -698,7 +692,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -732,7 +726,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -806,7 +800,7 @@ class Vbulletin5 extends Software
* @param string $type The vB Field Type
* @return string The IPS Field Type
*/
protected static function _pfieldMap( $type )
protected static function _pfieldMap( string $type ) : string
{
switch( mb_strtolower( $type ) )
{
@@ -814,20 +808,16 @@ class Vbulletin5 extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'select_multiple':
return 'Select';
break;
/* Just do Text as default */
default:
return 'Text';
break;
}
}
@@ -836,7 +826,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -848,7 +838,7 @@ class Vbulletin5 extends Software
$self = $this;
$checkpermission = function ( $name, $perm ) use ( $group, $self )
{
if ( $group[$name] & $self::$bitOptions[$name][$perm] )
if ( $group[$name] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -973,14 +963,14 @@ class Vbulletin5 extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'usergroupid' => 'group', 'membergroupids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'changeid' );
@@ -1014,7 +1004,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -1038,7 +1028,7 @@ class Vbulletin5 extends Software
$key = $name;
}
if ( $user[$key] & $self::$bitOptions[$name][$perm] )
if ( $user[$key] & self::$bitOptions[$name][$perm] )
{
return TRUE;
}
@@ -1353,8 +1343,8 @@ class Vbulletin5 extends Software
'vid' => md5( $activation['activationid'] . $activation['useractivationid'] ),
'member_id' => $memberId,
'entry_date' => $activation['dateline'],
'new_reg' => ( $activation['emailchange'] == 0 ? TRUE : FALSE ),
'email_chg' => ( $activation['emailchange'] == 1 ? TRUE : FALSE ),
'new_reg' => $activation['emailchange'] == 0,
'email_chg' => $activation['emailchange'] == 1,
'user_verified' => FALSE,
'ip_address' => $user['ipaddress'],
'email_sent' => $activation['dateline']
@@ -1417,11 +1407,11 @@ class Vbulletin5 extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[$ours] ) OR $values[$ours] == FALSE )
if ( !isset( $settings[$ours] ) OR !$settings[$ours] )
{
continue;
}
@@ -1444,7 +1434,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1470,7 +1460,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", 'vbulletin-4ecbdf567f3da8.31769341' ) )->first();
@@ -1549,7 +1539,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$node = $this->db->select( 'nodeid', 'channel', array( "guid=?", 'vbulletin-4ecbdf567f3da8.31769341' ) )->first();
@@ -1586,7 +1576,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertClubs()
public function convertClubs() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'nodeid' );
@@ -1598,7 +1588,7 @@ class Vbulletin5 extends Software
catch( UnderflowException $e )
{
/* shrug */
throw new \IPS\convert\Software\Exception;
throw new SoftwareException;
}
$categories = array();
@@ -1682,7 +1672,7 @@ class Vbulletin5 extends Software
*
* @return void
*/
public function convertClubMembers()
public function convertClubMembers() : void
{
$libraryClass = $this->getLibrary();
$clubs = array();
@@ -1885,7 +1875,7 @@ class Vbulletin5 extends Software
/**
* @brief Fetched Settings Cache
*/
protected $settingsCache = array();
protected array $settingsCache = array();
/**
* Get Setting Value - useful for global settings that need to be translated to group or member settings
@@ -1893,7 +1883,7 @@ class Vbulletin5 extends Software
* @param string $key The setting key
* @return mixed
*/
protected function _setting( $key )
protected function _setting( string $key ) : mixed
{
if ( isset( $this->settingsCache[$key] ) )
{
@@ -1925,9 +1915,9 @@ class Vbulletin5 extends Software
/**
* Helper method to retrieve forums from nodes
*
* @return void
* @return array
*/
protected function fetchForums()
protected function fetchForums() : array
{
$forums = array();
@@ -1943,7 +1933,7 @@ class Vbulletin5 extends Software
* @brief Channel GUID Mappins.
* @note As far as I can tell, these are static and not unique per installation. Only the ones that are used are present.
*/
public static $guids = array(
public static array $guids = array(
'clubs' => 'vbulletin-4ecbdf567f3a38.99555306',
'private_messages' => 'vbulletin-4ecbdf567f3da8.31769341'
);
@@ -1953,7 +1943,7 @@ class Vbulletin5 extends Software
*
* @return array
*/
protected function fetchClubs()
protected function fetchClubs() : array
{
$clubs = array();
@@ -1982,7 +1972,7 @@ class Vbulletin5 extends Software
/**
* @brief Types Cache
*/
protected $typesCache = array();
protected array $typesCache = array();
/**
* Helper method to retrieve content type ids
@@ -1990,7 +1980,7 @@ class Vbulletin5 extends Software
* @param string $type Content type
* @return string
*/
protected function fetchType( $type )
protected function fetchType( string $type ) : string
{
if ( !empty( $this->typesCache ) )
{
@@ -2010,9 +2000,9 @@ class Vbulletin5 extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
/* If we can't access profiles, don't bother trying to redirect */
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
@@ -2045,7 +2035,7 @@ class Vbulletin5 extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* If no algorithm is defined, use the legacy handler */
if ( strpos( $member->misc, 'blowfish' ) === FALSE and strpos( $member->misc, 'legacy' ) === FALSE )
@@ -2064,7 +2054,6 @@ class Vbulletin5 extends Software
require_once \IPS\ROOT_PATH . "/applications/convert/sources/Login/PasswordHash.php";
$ph = new PasswordHash( $algo[ 1 ], FALSE );
return $ph->CheckPassword( $md5_once_password, $member->conv_password );
break;
case 'legacy':
/* Legacy Passwords are stored in a format of HASH SALT so we need to explode on the space. */
@@ -2072,7 +2061,7 @@ class Vbulletin5 extends Software
$member->conv_password = $token[0];
$member->conv_password_extra = $token[1];
return Vbulletin::login( $member, $password );
break;
/** vBulletin 5.6.2 was able to also use the Argon2id password hashing scheme. */
case 'argon2id':
if( defined('PASSWORD_ARGON2ID') ) {
@@ -2082,8 +2071,8 @@ class Vbulletin5 extends Software
{
return FALSE;
}
break;
}
return false;
}
}
@@ -46,14 +46,14 @@ class Woltlab extends Software
/**
* @brief The WCF table prefix can change depending on the number of installs
*/
public static $installId = 1;
public static int $installId = 1;
/**
* Software Name
*
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WoltLab Suite (3.1)";
@@ -64,7 +64,7 @@ class Woltlab extends Software
*
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "woltlab";
@@ -73,9 +73,9 @@ class Woltlab extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertProfileFieldGroups' => array(
@@ -116,13 +116,13 @@ class Woltlab extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -136,20 +136,18 @@ class Woltlab extends Software
{
throw new Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -157,9 +155,9 @@ class Woltlab extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertProfileFieldGroups',
@@ -173,10 +171,10 @@ class Woltlab extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
switch( $method )
@@ -329,9 +327,9 @@ class Woltlab extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -362,9 +360,9 @@ class Woltlab extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -377,7 +375,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertProfileFieldGroups()
public function convertProfileFieldGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'categoryID' );
@@ -403,7 +401,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'optionID' );
@@ -476,7 +474,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'smileyID' );
@@ -515,7 +513,7 @@ class Woltlab extends Software
'emo_position' => $row['showOrder'],
);
$libraryClass->convertEmoticon( $info, $set, $this->app->_session['more_info']['convertEmoticons']['keep_existing_emoticons'], $filepath, NULL, $filepathx2, NULL );
$libraryClass->convertEmoticon( $info, $set, $this->app->_session['more_info']['convertEmoticons']['keep_existing_emoticons'], $filepath, NULL, $filepathx2 );
$libraryClass->setLastKeyValue( $row['smileyID'] );
}
}
@@ -525,7 +523,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'groupID' );
@@ -534,8 +532,8 @@ class Woltlab extends Software
{
/* Username Styles */
$style = explode( '%s', $row['userOnlineMarking'] );
$prefix = isset( $style[0] ) ? $style[0] : '';
$suffix = isset( $style[1] ) ? $style[1] : '';
$prefix = $style[0] ?? '';
$suffix = $style[1] ?? '';
$info = array(
'g_id' => $row['groupID'],
@@ -565,7 +563,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'userID' );
@@ -717,7 +715,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'ignoreID' );
@@ -742,7 +740,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'conversationID' );
@@ -789,7 +787,7 @@ class Woltlab extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'messageID' );
@@ -812,13 +810,13 @@ class Woltlab extends Software
/**
* @brief Cache default language
*/
static $_defaultLanguage = NULL;
static ?int $_defaultLanguage = NULL;
/**
* Helper to fetch a WCF lang string
*
* @param string $itemName WCF Language Name
* @param string $itemPrefix WCF Prefix for end-user input
* @param string|null $itemPrefix WCF Prefix for end-user input
* @return string Translated string, or original if no customisation exists
* @throws UnderflowException
*/
@@ -852,7 +850,7 @@ class Woltlab extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
/* If it's not blowfish, then we don't have a salt for it. fail. */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $member->conv_password ) )
@@ -41,9 +41,9 @@ class Wordpress extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "WordPress (5.x/6.x)";
@@ -52,9 +52,9 @@ class Wordpress extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wordpress";
@@ -63,9 +63,9 @@ class Wordpress extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return array(
'convertMembers' => array(
@@ -78,9 +78,9 @@ class Wordpress extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -88,9 +88,9 @@ class Wordpress extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_wordpress_preconvert';
}
@@ -98,9 +98,9 @@ class Wordpress extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return array(
'convertMembers',
@@ -110,9 +110,9 @@ class Wordpress extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -123,10 +123,10 @@ class Wordpress extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -171,7 +171,7 @@ class Wordpress extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -243,9 +243,9 @@ class Wordpress extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -255,7 +255,7 @@ class Wordpress extends Software
Cache::i()->clearAll();
/* Attachments */
\IPS\Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 1, array( 'app' ) );
Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 1, array( 'app' ) );
/* Content Counts */
Task::queue( 'core', 'RecountMemberContent', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
@@ -270,14 +270,14 @@ class Wordpress extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$success = FALSE;
// If the hash is still md5...
if ( strlen( $member->conv_password ) <= 32 )
{
$success = ( Login::compareHashes( $member->conv_password, md5( $password ) ) ) ? TRUE : FALSE;
$success = Login::compareHashes( $member->conv_password, md5( $password ) );
}
// New pass hash check
else
@@ -287,7 +287,7 @@ class Wordpress extends Software
$ph = new PasswordHash( 8, TRUE );
// Check it
$success = $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
$success = $ph->CheckPassword( $password, $member->conv_password );
}
return $success;
@@ -29,6 +29,7 @@ use IPS\Request;
use IPS\Task;
use OutOfRangeException;
use UnderflowException;
use ValueError;
use function count;
use function defined;
use function in_array;
@@ -52,9 +53,9 @@ class Wpforo extends Software
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
/* Child classes must override this method */
return "wpForo (2.1.x)";
@@ -63,9 +64,9 @@ class Wpforo extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
/* Child classes must override this method */
return "wpforo";
@@ -74,9 +75,9 @@ class Wpforo extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
return [
'convertGroups' => [
@@ -105,9 +106,9 @@ class Wpforo extends Software
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -115,9 +116,9 @@ class Wpforo extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_wpforo_preconvert';
}
@@ -125,9 +126,9 @@ class Wpforo extends Software
/**
* List of conversion methods that require additional information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
return [
'convertMembers',
@@ -138,9 +139,9 @@ class Wpforo extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -172,10 +173,10 @@ class Wpforo extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = [];
@@ -246,14 +247,14 @@ class Wpforo extends Software
/**
* @brief temporarily store post content
*/
protected $_postContent = [];
protected array $_postContent = [];
/**
* Convert attachments
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pmid' );
@@ -316,8 +317,7 @@ class Wpforo extends Software
$this->_postContent[ $messagePostId ] = str_replace( $matches[0][ $key ], '[attachment=' . $attachId . ':name]', $this->_postContent[ $messagePostId ] );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
}
}
@@ -358,8 +358,7 @@ class Wpforo extends Software
$this->_postContent[ $messagePostId ] = str_replace( $matches[0][ $key ], '[attachment=' . $attachId . ':name]', $this->_postContent[ $messagePostId ] );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
}
}
@@ -378,7 +377,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'groupid' );
@@ -420,14 +419,14 @@ class Wpforo extends Software
/**
* @brief Hardcoded wpForo profile fields
*/
protected $_profileFields = [ 'site', 'icq', 'aim', 'yahoo', 'msn', 'facebook', 'twitter', 'gtalk', 'skype', 'about', 'occupation', 'location' ];
protected array $_profileFields = [ 'site', 'icq', 'aim', 'yahoo', 'msn', 'facebook', 'twitter', 'gtalk', 'skype', 'about', 'occupation', 'location' ];
/**
* Convert members
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'users.ID' );
@@ -438,7 +437,7 @@ class Wpforo extends Software
{
$joined = ( new DateTime( $user['user_registered'] ) )->getTimestamp();
}
catch( \ValueError $e )
catch( ValueError $e )
{
$joined = time();
}
@@ -523,7 +522,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'folderid' );
@@ -593,7 +592,7 @@ class Wpforo extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'pmid' );
@@ -615,9 +614,9 @@ class Wpforo extends Software
/**
* Finish - Adds everything it needs to the queues and clears data store
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -652,7 +651,7 @@ class Wpforo extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
return Wordpress::login( $member, $password );
}
@@ -660,9 +659,9 @@ class Wpforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
*/
public function checkRedirects()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
$wpForoSlug = defined('WPFORO_SLUG') ? WPFOROSLUG : 'community';
@@ -21,7 +21,7 @@ use IPS\Application\Module;
use IPS\Content\Search\Index;
use IPS\convert\App;
use IPS\convert\Software;
use IPS\convert\Tools\Xenforo;
use IPS\convert\Tools\Xenforo as XenforoTrait;
use IPS\Data\Cache;
use IPS\Data\Store;
use IPS\Db;
@@ -58,22 +58,22 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class Xenforo extends Software
{
use Xenforo;
use XenforoTrait;
/**
* @brief The similarities between XF1 and XF2 are close enough that we can use the same converter
*/
public static $isLegacy = NULL;
public static ?bool $isLegacy = NULL;
/**
* @brief XF2.1 changed serialized data to json decoded
*/
public static $useJson = FALSE;
public static bool $useJson = FALSE;
/**
* @brief XF1&2 have different pseudo fields
*/
public static $pseudoFields = array(
public static array $pseudoFields = array(
1 => array( 'homepage', 'location', 'occupation', 'about', 'custom_title' ),
2 => array( 'website', 'location', 'about', 'custom_title' )
);
@@ -86,9 +86,9 @@ class Xenforo extends Software
* @return void
* @throws InvalidArgumentException
*/
public function __construct( App $app, $needDB=TRUE )
public function __construct( App $app, bool $needDB=TRUE )
{
$return = parent::__construct( $app, $needDB );
parent::__construct( $app, $needDB );
if ( $needDB )
{
@@ -117,16 +117,14 @@ class Xenforo extends Software
}
catch( Exception $e ) {} # If we can't query, we won't be able to do anything anyway
}
return $return;
}
/**
* Software Name
*
* @return string
* @return string
*/
public static function softwareName()
public static function softwareName(): string
{
return "XenForo (1.5.x/2.0.x/2.1.x/2.2.x)";
}
@@ -134,9 +132,9 @@ class Xenforo extends Software
/**
* Software Key
*
* @return string
* @return string
*/
public static function softwareKey()
public static function softwareKey(): string
{
return 'xenforo';
}
@@ -144,9 +142,9 @@ class Xenforo extends Software
/**
* Returns a block of text, or a language string, that explains what the admin must do to start this conversion
*
* @return string
* @return string|null
*/
public static function getPreConversionInformation()
public static function getPreConversionInformation(): ?string
{
return 'convert_xf_preconvert';
}
@@ -154,9 +152,9 @@ class Xenforo extends Software
/**
* Uses Prefix
*
* @return bool
* @return bool
*/
public static function usesPrefix()
public static function usesPrefix(): bool
{
return FALSE;
}
@@ -164,9 +162,9 @@ class Xenforo extends Software
/**
* Content we can convert from this software.
*
* @return array
* @return array|null
*/
public static function canConvert()
public static function canConvert(): ?array
{
$return = array(
'convertEmoticons' => array(
@@ -226,13 +224,13 @@ class Xenforo extends Software
/**
* Count Source Rows for a specific step
*
* @param string $table The table containing the rows to count.
* @param array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @param string $table The table containing the rows to count.
* @param string|array|NULL $where WHERE clause to only count specific rows, or NULL to count all.
* @param bool $recache Skip cache and pull directly (updating cache)
* @return integer
* @throws \IPS\convert\Exception
*/
public function countRows( $table, $where=NULL, $recache=FALSE )
public function countRows( string $table, string|array|null $where=NULL, bool $recache=FALSE ): int
{
switch( $table )
{
@@ -246,7 +244,7 @@ class Xenforo extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
/* XF2 */
case 'xf_change_log':
try
@@ -257,20 +255,18 @@ class Xenforo extends Software
{
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
}
break;
default:
return parent::countRows( $table, $where, $recache );
break;
}
}
/**
* Can we convert passwords from this software.
*
* @return boolean
* @return boolean
*/
public static function loginEnabled()
public static function loginEnabled(): bool
{
return TRUE;
}
@@ -278,9 +274,9 @@ class Xenforo extends Software
/**
* Can we convert settings?
*
* @return boolean
* @return boolean
*/
public static function canConvertSettings()
public static function canConvertSettings(): bool
{
return TRUE;
}
@@ -288,9 +284,9 @@ class Xenforo extends Software
/**
* List of Conversion Methods that require more information
*
* @return array
* @return array
*/
public static function checkConf()
public static function checkConf(): array
{
$return = array(
'convertAttachments',
@@ -312,10 +308,10 @@ class Xenforo extends Software
/**
* Get More Information
*
* @param string $method Conversion method
* @return array
* @param string $method Conversion method
* @return array|null
*/
public function getMoreInfo( $method )
public function getMoreInfo( string $method ): ?array
{
$return = array();
@@ -487,9 +483,9 @@ class Xenforo extends Software
/**
* Settings Map
*
* @return array
* @return array
*/
public function settingsMap()
public function settingsMap(): array
{
return array(
'boardTitle' => 'board_name',
@@ -499,9 +495,9 @@ class Xenforo extends Software
/**
* Settings Map Listing
*
* @return array
* @return array
*/
public function settingsMapList()
public function settingsMapList(): array
{
$settings = array();
foreach( $this->settingsMap() AS $theirs => $ours )
@@ -532,9 +528,9 @@ class Xenforo extends Software
/**
* Finish
*
* @return array Messages to display
* @return array Messages to display
*/
public function finish()
public function finish(): array
{
/* Search Index Rebuild */
Index::i()->rebuild();
@@ -567,9 +563,9 @@ class Xenforo extends Software
/**
* Pre-process content for the Invision Community text parser
*
* @param string The post
* @param string|null Content Classname passed by post-conversion rebuild
* @param int|null Content ID passed by post-conversion rebuild
* @param string $post post
* @param string|null $className Classname passed by post-conversion rebuild
* @param int|null $contentId ID passed by post-conversion rebuild
* @return string The converted post
*/
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
@@ -664,7 +660,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertAttachments()
public function convertAttachments() : void
{
$libraryClass = $this->getLibrary();
@@ -731,8 +727,7 @@ class Xenforo extends Software
Db::i()->update( 'core_message_posts', array( 'msg_post' => $post ), array( "msg_id=?", $messagePostId ) );
}
}
catch( UnderflowException $e ) {}
catch( OutOfRangeException $e ) {}
catch( UnderflowException|OutOfRangeException $e ) {}
$libraryClass->setLastKeyValue( $row['attachment_id'] );
}
@@ -743,7 +738,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertEmoticons()
public function convertEmoticons() : void
{
$libraryClass = $this->getLibrary();
@@ -790,7 +785,7 @@ class Xenforo extends Software
$fileurl = explode( '/', $row['image_url'] );
$filename = array_pop( $fileurl );
if( static::$isLegacy == FALSE AND !empty( $row['image_url_2x'] ) )
if( !static::$isLegacy AND !empty( $row['image_url_2x'] ) )
{
$filedata = file_get_contents( $row['image_url_2x'] );
$fileurlx2 = explode( '/', $row['image_url_2x'] );
@@ -803,7 +798,7 @@ class Xenforo extends Software
$filename = array_pop( $fileurl );
$filepath = rtrim( $this->app->_session['more_info']['convertEmoticons']['emoticon_path'], '/' ) . '/' . implode( '/', $fileurl );
if( static::$isLegacy == FALSE AND !empty( $row['image_url_2x'] ) )
if( !static::$isLegacy AND !empty( $row['image_url_2x'] ) )
{
$fileurlx2 = explode( '/', $row['image_url_2x'] );
$filenamex2 = array_pop( $fileurlx2 );
@@ -861,7 +856,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertProfileFields()
public function convertProfileFields() : void
{
$libraryClass = $this->getLibrary();
@@ -895,7 +890,7 @@ class Xenforo extends Software
* @param string $type XF Field Type
* @return string IPS Field Type
*/
protected function _fieldMap( $type )
protected function _fieldMap( string $type ) : string
{
switch( $type )
{
@@ -903,19 +898,15 @@ class Xenforo extends Software
case 'radio':
case 'checkbox':
return ucwords( $type );
break;
case 'textarea':
return 'TextArea';
break;
case 'multiselect':
return 'Select';
break;
default:
return 'Text';
break;
}
}
@@ -924,7 +915,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertGroups()
public function convertGroups() : void
{
$libraryClass = $this->getLibrary();
@@ -958,10 +949,6 @@ class Xenforo extends Software
$info['g_view_board'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
case 'deleteOwnPost' :
$info['g_delete_own_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
case 'editOwnPost':
$info['g_edit_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
@@ -975,6 +962,7 @@ class Xenforo extends Software
break;
case 'deleteOwnThread':
case 'deleteOwnPost' :
$info['g_delete_own_posts'] = ($perm['permission_value'] == 'allow') ? 1 : 0;
break;
@@ -1010,7 +998,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertWarnReasons()
public function convertWarnReasons() : void
{
$libraryClass = $this->getLibrary();
@@ -1053,14 +1041,14 @@ class Xenforo extends Software
/**
* @brief Member history type map
*/
protected static $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'user_group_id' => 'group', 'secondary_group_ids' => 'group' );
protected static array $changeLogTypes = array( 'username' => 'display_name', 'email' => 'email_change', 'user_group_id' => 'group', 'secondary_group_ids' => 'group' );
/**
* Convert member history
*
* @return void
*/
public function convertMemberHistory()
public function convertMemberHistory() : void
{
$libraryClass = $this->getLibrary();
@@ -1108,7 +1096,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertMembers()
public function convertMembers() : void
{
$libraryClass = $this->getLibrary();
@@ -1381,11 +1369,11 @@ class Xenforo extends Software
* @param array $settings Settings to convert
* @return void
*/
public function convertSettings( $settings=array() )
public function convertSettings( array $settings=array() ) : void
{
foreach( $this->settingsMap() AS $theirs => $ours )
{
if ( !isset( $values[ $ours ] ) OR $values[ $ours ] == FALSE )
if ( !isset( $settings[ $ours ] ) OR !$settings[$ours] )
{
continue;
}
@@ -1408,7 +1396,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertIgnoredUsers()
public function convertIgnoredUsers() : void
{
$libraryClass = $this->getLibrary();
@@ -1427,7 +1415,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertReactions()
public function convertReactions() : void
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'reaction_id' );
@@ -1510,7 +1498,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertPrivateMessages()
public function convertPrivateMessages() : void
{
$libraryClass = $this->getLibrary();
@@ -1566,7 +1554,7 @@ class Xenforo extends Software
*
* @return void
*/
public function convertPrivateMessageReplies()
public function convertPrivateMessageReplies() : void
{
$libraryClass = $this->getLibrary();
@@ -1602,10 +1590,10 @@ class Xenforo extends Software
/**
* Check if we can redirect the legacy URLs from this software to the new locations
*
* @return NULL|Url
* @return Url|NULL
* @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()
public function checkRedirects(): ?Url
{
$url = Request::i()->url();
@@ -1646,7 +1634,7 @@ class Xenforo extends Software
* @param string $password Password from form
* @return bool
*/
public static function login( $member, $password )
public static function login( Member $member, string $password ) : bool
{
$password = html_entity_decode( $password );