From a7d01d2117675588066ae0f3dfaeae5826dc8b09 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Mon, 20 Jul 2009 15:24:34 +0000 Subject: [PATCH] Import plugin. Fixed some incompatibilities with 0.8. Tested e107 -> e107 import and working correctly. Added wordpress user import, but salted passwords are an issue currently. Plugin-class - fixed some error message boxes. --- e107_handlers/plugin_class.php | 15 +- .../import/PHPFusion_import_class.php | 92 +++ e107_plugins/import/PHPNuke_import_class.php | 102 +++ e107_plugins/import/admin_import.php | 723 ++++++++++++++++++ .../import/coppermine_import_class.php | 93 +++ e107_plugins/import/csv_import.txt | 2 + e107_plugins/import/drupal_import_class.php | 90 +++ e107_plugins/import/e107_import_class.php | 112 +++ .../import/ikonboard_import_class.php | 106 +++ e107_plugins/import/images/import_16.png | Bin 0 -> 986 bytes e107_plugins/import/images/import_32.png | Bin 0 -> 2775 bytes e107_plugins/import/import_classes.php | 177 +++++ e107_plugins/import/import_readme.txt | 104 +++ e107_plugins/import/import_user_class.php | 221 ++++++ e107_plugins/import/index.html | 0 .../import/languages/English_admin_import.php | 84 ++ e107_plugins/import/mambo_import_class.php | 81 ++ e107_plugins/import/phpbb2_import_class.php | 408 ++++++++++ e107_plugins/import/plugin.xml | 18 + e107_plugins/import/smf_import_class.php | 94 +++ .../import/wordpress_import_class.php | 133 ++++ 21 files changed, 2650 insertions(+), 5 deletions(-) create mode 100644 e107_plugins/import/PHPFusion_import_class.php create mode 100644 e107_plugins/import/PHPNuke_import_class.php create mode 100644 e107_plugins/import/admin_import.php create mode 100644 e107_plugins/import/coppermine_import_class.php create mode 100644 e107_plugins/import/csv_import.txt create mode 100644 e107_plugins/import/drupal_import_class.php create mode 100644 e107_plugins/import/e107_import_class.php create mode 100644 e107_plugins/import/ikonboard_import_class.php create mode 100644 e107_plugins/import/images/import_16.png create mode 100644 e107_plugins/import/images/import_32.png create mode 100644 e107_plugins/import/import_classes.php create mode 100644 e107_plugins/import/import_readme.txt create mode 100644 e107_plugins/import/import_user_class.php create mode 100644 e107_plugins/import/index.html create mode 100644 e107_plugins/import/languages/English_admin_import.php create mode 100644 e107_plugins/import/mambo_import_class.php create mode 100644 e107_plugins/import/phpbb2_import_class.php create mode 100644 e107_plugins/import/plugin.xml create mode 100644 e107_plugins/import/smf_import_class.php create mode 100644 e107_plugins/import/wordpress_import_class.php diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index aed92d13f..cb376162a 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ -| $Revision: 1.70 $ -| $Date: 2009-07-16 08:46:11 $ +| $Revision: 1.71 $ +| $Date: 2009-07-20 15:24:34 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -164,7 +164,10 @@ class e107plugin if(!$this->parse_plugin($p['path'])) { //parsing of plugin.php/plugin.xml failed. - echo "Parsing failed - file format error: {$p['path']}
"; + require_once(e_HANDLER."message_handler.php"); + $emessage = &eMessage::getInstance(); + $emessage->add("Parsing failed - file format error: {$p['path']}", E_MESSAGE_ERROR); + // echo
"; continue; // Carry on and do any others that are OK } $plug_info = $this->plug_vars; @@ -1700,8 +1703,10 @@ class e107plugin $this->plug_vars = $xml->loadXMLfile(e_PLUGIN.$plugName.'/plugin.xml', true, true); if ($this->plug_vars === FALSE) { - echo "Error reading {$plugName}/plugin.xml
"; - return FALSE; + require_once(e_HANDLER."message_handler.php"); + $emessage = &eMessage::getInstance(); + $emessage->add("Error reading {$plugName}/plugin.xml", E_MESSAGE_ERROR); + return FALSE; } // print_a($this->plug_vars); return true; diff --git a/e107_plugins/import/PHPFusion_import_class.php b/e107_plugins/import/PHPFusion_import_class.php new file mode 100644 index 000000000..2e644767c --- /dev/null +++ b/e107_plugins/import/PHPFusion_import_class.php @@ -0,0 +1,92 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users"); + if ($result === FALSE) return FALSE; + break; + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['user_id']; + $target['user_name'] = $source['user_name']; + $target['user_loginname'] = $source['user_name']; + $target['user_password'] = $source['user_password']; + $target['user_email'] = $source['user_email']; + $target['user_hideemail'] = $source['user_hide_email']; + $target['user_image'] = $source['user_avatar']; + $target['user_signature'] = $source['user_sig']; + $target['user_forums'] = $source['user_posts']; + $target['user_join'] = $source['user_joined']; + $target['user_lastvisit'] = $source['user_lastvisit']; + $target['user_location'] = $source['user_location']; + $target['user_birthday'] = $source['user_birthdate']; + $target['user_aim'] = $source['user_aim']; + $target['user_icq'] = $source['user_icq']; + $target['user_msn'] = $source['user_msn']; + $target['user_yahoo'] = $source['user_yahoo']; + $target['user_homepage'] = $source['user_web']; + $target['user_timezone'] = $source['user_offset']; // guess - may need conversion + $target['user_ip'] = $source['user_ip']; +// $target['user_'] = $source['']; +// $target['user_'] = $source['']; + +// $target['user_ban'] = ($source['user_status'] ? 2 : 0); // Guess + return $target; + } + +} + + +?> diff --git a/e107_plugins/import/PHPNuke_import_class.php b/e107_plugins/import/PHPNuke_import_class.php new file mode 100644 index 000000000..50894c6b7 --- /dev/null +++ b/e107_plugins/import/PHPNuke_import_class.php @@ -0,0 +1,102 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active`=1"); + if ($result === FALSE) return FALSE; + break; + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + // Very similar to PHPBB fields (as far as the bits we can convert are concerned) + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['user_id']; + $target['user_name'] = $source['username']; + $target['user_loginname'] = $source['username']; + $target['user_loginname'] = $source['name']; + $target['user_password'] = $source['user_password']; + $target['user_join'] = strtotime($source['user_regdate']); + $target['user_email'] = $source['user_email']; + $target['user_hideemail'] = $source['user_viewemail']; + $target['user_image'] = $source['user_avatar']; + $target['user_signature'] = $source['user_sig']; + $target['user_forums'] = $source['user_posts']; + $target['user_lastvisit'] = $source['user_lastvisit']; + + switch ($source['user_avatar_type']) + { + default: + $target['user_image'] = $source['user_avatar']; + } + $target['user_timezone'] = $source['user_timezone']; // source is decimal(5,2) + $target['user_language'] = $source['user_lang']; // May need conversion + $target['user_location'] = $source['user_from']; + $target['user_icq'] = $source['user_icq']; + $target['user_aim'] = $source['user_aim']; + $target['user_yahoo'] = $source['user_yim']; + $target['user_msn'] = $source['user_msnm']; + $target['user_homepage'] = $source['user_website']; + $target['user_ip'] = $source['last_ip']; +// $target['user_'] = $source['']; + +// $source['user_rank']; +// $target['user_admin'] = ($source['user_level'] == 1) ? 1 : 0; // Guess +// if ($target['user_admin'] != 0) $target['user_perms'] = '0.'; +// $target['user_ban'] = ($source['ublockon'] ? 2 : 0); // Guess + return $target; + } + +} + + +?> diff --git a/e107_plugins/import/admin_import.php b/e107_plugins/import/admin_import.php new file mode 100644 index 000000000..9ee29b9fb --- /dev/null +++ b/e107_plugins/import/admin_import.php @@ -0,0 +1,723 @@ + array('message' => LAN_CONVERT_25, 'classfile' => 'import_user_class.php', 'classname' => 'user_import'), + 'news' => array('message' => LAN_CONVERT_28), + 'forumdefs' => array('message' => LAN_CONVERT_26), + 'forumposts' => array('message' => LAN_CONVERT_48), + 'polls' => array('message' => LAN_CONVERT_27) + + ); + + +// See what DB-based imports are available (don't really want it here, but gets it into the header script) +require_once(e_HANDLER.'file_class.php'); + +$fl = new e_file; +$importClassList = $fl->get_files(e_PLUGIN.'import', "^.+?_import_class\.php$", "standard", 1); +foreach($importClassList as $file) +{ + $tag = str_replace('_class.php','',$file['fname']); + include_once($file['fpath'].$file['fname']); // This will set up the variables +} +unset($importClassList); +unset($fl); + + + +if(varset($_POST['import_source'])) +{ + $import_source = varset($_POST['import_source'],'csv'); + if(varset($_POST['classes_select'])) + { + $checked_class_list = implode(',',$_POST['classes_select']); + } + $import_delete_existing_data = varset($_POST['import_delete_existing_data'],0); + + $current_csv = varset($_POST['csv_format'],'default'); + $csv_pw_not_encrypted = varset($_POST['csv_pw_not_encrypted'],0); + $csv_data_file = varset($_POST['csv_data_file'],'import.csv'); + + $current_db_type = varset($_POST['db_import_type'],key($import_class_names)); +} +$db_blocks_to_import = array(); + + +foreach ($db_import_blocks as $k => $v) +{ + if (isset($_POST['import_block_'.$k])) + { + $db_blocks_to_import[$k] = 1; + } +} + +require_once(e_ADMIN."auth.php"); + +if (!is_object($e_userclass)) +{ + require_once(e_HANDLER."userclass_class.php"); // Modified class handler + $e_userclass = new user_class; +} + + + + +define('CSV_DEF_FILE','csv_import.txt'); // Supplementary CSV format definitions + +// Definitions of available CSV-based imports +$csv_formats = array('default' => 'user_name,user_password'); +$csv_names = array('default' => LAN_CONVERT_12); +$csv_options = array('default' => 'simple'); +$csv_option_settings = array( + 'simple' => array('separator' => ',', 'envelope' => ''), + 'simple_sq' => array('separator' => ',', 'envelope' => "'"), + 'simple_dq' => array('separator' => ',', 'envelope' => '"'), + 'simple_semi' => array('separator' => ',', 'envelope' => ';'), + 'simple_bar' => array('separator' => ',', 'envelope' => '|') + ); + +// See what CSV format definitions are available +if (is_readable(CSV_DEF_FILE)) +{ + $csv_temp = file(CSV_DEF_FILE); + foreach ($csv_temp as $line) + { + $line = trim(str_replace("\n","",$line)); + if ($line) + { + list($temp,$name,$options,$line) = explode(',',$line,4); + $temp = trim($temp); + $name = trim($name); + $options = trim($options); + $line = trim($line); + if ($temp && $name && $options && $line) + { + $csv_formats[$temp] = $line; // Add any new definitions + $csv_names[$temp] = $name; + $csv_options[$temp] = $options; + } + } + } + unset($csv_temp); +} + + + +$msg = ''; + +//====================================================== +// Executive routine - actually do conversion +//====================================================== +if(isset($_POST['do_conversion'])) +{ + $abandon = TRUE; + switch ($import_source) + { + case 'csv' : + if (!isset($csv_formats[$current_csv])) $msg = "CSV File format error

