function parse_user($data) { $attributes =& $data['attributes']; if (empty($attributes['unique'])) { //echo "user tag without data we need!<br />\n"; flush(); return; } $deleted = isset($attributes['deleted']) ? '; deleted!' : ''; $user_object = new ImpExData($this->Db_object, $this->session, 'user'); $user_object->set_value('mandatory', 'usergroupid', $this->session->get_session_var('usergroupid')); // Swap hutch, jerry for jerry hutch if (substr(', ', $attributes['name'])) { $name_bits = explode(' ', $attributes['name']); $attributes['name'] = $name_bits[1] . ' ' . substr($name_bits[0], 0, -1); } $user_object->set_value('mandatory', 'username', trim($attributes['name'])); $user_object->set_value('mandatory', 'email', $attributes['email']); $user_object->set_value('mandatory', 'importuserid', hexdec($attributes['ID'])); // passwords are stored as binary md5 hashes. Need to take each nibble from each byte // and convert it to hex if (strlen($attributes['password']) == 16) { $password = ''; for ($i = 0; $i < 16; $i++) { $chr = ord($attributes['password'][$i]); $password .= dechex($chr >> 4 & 0xf); $password .= dechex($chr & 0xf); } } else { // hey, this wouldn't even going to come out to a valid md5 hash... $password = $attributes['password']; } $user_object->_password_md5_already = true; $user_object->set_value('nonmandatory', 'password', $password); $user_object->set_value('nonmandatory', 'passworddate', time()); $user_object->set_value('nonmandatory', 'homepage', $attributes['homePage']); $user_object->set_value('nonmandatory', 'joindate', @strtotime($attributes['registeredTd'])); $user_object->set_value('nonmandatory', 'lastvisit', @strtotime($attributes['lastLogin'])); $user_object->set_value('nonmandatory', 'lastactivity', @strtotime($attributes['lastLogin'])); $user_object->set_value('nonmandatory', 'options', $this->_default_user_permissions); if ($user_object->import_user($this->Db_object, $this->target_db_type, $this->target_db_prefix)) { echo "<br /><span class=\"isucc\"><b>" . $user_object->how_complete() . "%</b></span> users -> :: " . $user_object->get_value('mandatory', 'username'); flush(); } else { echo "<h1>'" . trim($attributes['name']) . " not imported" . "'</h1>"; } #echo "found user '$attributes[name]' ($attributes[unique]$deleted)<br />\n"; flush(); }