');
}
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
','
');
// Remove phpBB.users. Number 52 seems to be the greatest user_id
// value when no user has been created.
array_push($htmlblock,'
Cleanning up ...
');
$sql = sprintf('DELETE FROM %s.%susers WHERE user_id > 52;',
$db->db_phpbb_db,
$db->db_phpbb_tbl );
$db->query( $sql );
// Add users into LDAP directory
array_push($htmlblock,'
');
return $htmlblock;
}
/***
* Categories
*
* Not copied. In phpBB there is no category.
*/
/***
* Copy Forum
*/
function copy_Forums()
{
global $db;
$htmlblock = array('
');
$sql = sprintf("INSERT INTO %s.%sforums (forum_name,
forum_desc,
forum_topics,
forum_topics_real,
forum_type,
forum_posts) SELECT forum_name,
forum_desc,
forum_topics,
forum_topics,
(SELECT 1 AS forum_type),
forum_posts FROM %s.%sbb_forums;",
$db->db_phpbb_db, $db->db_phpbb_tbl,
$db->db_xoops_db, $db->db_xoops_tbl);
$db->query( $sql );
// Get forums recently added and update their order, ownership, and type.
$sql = sprintf('SELECT forum_id, left_id, right_id FROM %s.%sforums;',
$db->db_phpbb_db,
$db->db_phpbb_tbl );
$result = $db->query( $sql );
// Sanitize forum's order one by one
$left_id = 1;
$right_id = 2;
$counter = 0;
while ( $row = mysql_fetch_array( $result ) )
{
$sql = sprintf("UPDATE %s.%sforums SET left_id = %d, right_id = %d WHERE forum_id = %d;",
$db->db_phpbb_db,
$db->db_phpbb_tbl,
$left_id,
$right_id,
$row['forum_id']);
$db->query( $sql );
$left_id = $left_id + 2;
$right_id = $left_id + 1;
// Counter
$counter++;
}
// Get amount of forums copied.
array_push( $htmlblock, '
' . $counter . ' forum(s) copied successfully.
', '
');
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('