From 727390e015a9c4b1c04532392c422d42ae8b0199 Mon Sep 17 00:00:00 2001 From: e107steved Date: Mon, 20 Jul 2009 21:18:09 +0000 Subject: [PATCH] Add some work in progress - needs further testing --- e107_plugins/import/import_classes.php | 27 ++++++++++++++++++--- e107_plugins/import/import_user_class.php | 9 +++---- e107_plugins/import/phpbb2_import_class.php | 17 ++++++++++--- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/e107_plugins/import/import_classes.php b/e107_plugins/import/import_classes.php index 897cf8063..cf1a5509a 100644 --- a/e107_plugins/import/import_classes.php +++ b/e107_plugins/import/import_classes.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/import/import_classes.php,v $ -| $Revision: 1.1 $ -| $Date: 2009-07-20 15:24:34 $ -| $Author: e107coders $ +| $Revision: 1.2 $ +| $Date: 2009-07-20 21:18:09 $ +| $Author: e107steved $ | +----------------------------------------------------------------------------+ */ @@ -55,6 +55,27 @@ class base_import_class } + function saveData($dataRecord) + { + switch($this->currentTask) + { + case 'users' : + return $this->saveUserData($dataRecord); + break; + case 'forumdefs' : + return $this->saveForumData($dataRecord); + return FALSE; + case 'forumposts' : + return $this->savePostData($dataRecord); + return FALSE; + case 'polls' : + return FALSE; + case 'news' : + return FALSE; + } + return FALSE; + } + // Return the next record as an array. All data has been converted to the appropriate E107 formats // Return FALSE if no more data diff --git a/e107_plugins/import/import_user_class.php b/e107_plugins/import/import_user_class.php index 3bca0cffb..c4e686b7b 100644 --- a/e107_plugins/import/import_user_class.php +++ b/e107_plugins/import/import_user_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/import/import_user_class.php,v $ -| $Revision: 1.1 $ -| $Date: 2009-07-20 15:24:34 $ -| $Author: e107coders $ +| $Revision: 1.2 $ +| $Date: 2009-07-20 21:18:09 $ +| $Author: e107steved $ | +----------------------------------------------------------------------------+ */ @@ -95,7 +95,6 @@ class user_import // Constructor function user_import() { - global $sql; $this->userDB = new db; // Have our own database object to write to the user table // Create list of predefined extended user fields which are present @@ -155,7 +154,7 @@ class user_import // Add a user record to the DB - pass array as parameter. // Returns an error code on failure. TRUE on success - function saveData($userRecord) + function saveUserData($userRecord) { if ($this->blockMainAdmin && isset($userRecord['user_id']) && ($userRecord['user_id'] == 1)) return 1; $extendedFields = array(); diff --git a/e107_plugins/import/phpbb2_import_class.php b/e107_plugins/import/phpbb2_import_class.php index b6c7eed23..1849b8207 100644 --- a/e107_plugins/import/phpbb2_import_class.php +++ b/e107_plugins/import/phpbb2_import_class.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/import/phpbb2_import_class.php,v $ -| $Revision: 1.1 $ -| $Date: 2009-07-20 15:24:34 $ -| $Author: e107coders $ +| $Revision: 1.2 $ +| $Date: 2009-07-20 21:18:09 $ +| $Author: e107steved $ | +----------------------------------------------------------------------------+ */ @@ -87,7 +87,14 @@ class phpbb2_import extends base_import_class if ($this->copyUserInfo) $target['user_id'] = $source['user_id']; $target['user_name'] = $source['username']; $target['user_loginname'] = $source['username']; + if ((substr($source['user_password']) == '$H$') && (strlen($source['user_password']) == 34)) + { // Convert salted password to E107 style (they use the same basic coding) + $target['user_password'] = substr_replace($source['user_password'], '$E$',0,3); + } + else + { // Probably an old md5 password $target['user_password'] = $source['user_password']; + } $target['user_email'] = $source['user_email']; $target['user_signature'] = $this->proc_bb($source['user_sig'],'phpbb,bblower'); $target['user_hideemail'] = $source['user_viewemail']; @@ -375,7 +382,9 @@ while($topic = mysql_fetch_array($phpbb_res)) //echo "PARENT: $parent_id, TOPIC: $topic_id
"; - $query = "SELECT * FROM {$phpbb2Prefix}posts LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id) WHERE topic_id='{$topic_id}' AND post_subject = '' ORDER BY post_time DESC"; +// Not checking post_subject might work better + $query = "SELECT * FROM {$phpbb2Prefix}posts LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id) WHERE topic_id='{$topic_id}' ORDER BY post_time DESC"; +// $query = "SELECT * FROM {$phpbb2Prefix}posts LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id) WHERE topic_id='{$topic_id}' AND post_subject = '' ORDER BY post_time DESC"; $phpbb_res2 = mysql_query($query, $phpbbConnection); if(!$phpbb_res2) {