"; + if (!is_readable($csv_data_file)) $msg = LAN_CONVERT_31; + if (!isset($csv_options[$current_csv])) $msg = LAN_CONVERT_37.' '.$current_csv; + if (!isset($csv_option_settings[$csv_options[$current_csv]])) $msg = LAN_CONVERT_37.' '.$csv_options[$current_csv]; + + if (!$msg) + { + $field_list = explode(',',$csv_formats[$current_csv]); + $separator = $csv_option_settings[$csv_options[$current_csv]]['separator']; + $enveloper = $csv_option_settings[$csv_options[$current_csv]]['envelope']; + if (IMPORT_DEBUG) echo "CSV import: {$current_csv} Fields: {$csv_formats[$current_csv]}
"; + require_once('import_user_class.php'); + $usr = new user_import; + $usr->overrideDefault('user_class',$checked_class_list); + if (($source_data = file($csv_data_file)) === FALSE) $msg = LAN_CONVERT_32; + if ($import_delete_existing_data) $usr->emptyTargetDB(); // Delete existing users - reasonably safe now + $line_counter = 0; + $error_counter = 0; + $write_counter = 0; + foreach ($source_data as $line) + { + $line_counter++; + $line_error = FALSE; + if ($line = trim($line)) + { + $usr_data = $usr->getDefaults(); // Reset user data + $line_data = csv_split($line, $separator, $enveloper); + $field_data = current($line_data); + foreach ($field_list as $f) + { + if ($field_data === FALSE) $line_error = TRUE; + if ($f != 'dummy') $usr_data[$f] = $field_data; + $field_data = next($line_data); + } + if ($line_error) + { + if ($msg) $msg .= "
"; + $msg .= LAN_CONVERT_33.$line_counter; + $error_counter++; + } + else + { + if ($csv_pw_not_encrypted) + { + $usr_data['user_password'] = md5($usr_data['user_password']); + } + $line_error = $usr->saveData($usr_data); + if ($line_error === TRUE) + { + $write_counter++; + } + else + { + $line_error = $usr->getErrorText($line_error); + if ($msg) $msg .= "
"; + $msg .= str_replace('--ERRNUM--',$line_error,LAN_CONVERT_34).$line_counter; + $error_counter++; + } + } + } + } + if ($msg) $msg .= "
"; + if ($import_delete_existing_data) $msg .= LAN_CONVERT_40.'
'; + $msg .= str_replace(array('--LINES--','--USERS--', '--ERRORS--'),array($line_counter,$write_counter,$error_counter),LAN_CONVERT_35); + } + break; + + case 'db' : + + if (IMPORT_DEBUG) echo "Importing: {$current_db_type}
"; + if (!isset($_POST['dbParamHost']) || !isset($_POST['dbParamUsername']) || !isset($_POST['dbParamPassword']) || !isset($_POST['dbParamDatabase'])) + { + $msg = LAN_CONVERT_41; + } + if (!$msg) + { + if (class_exists($current_db_type)) + { + $converter = new $current_db_type; + } + else + { + $msg = LAN_CONVERT_42; + } + } + if (!$msg) + { + + $result = $converter->db_Connect($_POST['dbParamHost'], $_POST['dbParamUsername'], $_POST['dbParamPassword'], $_POST['dbParamDatabase'], $_POST['dbParamPrefix']); + + + + if ($result !== TRUE) + { + $msg = LAN_CONVERT_43.": ".$result; // db connect failed + } + } + if (!$msg) + { + foreach ($db_import_blocks as $k => $v) + { + if (isset($db_blocks_to_import[$k])) + { + $loopCounter = 0; + $errorCounter = 0; + if (is_readable($v['classfile'])) + { + require_once($v['classfile']); + } + else + { + $msg = LAN_CONVERT_45.': '.$v['classfile']; // can't read class file. + } + if (!$msg && (varset($_POST["import_block_{$k}"],0) == 1)) + { + if (IMPORT_DEBUG) echo "Importing: {$k}
"; + $result = $converter->setupQuery($k,!$import_delete_existing_data); + if ($result !== TRUE) + { + $msg = LAN_CONVERT_44.' '.$k; + // $msg .= "Prefix = ".$converter->DBPrefix; + break; + } + $exporter = new $v['classname']; // Writes the output data + // Do any type-specific default setting + switch ($k) + { + case 'users' : + $exporter->overrideDefault('user_class',$checked_class_list); + break; + } + if ($import_delete_existing_data) $exporter->emptyTargetDB(); // Clean output DB - reasonably safe now + while ($row = $converter->getNext($exporter->getDefaults())) + { + $loopCounter++; + $result = $exporter->saveData($row); + if ($result !== TRUE) + { + $errorCounter++; + $line_error = $exporter->getErrorText($result); + if ($msg) $msg .= "
"; + $msg .= str_replace(array('--ERRNUM--','--DB--'),array($line_error,$k),LAN_CONVERT_46).$loopCounter; + } + } + $converter->endQuery; + unset($exporter); + if ($msg) $msg .= "
"; + $msg .= str_replace(array('--LINES--','--USERS--', '--ERRORS--','--BLOCK--'), + array($loopCounter,$loopCounter-$errorCounter,$errorCounter, $k),LAN_CONVERT_47); + } + } + } + } +// $msg = LAN_CONVERT_29; + $abandon = FALSE; + break; + } + + if ($msg) + { + $emessage->add($msg, E_MESSAGE_INFO); // $ns -> tablerender(LAN_CONVERT_30, $msg); + $msg = ''; + } + + if ($abandon) + { +// unset($_POST['do_conversion']); + $text = " +
+ + + +
+ +
"; + $ns -> tablerender(LAN_CONVERT_30, $text); + require_once(e_ADMIN."footer.php"); + exit; + } +} + + + +//====================================================== +// Display front page +//====================================================== + + + +if(varset($_POST['import_type']) || varset($_POST['do_conversion'])) +{ + showImportOptions($_POST['import_type']); +} +else +{ + showStartPage(); +} + + require_once(e_ADMIN."footer.php"); + exit; + + + + + +function showStartPage() +{ + global $ns, $emessage, $frm, $import_class_names, $import_class_support, $db_import_blocks, $import_class_comment; + + $text = " +
+
+ ".DBLAN_10." + + + + + + + + + + + "; + foreach($db_import_blocks as $name) // 1 column for each of users, news, forum etc. + { + $text .= ""; + } + + $text.=" + + + + + + + + + + + + + + "; + + + foreach ($import_class_names as $k => $title) + { + $text .= " + \n"; + + foreach($db_import_blocks as $key=>$val) + { + $text .= "\n"; + } + + $text .= " + + "; + } + + + $text .= " + +
".LAN_CONVERT_06."".$name['message']."".LAN_OPTIONS."
CSV".ADMIN_TRUE_ICON."    ".$frm->radio('import_type', 'csv')."
".$title."
".$import_class_comment[$k]."
".(in_array($key,$import_class_support[$k]) ? ADMIN_TRUE_ICON : " ")." + ".$frm->radio('import_type', $k)." + +
+
+ ".$frm->admin_button('trigger_import',LAN_CONTINUE, 'execute')." +
+
+
"; + + $ns->tablerender(LAN_CONVERT_01, $emessage->render().$text); + +} + + + + +function showImportOptions($mode='csv') +{ + global $text, $frm, $ns, $emessage, $csv_names, $import_class_names, $e_userclass, $db_import_blocks, $import_class_support, $import_default_prefix; + + $message = LAN_CONVERT_02."
".LAN_CONVERT_05.""; + $emessage->add($message, E_MESSAGE_WARNING); + + $text = " +
+ + + + + "; + + if($mode == "csv") + { + $text .= " + + + + + + + + + + + + + + "; + + } + else + { + $importType = $import_class_names[$mode]; + + $text .= " + + + + + + + + + + + + + + + + + + + + + + + "; + } + + $text .= " + + + + +
".LAN_CONVERT_07."\n +
".LAN_CONVERT_36."
".LAN_CONVERT_17." + + + + + ".LAN_CONVERT_18."
$importType ".LAN_CONVERT_19."
$importType ".LAN_CONVERT_20."
$importType ".LAN_CONVERT_21."
$importType ".LAN_CONVERT_22."
$importType ".LAN_CONVERT_23." + +
$importType ".LAN_CONVERT_24.""; + + $defCheck = (count($import_class_support[$mode])==1) ? "checked='checked'" : ""; + foreach ($db_import_blocks as $k => $v) + { + if(in_array($k, $import_class_support[$mode])) // display only the options supported. + { + $text .= " ".$v['message']; + $text .= "
"; + } + } + $text .= "
".LAN_CONVERT_38." + ".LAN_CONVERT_39."
".LAN_CONVERT_16.""; + $text .= $e_userclass->vetted_tree('classes_select',array($e_userclass,'checkbox'), $checked_class_list,'main,admin,classes,matchclass'); + + $text .= "
+
".$frm->admin_button('do_conversion',LAN_CONTINUE, 'execute')." + + +
+
"; + + // Now a little bit of JS to initialise some of the display divs etc + $temp = ''; + if ($import_source) $temp .= "disp('{$import_source}');"; + if ($current_db_type) $temp .= " flagbits('{$current_db_type}');"; + if ($temp) $text .= ""; + + $ns -> tablerender(LAN_CONVERT_01." :: ".$importType, $emessage->render().$text); + +} + + + + + + +function csv_split(&$data,$delim=',',$enveloper='') +{ + $ret_array = array(); + $fldval=''; + $enclosed = false; +// $fldcount=0; +// $linecount=0; + for($i=0;$i $val) + { + $blocks .= "block_names[{$i}]='{$it}';\n"; + $i++; + } + + $i = 0; + foreach ($import_class_support as $k => $v) + { + $vals .= "db_names[$i] = '{$k}';\n"; + $comments .= "comment_text[$i] = '{$import_class_comment[$k]}';\n"; +// $temp = $import_class_support[$k]; // Array of import types supported + $j = 0; + $m = 1; // Mask bit + foreach ($db_import_blocks as $it => $val) + { + if (in_array($it,$v)) $j = $j + $m; + $m = $m + $m; + } + $texts .= "db_options[{$i}] = {$j};\n"; + $i++; + } + + $text = " + "; + + return $text; +} + + + +?> \ No newline at end of file diff --git a/e107_plugins/import/coppermine_import_class.php b/e107_plugins/import/coppermine_import_class.php new file mode 100644 index 000000000..07d4cc2c9 --- /dev/null +++ b/e107_plugins/import/coppermine_import_class.php @@ -0,0 +1,93 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active`='YES' "); + if ($result === FALSE) return FALSE; + break; + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['user_id']; + $target['user_name'] = $source['user_name']; + $target['user_loginname'] = $source['user_name']; + $target['user_login'] = $source['user_name']; + $target['user_password'] = $source['user_password']; + $target['user_email'] = $source['user_email']; + $target['user_join'] = strtotime($source['user_regdate']); + $target['user_lastvisit'] = strtotime($source['user_lastvisit']); + switch ($source['user_group']) + { + case 1 : // Admin + $target['user_admin'] = 1; + break; + case 2 : // Ordinary member + case 3 : // Anonymous + break; + case 4 : // Banned + $target['user_ban'] = 2; + break; + } + return $target; + + /* Unused fields: + user_group int(11) NOT NULL default '2', 2 = 'member'. + user_group_list varchar(255) NOT NULL default '', + */ + } +} + + +?> diff --git a/e107_plugins/import/csv_import.txt b/e107_plugins/import/csv_import.txt new file mode 100644 index 000000000..52193d478 --- /dev/null +++ b/e107_plugins/import/csv_import.txt @@ -0,0 +1,2 @@ +extra,add login name,simple,user_name,user_password,user_loginname +sq,basic information single quotes,simple_sq,user_name,user_password diff --git a/e107_plugins/import/drupal_import_class.php b/e107_plugins/import/drupal_import_class.php new file mode 100644 index 000000000..a9aced992 --- /dev/null +++ b/e107_plugins/import/drupal_import_class.php @@ -0,0 +1,90 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `status`=1"); + if ($result === FALSE) return FALSE; + break; + case 'forumdefs' : + return FALSE; + case 'forumposts' : + return FALSE; + case 'polls' : + return FALSE; + case 'news' : + return FALSE; + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['uid']; + $target['user_name'] = $source['name']; + $target['user_loginname'] = $source['name']; + $target['user_password'] = $source['pass']; + $target['user_email'] = $source['mail']; + $target['user_signature'] = $source['signature']; + $target['user_join'] = $source['created']; + $target['user_lastvisit'] = $source['login']; // Could use $source['access'] + $target['user_image'] = $source['picture']; + // $source['init'] is email address used to sign up from + $target['user_timezone'] = $source['timezone']; // May need conversion varchar(8) + $target['user_language'] = $source['language']; // May need conversion varchar(12) + return $target; + } +} + + +?> diff --git a/e107_plugins/import/e107_import_class.php b/e107_plugins/import/e107_import_class.php new file mode 100644 index 000000000..e69e3a6d3 --- /dev/null +++ b/e107_plugins/import/e107_import_class.php @@ -0,0 +1,112 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $query = "SELECT * FROM {$this->DBPrefix}user WHERE `user_id` != 1"; + $result = $this->ourDB->db_Select_gen($query); + + if ($result === FALSE) return FALSE; + break; + + + + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['user_id']; + $target['user_name'] = $source['user_name']; + $target['user_loginname'] = $source['user_loginname']; + $target['user_password'] = $source['user_password']; + $target['user_email'] = $source['user_email']; + $target['user_hideemail'] = $source['user_hideemail']; + $target['user_join'] = $source['user_join']; + $target['user_admin'] = $source['user_admin']; + $target['user_lastvisit'] = $source['user_lastvisit']; + $target['user_login'] = $source['user_login']; + $target['user_ban'] = $source['user_ban']; + $target['user_customtitle'] = $source['user_customtitle']; + $target['user_sess'] = $source['user_sess']; // Photo + $target['user_signature'] = $source['user_signature']; + $target['user_image'] = $source['user_image']; // Avatar + $target['user_currentvisit'] = $source['user_currentvisit']; + $target['user_lastpost'] = $source['user_lastpost']; + $target['user_chats'] = $source['user_chats']; + $target['user_comments'] = $source['user_comments']; +// $target['user_forums'] = $source['user_forums']; + $target['user_ip'] = $source['user_ip']; + $target['user_prefs'] = $source['user_prefs']; + // $target['user_viewed'] = $source['user_viewed']; + $target['user_visits'] = $source['user_visits']; + $target['user_class'] = $source['user_class']; + $target['user_perms'] = $source['user_perms']; + $target['user_xup'] = $source['user_xup']; + $target['user_language'] = $source['user_language']; + $target['user_country'] = $source['user_country']; + $target['user_location'] = $source['user_location']; + $target['user_aim'] = $source['user_aim']; + $target['user_icq'] = $source['user_icq']; + $target['user_yahoo'] = $source['user_yahoo']; + $target['user_msn'] = $source['user_msn']; + $target['user_homepage'] = $source['user_homepage']; + $target['user_birthday'] = $source['user_birthday']; + $target['user_timezone'] = $source['user_timezone']; + return $target; + } + +} + + +?> diff --git a/e107_plugins/import/ikonboard_import_class.php b/e107_plugins/import/ikonboard_import_class.php new file mode 100644 index 000000000..e2f8b3db1 --- /dev/null +++ b/e107_plugins/import/ikonboard_import_class.php @@ -0,0 +1,106 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}member_profiles"); + if ($result === FALSE) return FALSE; + break; + case 'forumdefs' : + return FALSE; + case 'forumposts' : + return FALSE; + case 'polls' : + return FALSE; + case 'news' : + return FALSE; + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['MEMBER_ID']; + $target['user_name'] = $source['MEMBER_NAME']; + $target['user_loginname'] = $source['MEMBER_NAME']; + $target['user_password'] = $source['MEMBER_PASSWORD']; + $target['user_email'] = $source['MEMBER_EMAIL']; + $target['user_signature'] = $source['SIGNATURE']; + $target['user_join'] = $source['MEMBER_JOINED']; + $target['user_lastvisit'] = $source['LAST_LOG_IN']; + $target['user_image'] = $source['MEMBER_AVATAR']; + $target['user_forums'] = $source['MEMBER_POSTS']; + $target['user_sess'] = $source['PHOTO']; + $target['user_hideemail'] = $source['HIDE_EMAIL']; + $target['user_login'] = $source['MEMBER_NAME_R']; // Guessing on this one + $target['user_ip'] = $source['MEMBER_IP']; + $target['user_aim'] = $source['AOLNAME']; + $target['user_icq'] = $source['ICQNUMBER']; + $target['user_location'] = $source['LOCATION']; + $target['user_homepage'] = $source['WEBSITE']; + $target['user_yahoo'] = $source['YAHOONAME']; + $target['user_customtitle'] = $source['MEMBER_TITLE']; + $target['user_timezone'] = $source['TIME_ADJUST']; // May need conversion + $target['user_language'] = $source['LANGUAGE']; // May need conversion + $target['user_msn'] = $source['MSNNAME']; + $target['user_lastpost'] = $source['LAST_POST']; // May need conversion +// $target['user_'] = $source['']; +// $target['user_'] = $source['']; +// $target['user_'] = $source['']; + // $source['MEMBER_LEVEL'] may be an admin indicator + return $target; + } +} + + +?> diff --git a/e107_plugins/import/images/import_16.png b/e107_plugins/import/images/import_16.png new file mode 100644 index 0000000000000000000000000000000000000000..3f6a25e4fac6e40d612d23f6480c15acbcba0de2 GIT binary patch literal 986 zcmV<0110>4P)^rz+Vy5=ocak9N&R)`IzDN_m2!L zf4La$-FWi^7_#E}2N`zn`G3KfftBGqFe+Yv;~N;_0096&0KWeN4dnc)=-2->H9!9% z0{!{`0QCR>00I2~`|Iog`t9}rE>#*83=Xh3 z0*F}`7<-Q%|J(TB{C_PG5e9V;QJ?`pb69{Wi;d?e1Jl3MAaE?OGBEsn`kZ0Kv8@aTA6;M&zP6v?_l;c)?>^pP;1?45 z$ISNiBLkn(PX@~faUG6-LXkHwe0%xx@1ILdKyLs95MwMf`7%M%!yibr0?lM#2huWv zJPdwz4h&h5%?$GYfdR`PF2!(r7e7N^_MQCqU%yWR2q0!)I55aSG%+wjTmw=D3}1#{ zK=zvtzZi}_zQu6v{4NH@&o}>xXqbKE6PEqXaPJJe(Bntn=K=%}%T-V+1Y%8GSpj1B zq09Ff4n4Tf;QaeL!|Gp*pI<+}&vKcafq@wyfEX#w&Hw=h0C>Ym)m+Agng9R*07*qo IM6N<$f?t8Xw*UYD literal 0 HcmV?d00001 diff --git a/e107_plugins/import/images/import_32.png b/e107_plugins/import/images/import_32.png new file mode 100644 index 0000000000000000000000000000000000000000..0226c2f3f20185d13af06f5de7f2194671a37ba7 GIT binary patch literal 2775 zcmWlbdpuP68^_PgF&8=*x6F~6K`yN@!VfKG#;tp*txav2Gh(DwR0>_pnPftCu_e>h z)ON9}klMAC%&8$VG`*tGWyiSdVq6NtnDd+c_V_YGP*s z0D$SLmEoHVnfc$Lk`3|Tkt1IX$tZ!ljtc;lP5z|3VZ$9xjfhVDAz6@`#y=1baO09= z2G6oIL?-Hh$s*nOGf}2CqHgDmi+Liuqz@i zS|U<2SVl0M4(s(h8?c#1k*LU`?+=_lshh)3slDEte0cbTNpMv#W;yil*s8wlHP<|PTFq$lLSE{%jm&A1CxymwGb=QTJ;c4}yiK)uHvL8G^Cu6hsylX^Ua_%QJv3tL zaw_fpZCS?TKwTwX=QW5RorJt>T&j~#SLS9F`1P?BLcNMZ*)cnYs+AfcN22u+1NG>`80$ z=*T;NF;9js)9I&5xRNs$MVGa<@}?4lZR*)WPXMxdDns%a++|4SS=0jui3i=RSQo)v*+mwY_Hp{#*~tB@<}1RrEl_Ditzi1Nrqzr* zfQw8;TT}+wZ!_O+PqZqn&G+rNdCfDUV&dqCkNu7#1>Cb^AXosglF&Ln0tzDcnUa4* z;5feiw7PeV_ouW+$*j9`Grax3^v~5i@{f67_tBk|V=~IpX>s#QHrzgykfS(Hhcoqh z`RHy{nAppo=Yb&c`GRTXS9k~@8(#b7)BrtF@XXJ7u6a2xrZ#rS^XQ?W_x+^{D;X)v z-yTW1>rI_I8E#g#BaS4dQYcvu8f?V{$v3|6G>^5XX5GUY*VQT0Ja-=HyYYuhtK$+! zY_!*_s*hBB77P6}aZ3Z)`u~eer)&1Qvtq_Yo-^}O0kDYx5bBLQ_9;StYq(VWK>}Y1 znP~!+x*P_r247W{b_sQqgxXn-j+$2qhJ~Y|jiJ9d+zPwo!0f7t82;Z64xnw@tBz!L z`qbCtBggySIw6Uz4Vc1oEt)J_X8+TEwdT|cMm0Tv{&Tmsz;x3*gEf^U9q{>I|DMs- z9^$#(<}d_y(LdkmD&OpDJ+flUkg<;mkM!Nqygsy%a}1=LT*JPOoqN)yg+VKy(|)sC zr7Tx@T_sx>updnh&fWDsq=^)^N)b{^KC9{MMyqXExK=|>Z#((Q1D$%2(NasF+caR z`WeBTEFQeT8J>bRVVCNDJAZ!Fj7BNkh&6W`T}SyRt%DzlHXfwV=V7boF;Pj~oKA+f z%twml#MC$D$o>gqx&w~h2?Jbq)l6S)zjgXw8;1_?r$wm}>z)<{~-aF}^^pP4dy+gP+@O!C7g`coC z!LMp37>=d-1pSlI&z%WknM}w^Sv}68uJ&H$HoRx-L&((kGhZ5`l2NljFY|nd$tWyu zO`clC_C%gE5j_S)H&}8zW@fgVc!8ZA-JpK&MX@2StdzfPQmX>#VqjZAW@wMGWR@OK z$YPz>Wxl{hzXh>2T+gPTY>hw@jU~=r&sj_N&Adp7YtuR>L3myOOpg&7{dv5s9vdY^ zUl{|+Up<;aPpCHh9J9gNF#b*gRJc8gPJexL^{r)a*(2~V{+WGU&~q|Y;*{>-sXt^E zy-0{8bl)!&&;aMtw(p_Y`MIpyL$&FH6Sva3IJ0RETmO>AY8KOY5eESd;C(anV8G@g zdxoogq-rVIuN*;`R3eET`a3v4L)1+eXu1$dk%2D7yzw5$@u3b{s=}8A1%9VsRcib3 z@>>-(;D>ijMt)Z;-g~0HNq;i~4Y=uli6HkfCkgXc8l`%|+8KTo}zwhjKOpPluvqF*d2Dpv)r zGy|y2ltd|5e{SVo!tNW3L1;M0IZpSw^4pI)+?>e>JLTH?7!Fg?3HDqbq8{hfCFPD49>Rcph z$rBafMeB07oQ*l6Pb4dOeXS63HT!q}E>XK5G$HyAupkvwaeFE4CIeXm%cHr^^4g;# zK6dHA9;GbPJ7tHgsXMjb4QwMJiEd=yZS_>iws6DVkUmpva4H5Q3^DP(6s(=`-0+dv zR0|+nBN``qmV`Sb=BdqS<)Lk4Y7lyo72yB$TA%q-(Q$tUD@i+rifkqPv!%fT39lT( zo&W3hTi46Tcg}G*aE^_ISeKCH zMzOh;P{9^#=&ZePRSruIsfgu8{@BBju8WOW%m+3}x~nT%+7BA^zUl1)Yti!11+8jM z);5vHy`8#RXb*$!^L}ouK)sw5ypu40eIt4xf%~AF#xga4?d7B?2}B5poG4r62vlD& QY^K1fi1pzWp~#8<0}Ay3D*ylh literal 0 HcmV?d00001 diff --git a/e107_plugins/import/import_classes.php b/e107_plugins/import/import_classes.php new file mode 100644 index 000000000..897cf8063 --- /dev/null +++ b/e107_plugins/import/import_classes.php @@ -0,0 +1,177 @@ +ourDB == NULL) + { + $this->ourDB = new db; + $result = $this->ourDB->db_Connect($server, $user, $password, $database); + $this->DBPrefix = $prefix; + if ($result) + { + return $result; + } + } + return TRUE; + } + + + // Set up a query for the specified task. If $blank_user is TRUE, user ID Data in source data is ignored + // Returns TRUE on success. FALSE on error + function setupQuery($task, $blank_user=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 + // Its passed a record initialised with the default values + function getNext($initial) + { + $result = $this->ourDB->db_Fetch(); + if (!$result) return FALSE; + switch($this->currentTask) + { + case 'users' : + return $this->copyUserData($initial, $result); + break; + case 'forumdefs' : + return FALSE; + case 'forumposts' : + return FALSE; + case 'polls' : + return FALSE; + case 'news' : + return FALSE; + } + return FALSE; + } + + + // Called to signal that current task is complete; tidy up as required + function endQuery() + { + $this->currentTask = ''; + } + + + // Empty function which descendants can inherit from + function copyUserData(&$target, &$source) + { + return $target; + } +} + + +//=========================================================== +// UTILITY ROUTINES +//=========================================================== + +// Process all bbcodes in the passed value; return the processed string. +// Works recursively +// Start by assembling matched pairs. Then map and otherwise process as required. +// Divide the value into five bits: +// Preamble - up to the identified bbcode (won't contain bbcode) +// BBCode start code +// Inner - text between the two bbcodes (may contain another bbcode) +// BBCode end code +// Trailer - remaining unprocessed text (may contain more bbcodes) +// (Note: preg_split might seem obvious, but doesn't pick out the actual codes +function proc_bb($value, $options = "", $maptable = null) +{ + $bblower = (strpos($options,'bblower') !== FALSE) ? TRUE : FALSE; // Convert bbcode to lower case + $bbphpbb = (strpos($options,'phpbb') !== FALSE) ? TRUE : FALSE; // Strip values as phpbb + $nextchar = 0; + $loopcount = 0; + + while ($nextchar < strlen($value)) + { + $firstbit = ''; + $middlebit = ''; + $lastbit = ''; + $loopcount++; + if ($loopcount > 10) return 'Max depth exceeded'; + unset($bbword); + $firstcode = strpos($value,'[',$nextchar); + if ($firstcode === FALSE) return $value; // Done if no square brackets + $firstend = strpos($value,']',$firstcode); + if ($firstend === FALSE) return $value; // Done if no closing bracket + $bbword = substr($value,$firstcode+1,$firstend - $firstcode - 1); // May need to process this more if parameter follows + $bbparam = ''; + $temp = strpos($bbword,'='); + if ($temp !== FALSE) + { + $bbparam = substr($bbword,$temp); + $bbword = substr($bbword,0,-strlen($bbparam)); + } + if (($bbword) && ($bbword == trim($bbword))) + { + $laststart = strpos($value,'[/'.$bbword,$firstend); // Find matching end + $lastend = strpos($value,']',$laststart); + if (($laststart === FALSE) || ($lastend === FALSE)) + { // No matching end character + $nextchar = $firstend; // Just move scan pointer along + } + else + { // Got a valid bbcode pair here + $firstbit = ''; + if ($firstcode > 0) $firstbit = substr($value,0,$firstcode); + $middlebit = substr($value,$firstend+1,$laststart - $firstend-1); + $lastbit = substr($value,$lastend+1,strlen($value) - $lastend); + // Process bbcodes here + if ($bblower) $bbword = strtolower($bbword); + if ($bbphpbb && (strpos($bbword,':') !== FALSE)) $bbword = substr($bbword,0,strpos($bbword,':')); + if ($maptable) + { // Do mapping + if (array_key_exists($bbword,$maptable)) $bbword = $maptable[$bbword]; + } + $bbbegin = '['.$bbword.$bbparam.']'; + $bbend = '[/'.$bbword.']'; + return $firstbit.$bbbegin.proc_bb($middlebit,$options,$maptable).$bbend.proc_bb($lastbit,$options,$maptable); + } + } + else + { + $nextchar = $firstend+1; + } + } //endwhile; + +} + + + + +?> diff --git a/e107_plugins/import/import_readme.txt b/e107_plugins/import/import_readme.txt new file mode 100644 index 000000000..3b6307432 --- /dev/null +++ b/e107_plugins/import/import_readme.txt @@ -0,0 +1,104 @@ +E107 IMPORT FACILITY FOR 0.8 +============================ + +This facility imports data from an existing non-E107 CMS or other sources into E107. + + +**************** CAUTION!!! EXISTING DATA WILL BE DELETED FROM YOUR E107 INSTALLATION ***************** + + +**************** THIS IS BETA CODE AT PRESENT - it may (probably will) contain bugs ! ********************* + + +If you use these routines, please help to make them better and report success or any problems to steved by PM. + + +If you encounter problems, it may help solve them if you are able to provide a sample database which demonstrates the problem. It doesn't have to be massive - often 5-10 records is plenty. A zipped export from PHPMyAdmin is often simplest. + + + +Prerequisites +------------- +You require an existing E107 V0.8 installation; create one if you are not working with an existing installation. + +This installation must include all plugins and features for which you want to import data - for example: + - if you want to import forum threads, the E107 forum plugin must be installed. + - If you want to import certain predefined extended user fields, they must be set up + +Other than configuration, you will usually want to import into a 'clean' installation - one which hasn't been used. + +The import will in most cases delete and/or overwrite existing data, so BACK UP YOUR E107 INSTALLATION BEFORE PROCEEDING. + + +Running the Import +------------------ +Log in to your E107 site as the main admin (this must be the very first user you created, which has an ID of 1). + +Point your browser at: yoursite/e107_files/import/import_to_e107.php + +You should see the front screen of the import routines. + +Select the appropriate options and click on 'continue'. + +Note that the import can take a long time if you have a large amount of 'source' data; you may need to temporarily adjust settings in php.ini to ensure that PHP doesn't time out before completion. (It is often simplest to run the import on a local set of databases using xampp or similar, so that you have complete control over the setup). + + +CSV Data import +--------------- +This is the simplest way to import a list of users; a suitable file can be created as an export from many databases and spreadsheets, and is quite simple to create in a basic text editor such as Notepad. + +Each line of the input text file corresponds to a single user, with the various values separated by commas, thus: + +fred,password +jim,jimspassword + +Make sure there are no spaces at the beginning or end of values (although there may be spaces in the middle). + +E107 requires passwords to be MD5-encoded; if yours are in 'plain text' just tick the box 'Password in CSV file is not already encrypted' and the import routine will encode them during processing. + + +Custom CSV Import +----------------- +If more than basic username/password information is available, you'll want to use a custom CSV import. These are specified in lines of the file csv_import.txt. Some examples are already in the file; add your special entries at the end. + +First step is to determine what data values you have available for import, and then tell the import routine the format of your CSV file. Must likely values you'll have are: + +user_loginname - the 'login name' for the user +user_name - the 'display name' for the user - may be the same as the login name +user_password - the user's password; either in 'clear text' or MD5 encoded +user_image - path to the user's avatar +user_session - path to the user's photo + +(for other values, just identify the field name in E107's 'user' table. You can also specify the predefined fields of E107's extended user data table). + + +Within file csv_import.txt, each line is itself CSV-formatted data, defining an import format: + Field 1 - an internal 'name' for the format - something fairly short + Field 2 - a description for the format - this is displayed in selection dropdowns + Field 3 - a format specifier code (see the list later) + Field 4 on are the names of data fields, in the order they will appear in the data (CSV) file + +There are some example formats already in this file; it may be edited to add more. + +Format +Name Delimiter Enclosure +-------------------------------------------- +simple ',' none +simple_sq ',' single quote (') +simple_dq ',' double quote (") +simple_semi ',' semi-colon (;) +simple_bar ',' 'pipe' (|) + + + +During the actual import some lines of data may be rejected; an error message is given, together with the line number of the data file. + + + +Database Import +--------------- +Converters have been written for most popular Content Management systems and BBS, and appear in the drop-down. + +At present only user data is imported, to an extent which depends on the source data and our knowledge of the data format. + +Extended user fields are imported if present in the E107 database. diff --git a/e107_plugins/import/import_user_class.php b/e107_plugins/import/import_user_class.php new file mode 100644 index 000000000..3bca0cffb --- /dev/null +++ b/e107_plugins/import/import_user_class.php @@ -0,0 +1,221 @@ + 0, + 'user_customtitle' => '', + 'user_sess' => '', // Photo + 'user_email' => '', + 'user_signature' => '', + 'user_image' => '', // Avatar + 'user_hideemail' => 1, + 'user_lastvisit' => 0, + 'user_currentvisit' => 0, + 'user_lastpost' => 0, + 'user_chats' => 0, + 'user_comments' => 0, + 'user_ip' => '', + 'user_ban' => 0, + 'user_prefs' => '', + // 'user_viewed' => '', + 'user_visits' => 0, + 'user_admin' => 0, + 'user_login' => '', // User real name + 'user_class' => '', + 'user_perms' => '', + 'user_xup' => '' + ); + + + // Fields which are defaulted at save-time if not previously set + var $userSpecial = array('user_join', 'user_realm', 'user_pwchange'); + + // Fields which must be set up by the caller. + var $userMandatory = array( + 'user_name', 'user_loginname', 'user_password' + ); + + + // Predefined fields which may appear in the extended user fields + var $userExtended = array( + 'user_language', + 'user_country', + 'user_location', + 'user_aim', + 'user_icq', + 'user_yahoo', + 'user_msn', + 'user_homepage', + 'user_birthday', + 'user_timezone' + ); + + // Array is set up with those predefined extended fields which are actually in use + var $actualExtended = array(); + + + // 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 + if($ret = getcachedvars("userdata_{$uid}")) + { + foreach ($this->userExtended as $v) + { + if (isset($ret[$v])) $this->actualExtended[] = $v; + } + } + } + + + // Empty the user DB - by default leaving only the main admin. + function emptyTargetDB($inc_admin = FALSE) + { + $delClause = ''; + if ($inc_admin === TRUE) + { + $this->blockMainAdmin = FALSE; + } + else + { + $this->blockMainAdmin = TRUE; + $delClause = 'user_id != 1'; + } + $this->userDB->db_Delete('user',$delClause); + $this->userDB->db_Delete('user_extended',$delClause); + } + + + // Set a new default for a particular field + function overrideDefault($key, $value) + { +// echo "Override: {$key} => {$value}
"; + if (!isset($this->userDefaults[$key])) return FALSE; + $this->userDefaults[$key] = $value; + } + + + // Returns an array with all relevant fields set to the current default + function getDefaults() + { + return $this->userDefaults; + } + + + // Vet a user or login name. If OK, always returns the name. + // On error, if $just_strip true, returns 'processed' name; otherwise returns FALSE + function vetUserName($name, $just_strip = FALSE) + { + $temp_name = trim(preg_replace('/ |\#|\=|\$/', "", strip_tags($name))); + if (($temp_name == $name) || $just_strip) return $temp_name; + return FALSE; + } + + + // Add a user record to the DB - pass array as parameter. + // Returns an error code on failure. TRUE on success + function saveData($userRecord) + { + if ($this->blockMainAdmin && isset($userRecord['user_id']) && ($userRecord['user_id'] == 1)) return 1; + $extendedFields = array(); + foreach ($userRecord as $k => $v) + { + if (in_array($k,$this->userExtended)) + { + if (in_array($k,$this->actualExtended)) $extendedFields[$k] = $v; // Pull out any extended field values which are needed + unset($userRecord[$k]); // And always delete from the original data record + } + } + foreach ($userRecord as $k => $v) + { // Check only valid fields being passed + if (!array_key_exists($k,$this->userDefaults) && !in_array($k,$this->userSpecial) && !in_array($k,$this->userMandatory) ) // + { + echo "Failed on {$k} => {$v}
"; + return 2; + } + } + // Check user names for invalid characters + $userRecord['user_name'] = $this->vetUserName($userRecord['user_name'],FALSE); + $userRecord['user_loginname'] = $this->vetUserName($userRecord['user_loginname'],FALSE); + if (($userRecord['user_name'] === FALSE) || ($userRecord['user_name'] === FALSE)) return 5; + + if (trim($userRecord['user_name']) == '') $userRecord['user_name'] = trim($userRecord['user_loginname']); + if (trim($userRecord['user_loginname']) == '') $userRecord['user_loginname'] = trim($userRecord['user_name']); + foreach ($this->userMandatory as $k) + { + if (!isset($userRecord[$k])) return 3; + if (strlen($userRecord[$k]) < 3) return 3; + } + if (!isset($userRecord['user_join'])) $userRecord['user_join'] = time(); + $userRecord['user_realm'] = ''; // Never carry across these fields + $userRecord['user_pwchange'] = 0; + + if(!$result = $this->userDB->db_Insert('user',$userRecord)) + { + return 4; + } + + if (count($extendedFields)) + { + $extendedFields['user_extended_id'] = varset($userRecord['user_id'],0) ? $userRecord['user_id'] : $result; + $result = $this->userDB->db_Insert('user_extended',$extendedFields); + if ($result === FALSE) return 6; + } + return TRUE; + } + + + + function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' . + { + $errorTexts = array(0 => 'No error', 1 => 'Can\'t change main admin data', 2 => 'invalid field passed', + 3 => 'Mandatory field not set', 4 => 'User already exists', 5 => 'Invalid characters in user or login name', + 6 => 'Error saving extended user fields'); + if (isset($errorTexts[$errnum])) return $errorTexts[$errnum]; + return 'Unknown: '.$errnum; + } +} + + +?> \ No newline at end of file diff --git a/e107_plugins/import/index.html b/e107_plugins/import/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/e107_plugins/import/languages/English_admin_import.php b/e107_plugins/import/languages/English_admin_import.php new file mode 100644 index 000000000..6f38f3b10 --- /dev/null +++ b/e107_plugins/import/languages/English_admin_import.php @@ -0,0 +1,84 @@ + \ No newline at end of file diff --git a/e107_plugins/import/mambo_import_class.php b/e107_plugins/import/mambo_import_class.php new file mode 100644 index 000000000..8abac2f16 --- /dev/null +++ b/e107_plugins/import/mambo_import_class.php @@ -0,0 +1,81 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users"); + if ($result === FALSE) return FALSE; + break; + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['id']; + $target['user_name'] = $source['name']; + $target['user_loginname'] = $source['username']; + $target['user_password'] = $source['password']; + $target['user_email'] = $source['email']; +// $target['user_hideemail'] = $source['user_viewemail']; + $target['user_join'] = $source['registerDate']; + $target['user_admin'] = ($source['usertype'] == 'superadministrator') ? 1 : 0; + if ($target['user_admin'] != 0) $target['user_perms'] = '0.'; + $target['user_lastvisit'] = $source['lastvisitDate']; + $target['user_login'] = $source['name']; + $target['user_ban'] = ($source['block'] ? 2 : 0); + return $target; + } + +} + + +?> diff --git a/e107_plugins/import/phpbb2_import_class.php b/e107_plugins/import/phpbb2_import_class.php new file mode 100644 index 000000000..b6c7eed23 --- /dev/null +++ b/e107_plugins/import/phpbb2_import_class.php @@ -0,0 +1,408 @@ + E107 forum IDs + + + // Set up a query for the specified task. + // Returns TRUE on success. FALSE on error + // If $blank_user is true, certain cross-referencing user info is to be zeroed + function setupQuery($task, $blank_user=FALSE) + { + if ($this->ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active` = 1"); + if ($result === FALSE) return FALSE; + break; + case 'forumdefs' : + return FALSE; + case 'forumposts' : + return FALSE; + case 'polls' : + return FALSE; + case 'news' : + return FALSE; + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['user_id']; + $target['user_name'] = $source['username']; + $target['user_loginname'] = $source['username']; + $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']; + $target['user_join'] = $source['user_regdate']; + $target['user_forums'] = $source['user_posts']; + $target['user_admin'] = $source['user_level']; + $target['user_lastvisit'] = $source['user_lastvisit']; + switch ($source['user_avatar_type']) + { + default: + $target['user_image'] = $source['user_avatar']; + } + $target['user_timezone'] = $source['user_timezone']; // source is decimal(5,2) + $target['user_language'] = $source['user_lang']; // May need conversion + $target['user_location'] = $source['user_from']; + $target['user_icq'] = $source['user_icq']; + $target['user_aim'] = $source['user_aim']; + $target['user_yahoo'] = $source['user_yim']; + $target['user_msn'] = $source['user_msnm']; + $target['user_homepage'] = $source['user_website']; +// $target['user_'] = $source['']; +// $target[] = $source['user_active]; // PHPBB2 +// $target['user_lastpost'] = $source['user_lastpost_time']; // PHPBB3 + return $target; + } + + + function convertForumParent(&$target, &$source) + { + $this->catcount++; + $this->id_map[$source['cat_id']] = $this->catcount; + $target['forum_id'] = $this->catcount; // Create new IDs for parent forums + $target['forum_name'] = $source['cat_title']; + $target['forum_order'] = $source['cat_order']; + $target['forum_description'] = $source['cat_desc']; + $target['forum_moderators'] = e_UC_ADMIN; +// $target['forum_'] = $source['']; +// $target['forum_'] = $source['']; + } + + + function convertForum(&$target, &$source, $catid) + { + $this->catcount++; + $this->id_map[$source['forum_id']] = $this->catcount; + $target['forum_id'] = $this->catcount; + $target['forum_parent'] = $this->id_map[$source['cat_id']]; // Map to the new E107 ID, rather than directly use the one from the DB + $target['forum_name'] = $source['forum_name']; + $target['forum_description'] = $source['forum_desc']; + $target['forum_order'] = $source['forum_order']; + $target['forum_threads'] = $source['forum_topics']; + $target['forum_replies'] = $source['forum_posts']; + $target['forum_moderators'] = e_UC_ADMIN; +// $target['forum_'] = $source['']; + } +} + + +/* +Historical info for conversion below here + +function convertParents($catid) +{ + $parentArray = array( + array("srcdata" => "cat_id", "e107" => "forum_id", "type" => "INT", "value" => $catid), + array("srcdata" => "cat_title", "e107" => "forum_name", "type" => "STRING"), + array("srcdata" => "cat_order", "e107" => "forum_order", "type" => "INT"), + array("srcdata" => "cat_desc", "e107" => "forum_description", "type" => "STRING"), + array("srcdata" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 254) + ); + return $parentArray; +} + +function convertForums($catid) +{ + $forumArray = array( + array("srcdata" => "forum_id", "e107" => "forum_id", "type" => "INT"), + array("srcdata" => "cat_id", "e107" => "forum_parent", "type" => "STRING", "value" => $catid), + array("srcdata" => "forum_name", "e107" => "forum_name", "type" => "STRING"), + array("srcdata" => "forum_desc", "e107" => "forum_description", "type" => "STRING"), + array("srcdata" => "forum_order", "e107" => "forum_order", "type" => "INT"), + array("srcdata" => "forum_topics", "e107" => "forum_threads", "type" => "INT"), + array("srcdata" => "forum_posts", "e107" => "forum_replies", "type" => "INT"), + array("srcdata" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 254) + ); + return $forumArray; +} + + +//function convertTopics($poster) +function convertTopics() +{ + $topicArray = array( + array("srcdata" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"), + array("srcdata" => "topic_title", "e107" => "thread_name", "type" => "STRING"), + array("srcdata" => "post_text", "e107" => "thread_thread", "type" => "STRING", "default" => "", "sproc" => "usebb,phpbb,bblower"), + array("srcdata" => "topic_poster", "e107" => "thread_user", "type" => "STRING"), + array("srcdata" => "null", "e107" => "thread_active", "type" => "INT", "value" => 1), + array("srcdata" => "topic_time", "e107" => "thread_datestamp", "type" => "INT"), + array("srcdata" => "topic_views", "e107" => "thread_views", "type" => "INT"), + array("srcdata" => "topic_replies", "e107" => "thread_total_replies", "type" => "INT"), + array("srcdata" => "null", "e107" => "thread_parent", "type" => "INT", "value" => 0), + ); + return $topicArray; +} + + + + +function convertForumPosts($parent_id, $poster) +{ + $postArray = array( + array("srcdata" => "post_text", "e107" => "thread_thread", "type" => "STRING", "default" => "", "sproc" => "usebb,phpbb,bblower"), + array("srcdata" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"), + array("srcdata" => "post_time", "e107" => "thread_datestamp", "type" => "INT"), + array("srcdata" => "topic_views", "e107" => "thread_views", "type" => "INT"), + array("srcdata" => "post_time", "e107" => "thread_lastpost", "type" => "INT"), + array("srcdata" => "poster_id", "e107" => "thread_user", "type" => "STRING"), + array("srcdata" => "post_subject", "e107" => "thread_name", "type" => "STRING"), + array("srcdata" => "null", "e107" => "thread_parent", "type" => "INT", "value" => $parent_id), + ); + return $postArray; +} + + +/* +-- -------------------------------------------------------- +PHPBB uses three tables to record a poll. Looks wildly different to E107! +-- +-- Table structure for table `_phpbb_vote_desc` +CREATE TABLE `_phpbb_vote_desc` ( + `vote_id` mediumint(8) unsigned NOT NULL auto_increment, + `topic_id` mediumint(8) unsigned NOT NULL default '0', + `vote_text` text NOT NULL, + `vote_start` int(11) NOT NULL default '0', + `vote_length` int(11) NOT NULL default '0', + PRIMARY KEY (`vote_id`), + KEY `topic_id` (`topic_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ; + + +-- +-- Table structure for table `_phpbb_vote_results` +CREATE TABLE `_phpbb_vote_results` ( + `vote_id` mediumint(8) unsigned NOT NULL default '0', + `vote_option_id` tinyint(4) unsigned NOT NULL default '0', + `vote_option_text` varchar(255) NOT NULL default '', + `vote_result` int(11) NOT NULL default '0', + KEY `vote_option_id` (`vote_option_id`), + KEY `vote_id` (`vote_id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + + +-- +-- Table structure for table `_phpbb_vote_voters` +CREATE TABLE `_phpbb_vote_voters` ( + `vote_id` mediumint(8) unsigned NOT NULL default '0', + `vote_user_id` mediumint(8) NOT NULL default '0', + `vote_user_ip` char(8) NOT NULL default '', + KEY `vote_id` (`vote_id`), + KEY `vote_user_id` (`vote_user_id`), + KEY `vote_user_ip` (`vote_user_ip`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +*/ + + +/* + +//----------------------------------------------------------- +// ### get phpbb categories and insert them as forum parents +//----------------------------------------------------------- + +mysql_query("TRUNCATE TABLE {$mySQLprefix}forum", $e107Connection); + + +$phpbb_res = mysql_query("SELECT * FROM {$phpbb2Prefix}categories", $phpbbConnection); +if(!$phpbb_res) +{ + goError("Error! Unable to access ".$phpbb2Prefix."categories table."); +} + +$catcount = 500; +while($parent = mysql_fetch_array($phpbb_res)) +{ + + $parentArray = convertParents($catcount); + + $query = createQuery($parentArray, $parent, $mySQLprefix."forum"); + echo (mysql_query($query, $e107Connection) ? "Successfully inserted parent: ".$parent['cat_id'].": ".$parent['cat_title'] : "Unable to insert parent: ".$parent['cat_id'].": ".$parent['cat_title']."
".mysql_errno() . ": " . mysql_error())."
"; + flush(); + + $phpbb_res2 = mysql_query("SELECT * FROM {$phpbb2Prefix}forums WHERE cat_id = ".$parent['cat_id'], $phpbbConnection); + if($phpbb_res2) + { + while($forum = mysql_fetch_array($phpbb_res2)) + { + $forumArray = convertForums($catcount); + $query = createQuery($forumArray, $forum, $mySQLprefix."forum"); + echo (mysql_query($query, $e107Connection) ? "Successfully inserted forum: ".$parent['cat_id'].": ".$parent['cat_title'] : "Unable to insert forum: ".$parent['cat_id'].": ".$parent['cat_title']."
".mysql_errno() . ": " . mysql_error())."
"; + flush(); + } + } + else + { + echo "Didn't find any forums for parent '".$parent['cat_title']."'
"; + } + $catcount ++; +} + + +//------------------------------------------------------ +// Read in forum topics +//------------------------------------------------------ + +mysql_query("TRUNCATE TABLE {$mySQLprefix}forum_t", $e107Connection); +mysql_query("TRUNCATE TABLE {$mySQLprefix}polls", $e107Connection); + +$query = "SELECT * FROM {$phpbb2Prefix}topics +LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}topics.topic_title = {$phpbb2Prefix}posts_text.post_subject) +LEFT JOIN {$phpbb2Prefix}posts ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id) +ORDER BY topic_time ASC"; + +$phpbb_res = mysql_query($query, $phpbbConnection); +if(!$phpbb_res) +{ + goError("Error! Unable to access ".$phpbb2Prefix."topics table."); +} +while($topic = mysql_fetch_array($phpbb_res)) +{ + + //echo "
"; print_r($topic); echo "
"; + + if($topic['topic_vote']) + { + // poll attached to this topic ... + $topic['topic_title'] = "[poll] ".$topic['topic_title']; + $query = "SELECT * FROM {$phpbb2Prefix}vote_desc WHERE topic_id=".$topic['topic_id']; + $phpbb_res3 = mysql_query($query, $phpbbConnection); + $pollQ = mysql_fetch_array($phpbb_res3); + + $query = "SELECT * FROM {$phpbb2Prefix}vote_results WHERE vote_id=".$pollQ['vote_id']; + $phpbb_res3 = mysql_query($query, $phpbbConnection); + $options = ""; + $votes = ""; + while($pollO = mysql_fetch_array($phpbb_res3)) + { + $options .= $pollO['vote_option_text'].chr(1); + $votes .= $pollO['vote_result'].chr(1); + } + + extract($pollQ); + $vote_text = $tp->toDB($vote_text); // McFly added 25/5/06 + $options = $tp->toDB($options); // McFly added 25/5/06 + $query = "INSERT INTO ".$mySQLprefix."polls VALUES ('0', {$vote_start}, {$vote_start}, 0, 0, '{$vote_text}', '{$options}', '{$votes}', '', 2, 0, 0, 0, 255, 0)"; + echo (mysql_query($query, $e107Connection) ? "Poll successfully inserted" : "Unable to insert poll ({$query})")."
"; + } + + + if($topic['topic_poster'] == 2) + { + $topic['topic_poster'] = 1; + } + + if($topic['topic_poster'] == -1) + { + $poster = ($topic['post_username'] ? $topic['post_username'] : "Anonymous"); + $topic['topic_poster'] = "0.".$poster; // McFly moved, edited 25/5/06 + } + + $topicArray = convertTopics(); // McFly edited 25/5/06 + $query = createQuery($topicArray, $topic, $mySQLprefix."forum_t"); + + if(!mysql_query($query, $e107Connection)) + { + echo "Unable to insert topic: ".$topic['topic_id']."
"; + flush(); + } + else + { + echo "Successfully inserted topic: ".$topic['topic_id']."
"; + flush(); + $parent_id = mysql_insert_id(); + $topic_id = $topic['topic_id']; + + //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"; + $phpbb_res2 = mysql_query($query, $phpbbConnection); + if(!$phpbb_res2) + { + goError("Error! Unable to access ".$phpbb2Prefix."posts / ".$phpbb2Prefix."posts_text table."); + } + while($post = mysql_fetch_array($phpbb_res2)) + { + + if($post['poster_id'] == 2) + { + $post['poster_id'] = 1; + } + if($post['poster_id'] == -1) + { + $poster = ($post['post_username'] ? $post['post_username'] : "Anonymous"); + $post['poster_id'] = "0.".$poster; // McFly moved, edited 25/5/06 + } + + + $postArray = convertForumPosts($parent_id, $poster); + $query = createQuery($postArray, $post, $mySQLprefix."forum_t",$mapdata); + echo (mysql_query($query, $e107Connection) ? "Successfully inserted thread: ".$post['post_id'] : "Unable to insert thread: ".$parent['cat_id'].": ".$parent['cat_title']."
".mysql_errno() . ": " . mysql_error())."
"; + flush(); + } + } +} + +*/ + +?> diff --git a/e107_plugins/import/plugin.xml b/e107_plugins/import/plugin.xml new file mode 100644 index 000000000..41e78c656 --- /dev/null +++ b/e107_plugins/import/plugin.xml @@ -0,0 +1,18 @@ + + + + + + + Import into e107 + import + tools + Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt) + + admin_import.php + images/import_32.png + images/import_16.png + Import into e107 + + + \ No newline at end of file diff --git a/e107_plugins/import/smf_import_class.php b/e107_plugins/import/smf_import_class.php new file mode 100644 index 000000000..e70f9b60f --- /dev/null +++ b/e107_plugins/import/smf_import_class.php @@ -0,0 +1,94 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}members WHERE `is_activated`=1"); + if ($result === FALSE) return FALSE; + break; + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + if ($this->copyUserInfo) $target['user_id'] = $source['ID_MEMBER']; + $target['user_name'] = $source['realName']; + $target['user_login'] = $source['realName']; + $target['user_loginname'] = $source['memberName']; + $target['user_password'] = $source['passwd']; // Check - could be plaintext + $target['user_email'] = $source['emailAddress']; + $target['user_hideemail'] = $source['hideEmail']; + $target['user_image'] = $source['avatar']; + $target['user_signature'] = $source['signature']; + $target['user_forums'] = $source['posts']; + $target['user_chats'] = $source['instantMessages']; + $target['user_join'] = $source['dateRegistered']; + $target['user_lastvisit'] = $source['lastLogin']; + $target['user_homepage'] = $source['websiteUrl']; + $target['user_location'] = $source['location']; + $target['user_icq'] = $source['ICQ']; + $target['user_aim'] = $source['AIM']; + $target['user_yahoo'] = $source['YIM']; + $target['user_msn'] = $source['MSN']; + $target['user_timezone'] = $source['timeOffset']; // Probably needs formatting + $target['user_customtitle'] = $source['usertitle']; + $target['user_ip'] = $source['memberIP']; +// $target['user_'] = $source['']; +// $target['user_'] = $source['']; + +// $target['user_language'] = $source['lngfile']; // Guess to verify + return $target; + } + +} + + +?> diff --git a/e107_plugins/import/wordpress_import_class.php b/e107_plugins/import/wordpress_import_class.php new file mode 100644 index 000000000..eaedbc6a0 --- /dev/null +++ b/e107_plugins/import/wordpress_import_class.php @@ -0,0 +1,133 @@ +ourDB == NULL) return FALSE; + switch ($task) + { + case 'users' : + $query = "SELECT * FROM {$this->DBPrefix}users WHERE `user_id` != 1"; + + $query = "SELECT u.*, + w.meta_value AS admin, + f.meta_value as firstname, + l.meta_value as lastname + FROM {$this->DBPrefix}users AS u + LEFT JOIN {$this->DBPrefix}usermeta AS w ON (u.ID = w.user_id AND w.meta_key = 'wp_capabilities') + LEFT JOIN {$this->DBPrefix}usermeta AS f ON (u.ID = f.user_id AND f.meta_key = 'first_name') + LEFT JOIN {$this->DBPrefix}usermeta AS l ON (u.ID = l.user_id AND l.meta_key = 'last_name') + GROUP BY u.ID"; + + $this->ourDB -> db_Select_gen($query); + + $result = $this->ourDB->db_Select_gen($query); + + if ($result === FALSE) return FALSE; + break; + + + + default : + return FALSE; + } + $this->copyUserInfo = !$blank_user; + $this->currentTask = $task; + return TRUE; + } + + + //------------------------------------ + // Internal functions below here + //------------------------------------ + + // Copy data read from the DB into the record to be returned. + function copyUserData(&$target, &$source) + { + $user_meta = unserialize($source['admin']); + + if ($this->copyUserInfo) + { + $target['user_id'] = $source['ID']; + } + $target['user_name'] = $source['user_nicename']; + $target['user_loginname'] = $source['user_login']; + $target['user_password'] = $source['user_pass']; // needs to be salted!!!! + $target['user_email'] = $source['user_email']; + $target['user_hideemail'] = $source['user_hideemail']; + $target['user_join'] = strtotime($source['user_registered']); + $target['user_admin'] = ($user_meta['administrator'] == 1) ? 1 : 0; + $target['user_lastvisit'] = $source['user_lastvisit']; + $target['user_login'] = $source['firstname']." ".$source['lastname']; + $target['user_ban'] = $source['user_ban']; + $target['user_customtitle'] = $source['display_name']; + $target['user_sess'] = $source['user_sess']; // Photo + $target['user_signature'] = $source['user_signature']; + $target['user_image'] = $source['user_image']; // Avatar + $target['user_currentvisit'] = $source['user_currentvisit']; + $target['user_lastpost'] = $source['user_lastpost']; + $target['user_chats'] = $source['user_chats']; + $target['user_comments'] = $source['user_comments']; + + $target['user_ip'] = $source['user_ip']; + $target['user_prefs'] = $source['user_prefs']; + $target['user_visits'] = $source['user_visits']; + $target['user_class'] = $source['user_class']; + $target['user_perms'] = $source['user_perms']; + $target['user_xup'] = $source['user_xup']; + $target['user_language'] = $source['user_language']; + $target['user_country'] = $source['user_country']; + $target['user_location'] = $source['user_location']; + $target['user_aim'] = $source['user_aim']; + $target['user_icq'] = $source['user_icq']; + $target['user_yahoo'] = $source['user_yahoo']; + $target['user_msn'] = $source['user_msn']; + $target['user_homepage'] = $source['user_url']; + $target['user_birthday'] = $source['user_birthday']; + $target['user_timezone'] = $source['user_timezone']; + + +// user_pass user_nicename user_email user_url user_registered user_activation_key user_status display_name + + return $target; + } + +} + + +?>