Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

@@ -31,7 +31,7 @@ class _Phpbb extends \IPS\convert\Software
public static function softwareName()
{
/* Child classes must override this method */
return "phpBB (3.1.x/3.2.x)";
return "phpBB (3.1.x/3.2.x/3.3.x)";
}
/**
@@ -81,10 +81,6 @@ class _Phpbb extends \IPS\convert\Software
'table' => 'privmsgs',
'where' => NULL,
),
'convertRanks' => array(
'table' => 'ranks',
'where' => array( "rank_special!=?", 1 ),
),
'convertProfanityFilters' => array(
'table' => 'words',
'where' => NULL
@@ -188,7 +184,6 @@ class _Phpbb extends \IPS\convert\Software
'convertProfileFields',
'convertGroups',
'convertMembers',
'convertRanks',
);
}
@@ -318,17 +313,6 @@ class _Phpbb extends \IPS\convert\Software
);
break;
case 'convertRanks':
$return['convertRanks']['rank_location'] = array(
'field_class' => 'IPS\\Helpers\\Form\\Text',
'field_default' => NULL,
'field_required' => TRUE,
'field_extra' => array(),
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_phpbb_ranks_path'),
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
);
break;
}
return ( isset( $return[ $method ] ) ) ? $return[ $method ] : array();
@@ -385,7 +369,7 @@ class _Phpbb extends \IPS\convert\Software
public static function fixPostData( $post )
{
/* Convert newlines to <br> tags */
$post = nl2br($post);
$post = nl2br( $post );
/* Preserve code data */
$codeboxes = array();
@@ -402,7 +386,7 @@ class _Phpbb extends \IPS\convert\Software
}
/* Convert HTML entities back into actual entities */
$post = html_entity_decode($post, ENT_COMPAT | ENT_HTML401, "UTF-8");
$post = html_entity_decode( $post, ENT_COMPAT | ENT_HTML401, "UTF-8" );
/* Put codeboxes back */
foreach( $codeboxes as $k => $v )
@@ -410,6 +394,9 @@ class _Phpbb extends \IPS\convert\Software
$post = str_replace( '__CODE_BOX_' . $k . '__', $v, $post );
}
/* Sort out emoticons */
$post = preg_replace( "/<!-- s(\S+?) --><img(?:[^<]+?)<!-- (?:\S+?) -->/", '$1', $post );
/* PhpBB 3.2 */
$search = array( '<r>', '<t>', '<s>', '<e>', '<code>', '</r>', '</t>', '</s>', '</e>', '</img>', '</url>', '</quote>', '</link_text>', '</code>' );
$post = str_ireplace( $search, '', $post );
@@ -431,14 +418,11 @@ class _Phpbb extends \IPS\convert\Software
$post = str_replace( array( "[/*]", "[/*:m]" ), "", $post );
$post = str_replace( array( "[/list:o]", "[/list:u]" ), "[/list]", $post );
/* Sort out emoticons */
$post = preg_replace("/<!-- s(\S+?) --><img(?:[^<]+?)<!-- (?:\S+?) -->/", '$1', $post);
/* Sort out media */
$post = preg_replace("#<!-- m --><a class=\"postlink\" href=\"([^\]]+?)\"([^>]+?)?>([^\]]+?)</a><!-- m -->#i", "$1", $post);
$post = preg_replace( "#<!-- m --><a class=\"postlink\" href=\"([^\]]+?)\"([^>]+?)?>([^\]]+?)</a><!-- m -->#i", "$1", $post );
/* And sort out URLs */
$post = preg_replace("#<a class=\"postlink\" href=\"([^\]]+?)\"([^>]+?)?>([^\]]+?)</a>#i", "[url=$1]$3[/url]", $post);
$post = preg_replace( "#<a class=\"postlink\" href=\"([^\]]+?)\"([^>]+?)?>([^\]]+?)</a>#i", "[url=$1]$3[/url]", $post );
return $post;
}
@@ -725,6 +709,7 @@ class _Phpbb extends \IPS\convert\Software
'member_posts' => $row['user_posts'],
'member_last_post' => $row['user_lastpost_time'],
'signature' => static::stripUid( $row['user_sig'], $row['user_sig_bbcode_uid'] ),
'temp_ban' => $temp_ban,
);
/* Profile Photos */
@@ -795,8 +780,12 @@ class _Phpbb extends \IPS\convert\Software
{
if ( $field_type == 'dropdown' )
{
/* phpBB stores the option incremented from 1 - however the options are stored incremented from 0. So if you select the first option, 1 is stored but profile_fields_lang actually has it as 0. I don't get it either. */
$pfields[ $field['field_id'] ] = $this->db->select( 'lang_value', 'profile_fields_lang', array( "field_id=? AND option_id=?", $field['field_id'], $userfields['pf_' . $field['field_name'] ] - 1 ) )->first();
try
{
/* phpBB stores the option incremented from 1 - however the options are stored incremented from 0. So if you select the first option, 1 is stored but profile_fields_lang actually has it as 0. I don't get it either. */
$pfields[ $field['field_id'] ] = $this->db->select( 'lang_value', 'profile_fields_lang', array( "field_id=? AND option_id=?", $field['field_id'], $userfields['pf_' . $field['field_name'] ] - 1 ) )->first();
}
catch( \UnderflowException $e ) { }
}
else
{
@@ -889,35 +878,6 @@ class _Phpbb extends \IPS\convert\Software
}
}
/**
* Convert ranks
*
* @return void
*/
public function convertRanks()
{
$libraryClass = $this->getLibrary();
$libraryClass::setKey( 'rank_id' );
foreach( $this->fetch( 'ranks', 'rank_id', array( "rank_special=?", 0 ) ) AS $row )
{
$filepath = NULL;
if ( $row['rank_image'] )
{
$filepath = rtrim( $this->app->_session['more_info']['convertRanks']['rank_location'], '/' ) . '/' . $row['rank_image'];
}
$libraryClass->convertRank( array(
'id' => $row['rank_id'],
'title' => $row['rank_title'],
'posts' => $row['rank_min'],
), $filepath );
$libraryClass->setLastKeyValue( $row['rank_id'] );
}
}
/**
* Convert profannity filters
*
@@ -934,7 +894,8 @@ class _Phpbb extends \IPS\convert\Software
$libraryClass->convertProfanityFilter( array(
'wid' => $row['word_id'],
'type' => $row['word'],
'swop' => $row['replacement']
'swop' => $row['replacement'],
'm_exact' => TRUE
) );
$libraryClass->setLastKeyValue( $row['word_id'] );
@@ -1207,7 +1168,7 @@ class _Phpbb extends \IPS\convert\Software
{
$password = html_entity_decode( $password );
$success = FALSE;
$hash = $member->conv_password;
$hash = preg_replace('/^\$CP\$/', '', $member->conv_password ); // Remove the prefix.
/* phpBB 3.1 */
if( preg_match( '/^\$2[ay]\$(0[4-9]|[1-2][0-9]|3[0-1])\$[a-zA-Z0-9.\/]{53}/', $hash ) )
@@ -1240,6 +1201,12 @@ class _Phpbb extends \IPS\convert\Software
$success = ( \IPS\Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $single_md5_pass, $hash, $itoa64 ) ) ) ? TRUE : FALSE ;
}
/* Fallback to password_verify(), this applies to PhpBB 3.3+ where Argon may be used */
if( !$success )
{
$success = password_verify( $password, $member->conv_password );
}
return $success;
}
}