Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

@@ -28,7 +28,7 @@ class _Phpbb extends \IPS\convert\Software
public static function softwareName()
{
/* Child classes must override this method */
return "phpBB 3.1";
return "phpBB (3.1.x/3.2.x)";
}
/**
@@ -98,6 +98,24 @@ class _Phpbb extends \IPS\convert\Software
);
}
/**
* Allows software to add additional menu row options
*
* @param array $rows Existing rows
* @return array
*/
public function extraMenuRows( $rows )
{
if( isset( $rows['convertBanfilters'] ) )
{
$rows['convertBanfilters2'] = $rows['convertBanfilters'];
$rows['convertBanfilters2']['step_method'] = 'convertBanfilters2';
$rows['convertBanfilters2']['source_rows'] = $this->countRows( static::canConvert()['convertBanfilters2']['table'], static::canConvert()['convertBanfilters2']['where'] );
}
return $rows;
}
/**
* Count Source Rows for a specific step
*
@@ -310,6 +328,9 @@ class _Phpbb extends \IPS\convert\Software
/* Content Counts */
\IPS\Task::queue( 'core', 'RecountMemberContent', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
/* Attachments */
\IPS\Task::queue( 'core', 'RebuildAttachmentThumbnails', array( 'app' => $this->app->app_id ), 1, array( 'app' ) );
/* First Post Data */
\IPS\Task::queue( 'convert', 'RebuildConversationFirstIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
@@ -698,8 +719,7 @@ class _Phpbb extends \IPS\convert\Software
{
$userfields = $this->db->select( '*', 'profile_fields_data', array( "user_id=?", $row['user_id'] ) )->first();
}
catch( \UnderflowException $e )
{}
catch( \UnderflowException $e ) {}
foreach( $this->db->select( '*', 'profile_fields' ) AS $field )
{
@@ -720,6 +740,10 @@ class _Phpbb extends \IPS\convert\Software
}
}
}
/* PM Folders */
$pmFolders = iterator_to_array( $this->db->select( 'folder_name', 'privmsgs_folder', array( 'user_id=?', $row['user_id'] ) ) );
$info['pconversation_filters'] = count( $pmFolders ) ? $pmFolders : NULL;
/* Finally */
$libraryClass->convertMember( $info, $pfields, $filename, $filepath );
@@ -946,7 +970,7 @@ class _Phpbb extends \IPS\convert\Software
$maps = array();
/* First one first initial author */
$maps[$row['author_id']] = array(
$maps[ $row['author_id'] ] = array(
'map_user_id' => $row['author_id'],
'map_is_starter' => 1,
'map_last_topic_reply' => $row['message_time'],
@@ -973,13 +997,18 @@ class _Phpbb extends \IPS\convert\Software
to a custom folder then they will have a row in privmsgs_to and we will end up resetting map_is_starter to 0 otherwise */
if( isset( $maps[ $to['user_id'] ] ) )
{
if( $to['folder_id'] > 0 )
{
$maps[ $to['user_id'] ]['map_folder_id'] = $this->_getPmFolder( $to['user_id'], $to['folder_id'] );
}
continue;
}
$maps[ $to['user_id'] ] = array(
'map_user_id' => $to['user_id'],
'map_is_starter' => 0,
'map_last_topic_reply' => $row['message_time']
'map_last_topic_reply' => $row['message_time'],
'map_folder_id' => ( $to['folder_id'] > 0 ) ? $this->_getPmFolder( $to['user_id'], $to['folder_id'] ) : FALSE
);
}
@@ -1045,4 +1074,108 @@ class _Phpbb extends \IPS\convert\Software
return NULL;
}
/**
* @brief Lookup cache
*/
protected static $pmFolders = array();
/**
* @brief PhpBB Source Folders
*/
protected static $phpBbFolders = NULL;
/**
* Get array key for the folder
*
* @param int $user User ID
* @param string $folderId Folder Name
* @return boolean
*/
protected function _getPmFolder( $user, $folderId )
{
/* Check for cached folder info */
if( isset( static::$pmFolders[ $user ][ $folderId ] ) )
{
return static::$pmFolders[ $user ][ $folderId ];
}
/* Check for cached phpBB data */
if( static::$phpBbFolders === NULL )
{
static::$phpBbFolders = iterator_to_array( $this->db->select( 'folder_id,folder_name', 'privmsgs_folder' )->setKeyField( 'folder_id' )->setValueField( 'folder_name' ) );
}
try
{
/* Does the referenced folder exist in PhpBB? */
if( !isset( static::$phpBbFolders[ $folderId ] ) )
{
throw new \OutOfRangeException;
}
$member = \IPS\Member::load( $this->app->getLink( (int) $user, 'core_members' ) );
$filters = json_decode( $member->pconversation_filters, TRUE );
/* No PM Folders or it's a guest */
if( $filters === NULL OR !$member->member_id )
{
throw new \OutOfRangeException;
}
}
catch( \OutOfRangeException $e )
{
return static::$pmFolders[ $user ][ $folderId ] = FALSE;
}
/* Search PM folders and return match */
return static::$pmFolders[ $user ][ $folderId ] = array_search( static::$phpBbFolders[ $folderId ], $filters );
}
/**
* Process a login
*
* @param \IPS\Member $member The member
* @param string $password Password from form
* @return bool
*/
public function login( $member, $password )
{
$password = html_entity_decode( $password );
$success = FALSE;
$hash = $member->conv_password;
/* phpBB 3.1 */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $hash ) )
{
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;
}
$hashLibrary = new \IPS\convert\Login\HashCryptPrivate;
if ( $success === FALSE )
{
/* phpBB3 */
$single_md5_pass = md5( $password );
$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ( \strlen( $hash ) == 34 )
{
$success = ( \IPS\Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) ) ) ? TRUE : FALSE;
}
else
{
$success = ( \IPS\Login::compareHashes( $hash, $single_md5_pass ) ) ? TRUE : FALSE;
}
}
/* phpBB2 */
if ( !$success )
{
$success = ( \IPS\Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $single_md5_pass, $hash, $itoa64 ) ) ) ? TRUE : FALSE ;
}
return $success;
}
}