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

@@ -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 */