***/ class NEWBB_TO_PHPBB { /*** * Class Construct * ---------------------------------------------------- */ function __construct() { // Initialize session session_start(); // Check action: usedefaults if ( isset( $_GET['action'] ) && $_GET['action'] == 'restore' ) { // Unset session values session_unset(); // Reload page header('Location: index.php'); } } /*** * Verify Configuration * * This verification is needed to be sure new information entered * is valid. */ function config_verification( $next_step ) { global $db; global $ldap; global $html; $htmlblock = array(); $error = 0; // Verify LDAP bind if ( $ldap->do_bind() ) { array_push($htmlblock, $html->format_message('LDAP Configuration is correct', 'green')); } else { array_push( $htmlblock, $html->format_message('LDAP Configuration is incorrect', 'orange')); $error++; } // Verify Database if ( $db->connect() === true ) { array_push( $htmlblock, $html->format_message('Common DB Configuration is correct', 'green')); // Verify XOOPS database and table if ( $db->check_existance('xoops') === true ) { array_push( $htmlblock, $html->format_message('Xoops configuration is correct', 'green')); } else { array_push( $htmlblock, $html->format_message('Xoops configuration is incorrect', 'orange')); $error++; } // Verify PHPBB database and table if ( $db->check_existance('phpbb') === true ) { array_push( $htmlblock, $html->format_message('phpBB configuration is correct', 'green')); } else { array_push( $htmlblock, $html->format_message('phpBB configuration is incorrect', 'orange')); $error++; } } else { array_push( $htmlblock, $html->format_message('Common DB Configuration is incorrect', 'orange')); $error++; } // Add action button if ( $error == 0 ) { $next_step++; array_push( $htmlblock, '

'); } else { array_push($htmlblock, '

PreviousCheck your configuration

'); } return $html->format_htmlblock($htmlblock); } /*** * Groups * * All users in xoops.users will be inserted into phpBB.users * using the REGISTERED group (group_id = 2). Forums administrators should * be redifined after migration. */ /*** * Users * * Basic fields are copied from xoops.users to phpBB.users. * * Password field should be redifined by the user in order to get logged in * after the migration. * * If LDAP authentication is used the directory structure should be design * to receive uid and userPassword attributes. In this case the migration * should be focused from xoops.users to LDAP directory not phpBB.users. * * The LDAP registration process is (as my understanding): 1. Add an entry * for the user in the LDAP directory. 2. Add an entry for the user in the * DB (this is automatically done by phpBB). This is needed to relate user * against user specific information like topics, posts, etc. * * As we are using LDAP server for users. This function use php's ldap * extension to add users into LDAP directory. If the user do no exist in * the Database but in LDAP server, phpBB will automatically insert a * record for that user in the phpBB.user table. It is needed to relate * user identity to posts, topics, etc . * * User passwords need to be reseted and a notification could be send to each * user telling the new password set. This is requiered because the * password codification used in newbb, phpbb and LDAP is different. * * The structure of LDAP user entries was built with rfc2377 in mind. */ function copy_Users() { global $ldap; global $db; $htmlblock = array('

Users

',''); return $htmlblock; } /*** * Categories * * Not copied. In phpBB there is no category. */ /*** * Copy Forum */ function copy_Forums() { global $db; $htmlblock = array('

Forums

', ''); return $htmlblock; } /*** * Topics * * When doing Topic copying the user used will be administrator. This means * that all topics and posts after migration will be own by the * administrator user. */ function copy_Topics() { global $db; $htmlblock = array('

Topics

','' ); return $htmlblock; } /*** * Posts */ function copy_Posts() { global $db; $htmlblock = array('

Posts

',''); return $htmlblock; } /*** * Generate random password */ function get_randomPass() { // Add lower case letters $seed = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'i', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z'); // Add upper case letters foreach ( $seed as $value ) { array_push( $seed, strtoupper($value) ); } // Add numbers array_push( $seed, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' ); // Use some symbols chars array_push( $seed, '!', '@', '#', '$', '%', '=', '/','+' ); // Build password based on seed $userPassword = ''; $passwordLength = 20; for ($i = 0; $i < $passwordLength; $i++) { $userPassword = $userPassword . $seed[array_rand($seed)]; } return $userPassword; } /*** * Class Destruct * ---------------------------------------------------- */ function __destruct() { } } $newbb_to_phpbb = new NEWBB_TO_PHPBB; ?>