Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,16 +12,44 @@
|
||||
namespace IPS\convert\Software\Core;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use DateTimeZone;
|
||||
use DomainException;
|
||||
use Exception;
|
||||
use IPS\Application\Module;
|
||||
use IPS\Content\Search\Index;
|
||||
use IPS\convert\Login\HashCryptPrivate;
|
||||
use IPS\convert\Software;
|
||||
use IPS\core\Ignore;
|
||||
use IPS\Data\Cache;
|
||||
use IPS\Data\Store;
|
||||
use IPS\Db;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Login;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use IPS\Request;
|
||||
use IPS\Task;
|
||||
use OutOfRangeException;
|
||||
use PasswordHash;
|
||||
use UnderflowException;
|
||||
use function count;
|
||||
use function defined;
|
||||
use function is_null;
|
||||
use function is_numeric;
|
||||
use function strlen;
|
||||
use function unserialize;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* PhpBB Core Converter
|
||||
*/
|
||||
class _Phpbb extends \IPS\convert\Software
|
||||
class Phpbb extends Software
|
||||
{
|
||||
/**
|
||||
* Software Name
|
||||
@@ -108,7 +136,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$rows['convertBanfilters2'] = array(
|
||||
'step_title' => 'convert_banfilters',
|
||||
'step_method' => 'convertBanfilters2',
|
||||
'ips_rows' => \IPS\Db::i()->select( 'COUNT(*)', 'core_banfilters' ),
|
||||
'ips_rows' => Db::i()->select( 'COUNT(*)', 'core_banfilters' ),
|
||||
'source_rows' => array( 'table' => static::canConvert()['convertBanfilters2']['table'], 'where' => static::canConvert()['convertBanfilters2']['where'] ),
|
||||
'per_cycle' => 200,
|
||||
'dependencies' => array( 'convertBanfilters' ),
|
||||
@@ -139,9 +167,9 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$count += $this->db->select( 'COUNT(*)', 'banlist', array( "ban_userid=?", 0 ) )->first();
|
||||
$count += $this->db->select( 'COUNT(*)', 'disallow' )->first();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
throw new \IPS\convert\Exception( sprintf( \IPS\Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
|
||||
throw new \IPS\convert\Exception( sprintf( Member::loggedIn()->language()->get( 'could_not_count_rows' ), $table ) );
|
||||
}
|
||||
return $count;
|
||||
break;
|
||||
@@ -204,8 +232,8 @@ class _Phpbb extends \IPS\convert\Software
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(),
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_phpbb_emoticons'),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
'field_hint' => Member::loggedIn()->language()->addToStack('convert_phpbb_emoticons'),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
|
||||
),
|
||||
'keep_existing_emoticons' => array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Checkbox',
|
||||
@@ -221,16 +249,16 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$return['convertProfileFields'] = array();
|
||||
|
||||
$options = array();
|
||||
$options['none'] = \IPS\Member::loggedIn()->language()->addToStack( 'none' );
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_pfields_data' ), 'IPS\core\ProfileFields\Field' ) AS $field )
|
||||
$options['none'] = Member::loggedIn()->language()->addToStack( 'none' );
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'core_pfields_data' ), 'IPS\core\ProfileFields\Field' ) AS $field )
|
||||
{
|
||||
$options[$field->_id] = $field->_title;
|
||||
}
|
||||
|
||||
foreach( $this->db->select( '*', 'profile_fields' ) AS $field )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words["map_pfield_{$field['field_id']}"] = $this->db->select( 'lang_name', 'profile_lang', array( "field_id=?", $field['field_id'] ) )->first();
|
||||
\IPS\Member::loggedIn()->language()->words["map_pfield_{$field['field_id']}_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'map_pfield_desc' );
|
||||
Member::loggedIn()->language()->words["map_pfield_{$field['field_id']}"] = $this->db->select( 'lang_name', 'profile_lang', array( "field_id=?", $field['field_id'] ) )->first();
|
||||
Member::loggedIn()->language()->words["map_pfield_{$field['field_id']}_desc"] = Member::loggedIn()->language()->addToStack( 'map_pfield_desc' );
|
||||
|
||||
$return['convertProfileFields']["map_pfield_{$field['field_id']}"] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Select',
|
||||
@@ -247,15 +275,15 @@ class _Phpbb extends \IPS\convert\Software
|
||||
|
||||
$options = array();
|
||||
$options['none'] = 'None';
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'core_groups' ), 'IPS\Member\Group' ) AS $group )
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'core_groups' ), 'IPS\Member\Group' ) AS $group )
|
||||
{
|
||||
$options[$group->g_id] = $group->name;
|
||||
}
|
||||
|
||||
foreach( $this->db->select( '*', 'groups' ) AS $group )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words["map_group_{$group['group_id']}"] = $group['group_name'];
|
||||
\IPS\Member::loggedIn()->language()->words["map_group_{$group['group_id']}_desc"] = \IPS\Member::loggedIn()->language()->addToStack( 'map_group_desc' );
|
||||
Member::loggedIn()->language()->words["map_group_{$group['group_id']}"] = $group['group_name'];
|
||||
Member::loggedIn()->language()->words["map_group_{$group['group_id']}_desc"] = Member::loggedIn()->language()->addToStack( 'map_group_desc' );
|
||||
|
||||
$return['convertGroups']["map_group_{$group['group_id']}"] = array(
|
||||
'field_class' => 'IPS\\Helpers\\Form\\Select',
|
||||
@@ -277,10 +305,10 @@ class _Phpbb extends \IPS\convert\Software
|
||||
|
||||
if( empty( $salt ) )
|
||||
{
|
||||
throw new \UnderflowException();
|
||||
throw new UnderflowException();
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
/* We can only retain one type of photo */
|
||||
$return['convertMembers']['photo_hash'] = array(
|
||||
@@ -288,19 +316,19 @@ class _Phpbb extends \IPS\convert\Software
|
||||
'field_default' => NULL,
|
||||
'field_required' => TRUE,
|
||||
'field_extra' => array(),
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_phpbb_randstring'),
|
||||
'field_hint' => Member::loggedIn()->language()->addToStack('convert_phpbb_randstring'),
|
||||
);
|
||||
}
|
||||
|
||||
/* Find out where the photos live */
|
||||
\IPS\Member::loggedIn()->language()->words['photo_location_desc'] = \IPS\Member::loggedIn()->language()->addToStack( 'photo_location_nodb_desc' );
|
||||
Member::loggedIn()->language()->words['photo_location_desc'] = Member::loggedIn()->language()->addToStack( 'photo_location_nodb_desc' );
|
||||
$return['convertMembers']['photo_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_avatars'),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
'field_hint' => Member::loggedIn()->language()->addToStack('convert_phpbb_avatars'),
|
||||
'field_validation' => function( $value ) { if ( !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
|
||||
$return['convertMembers']['gallery_location'] = array(
|
||||
@@ -308,8 +336,8 @@ class _Phpbb extends \IPS\convert\Software
|
||||
'field_default' => NULL,
|
||||
'field_required' => FALSE,
|
||||
'field_extra' => array(),
|
||||
'field_hint' => \IPS\Member::loggedIn()->language()->addToStack('convert_phpbb_avatargallery'),
|
||||
'field_validation' => function( $value ) { if ( $value AND !@is_dir( $value ) ) { throw new \DomainException( 'path_invalid' ); } },
|
||||
'field_hint' => Member::loggedIn()->language()->addToStack('convert_phpbb_avatargallery'),
|
||||
'field_validation' => function( $value ) { if ( $value AND !@is_dir( $value ) ) { throw new DomainException( 'path_invalid' ); } },
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -326,24 +354,24 @@ class _Phpbb extends \IPS\convert\Software
|
||||
public function finish()
|
||||
{
|
||||
/* Search Index Rebuild */
|
||||
\IPS\Content\Search\Index::i()->rebuild();
|
||||
Index::i()->rebuild();
|
||||
|
||||
/* Clear Cache and Store */
|
||||
\IPS\Data\Store::i()->clearAll();
|
||||
\IPS\Data\Cache::i()->clearAll();
|
||||
Store::i()->clearAll();
|
||||
Cache::i()->clearAll();
|
||||
|
||||
\IPS\Task::queue( 'convert', 'RebuildProfilePhotos', array( 'app' => $this->app->app_id ), 5, array( 'app' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildNonContent', array( 'app' => $this->app->app_id, 'link' => 'core_message_posts', 'extension' => 'core_Messaging' ), 2, array( 'app', 'link', 'extension' ) );
|
||||
\IPS\Task::queue( 'convert', 'RebuildNonContent', array( 'app' => $this->app->app_id, 'link' => 'core_members', 'extension' => 'core_Signatures' ), 2, array( 'app', 'link', 'extension' ) );
|
||||
Task::queue( 'convert', 'RebuildProfilePhotos', array( 'app' => $this->app->app_id ), 5, array( 'app' ) );
|
||||
Task::queue( 'convert', 'RebuildNonContent', array( 'app' => $this->app->app_id, 'link' => 'core_message_posts', 'extension' => 'core_Messaging' ), 2, array( 'app', 'link', 'extension' ) );
|
||||
Task::queue( 'convert', 'RebuildNonContent', array( 'app' => $this->app->app_id, 'link' => 'core_members', 'extension' => 'core_Signatures' ), 2, array( 'app', 'link', 'extension' ) );
|
||||
|
||||
/* Content Counts */
|
||||
\IPS\Task::queue( 'core', 'RecountMemberContent', array( 'app' => $this->app->app_id ), 4, array( 'app' ) );
|
||||
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' ) );
|
||||
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' ) );
|
||||
Task::queue( 'convert', 'RebuildConversationFirstIds', array( 'app' => $this->app->app_id ), 2, array( 'app' ) );
|
||||
|
||||
return array( "f_search_index_rebuild", "f_clear_caches", "f_rebuild_pms", "f_signatures_rebuild" );
|
||||
}
|
||||
@@ -360,14 +388,16 @@ class _Phpbb extends \IPS\convert\Software
|
||||
{
|
||||
return str_replace( ":" . $uid . "]", "]", $post );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fix post data
|
||||
* Pre-process content for the Invision Community text parser
|
||||
*
|
||||
* @param string $post Raw post data
|
||||
* @return string Parsed post data
|
||||
* @param string The post
|
||||
* @param string|null Content Classname passed by post-conversion rebuild
|
||||
* @param int|null Content ID passed by post-conversion rebuild
|
||||
* @return string The converted post
|
||||
*/
|
||||
public static function fixPostData( $post )
|
||||
public static function fixPostData( string $post, ?string $className=null, ?int $contentId=null ): string
|
||||
{
|
||||
/* Convert newlines to <br> tags */
|
||||
$post = nl2br( $post );
|
||||
@@ -378,7 +408,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
|
||||
foreach( $matches[0] as $k => $m )
|
||||
{
|
||||
$c = \count( $codeboxes );
|
||||
$c = count( $codeboxes );
|
||||
$codeboxes[ $c ] = $m;
|
||||
|
||||
$replacement = '__CODE_BOX_' . $c . '__';
|
||||
@@ -475,7 +505,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
{
|
||||
$name = $this->db->select( 'lang_name', 'profile_lang', array( "field_id=?", $row['field_id'] ) )->first();
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
$name = $row['field_name'];
|
||||
}
|
||||
@@ -590,7 +620,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/* Now check for group promotions */
|
||||
if( \count( $libraryClass->groupPromotions ) )
|
||||
if( count( $libraryClass->groupPromotions ) )
|
||||
{
|
||||
foreach( $libraryClass->groupPromotions as $groupPromotion )
|
||||
{
|
||||
@@ -616,10 +646,10 @@ class _Phpbb extends \IPS\convert\Software
|
||||
|
||||
if( empty( $avatarSalt ) )
|
||||
{
|
||||
throw new \UnderflowException();
|
||||
throw new UnderflowException();
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
$avatarSalt = rtrim( $this->app->_session['more_info']['convertMembers']['photo_hash'], '_' );
|
||||
}
|
||||
@@ -661,9 +691,9 @@ class _Phpbb extends \IPS\convert\Software
|
||||
/* Work out timezone - we don't really need to create an instance of \DateTimeZone here, however it helps check for invalid ones */
|
||||
try
|
||||
{
|
||||
$timezone = new \DateTimeZone( $row['user_timezone'] );
|
||||
$timezone = new DateTimeZone( $row['user_timezone'] );
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
$timezone = 'UTC';
|
||||
}
|
||||
@@ -683,7 +713,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
$temp_ban = $ban['ban_end'];
|
||||
}
|
||||
}
|
||||
catch( \UnderflowException $e ) {}
|
||||
catch( UnderflowException $e ) {}
|
||||
|
||||
/* Array of basic data */
|
||||
$info = array(
|
||||
@@ -720,7 +750,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
if ( $row['user_avatar_type'] )
|
||||
{
|
||||
/* Is it numeric? Apparently phpBB doesn't clean up after itself. */
|
||||
if ( \is_numeric( $row['user_avatar_type'] ) )
|
||||
if ( is_numeric( $row['user_avatar_type'] ) )
|
||||
{
|
||||
switch( $row['user_avatar_type'] )
|
||||
{
|
||||
@@ -769,7 +799,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 )
|
||||
{
|
||||
@@ -786,7 +816,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
/* 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 ) { }
|
||||
catch( UnderflowException $e ) { }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -797,7 +827,7 @@ 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;
|
||||
$info['pconversation_filters'] = count( $pmFolders ) ? $pmFolders : NULL;
|
||||
|
||||
/* Finally */
|
||||
$libraryClass->convertMember( $info, $pfields, $filename, $filepath );
|
||||
@@ -820,9 +850,9 @@ class _Phpbb extends \IPS\convert\Software
|
||||
try
|
||||
{
|
||||
$log = $this->db->select( '*', 'log', array( "log_id=?", $warn['log_id'] ) )->first();
|
||||
$data = @\unserialize( $log['log_data'] );
|
||||
$data = @unserialize( $log['log_data'] );
|
||||
}
|
||||
catch( \UnderflowException $e )
|
||||
catch( UnderflowException $e )
|
||||
{
|
||||
$log = array( 'user_id' => 0 );
|
||||
$data = array( 0 => NULL );
|
||||
@@ -870,7 +900,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
'ignore_ignore_id' => $row['zebra_id'],
|
||||
);
|
||||
|
||||
foreach( \IPS\core\Ignore::types() AS $type )
|
||||
foreach( Ignore::types() AS $type )
|
||||
{
|
||||
$info['ignore_' . $type] = 1;
|
||||
}
|
||||
@@ -927,7 +957,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
}
|
||||
|
||||
/* If Type is null - skip */
|
||||
if ( \is_null( $type ) )
|
||||
if ( is_null( $type ) )
|
||||
{
|
||||
$libraryClass->setLastKeyValue( $row['ban_id'] );
|
||||
continue;
|
||||
@@ -1073,26 +1103,26 @@ class _Phpbb extends \IPS\convert\Software
|
||||
/**
|
||||
* Check if we can redirect the legacy URLs from this software to the new locations
|
||||
*
|
||||
* @return NULL|\IPS\Http\Url
|
||||
* @return NULL|Url
|
||||
*/
|
||||
public function checkRedirects()
|
||||
{
|
||||
/* If we can't access profiles, don't bother trying to redirect */
|
||||
if( !\IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) )
|
||||
if( !Member::loggedIn()->canAccessModule( Module::get( 'core', 'members' ) ) )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$url = \IPS\Request::i()->url();
|
||||
$url = Request::i()->url();
|
||||
|
||||
if( mb_strpos( $url->data[ \IPS\Http\Url::COMPONENT_PATH ], 'memberlist.php' ) !== FALSE )
|
||||
if( mb_strpos( $url->data[ Url::COMPONENT_PATH ], 'memberlist.php' ) !== FALSE )
|
||||
{
|
||||
try
|
||||
{
|
||||
$data = (string) $this->app->getLink( \IPS\Request::i()->u, array( 'members', 'core_members' ) );
|
||||
return \IPS\Member::load( $data )->url();
|
||||
$data = (string) $this->app->getLink( Request::i()->u, array( 'members', 'core_members' ) );
|
||||
return Member::load( $data )->url();
|
||||
}
|
||||
catch( \Exception $e )
|
||||
catch( Exception $e )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -1137,19 +1167,19 @@ class _Phpbb extends \IPS\convert\Software
|
||||
/* Does the referenced folder exist in PhpBB? */
|
||||
if( !isset( static::$phpBbFolders[ $folderId ] ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
$member = \IPS\Member::load( $this->app->getLink( (int) $user, 'core_members' ) );
|
||||
$member = 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;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException $e )
|
||||
{
|
||||
return static::$pmFolders[ $user ][ $folderId ] = FALSE;
|
||||
}
|
||||
@@ -1161,7 +1191,7 @@ class _Phpbb extends \IPS\convert\Software
|
||||
/**
|
||||
* Process a login
|
||||
*
|
||||
* @param \IPS\Member $member The member
|
||||
* @param Member $member The member
|
||||
* @param string $password Password from form
|
||||
* @return bool
|
||||
*/
|
||||
@@ -1175,31 +1205,31 @@ class _Phpbb extends \IPS\convert\Software
|
||||
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 );
|
||||
$ph = new PasswordHash( 8, TRUE );
|
||||
$success = $ph->CheckPassword( $password, $member->conv_password ) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
$hashLibrary = new \IPS\convert\Login\HashCryptPrivate;
|
||||
$hashLibrary = new HashCryptPrivate;
|
||||
if ( $success === FALSE )
|
||||
{
|
||||
/* phpBB3 */
|
||||
$single_md5_pass = md5( $password );
|
||||
$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
|
||||
if ( \strlen( $hash ) == 34 )
|
||||
if ( strlen( $hash ) == 34 )
|
||||
{
|
||||
$success = ( \IPS\Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) ) ) ? TRUE : FALSE;
|
||||
$success = ( Login::compareHashes( $hash, $hashLibrary->hashCryptPrivate( $password, $hash, $itoa64 ) ) ) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$success = ( \IPS\Login::compareHashes( $hash, $single_md5_pass ) ) ? TRUE : FALSE;
|
||||
$success = ( 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 ;
|
||||
$success = ( 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 */
|
||||
|
||||
Reference in new issue
Block a user